Exemple #1
0
        public APIReturn _Add([FromForm] uint?Order_id, [FromForm] uint?Productitem_id, [FromForm] string Descript, [FromForm] string Email, [FromForm] string Img_url, [FromForm] IFormFile Img_url_file, [FromForm] Order_refundSTATE?State, [FromForm] string Tel, [FromForm] string Telphone, [FromForm] decimal?Wealth)
        {
            Order_refundInfo item = new Order_refundInfo();

            if (Img_url_file != null)
            {
                item.Img_url = $"/upload/{Guid.NewGuid().ToString()}.png";
                using (FileStream fs = new FileStream(System.IO.Path.Combine(AppContext.BaseDirectory, item.Img_url), FileMode.Create)) Img_url_file.CopyTo(fs);
            }
            else
            {
                item.Img_url = Img_url;
            }
            item.Order_id       = Order_id;
            item.Productitem_id = Productitem_id;
            item.Create_time    = DateTime.Now;
            item.Descript       = Descript;
            item.Email          = Email;
            item.State          = State;
            item.Tel            = Tel;
            item.Telphone       = Telphone;
            item.Wealth         = Wealth;
            item = Order_refund.Insert(item);
            return(APIReturn.成功.SetData("item", item.ToBson()));
        }
Exemple #2
0
 public static int Update(Order_refundInfo item)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(dal.Update(item));
 }
Exemple #3
0
 public static pifa.DAL.Order_refund.SqlUpdateBuild UpdateDiy(Order_refundInfo item, uint Id)
 {
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item != null ? item : GetItem(Id));
     }
     return(new pifa.DAL.Order_refund.SqlUpdateBuild(item, Id));
 }
Exemple #4
0
 private static void RemoveCache(Order_refundInfo item)
 {
     if (item == null)
     {
         return;
     }
     RedisHelper.Remove(string.Concat("pifa_BLL_Order_refund_", item.Id));
 }
Exemple #5
0
 public static Order_refundInfo Insert(Order_refundInfo item)
 {
     item = dal.Insert(item);
     if (itemCacheTimeout > 0)
     {
         RemoveCache(item);
     }
     return(item);
 }
Exemple #6
0
        public Order_refundInfo Insert(Order_refundInfo item)
        {
            uint loc1;

            if (uint.TryParse(string.Concat(SqlHelper.ExecuteScalar(TSQL.Insert, GetParameters(item))), out loc1))
            {
                item.Id = loc1;
            }
            return(item);
        }
Exemple #7
0
        public ActionResult Edit([FromQuery] uint Id)
        {
            Order_refundInfo item = Order_refund.GetItem(Id);

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

            if (!dr.IsDBNull(++index))
            {
                item.Id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Order_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Productitem_id = (uint?)dr.GetInt32(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Create_time = (DateTime?)dr.GetDateTime(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Descript = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Email = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Img_url = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.State = (Order_refundSTATE?)dr.GetInt64(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Tel = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Telphone = dr.GetString(index);
            }
            if (!dr.IsDBNull(++index))
            {
                item.Wealth = (decimal?)dr.GetDecimal(index);
            }
            return(item);
        }
Exemple #9
0
 public int Update(Order_refundInfo item)
 {
     return(new SqlUpdateBuild(null, item.Id.Value)
            .SetOrder_id(item.Order_id)
            .SetProductitem_id(item.Productitem_id)
            .SetCreate_time(item.Create_time)
            .SetDescript(item.Descript)
            .SetEmail(item.Email)
            .SetImg_url(item.Img_url)
            .SetState(item.State)
            .SetTel(item.Tel)
            .SetTelphone(item.Telphone)
            .SetWealth(item.Wealth).ExecuteNonQuery());
 }
Exemple #10
0
 protected static MySqlParameter[] GetParameters(Order_refundInfo item)
 {
     return(new MySqlParameter[] {
         GetParameter("?id", MySqlDbType.UInt32, 10, item.Id),
         GetParameter("?order_id", MySqlDbType.UInt32, 10, item.Order_id),
         GetParameter("?productitem_id", MySqlDbType.UInt32, 10, item.Productitem_id),
         GetParameter("?create_time", MySqlDbType.DateTime, -1, item.Create_time),
         GetParameter("?descript", MySqlDbType.Text, -1, item.Descript),
         GetParameter("?email", MySqlDbType.VarChar, 64, item.Email),
         GetParameter("?img_url", MySqlDbType.VarChar, 255, item.Img_url),
         GetParameter("?state", MySqlDbType.Enum, -1, item.State?.ToInt64()),
         GetParameter("?tel", MySqlDbType.VarChar, 32, item.Tel),
         GetParameter("?telphone", MySqlDbType.VarChar, 32, item.Telphone),
         GetParameter("?wealth", MySqlDbType.Decimal, 10, item.Wealth)
     });
 }
Exemple #11
0
        public APIReturn _Edit([FromQuery] uint Id, [FromForm] uint?Order_id, [FromForm] uint?Productitem_id, [FromForm] string Descript, [FromForm] string Email, [FromForm] string Img_url, [FromForm] IFormFile Img_url_file, [FromForm] Order_refundSTATE?State, [FromForm] string Tel, [FromForm] string Telphone, [FromForm] decimal?Wealth)
        {
            Order_refundInfo item = Order_refund.GetItem(Id);

            if (item == null)
            {
                return(APIReturn.记录不存在_或者没有权限);
            }
            if (!string.IsNullOrEmpty(item.Img_url) && (item.Img_url != Img_url || Img_url_file != null))
            {
                string path = System.IO.Path.Combine(AppContext.BaseDirectory, item.Img_url);
                if (System.IO.File.Exists(path))
                {
                    System.IO.File.Delete(path);
                }
            }
            if (Img_url_file != null)
            {
                item.Img_url = $"/upload/{Guid.NewGuid().ToString()}.png";
                using (FileStream fs = new FileStream(System.IO.Path.Combine(AppContext.BaseDirectory, item.Img_url), FileMode.Create)) Img_url_file.CopyTo(fs);
            }
            else
            {
                item.Img_url = Img_url;
            }
            item.Order_id       = Order_id;
            item.Productitem_id = Productitem_id;
            item.Create_time    = DateTime.Now;
            item.Descript       = Descript;
            item.Email          = Email;
            item.State          = State;
            item.Tel            = Tel;
            item.Telphone       = Telphone;
            item.Wealth         = Wealth;
            int affrows = Order_refund.Update(item);

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

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

            if (item == null)
            {
                return(null);
            }
            RedisHelper.Set(key, item.Stringify(), itemCacheTimeout);
            return(item);
        }
Exemple #13
0
 public SqlUpdateBuild(Order_refundInfo item, uint Id)
 {
     _item  = item;
     _where = SqlHelper.Addslashes("`id` = {0}", Id);
 }