📄 dlgdatauser.cs
字号:
this.txtPhone.Properties.AppearanceFocused.Options.UseBackColor = true;
this.txtPhone.Size = new System.Drawing.Size(176, 21);
this.txtPhone.TabIndex = 4;
this.txtPhone.EditValueChanged += new System.EventHandler(this.BaseEditor_EditValueChanged);
//
// txtName
//
this.txtName.EditValue = "";
this.txtName.EnterMoveNextControl = true;
this.txtName.Location = new System.Drawing.Point(72, 80);
this.txtName.Name = "txtName";
//
// txtName.Properties
//
this.txtName.Properties.AppearanceFocused.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(224)), ((System.Byte)(192)));
this.txtName.Properties.AppearanceFocused.Options.UseBackColor = true;
this.txtName.Size = new System.Drawing.Size(176, 21);
this.txtName.TabIndex = 1;
this.txtName.EditValueChanged += new System.EventHandler(this.BaseEditor_EditValueChanged);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Location = new System.Drawing.Point(8, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 23);
this.label1.TabIndex = 14;
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, 80);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 23);
this.label2.TabIndex = 15;
this.label2.Text = "姓名:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtCode
//
this.txtCode.EditValue = "";
this.txtCode.EnterMoveNextControl = true;
this.txtCode.Location = new System.Drawing.Point(72, 48);
this.txtCode.Name = "txtCode";
//
// txtCode.Properties
//
this.txtCode.Properties.AppearanceFocused.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(224)), ((System.Byte)(192)));
this.txtCode.Properties.AppearanceFocused.Options.UseBackColor = true;
this.txtCode.Size = new System.Drawing.Size(176, 21);
this.txtCode.TabIndex = 0;
this.txtCode.EditValueChanged += new System.EventHandler(this.BaseEditor_EditValueChanged);
//
// chkMPG1I3
//
this.chkMPG1I3.Location = new System.Drawing.Point(304, 104);
this.chkMPG1I3.Name = "chkMPG1I3";
//
// chkMPG1I3.Properties
//
this.chkMPG1I3.Properties.Caption = "交款收费";
this.chkMPG1I3.Size = new System.Drawing.Size(80, 19);
this.chkMPG1I3.TabIndex = 9;
this.chkMPG1I3.CheckedChanged += new System.EventHandler(this.CheckEdit_CheckedChanged);
//
// DlgDataUser
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.CancelButton = null;
this.ClientSize = new System.Drawing.Size(418, 352);
this.Controls.Add(this.chkMPG1I3);
this.Controls.Add(this.chkMPG2I4);
this.Controls.Add(this.chkMPG2I3);
this.Controls.Add(this.chkMPG2I2);
this.Controls.Add(this.chkMPG2I1);
this.Controls.Add(this.chkMPG1I4);
this.Controls.Add(this.chkMPG1I5);
this.Controls.Add(this.chkMPG1I2);
this.Controls.Add(this.chkMPG1I1);
this.Controls.Add(this.chkMPG2);
this.Controls.Add(this.chkMPG1);
this.Controls.Add(this.chkChangePass);
this.Controls.Add(this.txtMemo);
this.Controls.Add(this.txtPhone);
this.Controls.Add(this.txtDuty);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.txtName);
this.Controls.Add(this.txtCode);
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 = "DlgDataUser";
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.txtCode, 0);
this.Controls.SetChildIndex(this.txtName, 0);
this.Controls.SetChildIndex(this.txtPassword, 0);
this.Controls.SetChildIndex(this.txtDuty, 0);
this.Controls.SetChildIndex(this.txtPhone, 0);
this.Controls.SetChildIndex(this.txtMemo, 0);
this.Controls.SetChildIndex(this.chkChangePass, 0);
this.Controls.SetChildIndex(this.chkMPG1, 0);
this.Controls.SetChildIndex(this.chkMPG2, 0);
this.Controls.SetChildIndex(this.chkMPG1I1, 0);
this.Controls.SetChildIndex(this.chkMPG1I2, 0);
this.Controls.SetChildIndex(this.chkMPG1I5, 0);
this.Controls.SetChildIndex(this.chkMPG1I4, 0);
this.Controls.SetChildIndex(this.chkMPG2I1, 0);
this.Controls.SetChildIndex(this.chkMPG2I2, 0);
this.Controls.SetChildIndex(this.chkMPG2I3, 0);
this.Controls.SetChildIndex(this.chkMPG2I4, 0);
this.Controls.SetChildIndex(this.chkMPG1I3, 0);
((System.ComponentModel.ISupportInitialize)(this.txtPassword.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtMemo.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkChangePass.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG2.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG1I1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG1I2.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG1I4.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG1I5.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG2I1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG2I2.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG2I3.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG2I4.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtDuty.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtPhone.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtName.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtCode.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.chkMPG1I3.Properties)).EndInit();
this.ResumeLayout(false);
} #endregion #endregion #region Variable bool appendmode = true; DataView dvFind; WWAM.BLL.UserInfo orow = new WWAM.BLL.UserInfo(); 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.Data.Code = this.txtCode.Text.Trim(); orow.Data.Name = this.txtName.Text.Trim(); orow.Data.Duty = this.txtDuty.Text.Trim(); orow.Data.Phone = this.txtPhone.Text.Trim(); orow.Data.Memo = this.txtMemo.Text.Trim(); if(this.txtPassword.Enabled) { orow.Data.Password = WWAM.BLL.Verify.LocalEncodeString(this.txtPassword.Text.Trim()); } orow.Purview.MPG1 = this.chkMPG1.Checked; orow.Purview.MPG1I1 = this.chkMPG1I1.Checked; orow.Purview.MPG1I2 = this.chkMPG1I2.Checked; orow.Purview.MPG1I3 = this.chkMPG1I3.Checked; orow.Purview.MPG1I4 = this.chkMPG1I4.Checked; orow.Purview.MPG1I5 = this.chkMPG1I5.Checked; orow.Purview.MPG2 = this.chkMPG2.Checked; orow.Purview.MPG2I1 = this.chkMPG2I1.Checked; orow.Purview.MPG2I2 = this.chkMPG2I2.Checked; orow.Purview.MPG2I3 = this.chkMPG2I3.Checked; orow.Purview.MPG2I4 = this.chkMPG2I4.Checked; return orow.Data; } public bool IsChanged { get{return edited;} } #endregion #region CanColse protected override bool CanClose()
{
if(!appendmode && !edited)
{
return true;
}
if(ControlEmpty(this.txtCode,"请输入帐号"))return false;
if(ControlEmpty(this.txtCode,"请输入姓名"))return false;
int chkRepeat = DataRepeat();
if(chkRepeat==1)
{
msgBox.ShowWarning("指定的帐号已被占用!");
return false;
}
if(chkRepeat == 2)
{
msgBox.ShowWarning("指定的姓名已被占用!");
return false;
}
if(this.txtPassword.Enabled)
if(ControlEmpty(this.txtCode,"请输入密码"))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) { this.orow.Clear(); this.orow.Data.Used = true; this.orow.Data.Logined = true; this.DataInit(); this.dvFind = new DataView(dtfind); this.edited = false; this.appendmode = true; return base.ShowDialog(); } public DialogResult ShowDialog(DataRow dr , DataTable dtfind) { this.orow.GetData(dr); this.DataSetting(); this.dvFind = new DataView(dtfind); this.edited = false; this.appendmode = false; return base.ShowDialog(); } #endregion #region DataMethod void DataBind() { } void DataInit() { DataSetNormal(); this.txtPassword.Width = 176; this.txtPassword.Enabled = true; this.chkChangePass.Checked = false; this.chkChangePass.Visible = false; } void DataSetting() { DataSetNormal(); this.txtPassword.Width = 128; this.txtPassword.Enabled = false; this.chkChangePass.Checked = false; this.chkChangePass.Visible = true; } void DataSetNormal() { this.txtCode.Text = this.orow.Data.Code; this.txtName.Text = this.orow.Data.Name; this.txtPassword.Text = string.Empty; this.txtDuty.Text = this.orow.Data.Duty; this.txtPhone.Text = this.orow.Data.Phone; this.txtMemo.Text = this.orow.Data.Memo; this.chkMPG1.Checked = this.orow.Purview.MPG1; this.chkMPG1I1.Checked = this.orow.Purview.MPG1I1; this.chkMPG1I2.Checked = this.orow.Purview.MPG1I2; this.chkMPG1I3.Checked = this.orow.Purview.MPG1I3; this.chkMPG1I4.Checked = this.orow.Purview.MPG1I4; this.chkMPG1I5.Checked = this.orow.Purview.MPG1I5; this.chkMPG2.Checked = this.orow.Purview.MPG2; this.chkMPG2I1.Checked = this.orow.Purview.MPG2I1; this.chkMPG2I2.Checked = this.orow.Purview.MPG2I2; this.chkMPG2I3.Checked = this.orow.Purview.MPG2I3; this.chkMPG2I4.Checked = this.orow.Purview.MPG2I4; setCheckEditColor(this.chkMPG1); setCheckEditColor(this.chkMPG1I1); setCheckEditColor(this.chkMPG1I2); setCheckEditColor(this.chkMPG1I3); setCheckEditColor(this.chkMPG1I4); setCheckEditColor(this.chkMPG1I5); setCheckEditColor(this.chkMPG2); setCheckEditColor(this.chkMPG2I1); setCheckEditColor(this.chkMPG2I2); setCheckEditColor(this.chkMPG2I3); setCheckEditColor(this.chkMPG2I4); } #endregion #region Method int DataRepeat() { if(this.txtCode.Text.Trim()==string.Empty) return 0; if(appendmode) { dvFind.RowFilter = string.Format("Code = '{0}' ",this.txtCode.Text.Trim()); } else { dvFind.RowFilter = string.Format("Code = '{0}' and Userid <> {1}",this.txtCode.Text.Trim(),this.orow.Data.Userid); } if(dvFind.Count>0) return 1; if(appendmode) { dvFind.RowFilter = string.Format("Name = '{0}' ",this.txtCode.Text.Trim()); } else { dvFind.RowFilter = string.Format("Name = '{0}' and Userid <> {1}",this.txtCode.Text.Trim(),this.orow.Data.Userid); } if(dvFind.Count>0) return 2; else return 0; } #endregion #region EditValue Changed private void CheckEdit_CheckedChanged(object sender, System.EventArgs e)
{
setCheckEditColor((DevExpress.XtraEditors.CheckEdit)sender); this.edited = true; }
private void chkMPG1_CheckedChanged(object sender, System.EventArgs e)
{
CheckEdit_CheckedChanged(sender,e); this.chkMPG1I1.Checked = chkMPG1.Checked; this.chkMPG1I2.Checked = chkMPG1.Checked; this.chkMPG1I3.Checked = chkMPG1.Checked; this.chkMPG1I4.Checked = chkMPG1.Checked; this.chkMPG1I5.Checked = chkMPG1.Checked; }
private void chkMPG2_CheckedChanged(object sender, System.EventArgs e)
{
CheckEdit_CheckedChanged(sender,e);
this.chkMPG2I1.Checked = chkMPG2.Checked; this.chkMPG2I2.Checked = chkMPG2.Checked; this.chkMPG2I3.Checked = chkMPG2.Checked; this.chkMPG2I4.Checked = chkMPG2.Checked; }
private void chkChangePass_CheckedChanged(object sender, System.EventArgs e)
{
this.txtPassword.Text = "";
this.txtPassword.Enabled = this.chkChangePass.Checked;
this.txtPassword.ToolTip = "";
if(this.chkChangePass.Checked)
{
this.txtPassword.Focus();
}
}
#endregion
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -