protected void Page_Load(object sender, EventArgs e) { int dutyID = Utils.GetInt(Request.QueryString["DutyID"], -1); if (!IsPostBack) { if (dutyID != -1) { EyouSoft.BLL.AdminCenterStructure.RuleInfo bllRuleInfo = new EyouSoft.BLL.AdminCenterStructure.RuleInfo(); EyouSoft.Model.AdminCenterStructure.RuleInfo modelRuleInfo = bllRuleInfo.GetModel(CurrentUserCompanyID, dutyID); if (modelRuleInfo != null) { DutyNo = modelRuleInfo.RoleNo; DutyTitle = modelRuleInfo.Title; Content = modelRuleInfo.RoleContent; this.noData.Visible = false; } else { this.noData.Visible = true; } } else { this.noData.Visible = true; } } }
/// <summary> /// 获取规章制度信息集合 /// </summary> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="RecordCount"></param> /// <param name="RuleNo">规章制度编号</param> /// <param name="Title">规章制度标题</param> /// <returns></returns> public IList <EyouSoft.Model.AdminCenterStructure.RuleInfo> GetList(int PageSize, int PageIndex, ref int RecordCount, int CompanyId, string RuleNo, string Title) { IList <EyouSoft.Model.AdminCenterStructure.RuleInfo> ResultList = null; string tableName = "tbl_RuleInfo"; string identityColumnName = "Id"; string fields = " [Id],[Title],RoleNo"; string query = string.Format("[CompanyId]={0}", CompanyId); if (!string.IsNullOrEmpty(RuleNo)) { query = query + string.Format(" AND RoleNo LIKE '%{0}%' ", EyouSoft.Toolkit.Utils.ReplaceXmlSpecialCharacter(RuleNo)); } if (!string.IsNullOrEmpty(Title)) { query = query + string.Format(" AND Title LIKE '%{0}%' ", EyouSoft.Toolkit.Utils.ReplaceXmlSpecialCharacter(Title)); } string orderByString = " IssueTime DESC"; using (IDataReader dr = DbHelper.ExecuteReader(_db, PageSize, PageIndex, ref RecordCount, tableName, identityColumnName, fields, query, orderByString)) { ResultList = new List <EyouSoft.Model.AdminCenterStructure.RuleInfo>(); while (dr.Read()) { EyouSoft.Model.AdminCenterStructure.RuleInfo model = new EyouSoft.Model.AdminCenterStructure.RuleInfo() { Id = dr.GetInt32(dr.GetOrdinal("Id")), Title = dr.IsDBNull(dr.GetOrdinal("Title")) ? "" : dr.GetString(dr.GetOrdinal("Title")), RoleNo = dr.IsDBNull(dr.GetOrdinal("RoleNo")) ? "" : dr.GetString(dr.GetOrdinal("RoleNo")) }; ResultList.Add(model); model = null; } }; return(ResultList); }
/// <summary> /// 获取规章制度实体信息 /// </summary> /// <param name="CompanyId"></param> /// <param name="Id"></param> /// <returns></returns> public EyouSoft.Model.AdminCenterStructure.RuleInfo GetModel(int CompanyId, int Id) { EyouSoft.Model.AdminCenterStructure.RuleInfo model = null; model = (from item in dcDal.RuleInfo where item.CompanyId == CompanyId && item.Id == Id select new EyouSoft.Model.AdminCenterStructure.RuleInfo { Id = item.Id, FilePath = item.FilePath, RoleContent = item.RoleContent, RoleNo = item.RoleNo, Title = item.Title }).FirstOrDefault(); return(model); }
/// <summary> /// 修改 /// </summary> /// <param name="model">合同信息实体</param> /// <returns></returns> public bool Update(EyouSoft.Model.AdminCenterStructure.RuleInfo model) { bool IsTrue = false; EyouSoft.Data.RuleInfo DataModel = dcDal.RuleInfo.FirstOrDefault(item => item.Id == model.Id && item.CompanyId == model.CompanyId ); if (DataModel != null) { DataModel.FilePath = model.FilePath; DataModel.RoleContent = model.RoleContent; DataModel.RoleNo = model.RoleNo; DataModel.Title = model.Title; dcDal.SubmitChanges(); if (dcDal.ChangeConflicts.Count == 0) { IsTrue = true; } } DataModel = null; return(IsTrue); }
/// <summary> /// 新增 /// </summary> /// <param name="model">合同信息实体</param> /// <returns></returns> public bool Add(EyouSoft.Model.AdminCenterStructure.RuleInfo model) { bool IsTrue = false; EyouSoft.Data.RuleInfo DataModel = new EyouSoft.Data.RuleInfo() { FilePath = model.FilePath, RoleContent = model.RoleContent, RoleNo = model.RoleNo, Title = model.Title, CompanyId = model.CompanyId, OperatorId = model.OperatorId, IssueTime = System.DateTime.Now }; dcDal.RuleInfo.InsertOnSubmit(DataModel); dcDal.SubmitChanges(); if (dcDal.ChangeConflicts.Count == 0) { IsTrue = true; } DataModel = null; return(IsTrue); }
/// <summary> /// 新增 /// </summary> /// <param name="model">合同信息实体</param> /// <returns></returns> public bool Add(EyouSoft.Model.AdminCenterStructure.RuleInfo model) { bool IsTrue = false; IsTrue = idal.Add(model); #region LGWR if (IsTrue) { EyouSoft.Model.CompanyStructure.SysHandleLogs logInfo = new EyouSoft.Model.CompanyStructure.SysHandleLogs(); logInfo.CompanyId = 0; logInfo.DepatId = 0; logInfo.EventCode = EyouSoft.Model.CompanyStructure.SysHandleLogsNO.EventCode; logInfo.EventIp = string.Empty; logInfo.EventMessage = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "{0}在" + EyouSoft.Model.EnumType.CompanyStructure.SysPermissionClass.行政中心_规章制度.ToString() + "新增了规章制度信息数据."; logInfo.EventTime = DateTime.Now; logInfo.EventTitle = "新增规章制度信息"; logInfo.ModuleId = EyouSoft.Model.EnumType.CompanyStructure.SysPermissionClass.行政中心_规章制度; logInfo.OperatorId = 0; this.Logwr(logInfo); logInfo = null; } #endregion return(IsTrue); }
protected void Page_Load(object sender, EventArgs e) { int dutyID = Utils.GetInt(Request.QueryString["DutyID"], -1); //制度ID string method = Utils.GetFormValue("hidMethod"); if (!IsPostBack && method == "") { this.hidDutyID.Value = dutyID.ToString(); if (dutyID != -1) { EyouSoft.BLL.AdminCenterStructure.RuleInfo bllRuleInfo = new EyouSoft.BLL.AdminCenterStructure.RuleInfo(); EyouSoft.Model.AdminCenterStructure.RuleInfo modelRuleInfo = bllRuleInfo.GetModel(CurrentUserCompanyID, dutyID); if (modelRuleInfo != null) { Number = modelRuleInfo.RoleNo; RegentTitle = modelRuleInfo.Title; this.txt_RegentContent.Value = modelRuleInfo.RoleContent; if (modelRuleInfo.FilePath != "") { FileHref = modelRuleInfo.FilePath; this.hidFileValue.Value = modelRuleInfo.FilePath; file.Visible = true; } else { file.Visible = false; } } else { MessageBox.Show(this.Page, "没有该规章制度信息"); return; } } } if (method == "save") //保存 { Number = Utils.GetFormValue("txt_Number"); RegentTitle = Utils.GetFormValue("txt_RegentTitle"); RegentContent = Utils.EditInputText(Request.Form["txt_RegentContent"]); if (RegentTitle == "") { MessageBox.Show(this.Page, "制度标题不能为空!"); return; } HttpPostedFile hpf = this.Request.Files["file_Bylaw"]; string oldeFile = string.Empty; string fileName = string.Empty; if (hpf != null && hpf.ContentLength > 0) { if (UploadFile.FileUpLoad(hpf, "AdminCenterRuleInfo", out fileName, out oldeFile)) { FileHref = fileName; } else { MessageBox.Show(this.Page, "附加上传失败!"); return; } } else { FileHref = this.hidFileValue.Value; } EyouSoft.Model.AdminCenterStructure.RuleInfo modelRuleInfo = new EyouSoft.Model.AdminCenterStructure.RuleInfo(); EyouSoft.BLL.AdminCenterStructure.RuleInfo bllRuleInfo = new EyouSoft.BLL.AdminCenterStructure.RuleInfo(); modelRuleInfo.RoleNo = Number; modelRuleInfo.Title = RegentTitle; modelRuleInfo.RoleContent = RegentContent; modelRuleInfo.FilePath = FileHref; modelRuleInfo.CompanyId = CurrentUserCompanyID; if (dutyID == -1) { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_规章制度_新增制度)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_规章制度_新增制度, true); } if (bllRuleInfo.Add(modelRuleInfo)) { MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "保存成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/bylaw/Default.aspx")); } else { MessageBox.Show(this.Page, "保存失败!"); } } else if (dutyID != -1) { if (!CheckGrant(global::Common.Enum.TravelPermission.行政中心_规章制度_修改制度)) { Utils.ResponseNoPermit(global::Common.Enum.TravelPermission.行政中心_规章制度_修改制度, true); } modelRuleInfo.Id = dutyID; if (bllRuleInfo.Update(modelRuleInfo)) { MessageBox.ResponseScript(this, string.Format("alert('{0}');window.parent.Boxy.getIframeDialog('{1}').hide();window.parent.location='{2}';", "修改成功!", Utils.GetQueryStringValue("iframeId"), "/administrativeCenter/bylaw/Default.aspx")); } else { MessageBox.Show(this.Page, "修改失败!"); } } } }