Ejemplo n.º 1
0
 public bool Execute()
 {
     using (var cmd = new SaleDeleteByIdRepository())
     {
         cmd.SaleId = this.SaleId;
         cmd.Execute();
     }
     using (var cmd = new SaleItemDeleteBySaleIdRepository())
     {
         cmd.SaleId = this.SaleId;
         return(cmd.Execute());
     }
 }
Ejemplo n.º 2
0
        public bool Execute()
        {
            try
            {
                //Đánh dấu đã xóa hay chưa
                //var flag = false;

                foreach (var item in Item)
                {
                    var updateqty = new SaleItemChangeQty(item.ProductId, item.Qty, item.SaleId);

                    using (var cmd = new SaleItemDeleteBySaleIdRepository())
                    {
                        cmd.SaleItemId = item.SaleItemId;
                        cmd.SaleId     = item.SaleId;
                        //if (!flag)
                        //{
                        cmd.Execute();
                        //    flag = true;
                        //}
                    }
                    //if (flag)
                    //{
                    using (var cmd = new SaleItemInsertRepository())
                    {
                        cmd.Item = item;
                        cmd.Execute();
                    }
                    //}
                    //else
                    //{
                    //return false;
                    //}
                }
                using (var cmd = new SaleUpdateTotalRepository())
                {
                    cmd.Item = Item[0];
                    cmd.Excute();
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 public bool Execute()
 {
     try
     {
         var flag = false;
         foreach (var item in Item)
         {
             using (var cmd = new SaleItemDeleteBySaleIdRepository())
             {
                 cmd.SaleId = item.SaleId;
                 if (!flag)
                 {
                     cmd.Execute();
                     flag = true;
                 }
             }
             if (flag)
             {
                 using (var cmd = new SaleItemInsertRepository())
                 {
                     cmd.Item = item;
                     cmd.Execute();
                 }
             }
             else
             {
                 return(false);
             }
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }