public void OnSelectionChange(object param) { if (SelectedCustomerID != 0) { BalAndUnpaidInv = uiRepository.GetAllUnPaidInvoice(SelectedCustomerID, Convert.ToString(SelectedStatementDate)); LstBalances = BalAndUnpaidInv.LstBalances; LstInvoiceDetails = BalAndUnpaidInv.LstInvoices; LstInvoiceDetails = LstInvoiceDetails.OrderBy(e => e.InvoiceDate).ToList(); TotalInvoiceAmount = Convert.ToString(LstInvoiceDetails.Sum(e => e.InvoiceAmount)); TotalPaidAmount = Convert.ToString(LstInvoiceDetails.Sum(e => e.AmountPaid)); TotalDueAmount = Convert.ToString(LstInvoiceDetails.Sum(e => e.AmountDue)); LstCustomers.Where(x => x.CustomerID == SelectedCustomerID).ToList().ForEach(x => { x.IsSelected = false; }); //LstCustomers.Where(x => x.CustomerID != SelectedCustomerID).ToList().ForEach(x => { x.IsSelected = false; }); } else { if (param != null) { var SelectedCustomerID = param.ToString(); BalAndUnpaidInv = uiRepository.GetAllUnPaidInvoice(Convert.ToInt32(SelectedCustomerID), Convert.ToString(SelectedStatementDate)); LstBalances = BalAndUnpaidInv.LstBalances; LstInvoiceDetails = BalAndUnpaidInv.LstInvoices; LstInvoiceDetails = LstInvoiceDetails.OrderBy(e => e.InvoiceDate).ToList(); TotalInvoiceAmount = Convert.ToString(LstInvoiceDetails.Sum(e => e.InvoiceAmount)); TotalPaidAmount = Convert.ToString(LstInvoiceDetails.Sum(e => e.AmountPaid)); TotalDueAmount = Convert.ToString(LstInvoiceDetails.Sum(e => e.AmountDue)); } } }
public bool CanPrint(object param) { //bool a = false; List <CustomersUnpaidInvoicesEntity> demo = new List <CustomersUnpaidInvoicesEntity>(); if (LstCustomers != null) { demo = LstCustomers.Where(x => x.IsSelected == true).ToList(); } else { return(false); } if (demo.Count <= 0) { return(false); } else { return(true); } }