Ejemplo n.º 1
0
 protected void AddSellingList(object parameter)
 {
     if (SelectedProduct != null)
     {
         ProductSellingEntity Item = null;
         Item = CoverttoProductSellingEntity(SelectedProduct);
         List <ProductSellingEntity> temp_Selling_lst = new List <ProductSellingEntity>();
         if (SellingItems != null)
         {
             temp_Selling_lst = SellingItems;
             if (temp_Selling_lst.Where(p => p.ProductId == Item.ProductId).Count() != 0)
             {
                 int temp_quantity = temp_Selling_lst.Where(p => p.ProductId == Item.ProductId).FirstOrDefault().Quantity;
                 Quantity += temp_quantity;
                 if (!checkQuantity())
                 {
                     return;
                 }
                 Item = CoverttoProductSellingEntity(SelectedProduct);
                 temp_Selling_lst.Remove(temp_Selling_lst.Where(p => p.ProductId == Item.ProductId).FirstOrDefault());
             }
         }
         if (!checkQuantity())
         {
             return;
         }
         temp_Selling_lst.Add(Item);
         Quantity     = 0;
         SellingItems = null;
         SellingItems = temp_Selling_lst;
         TotalAmount  = SellingItems.Sum(s => s.Amount);
     }
 }
Ejemplo n.º 2
0
        protected ProductSellingEntity CoverttoProductSellingEntity(product ob)
        {
            ProductSellingEntity tempproduct = new ProductSellingEntity();

            tempproduct.ProductId    = ob.id;
            tempproduct.ProductName  = ob.product_name;
            tempproduct.Quantity     = Quantity;
            tempproduct.SellingPrice = ob.sell_price;
            tempproduct.Amount       = tempproduct.SellingPrice * Quantity;
            return(tempproduct);
        }
Ejemplo n.º 3
0
        protected selling_history Converttosellinghistory(ProductSellingEntity ob)
        {
            selling_history temphistory = new selling_history();

            temphistory.dealer_id        = null;
            temphistory.product_id       = ob.ProductId;
            temphistory.quantity         = ob.Quantity;
            temphistory.credit           = ob.Amount;
            temphistory.debit            = 0;
            temphistory.transaction_type = (int)InventoryHelper.TransactionType.Credit;
            temphistory.customer_info    = CustomerInfo;
            temphistory.payment_type     = PaymentType.Content == null ? "" : PaymentType.Content.ToString();
            temphistory.payment_date     = DateTime.Now;
            temphistory.customer_name    = CustomerName;
            temphistory.remarks          = Remarks;

            return(temphistory);
        }