📄 childadvmodel.cs
字号:
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label8
//
this.label8.BackColor = System.Drawing.Color.Transparent;
this.label8.Location = new System.Drawing.Point(8, 80);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(72, 23);
this.label8.TabIndex = 43;
this.label8.Text = "广告规格:";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label7
//
this.label7.BackColor = System.Drawing.Color.Transparent;
this.label7.Location = new System.Drawing.Point(216, 56);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 23);
this.label7.TabIndex = 42;
this.label7.Text = "色彩方案:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label6
//
this.label6.BackColor = System.Drawing.Color.Transparent;
this.label6.Location = new System.Drawing.Point(368, 8);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(72, 23);
this.label6.TabIndex = 41;
this.label6.Text = "计量单位:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
this.label5.BackColor = System.Drawing.Color.Transparent;
this.label5.Location = new System.Drawing.Point(8, 56);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 23);
this.label5.TabIndex = 40;
this.label5.Text = "版面名称:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label4
//
this.label4.BackColor = System.Drawing.Color.Transparent;
this.label4.Location = new System.Drawing.Point(328, 32);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(24, 23);
this.label4.TabIndex = 39;
this.label4.Text = "版";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Location = new System.Drawing.Point(8, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 37;
this.label1.Text = "模版编号:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Location = new System.Drawing.Point(8, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 38;
this.label2.Text = "报刊名称:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// ChildAdvModel
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(552, 382);
this.Controls.Add(this.mainPanel);
this.Controls.Add(this.dpDetail);
this.Name = "ChildAdvModel";
this.Controls.SetChildIndex(this.dpDetail, 0);
this.Controls.SetChildIndex(this.mainPanel, 0);
this.Controls.SetChildIndex(this.btnClose, 0);
this.mainPanel.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ftxtPaperName.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkQuickAppend.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gcAdvModel)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.wwamds1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gvAdvModel)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dockManager1)).EndInit();
this.dpDetail.ResumeLayout(false);
this.dockPanel1_Container.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.txtAdvSpec.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtMemo.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtCode.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPayUnit.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtColor.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPayPrice.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPayNum.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPaperSpaceNum.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPaperName.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPaperSpace.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPaySum.Properties)).EndInit();
this.ResumeLayout(false);
} #endregion
#endregion
#region Variable && Property Dlg.DlgDataAdvModel dlgAdvModel; DataTable dtType; DataRow drAdvModel { get { return this.gvAdvModel.GetDataRow(this.gvAdvModel.FocusedRowHandle); } } public DataTable dtAdvModel { get { return (DataTable)this.gcAdvModel.DataSource; } } #endregion #region Virtaul Event
protected override void OnFormLoad()
{
this.ComboDataBind(this.ftxtPaperName,this.BaseDB.RunCmdGetTable("select * from bType where Type = 1",0),"Code",this.BaseSysSet.DefaultPaper);
dlgAdvModel = new WWAM.Forms.Dlg.DlgDataAdvModel(this);
this.setLayoutFileName("AdvModel");
this.ViewLoadLayout(this.gvAdvModel);
}
protected override void OnFormClose()
{
this.ViewSaveLayout(this.gvAdvModel);
}
protected override void OnFormShow()
{}
protected override void DataRefresh()
{
this.Cursor = Cursors.WaitCursor;
this.gcAdvModel.DataSource = this.BaseDB.RunCmdGetTable("select * from iAdvModel where PaperName='"+this.ftxtPaperName.Text.Trim()+"'",0);
this.dtType = this.BaseDB.RunCmdGetTable("select * from bType",0);
ShowDetail();
this.Cursor = Cursors.Arrow;
}
#endregion
#region ShowDetail
public void ShowDetail()
{
DataRow orow = (this.drAdvModel!=null)?this.drAdvModel:WWAM.DBA.GetRow.GetAdvModelRow();
this.txtCode.Text = (string)orow["Code"]; this.txtPaperName.Text = (string)orow["PaperName"]; this.txtPaperSpaceNum.Text = (string)orow["PaperSpaceNum"]; this.txtPaperSpace.Text = (string)orow["PaperSpace"]; this.txtAdvSpec.Text = (string)orow["AdvSpec"]; this.txtColor.Text = (string)orow["Color"]; this.txtPayNum.Value = (decimal)((float)orow["PayNum"]); this.txtPaySum.EditValue = (float)orow["PaySum"]; this.txtPayUnit.Text = (string)orow["PayUnit"]; this.txtPayPrice.EditValue = (float)orow["PayPrice"]; this.txtMemo.Text = (string)orow["Memo"]; }
#endregion
#region Control EditValue Changed
private void gvAdvMdoel_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
{
ShowDetail();
}
#endregion
#region NavBarBtns ClickButton
private void nbbAdvModel_ClickButton(object sender, WWAM.BLL.NavBarBtns.ButtonEventArgs e)
{
switch((string)e.Button.Tag)
{
case "Append":
#region Append
if(this.ftxtPaperName.Text.Trim()!=string.Empty)
{
DataTable _fdt = this.dtAdvModel!=null?this.dtAdvModel:new DataTable();
if(this.dlgAdvModel.ShowDialog(this.ftxtPaperName.Text.Trim(),this.chkQuickAppend.Checked,_fdt,dtType) == DialogResult.OK)
{
DataRow _ndr = this.dlgAdvModel.GetRow();
int rv = this.BaseDB.RunSPGetInt("iAdvModelInsert",_ndr,0);
if(rv > 0)
{
_ndr["AdvModelid"] = rv;
WWAM.DBA.DTPro.AddRow(dtAdvModel,_ndr);
ShowDetail();
}
else
{
string title = "广告模版添加失败";
switch(rv)
{
case -1:
this.BaseMsgBox.ShowWarning("指定的广告模版["+(string)_ndr["Code"]+"]已被占用。",title);
break;
case -99:
this.BaseMsgBox.ShowWarning("数据库执行错误!\r\n"+this.BaseDB.LastError,title);
break;
default:
this.BaseMsgBox.ShowWarning("未知错误!\r\n错误码:"+rv.ToString(),title);
break;
}
}
}
}
#endregion
break;
case "Delete":
#region Delete
if(this.drAdvModel!=null)
{
if(this.BaseMsgBox.ShowQuestion("您确认要删除该条广告模版数据吗?","广告模版删除")==DialogResult.OK)
{
int rv = this.BaseDB.RunSPGetInt("iAdvModelDelete",new WWAM.DBA.SqlPara((int)this.drAdvModel["AdvModelid"]),0);
if(rv>0)
{
WWAM.DBA.DTPro.RemoveRow(dtAdvModel,drAdvModel);
ShowDetail();
}
else
{
string title = "广告模版删除失败";
switch(rv)
{
case -99:
this.BaseMsgBox.ShowWarning("数据库执行错误!\r\n"+this.BaseDB.LastError,title);
break;
default:
this.BaseMsgBox.ShowWarning("未知错误!\r\n错误码:"+rv.ToString(),title);
break;
}
}
}
}
#endregion
break;
case "Edit":
#region Edit
if(drAdvModel != null)
{
DataTable _fdt1 = this.dtAdvModel!=null?this.dtAdvModel:new DataTable();
if(this.dlgAdvModel.ShowDialog(drAdvModel,_fdt1,dtType) == DialogResult.OK)
{
DataRow _ndr = this.dlgAdvModel.GetRow();
int rv = this.BaseDB.RunSPGetInt("iAdvModelUpdate",_ndr,0);
if(rv > 0)
{
WWAM.DBA.DRPro.CloneDataRow(_ndr,drAdvModel);
ShowDetail();
}
else
{
string title = "广告模版修改失败";
switch(rv)
{
case -1:
this.BaseMsgBox.ShowWarning("指定的广告模版["+(string)_ndr["Code"]+"]已被占用。",title);
break;
case -99:
this.BaseMsgBox.ShowWarning("数据库执行错误!\r\n"+this.BaseDB.LastError,title);
break;
default:
this.BaseMsgBox.ShowWarning("未知错误!\r\n错误码:"+rv.ToString(),title);
break;
}
}
}
}
#endregion
break;
case "Refresh":
DataRefresh();
break;
}
}
#endregion
#region Method
void ComboDataBind(DevExpress.XtraEditors.ComboBoxEdit cmb, DataTable _dt, string fieldName, string defaultvalue) { cmb.Properties.Items.Clear(); foreach(DataRow _dr in _dt.Rows) { cmb.Properties.Items.Add(_dr[fieldName]); } cmb.Text = defaultvalue; } #endregion
#region FilterControl_EditValueChanged
private void FilterControl_EditValueChanged(object sender, System.EventArgs e)
{
DataRefresh();
}
#endregion
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -