📄 dlgdataclient.cs
字号:
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 104);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 23);
this.label4.TabIndex = 14;
this.label4.Text = "联系人:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 136);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 23);
this.label5.TabIndex = 15;
this.label5.Text = "电话:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 168);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(56, 23);
this.label6.TabIndex = 16;
this.label6.Text = "传真:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label7
//
this.label7.Location = new System.Drawing.Point(256, 40);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(56, 23);
this.label7.TabIndex = 17;
this.label7.Text = "地址:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label8
//
this.label8.Location = new System.Drawing.Point(256, 96);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(56, 23);
this.label8.TabIndex = 18;
this.label8.Text = "邮编:";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label9
//
this.label9.Location = new System.Drawing.Point(256, 128);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(56, 23);
this.label9.TabIndex = 19;
this.label9.Text = "备注:";
this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtClientType
//
this.txtClientType.EditValue = "";
this.txtClientType.EnterMoveNextControl = true;
this.txtClientType.Location = new System.Drawing.Point(72, 72);
this.txtClientType.Name = "txtClientType";
//
// txtClientType.Properties
//
this.txtClientType.Properties.AppearanceFocused.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(224)), ((System.Byte)(192)));
this.txtClientType.Properties.AppearanceFocused.Options.UseBackColor = true;
this.txtClientType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.txtClientType.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
this.txtClientType.Size = new System.Drawing.Size(176, 21);
this.txtClientType.TabIndex = 1;
this.txtClientType.EditValueChanged += new System.EventHandler(this.BaseEditor_EditValueChanged);
//
// DlgDataClient
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(490, 248);
this.Controls.Add(this.txtClientType);
this.Controls.Add(this.txtFax);
this.Controls.Add(this.txtAddress);
this.Controls.Add(this.txtZipCode);
this.Controls.Add(this.txtPhone);
this.Controls.Add(this.txtLinkMan);
this.Controls.Add(this.txtMemo);
this.Controls.Add(this.txtCode);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.lblTitle);
this.Name = "DlgDataClient";
this.Controls.SetChildIndex(this.btnCancel, 0);
this.Controls.SetChildIndex(this.btnAccept, 0);
this.Controls.SetChildIndex(this.lblTitle, 0);
this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.label2, 0);
this.Controls.SetChildIndex(this.label4, 0);
this.Controls.SetChildIndex(this.label5, 0);
this.Controls.SetChildIndex(this.label6, 0);
this.Controls.SetChildIndex(this.label7, 0);
this.Controls.SetChildIndex(this.label8, 0);
this.Controls.SetChildIndex(this.label9, 0);
this.Controls.SetChildIndex(this.txtCode, 0);
this.Controls.SetChildIndex(this.txtMemo, 0);
this.Controls.SetChildIndex(this.txtLinkMan, 0);
this.Controls.SetChildIndex(this.txtPhone, 0);
this.Controls.SetChildIndex(this.txtZipCode, 0);
this.Controls.SetChildIndex(this.txtAddress, 0);
this.Controls.SetChildIndex(this.txtFax, 0);
this.Controls.SetChildIndex(this.txtClientType, 0);
((System.ComponentModel.ISupportInitialize)(this.txtCode.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtMemo.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtLinkMan.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPhone.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtZipCode.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtAddress.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtFax.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtClientType.Properties)).EndInit();
this.ResumeLayout(false);
}
#endregion
#endregion
#region Variable bool appendmode = true; DataView dvFind; DataRow orow; DlgFrmMsg msgBox; #endregion #region FormEvent protected override void OnLoad(EventArgs e)
{
base.OnLoad (e);
msgBox = new DlgFrmMsg(this);
}
#endregion #region Return Value public DataRow GetRow() { orow["Code"] = this.txtCode.Text.Trim(); orow["ClientType"] = this.txtClientType.Text.Trim(); orow["LinkMan"] = this.txtLinkMan.Text.Trim(); orow["Phone"] = this.txtPhone.Text.Trim(); orow["Fax"] = this.txtFax.Text.Trim(); orow["Address"] = this.txtAddress.Text.Trim(); orow["ZipCode"] = this.txtZipCode.Text.Trim(); orow["Memo"] = this.txtMemo.Text.Trim(); return orow; } public bool IsChanged { get{return edited;} } #endregion #region CanColse protected override bool CanClose()
{
if(!appendmode && !edited)
{
return true;
}
if(DataRepeat())
{
msgBox.ShowWarning("已存在相同的数据!");
return false;
}
if(ControlEmpty(this.txtCode,"请输入名称"))return false;
if(ControlEmpty(this.txtClientType,"请选择分类"))return false;
return base.CanClose ();
}
#endregion #region OnFormShow protected override void OnFormShow()
{
base.OnFormShow ();
this.txtCode.Focus();
}
#endregion #region ShowDialog public DialogResult ShowDialog(DataTable dtfind,DataTable dtClientType) { DataBind(dtClientType); this.orow = WWAM.DBA.GetRow.GetClientRow(); this.orow["Used"] = true; this.DataInit(); this.dvFind = new DataView(dtfind); this.edited = false; this.appendmode = true; return base.ShowDialog(); } public DialogResult ShowDialog(DataRow dr , DataTable dtfind,DataTable dtClientType) { DataBind(dtClientType); this.orow = WWAM.DBA.DRPro.CloneDataRow(dr); this.DataSetting(); this.dvFind = new DataView(dtfind); this.edited = false; this.appendmode = false; return base.ShowDialog(); } #endregion #region DataMethod void DataBind(DataTable dt) { ComboDataBind(this.txtClientType,dt,"Code"); } void DataInit() { DataSetting(); } void DataSetting() { this.txtCode.Text = (string)orow["Code"]; this.txtClientType.Text = (string)orow["ClientType"]; this.txtLinkMan.Text = (string)orow["LinkMan"]; this.txtPhone.Text = (string)orow["Phone"]; this.txtFax.Text = (string)orow["Fax"]; this.txtAddress.Text = (string)orow["Address"]; this.txtZipCode.Text = (string)orow["ZipCode"]; this.txtMemo.Text = (string)orow["Memo"]; } #endregion #region Method bool DataRepeat() { if(this.txtCode.Text.Trim()==string.Empty) return false; if(appendmode) { dvFind.RowFilter = string.Format("Code = '{0}' ",this.txtCode.Text.Trim()); } else { dvFind.RowFilter = string.Format("Code = '{0}' and Clientid <> {1}",this.txtCode.Text.Trim(),this.orow["Clientid"]); } return dvFind.Count>0; } #endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -