📄 frmcarkuselect.cs
字号:
this.cbys.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.cbys.Size = new System.Drawing.Size(152, 21);
this.cbys.TabIndex = 67;
//
// dtxxrq
//
this.dtxxrq.EditValue = new System.DateTime(2006, 8, 26, 0, 0, 0, 0);
this.dtxxrq.Location = new System.Drawing.Point(576, 48);
this.dtxxrq.Name = "dtxxrq";
//
// dtxxrq.Properties
//
this.dtxxrq.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.dtxxrq.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.dtxxrq.Properties.Mask.UseMaskAsDisplayFormat = true;
this.dtxxrq.Size = new System.Drawing.Size(152, 21);
this.dtxxrq.TabIndex = 66;
//
// btReset
//
this.btReset.Location = new System.Drawing.Point(752, 96);
this.btReset.Name = "btReset";
this.btReset.TabIndex = 65;
this.btReset.Text = "清 空";
this.btReset.Click += new System.EventHandler(this.btReset_Click);
//
// btDelete
//
this.btDelete.Location = new System.Drawing.Point(752, 72);
this.btDelete.Name = "btDelete";
this.btDelete.TabIndex = 64;
this.btDelete.Text = "删 除";
this.btDelete.Click += new System.EventHandler(this.btDelete_Click);
//
// btSave
//
this.btSave.Location = new System.Drawing.Point(752, 48);
this.btSave.Name = "btSave";
this.btSave.TabIndex = 62;
this.btSave.Text = "修 改";
this.btSave.Click += new System.EventHandler(this.btSave_Click);
//
// btAdd
//
this.btAdd.Location = new System.Drawing.Point(752, 24);
this.btAdd.Name = "btAdd";
this.btAdd.TabIndex = 61;
this.btAdd.Text = "添 加";
this.btAdd.Click += new System.EventHandler(this.btAdd_Click);
//
// txtggxh
//
this.txtggxh.EditValue = "";
this.txtggxh.Location = new System.Drawing.Point(96, 96);
this.txtggxh.Name = "txtggxh";
//
// txtggxh.Properties
//
this.txtggxh.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtggxh.Size = new System.Drawing.Size(160, 21);
this.txtggxh.TabIndex = 58;
//
// txtfdjhm
//
this.txtfdjhm.EditValue = "";
this.txtfdjhm.Location = new System.Drawing.Point(96, 72);
this.txtfdjhm.Name = "txtfdjhm";
//
// txtfdjhm.Properties
//
this.txtfdjhm.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtfdjhm.Size = new System.Drawing.Size(160, 21);
this.txtfdjhm.TabIndex = 55;
//
// txtfdjxh
//
this.txtfdjxh.EditValue = "";
this.txtfdjxh.Location = new System.Drawing.Point(96, 48);
this.txtfdjxh.Name = "txtfdjxh";
//
// txtfdjxh.Properties
//
this.txtfdjxh.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtfdjxh.Size = new System.Drawing.Size(160, 21);
this.txtfdjxh.TabIndex = 50;
//
// txtccbh
//
this.txtccbh.EditValue = "";
this.txtccbh.Location = new System.Drawing.Point(96, 24);
this.txtccbh.Name = "txtccbh";
//
// txtccbh.Properties
//
this.txtccbh.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.txtccbh.Size = new System.Drawing.Size(160, 21);
this.txtccbh.TabIndex = 48;
//
// label7
//
this.label7.Font = new System.Drawing.Font("宋体", 9F);
this.label7.Location = new System.Drawing.Point(267, 24);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 23);
this.label7.TabIndex = 40;
this.label7.Text = "车体颜色";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label10
//
this.label10.Font = new System.Drawing.Font("宋体", 9F);
this.label10.Location = new System.Drawing.Point(267, 48);
this.label10.Name = "label10";
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(508, 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(267, 72);
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(508, 72);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(56, 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(24, 48);
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(24, 96);
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(508, 48);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(56, 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(27, 152);
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(24, 72);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 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(27, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 23);
this.label2.TabIndex = 23;
this.label2.Text = "出厂编号";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// FrmCarkuSelect
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(840, 522);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "FrmCarkuSelect";
this.Load += new System.EventHandler(this.CarkuManage_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.cbstate.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtbz.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dtrkrq.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbscdw.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbclxz.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbpp.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbys.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dtxxrq.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtggxh.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtfdjhm.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtfdjxh.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtccbh.Properties)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void CarkuManage_Load(object sender, System.EventArgs e)
{
CarkuBLL cbll=new CarkuBLL();
DataSet ds=new DataSet();
ds=cbll.getDic_DataSet("sptype","id","stname");//车辆性质
for(int i=0;i<ds.Tables["sptype"].Rows.Count;i++)
{
this.cbclxz.Properties.Items.Add(ds.Tables["sptype"].Rows[i]["stname"].ToString());
}
ds=cbll.getDic_DataSet("AppraiseGrade","gmark","gshow");//车体颜色
for(int i=0;i<ds.Tables["AppraiseGrade"].Rows.Count;i++)
{
this.cbys.Properties.Items.Add(ds.Tables["AppraiseGrade"].Rows[i]["gshow"].ToString());
}
ds=cbll.getDic_DataSet("WBType","id","WBType");//生产单位
for(int i=0;i<ds.Tables["WBType"].Rows.Count;i++)
{
this.cbscdw.Properties.Items.Add(ds.Tables["WBType"].Rows[i]["WBType"].ToString());
}
ds=cbll.getDic_DataSet("WBState","id","WBState");//车辆品牌
for(int i=0;i<ds.Tables["WBState"].Rows.Count;i++)
{
this.cbpp.Properties.Items.Add(ds.Tables["WBState"].Rows[i]["WBState"].ToString());
}
this.gridDataFilter1.checkbox=this.checkBox1;
ClearData();
getDataBind();
this.txtccbh.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 ;
}
CarkuInfo cinfo=new CarkuInfo();
cinfo=setData("添加");
if(cinfo==null)
{
return;
}
CarkuBLL cbll=new CarkuBLL();
int i=cbll.addCarku(cinfo);
if(i!=-1)
{
MessageBox.Show("添加成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
getDataBind();
ClearData();
}
else
{
MessageBox.Show("出厂编号重复,添加失败!","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
}
}
private CarkuInfo setData(string tag)
{
CarkuInfo cinfo=new CarkuInfo();
if(tag=="修改")
{
cinfo.ccbh=Convert.ToString(this.dgPriver[this.dgPriver.CurrentCell.RowNumber,1]);
if(cinfo.ccbh!=this.txtccbh.Text)
{
return null;
}
}
else
{
cinfo.ccbh=this.txtccbh.Text;
}
cinfo.state=this.cbstate.Text;
cinfo.ys=this.cbys.Text;
cinfo.pp=this.cbpp.Text;
cinfo.clxz=this.cbclxz.Text;
cinfo.ggxh=this.txtggxh.Text;
cinfo.fdjxh=this.txtfdjxh.Text;
cinfo.fdjhm=this.txtfdjhm.Text;
cinfo.xxrq=Convert.ToDateTime(this.dtxxrq.Text);
cinfo.scdw=this.cbscdw.Text;
cinfo.rkrq=Convert.ToDateTime(this.dtrkrq.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();
CarkuBLL cbll=new CarkuBLL();
CarkuInfo cinfo=new CarkuInfo();
dsservice=cbll.getALLCarku_DataSet("carku");
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["carku"].Columns.Add(myColumn);
DataView dv=new DataView();
dv=dsservice.Tables["carku"].DefaultView;
dv.AllowNew=false;
this.dgPriver.DataSource=dv;//dsservice.Tables["service"].DefaultView;
this.dgPriver.TableStyles.Clear();
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = dsservice.Tables["carku"].TableName;
ts.GridLineColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
ts.HeaderBackColor=Color.FromArgb(ShareClass.Rcolor,ShareClass.Gcolor,ShareClass.Bcolor);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -