/// <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> /// <param name="id">删除ID</param> /// <returns></returns> private void DeleteData(string id) { bool b = false; string msg = string.Empty; if (!String.IsNullOrEmpty(id)) { BRegulation BLL = new BRegulation(); b = BLL.DeleteGovRegulation(id.Split(',')); } msg = b ? "删除成功!" : "删除失败!"; Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(b ? "1" : "0", msg)); Response.End(); }
/// <summary> /// 初始化 /// </summary> private void DataInit() { //获取分页参数并强转 pageIndex = Utils.GetInt(Utils.GetQueryStringValue("page")); BRegulation BLL = new BRegulation(); EyouSoft.Model.GovStructure.MGovRegSearch resmodel = new EyouSoft.Model.GovStructure.MGovRegSearch(); resmodel.Code = Utils.GetQueryStringValue("txtNum"); resmodel.Title = Utils.GetQueryStringValue("txtTitle"); if (!string.IsNullOrEmpty(Utils.GetQueryStringValue(this.DeptSelect1.SelectIDClient))) { resmodel.DepIds = Utils.GetQueryStringValue(this.DeptSelect1.SelectIDClient).Split(','); } else { resmodel.DepName = Utils.GetQueryStringValue(this.DeptSelect1.SelectNameClient); } this.DeptSelect1.SectionName = Utils.GetQueryStringValue(this.DeptSelect1.SelectNameClient); this.DeptSelect1.SectionID = Utils.GetQueryStringValue(this.DeptSelect1.SelectIDClient); IList <EyouSoft.Model.GovStructure.MGovRegulation> lst = BLL.GetGovRegulationList(this.SiteUserInfo.CompanyId, resmodel, AttachItemType.规章制度, pageSize, pageIndex, ref recordCount); if (null != lst && lst.Count > 0) { this.RepList.DataSource = lst; this.RepList.DataBind(); if (recordCount <= pageSize) { this.ExporPageInfoSelect1.Visible = false; } else { BindPage(); } } else { this.RepList.Controls.Add(new Label() { Text = "<tr><td colspan='7' align='center'>对不起,没有相关数据!</td></tr>" }); this.ExporPageInfoSelect1.Visible = false; } }
/// <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 }