Beispiel #1
0
        public ApiMessage <string> Del(PriceEx p)
        {
            var api = new ApiMessage <string>();

            if (string.IsNullOrEmpty(p.ID))
            {
                api.Success = false;
                api.Msg     = "该商品不存在价格";
                return(api);
            }
            var old = new oldprice();

            old.ID          = Guid.NewGuid().ToString();
            old.PriceID     = p.ID;
            old.ProductID   = p.ProductID;
            old.Price       = p.Price;
            old.MemberPrice = p.MemberPrice;
            old.LimitNum    = p.LimitNum;
            old.StaffName   = p.StaffName;
            old.ProductName = p.Name;
            old.CreatDate   = DateTime.Now;
            var msg = _dal.Del(old);

            api.Success = msg;
            api.Msg     = msg ? "操作成功" : "操作失败";
            return(api);
        }
Beispiel #2
0
 public bool Save(productprice p)
 {
     using (var scope = new PetaPoco.Transaction(_db))
     {
         if (string.IsNullOrEmpty(p.ID))
         {//新增
             p.ID = Guid.NewGuid().ToString();
             _db.Insert(p);
         }
         else
         {//编辑
             var old   = _db.FirstOrDefault <productprice>("where id=@0", p.ID);
             var model = new oldprice();
             model.ID          = Guid.NewGuid().ToString();
             model.PriceID     = old.ID;
             model.LimitNum    = old.LimitNum;
             model.Price       = old.Price;
             model.MemberPrice = old.MemberPrice;
             model.StaffName   = p.StaffName;
             model.CreatDate   = DateTime.Now;
             model.ProductName = "";
             model.ProductID   = old.ProductID;
             _db.Update(p);
             _db.Insert(model);
         }
         scope.Complete();
         return(true);
     }
 }
Beispiel #3
0
 public bool Del(oldprice old)
 {
     using (var scope = new PetaPoco.Transaction(_db))
     {
         _db.Insert(old);
         _db.Delete <productprice>("where id=@0", old.PriceID);
         scope.Complete();
         return(true);
     }
 }