Beispiel #1
0
            public static void RemoveItemBillSection(FE_BillDetail item)
            {
                try
                {
                    var itemBill = FE_Bill.GetBillSection();
                    if (itemBill.BillDetails == null)
                    {
                        itemBill.BillDetails = new List <FE_BillDetail>();
                    }
                    itemBill.BillDetails.RemoveAll(p => p.ProductId == item.ProductId);
                    //var matches = itemBill.BillDetails.Where(p => p.ProductId == item.ProductId).ToList() ;
                    //if (matches.Count > 0)
                    //{
                    //    itemBill.BillDetails.RemoveAll(matches);
                    //}

                    itemBill.Quantity    = 0;
                    itemBill.PriceAmount = 0;
                    foreach (var itemBillDetail in itemBill.BillDetails)
                    {
                        itemBill.PriceAmount += (itemBillDetail.Quantity * itemBillDetail.PriceAmount);
                        itemBill.Quantity    += itemBillDetail.Quantity;
                    }
                    HttpContext.Current.Session["FE_Bill"] = itemBill;
                }
                catch (Exception ex)
                {
                }
            }
Beispiel #2
0
            public static void AddItemToBillSection(FE_BillDetail item)
            {
                try
                {
                    if (item.Quantity == 0)
                    {
                        item.Quantity = 1;
                    }
                    var product = FE_Product.GetDetail(item.ProductId.ToString());
                    if (product == null)
                    {
                        return;
                    }
                    var itemBill = FE_Bill.GetBillSection();
                    if (itemBill.BillDetails == null)
                    {
                        itemBill.BillDetails = new List <FE_BillDetail>();
                    }

                    var matches = itemBill.BillDetails.Where(p => p.ProductId == product.ProductId).ToList();
                    if (matches.Count > 0)
                    {
                        matches.ForEach(c => c.Quantity = c.Quantity + item.Quantity);
                    }
                    else
                    {
                        var itemBillDetail = new FE_BillDetail();
                        itemBillDetail.ProductId   = product.ProductId;
                        itemBillDetail.ProductName = product.ProductName;
                        itemBillDetail.ProductImg  = product.ProductImg;

                        itemBillDetail.Quantity    = item.Quantity;
                        itemBillDetail.PriceAmount = product.PriceAmount;
                        itemBillDetail.Discount    = product.Discount;
                        itemBillDetail.Price       = product.Price;

                        itemBill.BillDetails.Add(itemBillDetail);
                    }

                    itemBill.Quantity    = 0;
                    itemBill.PriceAmount = 0;
                    foreach (var itemBillDetail in itemBill.BillDetails)
                    {
                        itemBill.PriceAmount += (itemBillDetail.Quantity * itemBillDetail.PriceAmount);
                        itemBill.Quantity    += itemBillDetail.Quantity;
                    }
                    HttpContext.Current.Session["FE_Bill"] = itemBill;
                }
                catch (Exception ex)
                {
                }
            }
Beispiel #3
0
            public static void UpdateBillItem(List <FE_BillDetail> lstItem)
            {
                try
                {
                    var itemBill = FE_Bill.GetBillSection();
                    itemBill.BillDetails = new List <FE_BillDetail>();
                    foreach (var item in lstItem)
                    {
                        if (item.Quantity == 0)
                        {
                            item.Quantity = 1;
                        }
                        var product = FE_Product.GetDetail(item.ProductId.ToString());
                        if (product == null)
                        {
                            continue;
                        }

                        var itemBillDetail = new FE_BillDetail();
                        itemBillDetail.ProductId   = product.ProductId;
                        itemBillDetail.ProductName = product.ProductName;
                        itemBillDetail.ProductImg  = product.ProductImg;

                        itemBillDetail.Quantity    = item.Quantity;
                        itemBillDetail.PriceAmount = product.PriceAmount;
                        itemBillDetail.Discount    = product.Discount;
                        itemBillDetail.Price       = product.Price;

                        itemBill.BillDetails.Add(itemBillDetail);
                    }



                    itemBill.Quantity    = 0;
                    itemBill.PriceAmount = 0;
                    foreach (var itemBillDetail in itemBill.BillDetails)
                    {
                        itemBill.PriceAmount += (itemBillDetail.Quantity * itemBillDetail.PriceAmount);
                        itemBill.Quantity    += itemBillDetail.Quantity;
                    }
                    HttpContext.Current.Session["FE_Bill"] = itemBill;
                }
                catch (Exception ex)
                {
                }
            }