private List <SaleDetail> GetSaleDetails(Telerik.WinControls.UI.GridViewCellEventArgs e) { _currentsaleID = e.Row.Cells["SaleID"].Value.ToInt(); _currentSale = _sale.GetSingle(new Sale { SaleID = _currentsaleID }); int customerID = _currentSale.CustomerID.ToInt(); Customer customer = _customer.GetSingle(new Customer { CustomerID = customerID }); cmbCustomer.SelectedValue = customer.CustomerID; txtContact.Text = customer.ContactPerson ?? "N/A"; txtAddress.Text = customer.LocationAdress ?? customer.PostalAddress ?? "N/A"; txtPhone.Text = customer.PhoneNumber1 ?? "N/A"; cmbSalesRep.SelectedValue = _currentSale.EmployeeID; cmbLocation.SelectedValue = _currentSale.LocationID; txtOrderNo.Text = _currentSale.InvoiceNumber; txtSubTotal.Text = _currentSale.SubTotal.ToString(); txtSaleDiscount.Text = _currentSale.Discount.ToString(); txtTax.Text = _currentSale.Tax.ToString(); txtTotalAmt.Text = _currentSale.Amount.ToString(); txtAmountPaid.Text = _currentSale.AmountPaid.ToString(); txtBalanceDue.Text = _currentSale.CustBalance.ToString(); cmbPaymentMode.SelectedValue = _currentSale.PaymentModeID; dtpOrderDate.Value = _currentSale.InvoiceDate; List <SaleDetail> details = _saleDetail.FindAll("SaleID = " + _currentsaleID).ToList(); return(details); }
private void GetSaleDetails(int saleid) { try { List <SaleDetail> saledetails = _saleDetail.FindAll("SaleID =" + saleid).ToList(); foreach (var item in saledetails) { object[] rows = new object[7]; rows[0] = item.Quantity; rows[1] = ""; rows[2] = _product.FindByID(int.Parse(item.ProductID)).ProductName; rows[3] = item.UnitPrice; rows[4] = item.Discount; rows[5] = item.Tax; rows[6] = item.LineTotal; gridViewItemLayout.Rows.Add(rows); } } catch (Exception ex) { _logger.LogError(ex, "An error occurred", "ucSale", "GetSaleDetails"); Helper.ShowMessage("An error occured " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void GetSaleDetails(int saleid) { List <SaleDetail> saledetails = _saleDetail.FindAll("SaleID = " + saleid).ToList(); try { foreach (var item in saledetails) { object[] rows = new object[7]; rows[0] = item.Quantity; rows[1] = ""; rows[2] = _product.FindByID(int.Parse(item.ProductID)).ProductName; rows[3] = item.UnitPrice; rows[4] = item.Discount; rows[5] = item.Tax; rows[6] = item.LineTotal; gridViewItemLayout.Rows.Add(rows); } } catch { } }