Esempio n. 1
0
 public static int Update(Member_productInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Esempio n. 2
0
 private static void RemoveCache(Member_productInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("pifa_BLL_Member_product_", item.Member_id, "_,_", item.Product_id));
 }
Esempio n. 3
0
 public static pifa.DAL.Member_product.SqlUpdateBuild UpdateDiy(Member_productInfo item, uint Member_id, uint Product_id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Member_id, Product_id));
     }
     return(new pifa.DAL.Member_product.SqlUpdateBuild(item, Member_id, Product_id));
 }
Esempio n. 4
0
 protected static MySqlParameter[] GetParameters(Member_productInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?member_id", MySqlDbType.UInt32, 10, item.Member_id),
         GetParameter("?product_id", MySqlDbType.UInt32, 10, item.Product_id),
         GetParameter("?create_time", MySqlDbType.DateTime, -1, item.Create_time)
     });
 }
Esempio n. 5
0
 public static Member_productInfo Insert(Member_productInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
Esempio n. 6
0
        public APIReturn _Add([FromForm] uint?Member_id, [FromForm] uint?Product_id)
        {
            Member_productInfo item = new Member_productInfo();

            item.Member_id   = Member_id;
            item.Product_id  = Product_id;
            item.Create_time = DateTime.Now;
            item             = Member_product.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
Esempio n. 7
0
        public ActionResult Edit([FromQuery] uint Member_id, [FromQuery] uint Product_id)
        {
            Member_productInfo item = Member_product.GetItem(Member_id, Product_id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            ViewBag.item = item;
            return(View());
        }
Esempio n. 8
0
        public APIReturn _Edit([FromQuery] uint Member_id, [FromQuery] uint Product_id)
        {
            Member_productInfo item = Member_product.GetItem(Member_id, Product_id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            item.Create_time = DateTime.Now;
            int affrows = Member_product.Update(item);

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
Esempio n. 9
0
        public object GetItem(IDataReader dr, ref int index)
        {
            Member_productInfo item = new Member_productInfo();

            if (!dr.IsDBNull(++index))
            {
                item.Member_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Product_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Create_time = (DateTime?)dr.GetDateTime(index);
            }
            return(item);
        }
Esempio n. 10
0
        public static Member_productInfo GetItem(uint Member_id, uint Product_id)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereMember_id(Member_id).WhereProduct_id(Product_id).ToOne());
            }
            string key   = string.Concat("pifa_BLL_Member_product_", Member_id, "_,_", Product_id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(Member_productInfo.Parse(value)); } catch { }
            }
            Member_productInfo item = Select.WhereMember_id(Member_id).WhereProduct_id(Product_id).ToOne();

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Esempio n. 11
0
 public int Update(Member_productInfo item)
 {
     return(new SqlUpdateBuild(null, item.Member_id.Value, item.Product_id.Value)
            .SetCreate_time(item.Create_time).ExecuteNonQuery());
 }
Esempio n. 12
0
 public Member_productInfo Insert(Member_productInfo item)
 {
     SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item));
     return(item);
 }
Esempio n. 13
0
 public SqlUpdateBuild(Member_productInfo item, uint Member_id, uint Product_id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`member_id` = {0} AND `product_id` = {1}", Member_id, Product_id);
 }