Exemplo n.º 1
0
        internal bool EditDicDtlComm(DictionDtl dtl)
        {
            string sql = string.Format("UPDATE diction_dtl set name = '{0}', `order` = '{1}' where id = {2}'", dtl.name, dtl.order, dtl.id);
            int    row = mSql.ExcuteSql(sql);

            return(row >= 1);
        }
Exemplo n.º 2
0
        internal bool EditDicDtlValue(DictionDtl dtl, ValueTypeE dicType)
        {
            string sql = string.Format("UPDATE diction_dtl set updatetime = {0}, ", GetTimeOrNull(DateTime.Now));

            switch (dicType)
            {
            case ValueTypeE.Integer:
                sql += string.Format("int_value = '{0}'", dtl.int_value);
                break;

            case ValueTypeE.Boolean:
                sql += string.Format("bool_value = {0}", dtl.bool_value);
                break;

            case ValueTypeE.String:
                sql += string.Format("string_value = '{0}'", dtl.string_value);
                break;

            case ValueTypeE.Double:
                sql += string.Format("double_value = '{0}'", dtl.double_value);
                break;

            case ValueTypeE.UInteger:
                sql += string.Format("uint_value = '{0}'", dtl.uint_value);
                break;

            default:
                sql += "1=1";
                break;
            }
            sql += string.Format(" where id = {0}", dtl.id);
            int row = mSql.ExcuteSql(sql);

            return(row >= 1);
        }
Exemplo n.º 3
0
        public void SetValue(DictionDtl oldv, DictionDtl newv, ValueTypeE type)
        {
            oldv.order = newv.order;
            oldv.name  = newv.name;
            switch (type)
            {
            case ValueTypeE.Integer:
                oldv.int_value = newv.int_value;
                break;

            case ValueTypeE.Boolean:
                oldv.bool_value = newv.bool_value;
                break;

            case ValueTypeE.String:
                oldv.string_value = newv.string_value;
                break;

            case ValueTypeE.Double:
                oldv.double_value = newv.double_value;
                break;

            case ValueTypeE.UInteger:
                oldv.uint_value = newv.uint_value;
                break;

            default:
                break;
            }
        }
Exemplo n.º 4
0
        internal bool AddDictionDtl(DictionDtl dtl, ValueTypeE dicType)
        {
            string sql = "INSERT INTO `diction_dtl`(`diction_id`, `code`,  `name`, `int_value`, `bool_value`, `string_value`, `double_value`, `uint_value`, `order`) " +
                         "VALUES ('{0}', '{1}', '{2}', '{3}', {4}, '{5}', '{6}', '{7}', '{8}')";

            sql = string.Format(sql, dtl.diction_id, dtl.code, dtl.name, dtl.int_value, dtl.bool_value, dtl.string_value, dtl.double_value, dtl.uint_value, dtl.order);
            int row = mSql.ExcuteSql(sql);

            return(row >= 1);
        }
Exemplo n.º 5
0
        public void UpdateVersion(string dictag)
        {
            DictionDtl dtl = GetDtlInCode(dictag);

            if (dtl != null)
            {
                dtl.int_value++;
                PubMaster.Mod.DicSql.EditDicDtlValue(dtl, ValueTypeE.Integer);
            }
        }
Exemplo n.º 6
0
        public bool IsVersionDiffer(VersionDic pack)
        {
            DictionDtl dtl = GetDtlInCode(pack.Name);

            if (dtl != null)
            {
                return(dtl.int_value != pack.Version);
            }

            return(false);
        }
Exemplo n.º 7
0
 public bool AddDictionDtl(DictionDtl dtl, ValueTypeE dicType, out string result)
 {
     result = "";
     if (!PubMaster.Mod.DicSql.AddDictionDtl(dtl, dicType))
     {
         result = "添加失败!";
         return(false);
     }
     Refresh(false, true);
     return(true);
 }
Exemplo n.º 8
0
 public bool AddDictionDtl(DictionDtl dtl, ValueTypeE dicType, out string result)
 {
     result = "";
     if (!PubMaster.Mod.DicSql.AddDictionDtl(dtl, dicType))
     {
         result = "添加失败!";
         return(false);
     }
     mLog.Info(true, string.Format(@"在字典ID【{0}】里,添加字典细节{1}", dtl.diction_id, dtl.ToString()));
     Refresh(false, true);
     return(true);
 }
Exemplo n.º 9
0
        public string GetDtlStrCode(string code, out byte level)
        {
            DictionDtl dtl = DicDtlList.Find(c => c.code.Equals(code));

            if (dtl != null)
            {
                level = dtl.level;
                return(dtl?.string_value ?? code);
            }
            level = 0;
            return(code);
        }
Exemplo n.º 10
0
        public uint GenerateID(string dictag)
        {
            DictionDtl dtl = DicDtlList.Find(c => dictag.Equals(c.code));

            if (dtl != null)
            {
                uint uvalue = dtl.uint_value;
                dtl.uint_value = uvalue + 1;
                PubMaster.Mod.DicSql.EditDicDtlValue(dtl, ValueTypeE.UInteger);
                return(uvalue);
            }

            return(0);
        }
Exemplo n.º 11
0
        public bool EditDictionDtl(DictionDtl dtl, ValueTypeE dicType, out string result)
        {
            result = "";
            DictionDtl d = GetDictionDtl(dtl.id);

            SetValue(d, dtl, dicType);
            if (!PubMaster.Mod.DicSql.EditDicDtlValue(d, dicType))
            {
                result = "添加失败!";
                return(false);
            }
            Refresh(false, true);
            return(true);
        }
Exemplo n.º 12
0
        public bool EditDictionDtl(DictionDtl dtl, ValueTypeE dicType, out string result)
        {
            result = "";
            DictionDtl d = GetDictionDtl(dtl.id);

            SetValue(d, dtl, dicType);
            if (!PubMaster.Mod.DicSql.EditDicDtlValue(d, dicType))
            {
                result = "添加失败!";
                return(false);
            }
            mLog.Info(true, string.Format(@"在字典ID【{0}】里,编辑字典细节{1}", d.diction_id, d.ToString()));
            Refresh(false, true);
            return(true);
        }
Exemplo n.º 13
0
        public bool UpdateSwitch(string tag, bool onoff, bool fromrf)
        {
            DictionDtl dtl = GetDtlInCode(tag);

            if (dtl != null && dtl.bool_value != onoff)
            {
                dtl.bool_value = onoff;
                PubMaster.Mod.DicSql.EditDicDtlValue(dtl, ValueTypeE.Boolean);
                if (fromrf)
                {
                    Messenger.Default.Send(dtl, MsgToken.TaskSwitchUpdate);
                }
                return(true);
            }
            return(false);
        }