Ejemplo n.º 1
0
 private static void RemoveCache(Member_addressbookInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("pifa_BLL_Member_addressbook_", item.Id));
 }
Ejemplo n.º 2
0
 public static pifa.DAL.Member_addressbook.SqlUpdateBuild UpdateDiy(Member_addressbookInfo item, uint Id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Id));
     }
     return(new pifa.DAL.Member_addressbook.SqlUpdateBuild(item, Id));
 }
Ejemplo n.º 3
0
 public static int Update(Member_addressbookInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Ejemplo n.º 4
0
 public static Member_addressbookInfo Insert(Member_addressbookInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
Ejemplo n.º 5
0
        public Member_addressbookInfo Insert(Member_addressbookInfo item)
        {
            uint loc1;

            if (uint.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1))
            {
                item.Id = loc1;
            }
            return(item);
        }
Ejemplo n.º 6
0
        public ActionResult Edit([FromQuery] uint Id)
        {
            Member_addressbookInfo item = Member_addressbook.GetItem(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            ViewBag.item = item;
            return(View());
        }
Ejemplo n.º 7
0
 public int Update(Member_addressbookInfo item)
 {
     return(new SqlUpdateBuild(null, item.Id.Value)
            .SetMember_id(item.Member_id)
            .SetAddress(item.Address)
            .SetCreate_time(item.Create_time)
            .SetIs_default(item.Is_default)
            .SetName(item.Name)
            .SetTel(item.Tel)
            .SetTelphone(item.Telphone)
            .SetZip(item.Zip).ExecuteNonQuery());
 }
Ejemplo n.º 8
0
 protected static MySqlParameter[] GetParameters(Member_addressbookInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?id", MySqlDbType.UInt32, 10, item.Id),
         GetParameter("?member_id", MySqlDbType.UInt32, 10, item.Member_id),
         GetParameter("?address", MySqlDbType.VarChar, 255, item.Address),
         GetParameter("?create_time", MySqlDbType.DateTime, -1, item.Create_time),
         GetParameter("?is_default", MySqlDbType.Bit, 1, item.Is_default),
         GetParameter("?name", MySqlDbType.VarChar, 32, item.Name),
         GetParameter("?tel", MySqlDbType.VarChar, 32, item.Tel),
         GetParameter("?telphone", MySqlDbType.VarChar, 32, item.Telphone),
         GetParameter("?zip", MySqlDbType.VarChar, 16, item.Zip)
     });
 }
Ejemplo n.º 9
0
        public APIReturn _Add([FromForm] uint?Member_id, [FromForm] string Address, [FromForm] bool?Is_default, [FromForm] string Name, [FromForm] string Tel, [FromForm] string Telphone, [FromForm] string Zip)
        {
            Member_addressbookInfo item = new Member_addressbookInfo();

            item.Member_id   = Member_id;
            item.Address     = Address;
            item.Create_time = DateTime.Now;
            item.Is_default  = Is_default;
            item.Name        = Name;
            item.Tel         = Tel;
            item.Telphone    = Telphone;
            item.Zip         = Zip;
            item             = Member_addressbook.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
Ejemplo n.º 10
0
        public object GetItem(IDataReader dr, ref int index)
        {
            Member_addressbookInfo item = new Member_addressbookInfo();

            if (!dr.IsDBNull(++index))
            {
                item.Id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Member_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Address = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Create_time = (DateTime?)dr.GetDateTime(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Is_default = (bool?)dr.GetBoolean(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Name = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Tel = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Telphone = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Zip = dr.GetString(index);
            }
            return(item);
        }
Ejemplo n.º 11
0
        public static Member_addressbookInfo GetItem(uint Id)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereId(Id).ToOne());
            }
            string key   = string.Concat("pifa_BLL_Member_addressbook_", Id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(Member_addressbookInfo.Parse(value)); } catch { }
            }
            Member_addressbookInfo item = Select.WhereId(Id).ToOne();

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Ejemplo n.º 12
0
        public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Member_id, [FromForm] string Address, [FromForm] bool?Is_default, [FromForm] string Name, [FromForm] string Tel, [FromForm] string Telphone, [FromForm] string Zip)
        {
            Member_addressbookInfo item = Member_addressbook.GetItem(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            item.Member_id   = Member_id;
            item.Address     = Address;
            item.Create_time = DateTime.Now;
            item.Is_default  = Is_default;
            item.Name        = Name;
            item.Tel         = Tel;
            item.Telphone    = Telphone;
            item.Zip         = Zip;
            int affrows = Member_addressbook.Update(item);

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
Ejemplo n.º 13
0
 public SqlUpdateBuild(Member_addressbookInfo item, uint Id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`id` = {0}", Id);
 }