/// <summary> /// this method create and return a list of SaleItem /// </summary> /// <returns></returns> private List <Vivina.Erp.DataClasses.SaleItem> CreateSaleItemList() { List <Vivina.Erp.DataClasses.SaleItem> list = new List <Vivina.Erp.DataClasses.SaleItem>(); if (!SaleItemList.Any()) { return(new List <Vivina.Erp.DataClasses.SaleItem>()); } Vivina.Erp.DataClasses.SaleItem saleItem; foreach (SaleItem sItem in SaleItemList) { saleItem = new Vivina.Erp.DataClasses.SaleItem(); saleItem.CompanyId = Company.CompanyId; saleItem.ModifiedDate = DateTime.Now; saleItem.Quantity = sItem.Quantity; saleItem.SerialNumber = sItem.SerialNumber; saleItem.UnitCost = sItem.UnitCost; saleItem.UnitPrice = sItem.Price.Value; //saleItem.UserId = User.Identity.UserId; saleItem.ProductId = sItem.ProductId; if (!saleItem.ProductId.HasValue && sItem.Name.Contains(" ")) { saleItem.SpecialProductName = sItem.Name.Remove(sItem.Name.IndexOf(" ")); } list.Add(saleItem); } return(list); }
protected void BindGrdSaleItem() { grdSaleItens.DataSource = SaleItemList; lblSubtotal.Text = SaleItemList.Sum(item => item.ProfitPrice).ToString("##,##0.00"); CalculateTotal(); grdSaleItens.DataBind(); btnPayment.Visible = SaleItemList.Any(); }