예제 #1
0
        public static bool GetConfig(string fieldName, object fieldValue, out ConfPropGiftItem config)
        {
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_PropGiftItem", fieldName, fieldValue);

            if (sqReader != null)
            {
                try
                {
                    sqReader.Read();
                    if (sqReader.HasRows)
                    {
                        config = GetConfByDic(sqReader);
                    }
                    else
                    {
                        config = null;
                        return(false);
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    SqliteDriver.SQLiteHelper.OnError(string.Format("PropGiftItem 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex));
                }
                config = null;
                return(false);
            }
            config = null;
            return(false);
        }
예제 #2
0
        private static ConfPropGiftItem GetConfByDic(DataTable reader)
        {
            int  count     = reader.GetInt32(0);
            int  rate      = reader.GetInt32(1);
            long dropOutId = reader.GetInt64(2);
            long value     = reader.GetInt64(3);

            ConfPropGiftItem new_obj_ConfPropGiftItem = new ConfPropGiftItem(count,
                                                                             rate,
                                                                             dropOutId,
                                                                             value
                                                                             );

            return(new_obj_ConfPropGiftItem);
        }
예제 #3
0
 private static void GetArrrayList()
 {
     if (cacheArray.Count <= 0)
     {
         DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_PropGiftItem");
         if (sqReader != null)
         {
             while (sqReader.Read())
             {
                 ConfPropGiftItem _conf = GetConfByDic(sqReader);
                 cacheArray.Add(_conf);
                 dic[_conf.count] = _conf;
             }
             resLoaded = true;
         }
     }
 }
예제 #4
0
        public static bool GetConfig(int id, out ConfPropGiftItem config)
        {
            if (dic.TryGetValue(id, out config))
            {
                return(config != null);
            }
            if (cacheLoaded)
            {
                config = null;
                return(false);
            }
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_PropGiftItem", id);

            if (sqReader != null)
            {
                try
                {
                    sqReader.Read();
                    if (sqReader.HasRows)
                    {
                        config = GetConfByDic(sqReader);
                    }
                    else
                    {
                        dic[id] = null;
                        config  = null;
                        return(false);
                    }
                    dic[id] = config;
                    return(true);
                }
                catch (Exception ex)
                {
                    SqliteDriver.SQLiteHelper.OnError(string.Format("PropGiftItem 表找不到SN={0} 的数据\n{1}", id, ex));
                }
                config = null;
                return(false);
            }
            else
            {
                config = null;
                return(false);
            }
        }