/// <summary> /// 页面加载 /// </summary> /// <param name="id"></param> protected void PageInit(string id) { BGovFilePersonnel BLL = new BGovFilePersonnel(); //根据员工编号获取员工离职信息实体 MGovFilePersonnel model = BLL.GetGovFilePersonnelModelByFileId(id); if (model != null) { //表单赋值、列表绑定 this.lbFileName.Text = model.FileName; this.lbApproveCause.Text = model.Reason; this.lbApplicationTime.Text = string.Format("{0:yyyy-MM-dd}", model.ApplicationTime); if (model.GovPersonnelApproveList != null && model.GovPersonnelApproveList.Count > 0) { this.rptapprove.DataSource = model.GovPersonnelApproveList; this.rptapprove.DataBind(); } if (model.ApproveState != ApprovalStatus.审核通过) { ph_Save.Visible = false; } this.txtDepartureTime.Text = string.Format("{0:yyyy-MM-dd}", model.DepartureTime); if (!this.SiteUserInfo.IsHandleElse && this.SiteUserInfo.UserId != model.OperatorID) { this.ph_Save.Visible = false; } } }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { BGovFilePersonnel BLL = new BGovFilePersonnel(); MGovFilePersonnel model = BLL.GetGovFilePersonnelModel(id); if (model != null) { this.hidKeyId.Value = model.Id; this.HrSelect1.HrSelectName = model.FileName; this.HrSelect1.HrSelectID = model.FileId; this.txtApplyCause.Text = model.Reason; this.SellsSelect1.SellsID = GetApproveList(model.GovPersonnelApproveList, 2); this.SellsSelect1.SellsName = GetApproveList(model.GovPersonnelApproveList, 1); this.txtWantTime.Text = string.Format("{0:yyyy-MM-dd}", model.ApplicationTime); if (this.SiteUserInfo.UserId != model.OperatorID && !this.SiteUserInfo.IsHandleElse) { this.ph_Save.Visible = false; } } }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected void PageSave(string doType) { #region 表单取值 string KeyId = Utils.GetFormValue(this.hidKeyId.UniqueID); string filename = Utils.GetFormValue(this.HrSelect1.HrSelectNameClient); string fileid = Utils.GetFormValue(this.HrSelect1.HrSelectIDClient); string reason = Utils.GetFormValue(this.txtApplyCause.UniqueID); string applicationtime = Utils.GetFormValue(this.txtWantTime.UniqueID); string personnelapprovename = Utils.GetFormValue(this.SellsSelect1.SellsNameClient); string personnerapproveid = Utils.GetFormValue(this.SellsSelect1.SellsIDClient); #endregion #region 表单验证 string msg = ""; bool result = false; if (string.IsNullOrEmpty(filename) || string.IsNullOrEmpty(fileid)) { msg += "-请选择申请人员!"; } if (string.IsNullOrEmpty(personnelapprovename)) { msg += "-请选择审批人员!"; } if (!string.IsNullOrEmpty(msg)) { Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); } #endregion #region 实体赋值 MGovFilePersonnel model = new MGovFilePersonnel(); model.ApplicationTime = Utils.GetDateTimeNullable(applicationtime); model.ApproveState = ApprovalStatus.待审核; model.DepartureTime = null; model.FileId = fileid; model.FileName = filename; model.GovPersonnelApproveList = GetApproveList(personnerapproveid, personnelapprovename, KeyId); model.Id = KeyId; model.IssueTime = DateTime.Now; model.OperatorID = this.SiteUserInfo.UserId; model.Reason = reason; model.StaffStatus = StaffStatus.在职; #endregion #region 提交保存 BGovFilePersonnel BLL = new BGovFilePersonnel(); if (doType == "add") { result = BLL.AddGovFilePersonnel(model); msg = result ? "添加成功!" : "添加失败"; } if (doType == "update") { result = BLL.UpdateGovFilePersonnel(model); msg = result ? "修改成功!" : "修改失败!"; } Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); #endregion }