📄 dwxxmanage.cs
字号:
this.label10.Size = new System.Drawing.Size(72, 23);
this.label10.TabIndex = 31;
this.label10.Text = "年龄";
this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 9F);
this.label3.Location = new System.Drawing.Point(488, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(69, 23);
this.label3.TabIndex = 24;
this.label3.Text = "单位性质";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label8
//
this.label8.Font = new System.Drawing.Font("宋体", 9F);
this.label8.Location = new System.Drawing.Point(232, 48);
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;
//
// label13
//
this.label13.Font = new System.Drawing.Font("宋体", 9F);
this.label13.Location = new System.Drawing.Point(488, 48);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(76, 23);
this.label13.TabIndex = 44;
this.label13.Text = "城市";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label6
//
this.label6.Font = new System.Drawing.Font("宋体", 9F);
this.label6.Location = new System.Drawing.Point(232, 168);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(88, 23);
this.label6.TabIndex = 29;
this.label6.Text = "性别";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label4
//
this.label4.Font = new System.Drawing.Font("宋体", 9F);
this.label4.Location = new System.Drawing.Point(16, 72);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 23);
this.label4.TabIndex = 26;
this.label4.Text = "邮政编码";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label11
//
this.label11.Font = new System.Drawing.Font("宋体", 9F);
this.label11.Location = new System.Drawing.Point(488, 192);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(76, 23);
this.label11.TabIndex = 38;
this.label11.Text = "文化程度";
this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋体", 9F);
this.label1.Location = new System.Drawing.Point(232, 216);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 25;
this.label1.Text = "备注";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
this.label5.Font = new System.Drawing.Font("宋体", 9F);
this.label5.Location = new System.Drawing.Point(16, 48);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 23);
this.label5.TabIndex = 27;
this.label5.Text = "客户来源";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.Font = new System.Drawing.Font("宋体", 9F);
this.label2.Location = new System.Drawing.Point(16, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 23;
this.label2.Text = "单位名称";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// DwxxManage
//
this.AutoScroll = true;
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "DwxxManage";
this.Size = new System.Drawing.Size(848, 549);
this.Load += new System.EventHandler(this.GrxxManage_Load);
((System.ComponentModel.ISupportInitialize)(this.panel2)).EndInit();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgPriver)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.panel1)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.txtdwzc.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtdwnsr.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtdwlxr.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtdwrs.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtzw.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtzy.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtyyah.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtdzyx.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtcz.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtyddh.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtdh.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtqh.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtxxdz.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtyzbm.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtcs.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtsf.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtkhly.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbxb.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtwhcd.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtnl.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtdwxz.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtdwbm.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtdwmc.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtbz.Properties)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void GrxxManage_Load(object sender, System.EventArgs e)
{
this.gridDataFilter1.checkbox=this.checkBox1;
ClearData();
getDataBind();
this.txtdwmc.Focus();
}
private void btAdd_Click(object sender, System.EventArgs e)
{
try
{
insertData();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void insertData()
{
if(!this.checkValidate())
{
return ;
}
DwxxInfo cinfo=new DwxxInfo();
cinfo=setData("添加");
if(cinfo==null)
{
return;
}
DwxxBLL cbll=new DwxxBLL();
int i=cbll.addDwxx(cinfo);
if(i!=-1)
{
MessageBox.Show("添加成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
getDataBind();
ClearData();
}
else
{
MessageBox.Show("单位编码重复,添加失败!","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
private DwxxInfo setData(string tag)
{
DwxxInfo cinfo=new DwxxInfo();
if(tag=="修改")
{
cinfo.id=Convert.ToInt32(this.dsservice.Tables["dwxx"].Rows[this.dgPriver.CurrentCell.RowNumber]["id"]);//Convert.ToString(this.dgPriver[this.dgPriver.CurrentCell.RowNumber,1]);
// MessageBox.Show(cinfo.id.ToString());
}
// else
// {
// cinfo.ccbh=this.txtccbh.Text;
// }
cinfo.dwmc=this.txtdwmc.Text;
cinfo.dwbm=this.txtdwbm.Text;
cinfo.dwxz=this.txtdwxz.Text;
cinfo.khly=this.txtkhly.Text;
cinfo.sf=this.txtsf.Text;
cinfo.cs=this.txtcs.Text;
cinfo.yzbm=this.txtyzbm.Text;
cinfo.xxdz=this.txtxxdz.Text;
cinfo.qh=this.txtqh.Text;
cinfo.dh=this.txtdh.Text;
cinfo.yddh=this.txtyddh.Text;
cinfo.cz=this.txtcz.Text;
cinfo.dzyx=this.txtdzyx.Text;
cinfo.dwrs=Convert.ToInt32(this.txtdwrs.Text==null||this.txtdwrs.Text==""?"0":this.txtdwrs.Text);
cinfo.dwnsr=Convert.ToDecimal(this.txtdwnsr.Text==""?"0":this.txtdwnsr.Text);
cinfo.dwzc=Convert.ToDecimal(this.txtdwzc.Text==""?"0":this.txtdwzc.Text);
cinfo.dwlxr=this.txtdwlxr.Text;
cinfo.xb=this.cbxb.Text;
cinfo.nl=Convert.ToInt32(this.txtnl.Text==""?"0":this.txtnl.Text);
cinfo.zy=this.txtzy.Text;
cinfo.zw=this.txtzw.Text;
cinfo.whcd=this.txtwhcd.Text;
cinfo.yyah=this.txtyyah.Text;
cinfo.bz=this.txtbz.Text;
return cinfo;
}
private void getDataBind()
{
this.dgPriver.CaptionBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
this.dgPriver.BackgroundColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
this.checkBox1.BackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
dsservice=new DataSet();
DwxxBLL cbll=new DwxxBLL();
DwxxInfo cinfo=new DwxxInfo();
dsservice=cbll.getALLDwxx_DataSet("dwxx");
System.Type myDataType;
myDataType = System.Type.GetType("System.Boolean");
System.Data.DataColumn myColumn = new System.Data.DataColumn("check");
// Set various properties.
myColumn.AutoIncrement = false;
myColumn.ReadOnly = false;
myColumn.ColumnMapping = System.Data.MappingType.Attribute;
myColumn.Caption = "check";
myColumn.DefaultValue = "false";
myColumn.DataType = myDataType;
dsservice.Tables["dwxx"].Columns.Add(myColumn);
DataView dv=new DataView();
dv=dsservice.Tables["dwxx"].DefaultView;
dv.AllowNew=false;
this.dgPriver.DataSource=dv;//dsservice.Tables["service"].DefaultView;
this.dgPriver.TableStyles.Clear();
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = dsservice.Tables["dwxx"].TableName;
ts.GridLineColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
ts.HeaderBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
DataGridColumnStyle gsc = new DataGridBoolColumn();
gsc.MappingName = "check";
gsc.HeaderText = "选择";
gsc.Width=40;
ts.GridColumnStyles.Add(gsc);
DataGridColumnStyle gs0 = new DataGridTextBoxColumn();
gs0.MappingName = "dwmc";
gs0.HeaderText = "单位名称";
gs0.Width=200;
gs0.ReadOnly=true;
gs0.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs0);
DataGridColumnStyle gs00 = new DataGridTextBoxColumn();
gs00.MappingName = "dwbm";
gs00.HeaderText = "单位编码";
gs00.NullText = "";
gs00.Width=80;
gs00.ReadOnly=true;
gs00.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs00);
DataGridColumnStyle gs1 = new DataGridTextBoxColumn();
gs1.MappingName = "dwxz";
gs1.HeaderText = "单位性质";
gs1.NullText = "";
gs1.Width=100;
gs1.ReadOnly=true;
gs1.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs1);
DataGridColumnStyle gs2 = new DataGridTextBoxColumn();
gs2.MappingName = "khly";
gs2.HeaderText = "客户来源";
gs2.NullText = "";
gs2.Width=100;
gs2.ReadOnly=true;
gs2.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs2);
DataGridColumnStyle gst2 = new DataGridTextBoxColumn();
gst2.MappingName = "sf";
gst2.HeaderText = "省份";
gst2.NullText = "";
gst2.Width=80;
gst2.ReadOnly=true;
gst2.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gst2);
DataGridColumnStyle gs3 = new DataGridTextBoxColumn();
gs3.MappingName = "cs";
gs3.HeaderText = "城市";
gs3.NullText = "";
gs3.Width=80;
gs3.ReadOnly=true;
gs3.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs3);
DataGridColumnStyle gs4 = new DataGridTextBoxColumn();
gs4.MappingName = "yzbm";
gs4.HeaderText = "邮政编码";
gs4.NullText = "";
gs4.Width=100;
gs4.ReadOnly=true;
gs4.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs4);
DataGridColumnStyle gs5 = new DataGridTextBoxColumn();
gs5.MappingName = "xxdz";
gs5.HeaderText = "详细地址";
gs5.NullText = "";
gs5.Width=100;
gs5.ReadOnly=true;
gs5.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs5);
DataGridColumnStyle gs6 = new DataGridTextBoxColumn();
gs6.MappingName = "qh";
gs6.HeaderText = "区号";
gs6.NullText = "";
gs6.Width=100;
gs6.ReadOnly=true;
gs6.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs6);
DataGridColumnStyle gs7 = new DataGridTextBoxColumn();
gs7.MappingName = "dh";
gs7.HeaderText = "电话";
gs7.NullText = "";
gs7.Width=100;
gs7.ReadOnly=true;
gs7.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs7);
DataGridColumnStyle gs8 = new DataGridTextBoxColumn();
gs8.MappingName = "yddh";
gs8.HeaderText = "移动电话";
gs8.NullText = "";
gs8.Width=300;
gs8.ReadOnly=true;
gs8.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs8);
DataGridColumnStyle gs9 = new DataGridTextBoxColumn();
gs9.MappingName = "cz";
gs9.HeaderText = "传真";
gs9.NullText = "";
gs9.Width=80;
gs9.ReadOnly=true;
gs9.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs9);
DataGridColumnStyle gs10 = new DataGridTextBoxColumn();
gs10.MappingName = "dzyx";
gs10.HeaderText = "电子邮箱";
gs10.NullText = "";
gs10.Width=100;
gs10.ReadOnly=true;
gs10.Alignment = HorizontalAlignment.Left;
ts.GridColumnStyles.Add(gs10);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -