/// <summary> /// 检查制度编号是否重复 /// </summary> protected void CheckNum() { String str = String.Empty; String id = Request.QueryString["id"].Trim(); String num = Request.QueryString["num"].Trim(); if (!String.IsNullOrEmpty(num)) { BRegulation BLL = new BRegulation(); if (String.IsNullOrEmpty(id)) {//新增 if (BLL.ExistsCode(num, "", this.SiteUserInfo.CompanyId)) { str = "1"; } } else { //编辑 MGovRegulation Model = BLL.GetGovRegulationModel(id); if (null != Model && !String.Equals(num, Model.Code)) { if (BLL.ExistsCode(num, "", this.SiteUserInfo.CompanyId)) { str = "1"; } } } } Response.Clear(); Response.Write(str); Response.End(); }
/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { #region 初始化用户控件 this.SingleFileUpload1.CompanyID = this.SiteUserInfo.CompanyId; #endregion BRegulation BLL = new BRegulation(); MGovRegulation Model = BLL.GetGovRegulationModel(id); if (null != Model) { //主键 this.hidRuleId.Value = Model.RegId; //规章制度编号 this.txtRuleId.Text = Model.Code; //制度标题 this.txtRuleTitle.Text = Model.Title; //制度内容 this.txtRuleContent.Text = Utils.InputText(Model.Content); //适用部门 this.SelectSection1.SectionID = GetSectionID(Model.ApplyDeptList, 1); this.SelectSection1.SectionName = GetSectionID(Model.ApplyDeptList, 2); //发布部门 this.SelectSection2.SectionID = Model.IssuedDeptId.ToString(); this.SelectSection2.SectionName = Model.IssuedDepartName; //发布人 this.HrSelect1.HrSelectID = Model.IssuedId.ToString(); this.HrSelect1.HrSelectName = Model.IssuedName; // 发布时间 this.IssueTime.Text = Model.IssueTime.ToString(ProviderToDate); #region 注释代码 //附件 StringBuilder strFile = new StringBuilder(); IList <EyouSoft.Model.ComStructure.MComAttach> lstFile = Model.ComAttachList; if (null != lstFile && lstFile.Count > 0) { for (int i = 0; i < lstFile.Count; i++) { strFile.AppendFormat("<span class='upload_filename'><a href='/CommonPage/FileDownLoad.aspx?doType=downLoad&filePath={0}&name={1}' target='_blank'>{1}</a><a href=\"javascript:void(0)\" onclick=\"PageJsData.DelFile(this)\" title='删除附件'><img style='vertical-align:middle' src='/images/cha.gif'></a><input type=\"hidden\" name=\"hideFileInfo\" value='{1}|{0}'/></span>", lstFile[i].FilePath, lstFile[i].Name); } } this.lbFiles.Text = strFile.ToString();//附件 #endregion #region 权限判断 if (!this.SiteUserInfo.IsHandleElse && this.SiteUserInfo.UserId != Model.OperatorId) { this.ph_save.Visible = false; } #endregion } }
/// <summary> /// 保存 /// </summary> protected void PageSave(string doType) { #region 表单取值 string msg = ""; bool result = false; string code = Utils.GetFormValue(this.txtRuleId.UniqueID); string title = Utils.GetFormValue(this.txtRuleTitle.UniqueID); string content = Utils.GetFormValue(this.txtRuleContent.UniqueID); string issueddepartname = Utils.GetFormValue(this.SelectSection2.SelectNameClient); string issueddeptid = Utils.GetFormValue(this.SelectSection2.SelectIDClient); string issuedid = Utils.GetFormValue(this.HrSelect1.HrSelectIDClient); string issuedname = Utils.GetFormValue(this.HrSelect1.HrSelectNameClient); string issuetime = Utils.GetFormValue(this.IssueTime.UniqueID); string applydeptid = Utils.GetFormValue(this.SelectSection1.SelectIDClient); string applydeptname = Utils.GetFormValue(this.SelectSection1.SelectNameClient); string ruleid = Utils.GetFormValue(this.hidRuleId.UniqueID); #endregion #region 表单验证 if (string.IsNullOrEmpty(code)) { msg += "-请输入制度编号!<br/>"; } if (string.IsNullOrEmpty(title)) { msg += "-请输入制度标题!<br/>"; } if (!string.IsNullOrEmpty(msg)) { result = false; Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); return; } #endregion #region 实体赋值 BRegulation BLL = new BRegulation(); MGovRegulation Model = new MGovRegulation(); Model.RegId = ruleid; //制度编号 Model.Code = code; //制度标题 Model.Title = title; //制度内容 Model.Content = content; //发布部门名称 Model.IssuedDepartName = issueddepartname; //发布部门编号 Model.IssuedDeptId = Utils.GetInt(issueddeptid); //发布人编号 Model.IssuedId = issuedid; //发布人名称 Model.IssuedName = issuedname; //适用部门 Model.ApplyDeptList = GetApplyDeptList(applydeptname, applydeptid, ruleid); Model.IssueTime = Utils.GetDateTime(issuetime, DateTime.Now); Model.CompanyId = this.SiteUserInfo.CompanyId; Model.OperatorId = this.SiteUserInfo.UserId; Model.ComAttachList = NewGetAttach(); #endregion #region 提交回应 if (doType == "update") { result = BLL.UpdateRegulation(Model); msg = result ? "修改成功!" : "修改失败!"; } if (doType == "add") { result = BLL.AddGovRegulation(Model); msg = result ? "添加成功!" : "添加失败"; //新增 } Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); #endregion }