/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { try { if (NullHandleMethod()) { if (intCarTypeID > 0) { OthCarAttribute("", cbxCarAttribute.Text.Trim()); ssy = 0; Expression <Func <CarType, bool> > funCartype = n => n.CarType_ID == intCarTypeID; Action <CarType> action = n => { n.CarType_UserId = CommonalityEntity.GetInt(CommonalityEntity.USERID); n.CarType_Name = txt_CarTypeNmae.Text.Trim(); n.CarType_Content = txt_CarTypeContent.Text.Trim(); n.CarType_State = cob_CarTypeState.Text.Trim(); n.CarType_Property = cbxCarAttribute.Text.Trim(); n.CarType_Remark = txt_CarTypeRemarks.Text.Trim(); n.CarType_Validity = cob_CarTypeEffective.Text.Trim(); n.CarType_ValidityTemporary = cob_CarTypeTemporary.Text.Trim(); n.CarType_OtherProperty = butname.Trim(); if (!string.IsNullOrEmpty(txt_CarTemporaryValue.Text.Trim())) { n.CarType_ValidityValue = CommonalityEntity.GetInt(txt_CarTemporaryValue.Text.Trim()); } if (!string.IsNullOrEmpty(txtInOutTime.Text.Trim())) { n.CarType_InOutTime = CommonalityEntity.GetInt(txtInOutTime.Text.Trim()); } n.CarType_Value = txt_CarTypeValue.Text.Trim(); n.CarType_DriSName = cmbDriSta.Text; n.CarType_BusType = txtBusType.Text.Trim(); }; if ((CarTypeDAL.Update(funCartype, action))) { //查出通行策略ID、通道ID updateDri(cmbDriSta.Text); btn_Empty_Click(btn_Empty, null); //调用清空按钮事件 CommonalityEntity.WriteLogData("修改", "车辆类型:" + txt_CarTypeNmae.Text.Trim(), CommonalityEntity.USERNAME); //添加操作日志 btn_Empty.Text = "清 空"; MessageBox.Show(this, "修改成功"); } } } } catch { CommonalityEntity.WriteTextLog("CarTypeForm.btnUpdate_Click()"); MessageBox.Show(this, "修改失败"); } finally { btn_Save.Enabled = true; btnUpdate.Enabled = false; BingMethod(); } }
public Province_City_CarBLL() { pd = new ProvinceDAL(); cd = new CityDAL(); cbd = new CarBrandDAL(); csd = new CarSystemDAL(); ctd = new CarTypeDAL(); }
/// <summary> /// 绑定车辆类型 /// </summary> private void BindCarType() { string sql = "select * from CarType where CarType_State='启动'"; this.cobCarType.DataSource = CarTypeDAL.GetViewCarTypeName(sql); if (this.cobCarType.DataSource != null) { this.cobCarType.DisplayMember = "CarType_Name"; this.cobCarType.ValueMember = "CarType_ID"; cobCarType.SelectedIndex = -1; } }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Save_Click(object sender, EventArgs e) { try { if (NullHandleMethod()) { OthCarAttribute("", cbxCarAttribute.Text.Trim()); ssy = 0; CarType ct = new CarType(); ct.CarType_UserId = CommonalityEntity.GetInt(CommonalityEntity.USERID); ct.CarType_Name = txt_CarTypeNmae.Text.Trim(); ct.CarType_Content = txt_CarTypeContent.Text.Trim(); ct.CarType_State = cob_CarTypeState.Text.Trim(); ct.CarType_Property = cbxCarAttribute.Text.Trim(); ct.CarType_Remark = txt_CarTypeRemarks.Text.Trim(); ct.CarType_Validity = cob_CarTypeEffective.Text.Trim(); ct.CarType_ValidityTemporary = cob_CarTypeTemporary.Text.Trim(); ct.CarType_OtherProperty = butname.Trim(); if (!string.IsNullOrEmpty(txtInOutTime.Text.Trim())) { ct.CarType_InOutTime = CommonalityEntity.GetInt(txtInOutTime.Text.Trim()); } if (!string.IsNullOrEmpty(txt_CarTemporaryValue.Text.Trim())) { ct.CarType_ValidityValue = CommonalityEntity.GetInt(txt_CarTemporaryValue.Text.Trim()); } ct.CarType_Value = txt_CarTypeValue.Text.Trim(); ct.CarType_CreatTime = CommonalityEntity.GetServersTime(); ct.CarType_UserId = CommonalityEntity.USERID; ct.CarType_DriSName = cmbDriSta.Text; ct.CarType_BusType = txtBusType.Text.Trim(); if ((CarTypeDAL.InsertOneQCRecord(ct))) { btn_Empty_Click(btn_Empty, null); //调用清空按钮事件 CommonalityEntity.WriteLogData("新增", "新增车辆类型:" + txt_CarTypeNmae.Text.Trim(), CommonalityEntity.USERNAME); //添加操作日志 MessageBox.Show(this, "添加成功"); } } } catch { CommonalityEntity.WriteTextLog("CarTypeForm.JudgeCarTypeUseMethod()"); MessageBox.Show(this, "添加失败"); } finally { BingMethod(); } }