protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SystemDictionaryType systemDictionaryType = (SystemDictionaryType)Enum.Parse(typeof(SystemDictionaryType), Request.QueryString["type"].ToString()); this.lblDictionaryName.Text = systemDictionaryType.GetDescription(); if (Request.QueryString["action"] != null && Request.QueryString["action"].ToString() == "update") { IEnumerable <SystemDictionaryItem> systemDictionaryItems = SystemDictionaryService.Query(systemDictionaryType); var itemId = new Guid(Request.QueryString["Id"]); var dictionaryItem = systemDictionaryItems.FirstOrDefault(item => item.Id == itemId); if (dictionaryItem == null) { return; } if (dictionaryItem.Name != null) { this.txtName.Text = dictionaryItem.Name; } if (dictionaryItem.Value != null) { this.txtValue.Text = dictionaryItem.Value; } if (dictionaryItem.Remark != null) { this.ttRemark.InnerText = dictionaryItem.Remark; } } } }
private void Refresh() { SystemDictionaryType dictionaryType = SystemDictionaryType.FirstOrBusinessBunkDescription; if (Request.QueryString["categoryId"] != null) { string categoryId = Request.QueryString["categoryId"].ToString(); dictionaryType = (SystemDictionaryType)Enum.Parse(typeof(SystemDictionaryType), categoryId); } this.lblDictionaryName.Text = dictionaryType.GetDescription(); this.gvSpecialType.DataSource = SystemDictionaryService.Query(dictionaryType); this.gvSpecialType.DataBind(); this.iType.Value = ((int)dictionaryType).ToString(); }
/// <summary> /// 添加字典表子项 /// </summary> public static void AddItem(SystemDictionaryType type, SystemDictionaryItem item, string account) { if (null == item) { throw new ArgumentNullException("item"); } // 添加数据 SystemDictionarys.Instance.AddItem(type, item); // 记录日志 var logContent = string.Format("添加字典表 [{0}] 的子项。内容:{1}", type.GetDescription(), item.ToString()); var log = new Service.Log.Domain.OperationLog(OperationModule.系统字典表, OperationType.Insert, account, OperatorRole.Platform, item.Id.ToString(), logContent, DateTime.Now); Service.LogService.SaveOperationLog(log); }
/// <summary> /// 删除字典表子项 /// </summary> public static void DeleteItem(SystemDictionaryType type, Guid item, string account) { var originalItem = SystemDictionarys.Instance[type][item]; if (null == originalItem) { throw new ChinaPay.Core.CustomException("原子项不存在"); } var originalContent = originalItem.ToString(); // 删除数据 SystemDictionarys.Instance.DeleteItem(type, item); // 记录日志 var logContent = string.Format("删除字典表 [{0}] 的子项。内容:{1}", type.GetDescription(), originalContent); var log = new Service.Log.Domain.OperationLog(OperationModule.系统字典表, OperationType.Delete, account, OperatorRole.Platform, item.ToString(), logContent, DateTime.Now); Service.LogService.SaveOperationLog(log); }
/// <summary> /// 修改字典表子项 /// </summary> public static void UpdateItem(SystemDictionaryType type, SystemDictionaryItem item, string account) { if (null == item) { throw new ArgumentNullException("item"); } var originalItem = SystemDictionarys.Instance[type][item.Id]; if (null == originalItem) { throw new ChinaPay.Core.CustomException("原子项不存在"); } var originalContent = originalItem.ToString(); // 修改数据 SystemDictionarys.Instance.UpdateItem(type, item); // 记录日志 var logContent = string.Format("修改字典表 [{0}] 的子项。由 {1} 修改为 {2}", type.GetDescription(), originalContent, item.ToString()); var log = new Service.Log.Domain.OperationLog(OperationModule.系统字典表, OperationType.Update, account, OperatorRole.Platform, item.Id.ToString(), logContent, DateTime.Now); Service.LogService.SaveOperationLog(log); }