Example #1
0
        public static Raffle_info_tblInfo GetItemByGateAndTel(string Gate, string Tel)
        {
            if (Gate == null || Tel == null)
            {
                return(null);
            }
            if (itemCacheTimeout <= 0)
            {
                return(dal.GetItemByGateAndTel(Gate, Tel));
            }
            string key   = string.Concat("DC2016_BLL_Raffle_info_tblByGateAndTel_", Gate, "_,_", Tel);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(new Raffle_info_tblInfo(value)); } catch { }
            }
            Raffle_info_tblInfo item = dal.GetItemByGateAndTel(Gate, Tel);

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Example #2
0
        public static Raffle_info_tblInfo GetItem(uint?Id)
        {
            if (Id == null)
            {
                return(null);
            }
            if (itemCacheTimeout <= 0)
            {
                return(dal.GetItem(Id));
            }
            string key   = string.Concat("DC2016_BLL_Raffle_info_tbl_", Id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(new Raffle_info_tblInfo(value)); } catch { }
            }
            Raffle_info_tblInfo item = dal.GetItem(Id);

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Example #3
0
 public static DC2016.DAL.Raffle_info_tbl.SqlUpdateBuild UpdateDiy(Raffle_info_tblInfo item, uint?Id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Id));
     }
     return(new DC2016.DAL.Raffle_info_tbl.SqlUpdateBuild(item, Id));
 }
Example #4
0
 public static int Update(Raffle_info_tblInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Example #5
0
 private static void RemoveCache(Raffle_info_tblInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("DC2016_BLL_Raffle_info_tbl_", item.Id));
     RedisHelper.Remove(string.Concat("DC2016_BLL_Raffle_info_tblByGateAndTel_", item.Gate, "_,_", item.Tel));
 }
Example #6
0
 public static Raffle_info_tblInfo Insert(Raffle_info_tblInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
Example #7
0
 public int Update(Raffle_info_tblInfo item)
 {
     return(new SqlUpdateBuild(null, item.Id)
            .SetActiveid(item.Activeid)
            .SetGate(item.Gate)
            .SetRewarditem(item.Rewarditem)
            .SetState(item.State)
            .SetTel(item.Tel)
            .SetTime(item.Time).ExecuteNonQuery());
 }
Example #8
0
        public Raffle_info_tblInfo Insert(Raffle_info_tblInfo item)
        {
            uint loc1;

            if (uint.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1))
            {
                item.Id = loc1;
            }
            return(item);
        }
Example #9
0
 protected static MySqlParameter[] GetParameters(Raffle_info_tblInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?id", MySqlDbType.UInt32, 10, item.Id),
         GetParameter("?activeid", MySqlDbType.VarChar, 32, item.Activeid),
         GetParameter("?gate", MySqlDbType.VarChar, 8, item.Gate),
         GetParameter("?rewarditem", MySqlDbType.Int32, 11, item.Rewarditem),
         GetParameter("?state", MySqlDbType.Int32, 11, item.State),
         GetParameter("?tel", MySqlDbType.VarChar, 18, item.Tel),
         GetParameter("?time", MySqlDbType.DateTime, -1, item.Time)
     });
 }
Example #10
0
 public SqlUpdateBuild(Raffle_info_tblInfo item, uint?Id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`id` = {0}", Id);
 }