private StoreOrder SaveForSaleInvoice(StoreOrder storeOrder)
        {
            try
            {
                var storeDetailsBusiness = Business.GetStoreOrderDetailBusiness();
                var storeOrderBusiness   = Business.GetStoreOrderBusiness();

                var storeDetails   = storeDetailsBusiness.GetByStoreOrderId(storeOrder.Id);
                var saleStoreOrder = storeOrderBusiness.Clone(storeOrder);
                saleStoreOrder.IdStoreOperation = Constants.StoreOperation.SaleInvoice.ToInt();
                storeOrderBusiness.Save(saleStoreOrder);

                foreach (var item in storeDetails)
                {
                    var saleStoreDetail = new StoreOrderDetail();
                    saleStoreDetail = storeDetailsBusiness.Clone(item);
                    saleStoreDetail.IdStoreOrder = saleStoreDetail.Id;
                    storeDetailsBusiness.Save(saleStoreDetail);
                }

                return(saleStoreOrder);
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// register store order detail
        /// </summary>
        private StoreOrderDetail RegisterStoreDetail(StoreOrder storeOrder)
        {
            try
            {
                var commodity = Business.GetCommodityBusiness().GetByName(txtCommodityCode.Text);
                if (commodity == null)
                {
                    throw new Exception(Localize.ex_commodity_not_found);
                }
                var storeOrderDetailBusiness = Business.GetStoreOrderDetailBusiness();

                var storeOrderDetail = Business.GetStoreOrderDetailBusiness().GetByCommodity(commodity.ID, cmbUnitCount.SelectedValue.ToGUID());
                if (storeOrderDetail == null)
                {
                    storeOrderDetail = new StoreOrderDetail();
                }

                storeOrderDetail.IdStoreOrder   = storeOrder.Id;
                storeOrderDetail.IdCommodity    = commodity.ID;
                storeOrderDetail.ODCountingUnit = cmbUnitCount.SelectedValue.ToGUID();
                storeOrderDetail.ODCount        = storeOrderDetail.ORemained = txtCount.Text.ToInt();
                storeOrderDetail.ODMoney        = txtUnitPrice.Text.ToDecimal() * txtCount.Text.ToInt();
                storeOrderDetail.ODDiscount     = txtDicountPrice.Text.ToDecimal();
                storeOrderDetail.ODDescription  = txtBillDescription.Text;

                Business.GetStoreOrderDetailBusiness().Save(storeOrderDetail);

                return(storeOrderDetail);
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 3
0
 public void Insert(StoreOrderDetail storeOrderDetail)
 {
     try
     {
         this.Insert(new List <StoreOrderDetail>()
         {
             storeOrderDetail
         });
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 4
0
 public void Save(StoreOrderDetail storeOrderDetail)
 {
     try
     {
         if (storeOrderDetail.Id == Guid.Empty)
         {
             storeOrderDetail.Id = Guid.NewGuid();
             this.Insert(storeOrderDetail);
         }
         else
         {
             this.SubmitChanges();
         }
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 5
0
 public StoreOrderDetail Clone(StoreOrderDetail storeOrderDetail)
 {
     try
     {
         return(new StoreOrderDetail()
         {
             IdStoreOrder = storeOrderDetail.IdStoreOrder,
             IdStoreS = storeOrderDetail.IdStoreS,
             IdCommodity = storeOrderDetail.IdCommodity,
             ODCountingUnit = storeOrderDetail.ODCountingUnit,
             ODCount = storeOrderDetail.ODCount,
             ODMoney = storeOrderDetail.ODMoney,
             ODDiscount = storeOrderDetail.ODDiscount,
             ODDescription = storeOrderDetail.ODDescription
         });
     }
     catch
     {
         throw;
     }
 }