Exemple #1
0
        public static RoleclaimInfo GetItem(uint?Id)
        {
            if (Id == null)
            {
                return(null);
            }
            if (itemCacheTimeout <= 0)
            {
                return(dal.GetItem(Id));
            }
            string key   = string.Concat("cnodejs_BLL_Roleclaim_", Id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(new RoleclaimInfo(value)); } catch { }
            }
            RoleclaimInfo item = dal.GetItem(Id);

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Exemple #2
0
 private static void RemoveCache(RoleclaimInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("cnodejs_BLL_Roleclaim_", item.Id));
 }
Exemple #3
0
 public static cnodejs.DAL.Roleclaim.SqlUpdateBuild UpdateDiy(RoleclaimInfo item, uint?Id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Id));
     }
     return(new cnodejs.DAL.Roleclaim.SqlUpdateBuild(item, Id));
 }
Exemple #4
0
 public static int Update(RoleclaimInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Exemple #5
0
 public int Update(RoleclaimInfo item)
 {
     return(new SqlUpdateBuild(null, item.Id)
            .SetRoles_id(item.Roles_id)
            .SetCreate_time(item.Create_time)
            .SetType(item.Type)
            .SetValue(item.Value).ExecuteNonQuery());
 }
Exemple #6
0
 public static RoleclaimInfo Insert(RoleclaimInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
        public APIReturn Get_item(uint?Id)
        {
            RoleclaimInfo item = Roleclaim.GetItem(Id);

            if (item == null)
            {
                return(new APIReturn(98, "记录不存在,或者没有权限"));
            }
            return(new APIReturn(0, "成功", "item", item.ToBson()));
        }
Exemple #8
0
 protected static MySqlParameter[] GetParameters(RoleclaimInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?id", MySqlDbType.UInt32, 10, item.Id),
         GetParameter("?roles_id", MySqlDbType.UInt32, 10, item.Roles_id),
         GetParameter("?create_time", MySqlDbType.DateTime, -1, item.Create_time),
         GetParameter("?type", MySqlDbType.VarChar, 96, item.Type),
         GetParameter("?value", MySqlDbType.VarChar, 255, item.Value)
     });
 }
Exemple #9
0
        public RoleclaimInfo Insert(RoleclaimInfo item)
        {
            uint loc1;

            if (uint.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1))
            {
                item.Id = loc1;
            }
            return(item);
        }
        public APIReturn Post_insert([FromForm] uint?Roles_id, [FromForm] string Type, [FromForm] string Value)
        {
            RoleclaimInfo item = new RoleclaimInfo();

            item.Roles_id    = Roles_id;
            item.Create_time = DateTime.Now;
            item.Type        = Type;
            item.Value       = Value;
            item             = Roleclaim.Insert(item);
            return(new APIReturn(0, "成功", "item", item.ToBson()));
        }
        public APIReturn Put_update(uint?Id, [FromForm] uint?Roles_id, [FromForm] string Type, [FromForm] string Value)
        {
            RoleclaimInfo item = new RoleclaimInfo();

            item.Id          = Id;
            item.Roles_id    = Roles_id;
            item.Create_time = DateTime.Now;
            item.Type        = Type;
            item.Value       = Value;
            int affrows = Roleclaim.Update(item);

            if (affrows > 0)
            {
                return(new APIReturn(0, "成功"));
            }
            return(new APIReturn(99, "失败"));
        }
Exemple #12
0
 public SqlUpdateBuild(RoleclaimInfo item, uint?Id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`id` = {0}", Id);
 }