Esempio n. 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["action"] != null)
     {
         SystemDictionaryType systemDictionaryType = (SystemDictionaryType)Enum.Parse(typeof(SystemDictionaryType), Request.QueryString["type"].ToString());
         SystemDictionaryItem systemDictionaryItem = null;
         if (Request.QueryString["action"].ToString() == "add")
         {
             try
             {
                 systemDictionaryItem = new SystemDictionaryItem(this.txtName.Text.Trim(), this.txtValue.Text.Trim(), this.ttRemark.InnerText.Trim());
                 SystemDictionaryService.AddItem(systemDictionaryType, systemDictionaryItem, CurrentUser.UserName);
                 RegisterScript("alert('添加成功!'); window.location.href='Dictionary.aspx';");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "添加");
             }
         }
         else if (Request.QueryString["action"].ToString() == "update")
         {
             try
             {
                 systemDictionaryItem = new SystemDictionaryItem(new Guid(Request.QueryString["Id"]), this.txtName.Text.Trim(), this.txtValue.Text.Trim(), this.ttRemark.InnerText.Trim());
                 SystemDictionaryService.UpdateItem(systemDictionaryType, systemDictionaryItem, CurrentUser.UserName);
                 RegisterScript("alert('修改成功!'); window.location.href='Dictionary.aspx';");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "修改");
             }
         }
     }
 }
Esempio n. 2
0
        private static string getOemContractValue(string name)
        {
            IEnumerable <SystemDictionaryItem> oemContract = SystemDictionaryService.Query(SystemDictionaryType.OEMContract);
            SystemDictionaryItem result = oemContract.Where(r => r.Name == name).FirstOrDefault();

            return(result != null && !string.IsNullOrEmpty(result.Value) ? result.Value : string.Empty);
        }
Esempio n. 3
0
        private static string GetServicePhone()
        {
            IEnumerable <SystemDictionaryItem> oemContract = SystemDictionaryService.Query(SystemDictionaryType.OEMContract);
            SystemDictionaryItem result = oemContract.FirstOrDefault(r => r.Name == "ServicePhone");

            return(result != null && !string.IsNullOrEmpty(result.Value) ? result.Value : string.Empty);
        }
Esempio n. 4
0
        public int InsertItem(SystemDictionaryType type, SystemDictionaryItem item)
        {
            string sql = "INSERT INTO [T_SystemDictionary] ([TYPE],[ID],[NAME],[VALUE],[REMARK]) VALUES (@TYPE,@ID,@NAME,@VALUE,@REMARK)";

            using (var dbOperator = new DbOperator(Provider, ConnectionString)) {
                dbOperator.AddParameter("TYPE", (int)type);
                dbOperator.AddParameter("ID", item.Id);
                dbOperator.AddParameter("NAME", item.Name);
                dbOperator.AddParameter("VALUE", item.Value);
                dbOperator.AddParameter("REMARK", item.Remark);
                return(dbOperator.ExecuteNonQuery(sql));
            }
        }
Esempio n. 5
0
        public int UpdateItem(SystemDictionaryType type, SystemDictionaryItem item)
        {
            string sql = "UPDATE [T_SystemDictionary] SET [NAME]=@NAME,[VALUE]=@VALUE,[REMARK]=@REMARK WHERE [TYPE]=@TYPE AND [ID]=@ID";

            using (var dbOperator = new DbOperator(Provider, ConnectionString)) {
                dbOperator.AddParameter("NAME", item.Name);
                dbOperator.AddParameter("VALUE", item.Value);
                dbOperator.AddParameter("REMARK", item.Remark);
                dbOperator.AddParameter("TYPE", (int)type);
                dbOperator.AddParameter("ID", item.Id);
                return(dbOperator.ExecuteNonQuery(sql));
            }
        }
Esempio n. 6
0
        /// <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);
        }
Esempio n. 7
0
        /// <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);
        }