Ejemplo n.º 1
0
        public object GetItem(IDataReader dr, ref int index)
        {
            ShopstatInfo item = new ShopstatInfo();

            if (!dr.IsDBNull(++index))
            {
                item.Shop_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Today_fav = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Today_session = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Today_share = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Total_fav = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Total_session = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Total_share = (uint?)dr.GetInt32(index);
            }
            return(item);
        }
Ejemplo n.º 2
0
 private static void RemoveCache(ShopstatInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("pifa_BLL_Shopstat_", item.Shop_id));
 }
Ejemplo n.º 3
0
 public static pifa.DAL.Shopstat.SqlUpdateBuild UpdateDiy(ShopstatInfo item, uint Shop_id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Shop_id));
     }
     return(new pifa.DAL.Shopstat.SqlUpdateBuild(item, Shop_id));
 }
Ejemplo n.º 4
0
 public static int Update(ShopstatInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Ejemplo n.º 5
0
 public static ShopstatInfo Insert(ShopstatInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
Ejemplo n.º 6
0
 public int Update(ShopstatInfo item)
 {
     return(new SqlUpdateBuild(null, item.Shop_id.Value)
            .SetToday_fav(item.Today_fav)
            .SetToday_session(item.Today_session)
            .SetToday_share(item.Today_share)
            .SetTotal_fav(item.Total_fav)
            .SetTotal_session(item.Total_session)
            .SetTotal_share(item.Total_share).ExecuteNonQuery());
 }
Ejemplo n.º 7
0
        public ActionResult Edit([FromQuery] uint Shop_id)
        {
            ShopstatInfo item = Shopstat.GetItem(Shop_id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            ViewBag.item = item;
            return(View());
        }
Ejemplo n.º 8
0
 protected static MySqlParameter[] GetParameters(ShopstatInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?shop_id", MySqlDbType.UInt32, 10, item.Shop_id),
         GetParameter("?today_fav", MySqlDbType.UInt32, 10, item.Today_fav),
         GetParameter("?today_session", MySqlDbType.UInt32, 10, item.Today_session),
         GetParameter("?today_share", MySqlDbType.UInt32, 10, item.Today_share),
         GetParameter("?total_fav", MySqlDbType.UInt32, 10, item.Total_fav),
         GetParameter("?total_session", MySqlDbType.UInt32, 10, item.Total_session),
         GetParameter("?total_share", MySqlDbType.UInt32, 10, item.Total_share)
     });
 }
Ejemplo n.º 9
0
        public APIReturn _Add([FromForm] uint?Shop_id, [FromForm] uint?Today_fav, [FromForm] uint?Today_session, [FromForm] uint?Today_share, [FromForm] uint?Total_fav, [FromForm] uint?Total_session, [FromForm] uint?Total_share)
        {
            ShopstatInfo item = new ShopstatInfo();

            item.Shop_id       = Shop_id;
            item.Today_fav     = Today_fav;
            item.Today_session = Today_session;
            item.Today_share   = Today_share;
            item.Total_fav     = Total_fav;
            item.Total_session = Total_session;
            item.Total_share   = Total_share;
            item = Shopstat.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
Ejemplo n.º 10
0
        public static ShopstatInfo GetItem(uint Shop_id)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereShop_id(Shop_id).ToOne());
            }
            string key   = string.Concat("pifa_BLL_Shopstat_", Shop_id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(ShopstatInfo.Parse(value)); } catch { }
            }
            ShopstatInfo item = Select.WhereShop_id(Shop_id).ToOne();

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Ejemplo n.º 11
0
        public APIReturn _Edit([FromQuery] uint Shop_id, [FromForm] uint?Today_fav, [FromForm] uint?Today_session, [FromForm] uint?Today_share, [FromForm] uint?Total_fav, [FromForm] uint?Total_session, [FromForm] uint?Total_share)
        {
            ShopstatInfo item = Shopstat.GetItem(Shop_id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            item.Today_fav     = Today_fav;
            item.Today_session = Today_session;
            item.Today_share   = Today_share;
            item.Total_fav     = Total_fav;
            item.Total_session = Total_session;
            item.Total_share   = Total_share;
            int affrows = Shopstat.Update(item);

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
Ejemplo n.º 12
0
 public ShopstatInfo Insert(ShopstatInfo item)
 {
     SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item));
     return(item);
 }
Ejemplo n.º 13
0
 public SqlUpdateBuild(ShopstatInfo item, uint Shop_id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`shop_id` = {0}", Shop_id);
 }