/// <summary> /// “修改” 按钮的单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { try { if (this.txtBusinessType_Name.Text == "") { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "业务类别名称不能为空!", txtBusinessType_Name, this); return; } if (this.dgvBusinessType.SelectedRows.Count > 0)//选中行 { if (dgvBusinessType.SelectedRows.Count > 1) { MessageBox.Show("修改只能选中一行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (!btnCheckupdate()) { return; // 去重复 } Expression <Func <BusinessType, bool> > pc = n => n.BusinessType_ID == int.Parse(this.dgvBusinessType.SelectedRows[0].Cells["BusinessType_ID"].Value.ToString()); Action <BusinessType> ap = s => { s.BusinessType_UserId = CommonalityEntity.USERID; s.BusinessType_Name = this.txtBusinessType_Name.Text.Trim(); s.BusinessType_Content = this.txtBusinessType_Content.Text.Trim(); s.BusinessType_CreatTime = Convert.ToDateTime(CommonalityEntity.GetServersTime().ToString()); s.BusinessType_Remark = this.txtBusinessType_Remark.Text.Trim(); s.BusinessType_Use = this.txtBusinessType_Use.Text.Trim(); s.BusinessType_State = this.cbxBusinessType_State.Text; s.BusinessType_Loaded = this.cbxBusinessType_Loaded.Text; s.BusinessType_CarType_ID = Convert.ToInt32(cmbCarType.SelectedValue.ToString()); }; if (BusinessTypeDAL.Update(pc, ap)) { string strContent = "业务类别名称为:" + this.txtBusinessType_Name.Text.Trim();; CommonalityEntity.WriteLogData("修改", "修改 " + strContent + " 的信息", common.USERNAME);//添加日志 MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch { CommonalityEntity.WriteTextLog("业务类别管理 btnAdd_Click()"); } finally { LogInfoLoad(""); this.btnUpdate.Enabled = false; this.btnSave.Enabled = true; Empty(); // 调用清空的方法 } }
public IEnumerable <BusinessTypeClass> Update(string BusinessTypeName, int UpdatedBy, int BusinessTypeId) { return(obj.Update(BusinessTypeName, UpdatedBy, BusinessTypeId)); }