示例#1
0
 protected static MySqlParameter[] GetParameters(Factory_franchisingInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?factory_id", MySqlDbType.UInt32, 10, item.Factory_id),
         GetParameter("?franchising_id", MySqlDbType.UInt32, 10, item.Franchising_id)
     });
 }
示例#2
0
 private static void RemoveCache(Factory_franchisingInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("pifa_BLL_Factory_franchising_", item.Factory_id, "_,_", item.Franchising_id));
 }
示例#3
0
 public static pifa.DAL.Factory_franchising.SqlUpdateBuild UpdateDiy(Factory_franchisingInfo item, uint Factory_id, uint Franchising_id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Factory_id, Franchising_id));
     }
     return(new pifa.DAL.Factory_franchising.SqlUpdateBuild(item, Factory_id, Franchising_id));
 }
示例#4
0
 public static int Update(Factory_franchisingInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
示例#5
0
        public APIReturn _Add([FromForm] uint?Factory_id, [FromForm] uint?Franchising_id)
        {
            Factory_franchisingInfo item = new Factory_franchisingInfo();

            item.Factory_id     = Factory_id;
            item.Franchising_id = Franchising_id;
            item = Factory_franchising.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
示例#6
0
 public static Factory_franchisingInfo Insert(Factory_franchisingInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
示例#7
0
        public ActionResult Edit([FromQuery] uint Factory_id, [FromQuery] uint Franchising_id)
        {
            Factory_franchisingInfo item = Factory_franchising.GetItem(Factory_id, Franchising_id);

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

            if (!dr.IsDBNull(++index))
            {
                item.Factory_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Franchising_id = (uint?)dr.GetInt32(index);
            }
            return(item);
        }
示例#9
0
        public APIReturn _Edit([FromQuery] uint Factory_id, [FromQuery] uint Franchising_id)
        {
            Factory_franchisingInfo item = Factory_franchising.GetItem(Factory_id, Franchising_id);

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

            if (affrows > 0)
            {
                return(APIReturn.成功.SetMessage($"更新成功,影响行数:{affrows}"));
            }
            return(APIReturn.失败);
        }
示例#10
0
        public static Factory_franchisingInfo GetItem(uint Factory_id, uint Franchising_id)
        {
            if (itemCacheTimeout <= 0)
            {
                return(Select.WhereFactory_id(Factory_id).WhereFranchising_id(Franchising_id).ToOne());
            }
            string key   = string.Concat("pifa_BLL_Factory_franchising_", Factory_id, "_,_", Franchising_id);
            string value = RedisHelper.Get(key);

            if (!string.IsNullOrEmpty(value))
            {
                try { return(Factory_franchisingInfo.Parse(value)); } catch { }
            }
            Factory_franchisingInfo item = Select.WhereFactory_id(Factory_id).WhereFranchising_id(Franchising_id).ToOne();

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
示例#11
0
 public SqlUpdateBuild(Factory_franchisingInfo item, uint Factory_id, uint Franchising_id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`factory_id` = {0} AND `franchising_id` = {1}", Factory_id, Franchising_id);
 }
示例#12
0
 public int Update(Factory_franchisingInfo item)
 {
     return(new SqlUpdateBuild(null, item.Factory_id.Value, item.Franchising_id.Value).ExecuteNonQuery());
 }
示例#13
0
 public Factory_franchisingInfo Insert(Factory_franchisingInfo item)
 {
     SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item));
     return(item);
 }