using LYFZ.BLL; using LYFZ.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.OAShopManagement { public class frmWorkReportView : LYFZ.Software.UI.OAShopManagement.frmWorkReportView { public frmWorkReportView() { this.btnClose.Click += btnClose_Click; this.btnSave.Click += btnSave_Click; this.Load += frmTeskView_Load; if (LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.WorkReport, CustomAttributes.OperatingAuthority.Audit)) { this.btnSave.Enabled = true; } else { this.btnSave.Enabled = false; } this.btnSet.Click += btnSet_Click; } void btnSet_Click(object sender, EventArgs e) { LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet(); frm.TypeName = BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.工作汇报).ToUpper(); frm.Version = "Version"; if (frm.ShowDialog() == DialogResult.OK) { FinancialManagement.frmEditStatisticsProgram.LoadAllSystemCategory(); FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.工作汇报).ToUpper(), this.cmbCategory.TreeView); } } BLL_ErpShopEvententry Bll = new BLL_ErpShopEvententry(); string _id = ""; /// <summary> /// ID /// </summary> public string ID { get { return this._id; } set { this._id = value; } } Model_ErpShopEvententry model = new Model_ErpShopEvententry(); void frmTeskView_Load(object sender, EventArgs e) { FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.工作汇报).ToUpper(), this.cmbCategory.TreeView); if (!string.IsNullOrEmpty(this.ID)) { model = Bll.GetModel(Convert.ToInt32(ID)); //申请人 this.labPriority.Text = frmMattersApply.UserIDToName(model.Matter_UpdateName); FinancialManagement.frmEditStatisticsProgram.SetSelectItme(this.cmbCategory, model.Matter_Category); //申请时间 this.labReleaseDatetime.Text = model.Matter_CreateDatetime.ToString("yyyy-MM-dd HH:mm"); //申请内容 this.txtApplyInfo.Text = model.Matter_content; //审批人 this.labPostedby.Text = Bll.Name(model.Matter_UpdateName); //审批意见 this.txtApplyReply.Text = model.Matter_opinion; this.txtLeadershipInstruction.Text = model.Matter_LeadershipInstruction; this.txtTitle.Text = model.Matter_Title; } switch (_ApplyType) { case MattersApplyType.批示领导: this.txtApplyReply.Enabled = false; this.txtLeadershipInstruction.Enabled = true; this.btnSave.Enabled = true; break; case MattersApplyType.申请人: this.txtApplyReply.Enabled = false; this.txtLeadershipInstruction.Enabled = false; this.btnSave.Enabled = false; break; case MattersApplyType.审核人: this.txtApplyReply.Enabled = true; this.txtLeadershipInstruction.Enabled = false; this.btnSave.Enabled = true; break; } } /// <summary> /// 审核按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnSave_Click(object sender, EventArgs e) { if (model.ID > 0) { if (this.cmbCategory.TreeView.SelectedNode == null) { MessageBoxCustom.Show("请选工作审批评价"); return; } if (_ApplyType == MattersApplyType.审核人) { if (string.IsNullOrEmpty(txtApplyReply.Text)) { MessageBoxCustom.Show("请输入审批意见"); return; } if (txtApplyReply.Text.Trim().Length > 200) { MessageBoxCustom.Show("审批意见不能超过200个字"); return; } model.Matter_opinion = this.txtApplyReply.Text.Trim(); model.Matter_UpdateDatetime = SDateTime.Now; model.Matter_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; } else if (_ApplyType == MattersApplyType.批示领导) { if (string.IsNullOrEmpty(txtLeadershipInstruction.Text)) { MessageBoxCustom.Show("请输入领导批示意见"); return; } if (txtLeadershipInstruction.Text.Trim().Length > 200) { MessageBoxCustom.Show("领导批示意见不能超过200个字"); return; } model.Matter_LeadershipInstruction = this.txtLeadershipInstruction.Text.Trim(); model.Matter_InstructedPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; model.Matter_InstructedTime = SDateTime.Now; } model.Matter_Category = this.cmbCategory.TreeView.SelectedNode.Name; model.Matter_state = state.申请通过.ToString(); if (model.Matter_state == state.申请中.ToString()) { MessageBoxCustom.Show("请选择审核状态"); return; } if (Bll.Update(model)) { MessageBoxCustom.Show("审核成功"); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { MessageBoxCustom.Show("审核失败"); } } } void btnClose_Click(object sender, EventArgs e) { this.Close(); } MattersApplyType _ApplyType = MattersApplyType.申请人; /// <summary> /// 操作人类型 申请,审核 /// </summary> internal MattersApplyType ApplyType { get { return _ApplyType; } set { _ApplyType = value; } } } }