private void saveVmasLogin() { SYS.Model.BJCLXXB model = new SYS.Model.BJCLXXB(); if (!check_IsRight(out model)) { MessageBox.Show("带\"*\"项为必填项,请填写完整后再提交", "系统提示"); } else { if (CarWait.bjclxx.Have_BjclInDaijian(model.JCCLPH)) { //MessageBox.Show("该车已经在待检序列中,是否要更新该车信息", "系统提示"); if (MessageBox.Show("该车已经在待检序列中,是否要更新该车信息?", "系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { CarWait.bjclxx.Update(model); MessageBox.Show("更新成功", "系统提示"); } } else { if (CarWait.bjclxx.Savedate(model)) { //ref_WaitCar(); MessageBox.Show("保存成功,检测编号为" + model.JCBH + ".", "系统提示"); } } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SYS.Model.BJCLXXB model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update BJCLXXB set "); strSql.Append("PZLX=@PZLX,"); strSql.Append("CLXHBH=@CLXHBH,"); strSql.Append("JCCS=@JCCS,"); strSql.Append("CCRQ=@CCRQ,"); strSql.Append("DJRQ=@DJRQ,"); strSql.Append("FDJH=@FDJH,"); strSql.Append("CJH=@CJH,"); strSql.Append("CZ=@CZ,"); strSql.Append("CZDH=@CZDH,"); strSql.Append("CZDZ=@CZDZ,"); strSql.Append("LCBDS=@LCBDS,"); strSql.Append("HBBZ=@HBBZ,"); strSql.Append("SYQK=@SYQK,"); strSql.Append("JCBJ=@JCBJ,"); strSql.Append("JCZT=@JCZT,"); strSql.Append("QRJCFF=@QRJCFF,"); strSql.Append("RYLX=@RYLX,"); strSql.Append("GYFF=@GYFF,"); strSql.Append("BSXLX=@BSXLX,"); strSql.Append("CLLX=@CLLX,"); strSql.Append("ZBZL=@ZBZL,"); strSql.Append("ZDZZL=@ZDZZL,"); strSql.Append("FDJPL=@FDJPL,"); strSql.Append("FDJSCS=@FDJSCS,"); strSql.Append("JCZH=@JCZH,"); strSql.Append("DCZZ=@DCZZ,"); strSql.Append("FDJEDGL=@FDJEDGL,"); strSql.Append("FDJEDZS=@FDJEDZS,"); strSql.Append("PQGSL=@PQGSL,"); strSql.Append("PFBZ=@PFBZ,"); strSql.Append("ZZCS=@ZZCS,"); strSql.Append("QGS=@QGS,"); strSql.Append("QDXS=@QDXS,"); strSql.Append("QDLQY=@QDLQY,"); strSql.Append("JCYH=@JCYH,"); strSql.Append("DWS=@DWS,"); strSql.Append("HDZK=@HDZK,"); strSql.Append("JQXS=@JQXS"); strSql.Append(" where JCCLPH=@JCCLPH"); SqlParameter[] parameters = { new SqlParameter("@PZLX", SqlDbType.VarChar, 32), new SqlParameter("@CLXHBH", SqlDbType.VarChar, 32), new SqlParameter("@JCCS", SqlDbType.Int, 4), new SqlParameter("@CCRQ", SqlDbType.DateTime), new SqlParameter("@DJRQ", SqlDbType.DateTime), new SqlParameter("@FDJH", SqlDbType.VarChar, 32), new SqlParameter("@CJH", SqlDbType.VarChar, 32), new SqlParameter("@CZ", SqlDbType.VarChar, 32), new SqlParameter("@CZDH", SqlDbType.VarChar, 32), new SqlParameter("@CZDZ", SqlDbType.VarChar, 32), new SqlParameter("@LCBDS", SqlDbType.Int, 32), new SqlParameter("@HBBZ", SqlDbType.VarChar, 32), new SqlParameter("@SYQK", SqlDbType.VarChar, 32), new SqlParameter("@JCBJ", SqlDbType.VarChar, 32), new SqlParameter("@JCZT", SqlDbType.VarChar, 128), new SqlParameter("@QRJCFF", SqlDbType.VarChar, 128), new SqlParameter("@RYLX", SqlDbType.VarChar, 128), new SqlParameter("@GYFF", SqlDbType.VarChar, 128), new SqlParameter("@BSXLX", SqlDbType.VarChar, 128), new SqlParameter("@CLLX", SqlDbType.VarChar, 128), new SqlParameter("@ZBZL", SqlDbType.VarChar, 32), new SqlParameter("@ZDZZL", SqlDbType.VarChar, 32), new SqlParameter("@FDJPL", SqlDbType.VarChar, 32), new SqlParameter("@FDJSCS", SqlDbType.VarChar, 32), new SqlParameter("@JCZH", SqlDbType.VarChar, 32), new SqlParameter("@DCZZ", SqlDbType.VarChar, 32), new SqlParameter("@FDJEDGL", SqlDbType.VarChar, 32), new SqlParameter("@FDJEDZS", SqlDbType.VarChar, 32), new SqlParameter("@PQGSL", SqlDbType.Int, 4), new SqlParameter("@PFBZ", SqlDbType.VarChar, 32), new SqlParameter("@ZZCS", SqlDbType.VarChar, 32), new SqlParameter("@QGS", SqlDbType.Int, 4), new SqlParameter("@QDXS", SqlDbType.VarChar, 32), new SqlParameter("@QDLQY", SqlDbType.VarChar, 32), new SqlParameter("@JCYH", SqlDbType.VarChar, 32), new SqlParameter("@DWS", SqlDbType.Int, 4), new SqlParameter("@HDZK", SqlDbType.Int, 4), new SqlParameter("@JQXS", SqlDbType.VarChar, 32), new SqlParameter("@JCCLPH", SqlDbType.VarChar, 32) }; parameters[0].Value = model.PZLX; //parameters[1].Value = model.JCBH; parameters[1].Value = model.CLXHBH; parameters[2].Value = model.JCCS; parameters[3].Value = model.CCRQ; parameters[4].Value = model.DJRQ; parameters[5].Value = model.FDJH; parameters[6].Value = model.CJH; parameters[7].Value = model.CZ; parameters[8].Value = model.CZDH; parameters[9].Value = model.CZDZ; parameters[10].Value = model.LCBDS; parameters[11].Value = model.HBBZ; parameters[12].Value = model.SYQK; parameters[13].Value = model.JCBJ; parameters[14].Value = model.JCZT; parameters[15].Value = model.QRJCFF; parameters[16].Value = model.RYLX; parameters[17].Value = model.GYFF; parameters[18].Value = model.BSXLX; parameters[19].Value = model.CLLX; parameters[20].Value = model.ZBZL; parameters[21].Value = model.ZDZZL; parameters[22].Value = model.FDJPL; parameters[23].Value = model.FDJSCS; parameters[24].Value = model.JCZH; parameters[25].Value = model.DCZZ; parameters[26].Value = model.FDJEDGL; parameters[27].Value = model.FDJEDZS; parameters[28].Value = model.PQGSL; parameters[29].Value = model.PFBZ; parameters[30].Value = model.ZZCS; parameters[31].Value = model.QGS; parameters[32].Value = model.QDXS; parameters[33].Value = model.QDLQY; parameters[34].Value = model.JCYH; parameters[35].Value = model.DWS; parameters[36].Value = model.HDZK; parameters[37].Value = model.JQXS; parameters[38].Value = model.JCCLPH; try { int rows = DBHelperSQL.Execute(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } } catch (Exception) { throw; } }
/// <summary> /// 保存一条数据 /// </summary> public bool Savedate(SYS.Model.BJCLXXB model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into BJCLXXB ("); strSql.Append("PZLX,"); //=@PZLX,"); strSql.Append("JCBH,"); //=@JCCLPH,"); strSql.Append("CLXHBH,"); //=@CLXHBH,"); strSql.Append("JCCS,"); //=@JCCS,"); strSql.Append("CCRQ,"); //=@CCRQ,"); strSql.Append("DJRQ,"); //=@DJRQ,"); strSql.Append("FDJH,"); //=@FDJH,"); strSql.Append("CJH,"); //=@CJH,"); strSql.Append("CZ,"); //=@CZ,"); strSql.Append("CZDH,"); //=@CZDH,"); strSql.Append("CZDZ,"); //=@CZDZ,"); strSql.Append("LCBDS,"); //=@LCBDS,"); strSql.Append("HBBZ,"); //=@HBBZ,"); strSql.Append("SYQK,"); //=@SYQK,"); strSql.Append("JCBJ,"); //=@JCBJ,"); strSql.Append("JCZT,"); //=@JCZT,"); strSql.Append("QRJCFF,"); //=@QRJCFF"); strSql.Append("RYLX,"); //=@RYLX,"); strSql.Append("GYFF,"); //=@GYFF,"); strSql.Append("BSXLX,"); //=@BSXLX,"); strSql.Append("CLLX,"); //=@CLLX,"); strSql.Append("ZBZL,"); //=@ZBZL,"); strSql.Append("ZDZZL,"); //=@ZDZZL,"); strSql.Append("FDJPL,"); //=@FDJPL,"); strSql.Append("FDJSCS,"); //=@FDJSCS,"); strSql.Append("JCZH,"); //=@JCZH,"); strSql.Append("DCZZ,"); //=@DCZZ,"); strSql.Append("FDJEDGL,"); //=@FDJEDGL,"); strSql.Append("FDJEDZS,"); //=@FDJEDZS,"); strSql.Append("PQGSL,"); //=@PQGSL,"); strSql.Append("PFBZ,"); //=@PFBZ,"); strSql.Append("ZZCS,"); //=@ZZCS,"); strSql.Append("QGS,"); //=@QGS,"); strSql.Append("QDXS,"); //=@QDXS"); strSql.Append("QDLQY,"); //=@QDLQY,"); strSql.Append("JCYH,"); //=@JCYH"); strSql.Append("DWS,"); //=@DWS"); strSql.Append("HDZK,"); //=@DWS"); strSql.Append("JQXS,"); //=@DWS"); strSql.Append("JCCLPH)"); //@JCBH and JCCS=@JCCS "); strSql.Append("values (@PZLX,@JCBH,@CLXHBH,@JCCS,@CCRQ,@DJRQ,@FDJH,@CJH,@CZ,@CZDH,@CZDZ,@LCBDS,@HBBZ,@SYQK,@JCBJ,@JCZT,@QRJCFF,@RYLX,@GYFF,@BSXLX,@CLLX,@ZBZL,@ZDZZL,@FDJPL,@FDJSCS,@JCZH,@DCZZ,@FDJEDGL,@FDJEDZS,@PQGSL,@PFBZ,@ZZCS,@QGS,@QDXS,@QDLQY,@JCYH,@DWS,@HDZK,@JQXS,@JCCLPH)"); SqlParameter[] parameters = { new SqlParameter("@PZLX", SqlDbType.VarChar, 32), new SqlParameter("@JCBH", SqlDbType.VarChar, 16), new SqlParameter("@CLXHBH", SqlDbType.VarChar, 32), new SqlParameter("@JCCS", SqlDbType.Int, 4), new SqlParameter("@CCRQ", SqlDbType.DateTime), new SqlParameter("@DJRQ", SqlDbType.DateTime), new SqlParameter("@FDJH", SqlDbType.VarChar, 32), new SqlParameter("@CJH", SqlDbType.VarChar, 32), new SqlParameter("@CZ", SqlDbType.VarChar, 8), new SqlParameter("@CZDH", SqlDbType.VarChar, 16), new SqlParameter("@CZDZ", SqlDbType.VarChar, 32), new SqlParameter("@LCBDS", SqlDbType.Int, 4), new SqlParameter("@HBBZ", SqlDbType.VarChar, 4), new SqlParameter("@SYQK", SqlDbType.VarChar, 4), new SqlParameter("@JCBJ", SqlDbType.VarChar, 32), new SqlParameter("@JCZT", SqlDbType.VarChar, 128), new SqlParameter("@QRJCFF", SqlDbType.VarChar, 128), new SqlParameter("@RYLX", SqlDbType.VarChar, 128), new SqlParameter("@GYFF", SqlDbType.VarChar, 128), new SqlParameter("@BSXLX", SqlDbType.VarChar, 128), new SqlParameter("@CLLX", SqlDbType.VarChar, 128), new SqlParameter("@ZBZL", SqlDbType.VarChar, 32), new SqlParameter("@ZDZZL", SqlDbType.VarChar, 32), new SqlParameter("@FDJPL", SqlDbType.VarChar, 32), new SqlParameter("@FDJSCS", SqlDbType.VarChar, 32), new SqlParameter("@JCZH", SqlDbType.VarChar, 32), new SqlParameter("@DCZZ", SqlDbType.VarChar, 32), new SqlParameter("@FDJEDGL", SqlDbType.VarChar, 32), new SqlParameter("@FDJEDZS", SqlDbType.VarChar, 32), new SqlParameter("@PQGSL", SqlDbType.Int, 4), new SqlParameter("@PFBZ", SqlDbType.VarChar, 32), new SqlParameter("@ZZCS", SqlDbType.VarChar, 32), new SqlParameter("@QGS", SqlDbType.Int, 4), new SqlParameter("@QDXS", SqlDbType.VarChar, 32), new SqlParameter("@QDLQY", SqlDbType.VarChar, 32), new SqlParameter("@JCYH", SqlDbType.VarChar, 32), new SqlParameter("@DWS", SqlDbType.Int, 4), new SqlParameter("@HDZK", SqlDbType.Int, 4), new SqlParameter("@JQXS", SqlDbType.VarChar, 32), new SqlParameter("@JCCLPH", SqlDbType.VarChar, 32) }; parameters[0].Value = model.PZLX; parameters[1].Value = model.JCBH; parameters[2].Value = model.CLXHBH; parameters[3].Value = model.JCCS; parameters[4].Value = model.CCRQ; parameters[5].Value = model.DJRQ; parameters[6].Value = model.FDJH; parameters[7].Value = model.CJH; parameters[8].Value = model.CZ; parameters[9].Value = model.CZDH; parameters[10].Value = model.CZDZ; parameters[11].Value = model.LCBDS; parameters[12].Value = model.HBBZ; parameters[13].Value = model.SYQK; parameters[14].Value = model.JCBJ; parameters[15].Value = model.JCZT; parameters[16].Value = model.QRJCFF; parameters[17].Value = model.RYLX; parameters[18].Value = model.GYFF; parameters[19].Value = model.BSXLX; parameters[20].Value = model.CLLX; parameters[21].Value = model.ZBZL; parameters[22].Value = model.ZDZZL; parameters[23].Value = model.FDJPL; parameters[24].Value = model.FDJSCS; parameters[25].Value = model.JCZH; parameters[26].Value = model.DCZZ; parameters[27].Value = model.FDJEDGL; parameters[28].Value = model.FDJEDZS; parameters[29].Value = model.PQGSL; parameters[30].Value = model.PFBZ; parameters[31].Value = model.ZZCS; parameters[32].Value = model.QGS; parameters[33].Value = model.QDXS; parameters[34].Value = model.QDLQY; parameters[35].Value = model.JCYH; parameters[36].Value = model.DWS; parameters[37].Value = model.HDZK; parameters[38].Value = model.JQXS; parameters[39].Value = model.JCCLPH; try { if (Have_BjclInDaijian(model.JCCLPH)) { if (Update(model)) { return(true); } else { return(false); } } else { if (DBHelperSQL.Execute(strSql.ToString(), parameters) > 0) { return(true); } else { return(false); } } } catch (Exception) { throw; } }
private bool check_IsRight(out SYS.Model.BJCLXXB model) { model = new BJCLXXB(); if (textBoxPlateNumber.Text == "" || comboBoxMobileType.Text == "" || textBoxFarameNumber.Text == "" || textBoxWeight.Text == "" || textBoxMostWeight.Text == "" || comboBoxFuelType.Text == "" || comboBoxFuelSupplyType.Text == "" || comboBoxGreenFlag.Text == "" || dateEditRegisterData.Text == "") { return(false); } else { DateTime dt = DateTime.Now; string nowtime = dt.ToString().Replace("/", "").Replace(" ", "").Replace(":", "").Trim(); model.JCBH = nowtime; //用注册的时间做为被检车辆的编号,检测完了再重新定义检测编号存储到相应的数据库中 //model.JCBH = jczNumber + "-" + jcxxxb.JCXBH.ToString() + "-" + jcxxxb.LJSYS.ToString(); model.PZLX = comboBoxMobileColor.Text; //牌照颜色 model.JCCLPH = textBoxPlateNumber.Text; //牌照号码 model.CLXHBH = textBoxMobileNumber.Text; //车辆型号 model.JCCS = 0; //检测次数 //model.LSH=;// model.CCRQ = Convert.ToDateTime(dateEditProductDate.Text.Replace('/', '-')); //生产日期 model.DJRQ = Convert.ToDateTime(dateEditRegisterData.Text.Replace('/', '-')); //登记日期 model.FDJH = textBoxEngineNumber.Text; //发动机号 model.CJH = textBoxFarameNumber.Text; //车架号 model.CZ = textBoxOwnerName.Text; //车主 model.CZDH = textBoxOwnerTel.Text; //车主电话 model.CZDZ = textBoxOwnerAdd.Text; //车主地址 if (textBoxOdometer.Text != "") { model.LCBDS = Convert.ToInt32(textBoxOdometer.Text);//里程表读数 } else { model.LCBDS = 0; } model.HBBZ = comboBoxGreenFlag.Text; //环保标志 model.SYQK = comboBoxInUse.Text; //使用情况 if (comboBox_detectLine.Text.Trim() == "" || comboBox_detectLine.Text.Trim() == "本线检测") { model.JCBJ = CarWait.jcxxxb.JCXBH.ToString();//默认为本线检测 }//检测线号 else if (comboBox_detectLine.Text.Trim() == "优先") { model.JCBJ = "-1"; } model.JCZT = "请上测功机检测"; //检测状态 model.QRJCFF = comboBoxJcff.Text; //检测方法 model.RYLX = comboBoxFuelType.Text; model.GYFF = comboBoxFuelSupplyType.Text; model.BSXLX = comboBoxGearbox.Text; model.CLLX = comboBoxMobileType.Text; model.ZBZL = textBoxWeight.Text; model.ZDZZL = textBoxMostWeight.Text; model.FDJPL = textBoxEnginePlacement.Text; model.FDJSCS = textBoxEngineManufacture.Text; model.JCZH = CarWait.jczNumber; model.DCZZ = textBoxAxleLoad.Text; model.FDJEDGL = textBoxEnginePower.Text; model.FDJEDZS = textBoxEngineSpeed.Text; if (textBoxPipeCount.Text != "") { model.PQGSL = Convert.ToInt32(textBoxPipeCount.Text); } else { model.PQGSL = 0; } model.PFBZ = "地方标准"; model.ZZCS = textBoxMobileManufacture.Text; if (comboBoxCylinderCount.Text != "") { model.QGS = Convert.ToInt32(comboBoxCylinderCount.Text); } else { model.QGS = 0; } model.QDXS = comboBoxDriveStyle.Text; model.QDLQY = textBoxPneumaticWheel.Text; model.JCYH = textBoxInspectorNumber.Text; if (textBoxGearCount.Text != "") { model.DWS = Convert.ToInt32(textBoxGearCount.Text); } else { model.DWS = 0; } if (textBoxHdzk.Text != "") { model.HDZK = Convert.ToInt32(textBoxHdzk.Text); } else { model.HDZK = 0; } //model.JQXS = comboBoxJqxs.Text; return(true); } }