示例#1
0
        public string GetString(SystemProfileKey key)
        {
            var rsp = Execute(new SystemProfileRequest {
                Category = CATEGORY, Key = (int)key
            });

            return(rsp.Content.value);
        }
示例#2
0
        public void Update(SystemProfileCategory category, SystemProfileKey key, string value)
        {
            var iRnt = 0;

            iRnt = DBHelper.GetInstance(mContext).ExecuteSql(string.Format("update _systemprofile set _value='{0}' where _category='{1}' and _key='{2}'", value, category, key));
            if (iRnt == 0)
            {
                throw new FinanceException(FinanceResult.RECORD_NOT_EXIST);
            }
        }
示例#3
0
        public long GetLong(SystemProfileCategory category, SystemProfileKey key)
        {
            long result = 0;

            if (!long.TryParse(GetString(category, key), out result))
            {
                throw new FinanceException(FinanceResult.IMPERFECT_DATA);
            }
            return(result);
        }
示例#4
0
        public int GetInt(SystemProfileCategory category, SystemProfileKey key)
        {
            int result = 0;

            if (!int.TryParse(GetString(category, key), out result))
            {
                throw new FinanceException(FinanceResult.IMPERFECT_DATA);
            }
            return(result);
        }
示例#5
0
        public int GetInt(SystemProfileKey key)
        {
            var rsp    = GetString(key);
            int result = 0;

            if (int.TryParse(rsp, out result))
            {
                return(result);
            }
            throw new FinanceAccountDataException(FinanceAccountDataErrorCode.FORMAT_ERROR);
        }
示例#6
0
        public SystemProfile Find(SystemProfileCategory category, SystemProfileKey key)
        {
            var dt = DBHelper.GetInstance(mContext).ExecuteDt(string.Format("select * from _systemprofile where _category='{0}' and _key='{1}'", category, key));

            if (dt == null || dt.Rows.Count == 0)
            {
                throw new FinanceException(FinanceResult.RECORD_NOT_EXIST);
            }

            var rsp = EntityConvertor <SystemProfile> .ToEntity(dt.Rows[0]);

            return(rsp);
        }
示例#7
0
        public void Update(dynamic tranc, SystemProfileCategory category, SystemProfileKey key, object value)
        {
            var sql = string.Format("update _systemprofile set _value='{0}' where _category='{1}' and _key='{2}'", value, category, key);

            DBHelper.GetInstance(mContext).ExecuteSql(tranc, sql);
        }
示例#8
0
 public string GetString(SystemProfileCategory category, SystemProfileKey key)
 {
     return(Find(category, key).value);
 }
示例#9
0
 public void Update(SystemProfileKey key, object value)
 {
     Execute(new SystemProfileUpdateRequest {
         Category = CATEGORY, Key = (int)key, Value = value.ToString()
     });
 }