コード例 #1
0
        public static Roles_usersInfo GetItem(uint?Roles_id, ulong?Users_id)
        {
            if (Roles_id == null || Users_id == null)
            {
                return(null);
            }
            if (itemCacheTimeout <= 0)
            {
                return(dal.GetItem(Roles_id, Users_id));
            }
            string key   = string.Concat("cnodejs_BLL_Roles_users_", Roles_id, "_,_", Users_id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(new Roles_usersInfo(value)); } catch { }
            }
            Roles_usersInfo item = dal.GetItem(Roles_id, Users_id);

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
コード例 #2
0
 protected static MySqlParameter[] GetParameters(Roles_usersInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?roles_id", MySqlDbType.UInt32, 10, item.Roles_id),
         GetParameter("?users_id", MySqlDbType.UInt64, 20, item.Users_id)
     });
 }
コード例 #3
0
 private static void RemoveCache(Roles_usersInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("cnodejs_BLL_Roles_users_", item.Roles_id, "_,_", item.Users_id));
 }
コード例 #4
0
 public static cnodejs.DAL.Roles_users.SqlUpdateBuild UpdateDiy(Roles_usersInfo item, uint?Roles_id, ulong?Users_id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Roles_id, Users_id));
     }
     return(new cnodejs.DAL.Roles_users.SqlUpdateBuild(item, Roles_id, Users_id));
 }
コード例 #5
0
 public static int Update(Roles_usersInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
コード例 #6
0
        public APIReturn Post_insert([FromForm] uint?Roles_id, [FromForm] ulong?Users_id)
        {
            Roles_usersInfo item = new Roles_usersInfo();

            item.Roles_id = Roles_id;
            item.Users_id = Users_id;
            item          = Roles_users.Insert(item);
            return(new APIReturn(0, "成功", "item", item.ToBson()));
        }
コード例 #7
0
 public static Roles_usersInfo Insert(Roles_usersInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
コード例 #8
0
        public APIReturn Get_item(uint?Roles_id, ulong?Users_id)
        {
            Roles_usersInfo item = Roles_users.GetItem(Roles_id, Users_id);

            if (item == null)
            {
                return(new APIReturn(98, "记录不存在,或者没有权限"));
            }
            return(new APIReturn(0, "成功", "item", item.ToBson()));
        }
コード例 #9
0
        public APIReturn Put_update(uint?Roles_id, ulong?Users_id)
        {
            Roles_usersInfo item = new Roles_usersInfo();

            item.Roles_id = Roles_id;
            item.Users_id = Users_id;
            int affrows = Roles_users.Update(item);

            if (affrows > 0)
            {
                return(new APIReturn(0, "成功"));
            }
            return(new APIReturn(99, "失败"));
        }
コード例 #10
0
 public SqlUpdateBuild(Roles_usersInfo item, uint?Roles_id, ulong?Users_id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`roles_id` = {0} AND `users_id` = {1}", Roles_id, Users_id);
 }
コード例 #11
0
 public int Update(Roles_usersInfo item)
 {
     return(new SqlUpdateBuild(null, item.Roles_id, item.Users_id).ExecuteNonQuery());
 }
コード例 #12
0
 public Roles_usersInfo Insert(Roles_usersInfo item)
 {
     SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item));
     return(item);
 }