Exemple #1
0
 protected static MySqlParameter[] GetParameters(Member_securityInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?member_id", MySqlDbType.UInt32, 10, item.Member_id),
         GetParameter("?password", MySqlDbType.VarChar, 255, item.Password)
     });
 }
Exemple #2
0
 private static void RemoveCache(Member_securityInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("pifa_BLL_Member_security_", item.Member_id));
 }
Exemple #3
0
 public static pifa.DAL.Member_security.SqlUpdateBuild UpdateDiy(Member_securityInfo item, uint Member_id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Member_id));
     }
     return(new pifa.DAL.Member_security.SqlUpdateBuild(item, Member_id));
 }
Exemple #4
0
 public static int Update(Member_securityInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Exemple #5
0
        public APIReturn _Add([FromForm] uint?Member_id, [FromForm] string Password)
        {
            Member_securityInfo item = new Member_securityInfo();

            item.Member_id = Member_id;
            item.Password  = Password;
            item           = Member_security.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
Exemple #6
0
 public static Member_securityInfo Insert(Member_securityInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
Exemple #7
0
        public ActionResult Edit([FromQuery] uint Member_id)
        {
            Member_securityInfo item = Member_security.GetItem(Member_id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            ViewBag.item = item;
            return(View());
        }
Exemple #8
0
        public object GetItem(IDataReader dr, ref int index)
        {
            Member_securityInfo item = new Member_securityInfo();

            if (!dr.IsDBNull(++index))
            {
                item.Member_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Password = dr.GetString(index);
            }
            return(item);
        }
Exemple #9
0
        public APIReturn _Edit([FromQuery] uint Member_id, [FromForm] string Password)
        {
            Member_securityInfo item = Member_security.GetItem(Member_id);

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

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
Exemple #10
0
        public static Member_securityInfo GetItem(uint Member_id)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereMember_id(Member_id).ToOne());
            }
            string key   = string.Concat("pifa_BLL_Member_security_", Member_id);
            string value = RedisHelper.Get(key);

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

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Exemple #11
0
 public SqlUpdateBuild(Member_securityInfo item, uint Member_id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`member_id` = {0}", Member_id);
 }
Exemple #12
0
 public int Update(Member_securityInfo item)
 {
     return(new SqlUpdateBuild(null, item.Member_id.Value)
            .SetPassword(item.Password).ExecuteNonQuery());
 }
Exemple #13
0
 public Member_securityInfo Insert(Member_securityInfo item)
 {
     SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item));
     return(item);
 }