using LYFZ.BLL; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.OAShopManagement { public class frmAddWorkReport : LYFZ.Software.UI.OAShopManagement.frmAddWorkReport { public frmAddWorkReport() { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.comboBoxTreeViewEx1); this.btnRelease.Click += btnRelease_Click; this.btnClose.Click += btnClose_Click; this.Load += frmReleaseTask_Load; this.comboBoxTreeViewEx1.IsNodeMouseClick = true; } BLL_ErpShopEvententry ctbll = new BLL_ErpShopEvententry(); string _id = ""; /// /// ID /// public string ID { get { return this._id; } set { this._id = value; } } Model.Model_ErpShopEvententry model = new Model.Model_ErpShopEvententry(); void frmReleaseTask_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.ID)) { model = ctbll.GetModel(Convert.ToInt32(ID)); this.comboBoxTreeViewEx1.Text = frmMattersApply.UserIDToName(model.Matter_UpdateName); this.comboBoxTreeViewEx1.Tag = model.Matter_UpdateName; this.txtTitle.Text = model.Matter_Title; this.txtInfo.Text = model.Matter_content; } } void btnClose_Click(object sender, EventArgs e) { this.Close(); } void btnRelease_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtTitle.Text.Trim())) { MessageBoxCustom.Show("请输入工作汇报主题"); return; } if (this.comboBoxTreeViewEx1.Tag == null) { MessageBoxCustom.Show("请选工作汇报审批人"); return; } if (string.IsNullOrEmpty(this.txtInfo.Text.Trim())) { MessageBoxCustom.Show("请输入工作汇报内容"); return; } if (this.txtTitle.Text.Trim().Length > 100) { MessageBoxCustom.Show("申请工作汇报主题不能超过100个字"); return; } if (this.txtInfo.Text.Trim().Length > 500) { MessageBoxCustom.Show("申请工作汇报内容不能超过500个字"); return; } model.Matter_ID = LYFZ.WinAPI.CustomPublicMethod.GenerateId(); model.Matter_UpdateName = comboBoxTreeViewEx1.Tag.ToString(); model.Matter_content = txtInfo.Text.Trim(); model.Matter_Title = this.txtTitle.Text.Trim(); model.Matter_CreateDatetime = SDateTime.Now; model.Matter_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; model.Matter_state = state.申请中.ToString(); model.Matter_Type = 2; model.Matter_opinion = ""; model.Matter_UpdateDatetime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime(); if (model.ID > 0) { if (ctbll.Update(model)) { MessageBoxCustom.Show("重新汇报发送成功"); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MessageBoxCustom.Show("重新汇报发送失败"); return; } } else { if (ctbll.Add(model)) { MessageBoxCustom.Show("汇报发送成功"); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MessageBoxCustom.Show("汇报发送成功"); return; } } } } }