/// <summary> /// 保存按纽点击执行结束方法 /// </summary> protected void PageEnd() { //ajax返回信息 string resultmsg = ""; BIndividual bllBIndividual = new BIndividual(); MWorkPlan modelMWorkReportCheck = new MWorkPlan(); if (!string.IsNullOrEmpty(Utils.GetFormValue("WorkId"))) { //根据编号获取工作计划实体 modelMWorkReportCheck = bllBIndividual.GetWorkPlan(Utils.GetFormValue("WorkId")); if (modelMWorkReportCheck != null) { if (Utils.GetFormValue("Status") == ((int)Status.已结束).ToString()) { //审核状态 modelMWorkReportCheck.Status = Status.已结束; } else { resultmsg = UtilsCommons.AjaxReturnJson("false", "审核状态未勾选"); Response.Clear(); Response.Write(resultmsg); Response.End(); } //实际完成时间 if (!string.IsNullOrEmpty(Utils.GetFormValue("ActualTime"))) { modelMWorkReportCheck.ActualTime = Utils.GetDateTime(Utils.GetFormValue("ActualTime")); } else { modelMWorkReportCheck.ActualTime = DateTime.Now; } //结束 modelMWorkReportCheck.Result = Utils.GetFormValue("Result"); //最后修改时间 modelMWorkReportCheck.UpdateTime = DateTime.Now; if (bllBIndividual.SetWorkPlanEnd(modelMWorkReportCheck)) { resultmsg = UtilsCommons.AjaxReturnJson("true", "结束成功"); } else { resultmsg = UtilsCommons.AjaxReturnJson("false", "结束失败"); } } else { resultmsg = UtilsCommons.AjaxReturnJson("false", "结束失败 无法获取结束数据"); } } else { resultmsg = UtilsCommons.AjaxReturnJson("false", "结束失败 参数编号为空"); } Response.Clear(); Response.Write(resultmsg); Response.End(); }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { if (!string.IsNullOrEmpty(id)) { BIndividual bllBIndividual = new BIndividual(); //根据id获取计划实体 MWorkPlan modelMWorkPlan = bllBIndividual.GetWorkPlan(id); if (modelMWorkPlan != null) { //计划标题 lblTitle.Text = modelMWorkPlan.Title; //计划人 lblOperatorName.Text = modelMWorkPlan.OperatorName; //计划部门 if (modelMWorkPlan.DeptId > 0) { lblDepartment.Text = GetDepartmentById(modelMWorkPlan.DeptId, SiteUserInfo.CompanyId); } //计划时间 lblIssueTime.Text = modelMWorkPlan.IssueTime.ToShortDateString(); if (modelMWorkPlan.list != null && modelMWorkPlan.list.Count > 0) { StringBuilder strList = new StringBuilder(); #region strList.Append("<table width=\"99%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">"); strList.Append("<tr style=\"background: url(../images/y-formykinfo.gif) repeat-x center top;\">"); strList.Append("<td align=\"center\" bgcolor=\"#B7E0F3\" class=\"alertboxTableT\">审批人</td>"); strList.Append("<td height=\"23\" align=\"center\" bgcolor=\"#B7E0F3\" class=\"alertboxTableT\">审批时间</td>"); strList.Append("<td align=\"center\" bgcolor=\"#B7E0F3\" class=\"alertboxTableT\">审批状态</td>"); strList.Append("<td align=\"center\" bgcolor=\"#B7E0F3\" class=\"alertboxTableT\">审批意见</td>"); strList.Append("<td align=\"center\" bgcolor=\"#B7E0F3\" class=\"alertboxTableT\">操作</td>"); strList.Append("</tr>"); #endregion foreach (MWorkPlanCheck item in modelMWorkPlan.list) { if (item != null) { //如果审批人为自己(操作审批) //if (item.Approver.Trim() == SiteUserInfo.Username && item.Status == Status.审批中) //if (item.Approver.Trim() == "fq" && item.Status == Status.审批中) if (item.ApproverId == SiteUserInfo.UserId && item.Status == Status.审批中) { #region 自己审核人 strList.Append("<tr>"); strList.AppendFormat("<td align=\"center\" bgcolor=\"#FFFFFF\"><strong class=\"fontred\">{0}</strong></td>", item.Approver); strList.Append("<td height=\"28\" align=\"center\" bgcolor=\"#FFFFFF\"><input name=\"txtApproveTime\" onfocus=\"WdatePicker()\" type=\"text\" class=\"formsize120\" id=\"txtApproveTime\" size=\"30\"/></td>"); strList.AppendFormat("<td align=\"center\" bgcolor=\"#FFFFFF\"><input name=\"chbStatus\" type=\"checkbox\" id=\"chbStatus\" checked=\"checked\" value=\"{0}\" /></td>", item.Id); strList.Append("<td align=\"center\" bgcolor=\"#FFFFFF\"><input name=\"txtComment\" type=\"text\" class=\"formsize180\" id=\"txtComment\" size=\"30\"/></td>"); strList.Append("<td align=\"center\" bgcolor=\"#FFFFFF\"><a href=\"javascript:void(0)\" onclick=\"WorkPlanApproval.IntiData()\">审批</a></td>"); strList.Append("</tr>"); #endregion } else//查看别人的审批状态 { #region 其他审核人 string strimage = string.Empty; string strimagetitle = string.Empty; strList.Append("<tr>"); strList.AppendFormat("<td align=\"center\" bgcolor=\"#FFFFFF\"><strong>{0}</strong></td>", item.Approver); strList.AppendFormat("<td height=\"28\" align=\"center\" bgcolor=\"#FFFFFF\">{0}</td>", Utils.GetDateTime(item.ApproveTime.ToString()).ToShortDateString() == "0001-1-1" ? "" : Utils.GetDateTime(item.ApproveTime.ToString()).ToShortDateString()); strList.Append("<td align=\"center\" bgcolor=\"#FFFFFF\">"); #region 根据状态获取相应的图片 switch (item.Status) { case Status.审批中: strimage = "y-delupdateicon.gif"; strimagetitle = "审批中"; break; case Status.已结束: strimage = "y-cuohao.gif"; strimagetitle = "已结束"; break; case Status.已审批: strimage = "y-duihao.gif"; strimagetitle = "已审批"; break; } strList.AppendFormat("<img src=\"/images/{0}\" width=\"13\" title=\"{1}\" height=\"9\" />", strimage, strimagetitle); #endregion strList.Append("</td>"); strList.AppendFormat("<td align=\"center\" bgcolor=\"#FFFFFF\">{0}</td>", item.Comment); strList.AppendFormat("<td align=\"center\" bgcolor=\"#FFFFFF\">{0}</td>", ""); strList.Append("</tr>"); #endregion } } } strList.Append("</table>"); if (modelMWorkPlan.Status == Status.已审批) { strList.Append("<div class=\"hr_5\"></div>"); strList.Append("<table width=\"99%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">"); strList.Append("<tr>"); strList.Append("<td height=\"28\" align=\"left\" bgcolor=\"#FFFFFF\">实际完成时间:"); strList.Append("<input name=\"txtActualTime\" onfocus=\"WdatePicker()\" type=\"text\" class=\"formsize120\" id=\"txtActualTime\" size=\"30\"/>结果:"); strList.Append("<input name=\"txtEnd\" type=\"text\" class=\"formsize180\" id=\"txtEnd\" size=\"30\"/>"); strList.Append("<input name=\"chbIsEnd\" type=\"checkbox\" id=\"chbIsEnd\" checked=\"checked\"/>是否结束"); strList.Append(" <img src=\"/images/baocunimg.gif\" width=\"48\" height=\"20\" onclick=\"WorkPlanEnd.IntiData()\" /></td>"); strList.Append("</tr>"); strList.Append("</table>"); } litList.Text = strList.ToString(); } //是否可以操作该数据 if (!SiteUserInfo.IsHandleElse) { if (modelMWorkPlan.Status == Status.已审批 || (modelMWorkPlan.OperatorId != null && modelMWorkPlan.OperatorId != SiteUserInfo.UserId)) { this.phdPrint.Visible = false; } } } } }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { if (!string.IsNullOrEmpty(id)) { //把操作id方法在隐藏域之中供修改的时候用 hidId.Value = id; //实例化工作汇报实体 MWorkPlan modelMWorkPlan = new MWorkPlan(); //实例化业务层 BIndividual bllBIndividual = new BIndividual(); modelMWorkPlan = bllBIndividual.GetWorkPlan(id); if (modelMWorkPlan != null) { //计划标题 this.txtTitle.Text = modelMWorkPlan.Title; //计划人 this.txtUserName.Text = modelMWorkPlan.OperatorName; //计划部门id this.SelectSection1.SectionID = modelMWorkPlan.DeptId.ToString(); //计划部门名称 this.SelectSection1.SectionName = modelMWorkPlan.Department; //计划时间 this.txtDateTime.Text = modelMWorkPlan.ScheduledTime.ToShortDateString(); //计划内容 this.txtContent.Text = modelMWorkPlan.Remark; //附件 if (!string.IsNullOrEmpty(modelMWorkPlan.UploadUrl)) { string[] strlist = modelMWorkPlan.UploadUrl.Split('|'); if (strlist.Length == 2) { this.lclFile.Text = "<span class='upload_filename'> <a href='" + strlist[1] + "' title='" + strlist[0] + "' target='_blank'>查看附件</a><a href='javascript:void(0);' onclick='WorkPlanEditPage.RemoveVisaFile(this);return false;'> <img style='vertical-align:middle' src='/images/cha.gif'></a><input type='hidden' name='hideOtherFile' value='" + modelMWorkPlan.UploadUrl + "'></span>"; } } #region 审核人and ID //审核人 string approver = ""; //审核人id string approverid = ""; if (modelMWorkPlan.list != null && modelMWorkPlan.list.Count > 0) { foreach (MWorkPlanCheck item in modelMWorkPlan.list) { if (item != null) { //审核人 approver += item.Approver.Trim() + ","; //审核人ID approverid += item.ApproverId.Trim() + ","; } } } this.SelectSection2.SellsName = approver.TrimEnd(','); this.SelectSection2.SellsID = approverid.TrimEnd(','); #endregion //是否可以操作该数据 if (!SiteUserInfo.IsHandleElse) { bool IsShenpi = false; if (modelMWorkPlan.list != null && modelMWorkPlan.list.Count > 0) { foreach (MWorkPlanCheck model in modelMWorkPlan.list) { if (model != null) { if (model.Status == Status.已结束 || model.Status == Status.已审批) { IsShenpi = true; } } } if (IsShenpi || modelMWorkPlan.OperatorId != null && modelMWorkPlan.OperatorId != SiteUserInfo.UserId) { this.phdSave.Visible = false; } } } } else { txtDateTime.Text = DateTime.Now.ToShortDateString(); } } }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> protected void PageSave() { //ajax返回信息 string resultmsg = ""; //实例化工作计划实体 MWorkPlan modelMWorkPlan = new MWorkPlan(); //实例化业务层 BIndividual bllBIndividual = new BIndividual(); if (!string.IsNullOrEmpty(Utils.GetFormValue(hidId.UniqueID))) { //修改状态根据id获取计划实体 modelMWorkPlan = bllBIndividual.GetWorkPlan(Utils.GetFormValue(hidId.UniqueID)); } else { //计划时间 modelMWorkPlan.IssueTime = DateTime.Now; //最后修改时间 modelMWorkPlan.UpdateTime = DateTime.Now; } #region 显性属性(页面直接和用户交互) //计划标题 string title = Utils.GetFormValue(txtTitle.UniqueID); //计划人 string userName = Utils.GetFormValue(txtUserName.UniqueID); //部门id string departID = Utils.GetFormValue(this.SelectSection1.SelectIDClient); //部门名称 string departName = Utils.GetFormValue(this.SelectSection1.SelectNameClient); //计划预计完成时间 string dateTime = Utils.GetFormValue(txtDateTime.UniqueID); //计划内容 string content = Utils.GetFormValue(txtContent.UniqueID); //附件上传 string strUploadUrl = Utils.GetFormValue(UploadControl1.ClientHideID); #region 审批人列表 //审批人 string strapprover = Utils.GetFormValue(this.SelectSection2.SellsNameClient); string[] approver = { "" }; if (strapprover != null && strapprover.Contains(',')) { approver = strapprover.Split(','); } else { approver[0] = strapprover; } //审核人id string strapproverId = Utils.GetFormValue(this.SelectSection2.SellsIDClient); string[] approverId = { "" }; if (strapproverId != null && strapproverId.Contains(',')) { approverId = strapproverId.Split(','); } else { approverId[0] = strapproverId; } List <MWorkPlanCheck> list = new List <MWorkPlanCheck>(); if (approver.Length > 0) { for (int i = 0; i < approver.Length; i++) { MWorkPlanCheck modelMWorkPlanCheck = new MWorkPlanCheck(); if (approverId[i] != null) { //审批人id modelMWorkPlanCheck.ApproverId = approverId[i]; } //审批人姓名 modelMWorkPlanCheck.Approver = approver[i]; list.Add(modelMWorkPlanCheck); } } #endregion #region 实体赋值 modelMWorkPlan.Title = title; modelMWorkPlan.OperatorName = userName; modelMWorkPlan.OperatorId = ""; modelMWorkPlan.DeptId = Utils.GetInt(departID); modelMWorkPlan.Department = departName; modelMWorkPlan.ScheduledTime = Utils.GetDateTime(dateTime); modelMWorkPlan.Remark = content; #region 附件 if (!string.IsNullOrEmpty(strUploadUrl)) { //验证数据 string[] strUploadList = strUploadUrl.Split('|'); if (strUploadList.Length == 2) { strUploadUrl = strUploadList[0] + "|" + strUploadList[1]; } } else { if (!string.IsNullOrEmpty(Utils.GetFormValue("hideOtherFile"))) { strUploadUrl = Utils.GetFormValue("hideOtherFile"); } } modelMWorkPlan.UploadUrl = strUploadUrl; modelMWorkPlan.list = list; #endregion #endregion #endregion #region 隐性属性(id之类) //系统公司id string companyid = SiteUserInfo.CompanyId; modelMWorkPlan.CompanyId = companyid; //计划人编号 modelMWorkPlan.OperatorId = SiteUserInfo.UserId; #endregion //操作之后返回结果 bool result = false; if (!string.IsNullOrEmpty(hidId.Value)) { result = bllBIndividual.UpdWorkPlan(modelMWorkPlan); if (result) { resultmsg = UtilsCommons.AjaxReturnJson("true", "修改成功"); } else { resultmsg = UtilsCommons.AjaxReturnJson("false", "修改失败,检查选用的数据是否正确"); } } else { result = bllBIndividual.AddWorkPlan(modelMWorkPlan); if (result) { resultmsg = UtilsCommons.AjaxReturnJson("true", "添加成功"); } else { resultmsg = UtilsCommons.AjaxReturnJson("false", "添加失败,检查选用的数据是否正确"); } } Response.Clear(); Response.Write(resultmsg); Response.End(); }