private void RefreshData() { IPandSHistoryRepository purchaseRepository = new PandSHistoryRepository(); // this.DateFormat = purchaseRepository.GetDateFormat(); //this.ShowAllCount = purchaseRepository.GetAllSalesInvoice().Count(); GetOptionsandTaxValues(); this.JsonData = purchaseRepository.GetLastSelectionData(Convert.ToInt32(ScreenId.PandSHistoryList)); this.PandSHistoryList = purchaseRepository.GetAllSalesInvoiceJson(this.JsonData, this.IncludingGSTTrue).ToList(); // this.PandSHistoryListcmb = purchaseRepository.GetAllSalesInvoice().OrderBy(x => x.ProductCode).ToList(); DefaultList = this.PandSHistoryList; FullPQList = this.PandSHistoryList; PandSHistoryListcmb = PandSHistoryList; //this.ShowAllCount = this.PandSHistorycmb.Count(); SetDefaultSearchSelection(this.JsonData); var Updateddate = this.PandSHistoryListcmb.Max(x => x.CreatedDate); string date = this.DateFormat as string; //this.LastUpdateDate = Convert.ToDateTime(Updateddate).ToString(date); //TotalInvoiceAmount = Convert.ToString(PandSHistory.Sum(e => e.InvoiceAmountValue)); //TotalCCDAmount = Convert.ToString(PandSHistory.Sum(e => e.TotalAmount)); this.TotalCusM1 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM1)); this.TotalCusM2 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM2)); this.TotalCusM3 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM3)); this.TotalCusQuarter = Convert.ToString(PandSHistoryList.Sum(e => e.QuarterTotal)); this.TotalCusYear = Convert.ToString(PandSHistoryList.Sum(e => e.YearTotal)); //this.GetData(this.SelectedSearchSupplier); }
public void GetData(string SearchFilter, string parameter) { //IPandSHistoryRepository purchaseRepository = new PandSHistoryRepository(); //var result = purchaseRepository.GetAllPurInvoice().ToList(); if (SearchFilter != null || SearchFilter == string.Empty) { if (parameter == "ProductCode") { PandSHistoryList = DefaultList.Where(x => (x.ProductCode == SearchFilter || x.ProductName == SearchFilter)).ToList(); } if (parameter == "ProductName") { PandSHistoryList = DefaultList.Where(x => (x.ProductCode == SearchFilter || x.ProductName == SearchFilter)).ToList(); } } else { PandSHistoryList = DefaultList; } //changedateformat(PandSHistory); //changeNumberformat(PandSHistory); //TotalInvoiceAmount = Convert.ToString(PandSHistory.Sum(e => e.InvoiceAmountValue)); //TotalCCDAmount = Convert.ToString(PandSHistory.Sum(e => e.TotalAmount)); this.TotalCusM1 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM1)); this.TotalCusM2 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM2)); this.TotalCusM3 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM3)); this.TotalCusQuarter = Convert.ToString(PandSHistoryList.Sum(e => e.QuarterTotal)); this.TotalCusYear = Convert.ToString(PandSHistoryList.Sum(e => e.YearTotal)); }
void Search(object param) { if (Count != 0) { SearchValues = new List <SearchEntity>(); //this.ShowSelectedTrue = true; //this.ShowAllTrue = false; if (this.SelectedSearchYear != null || this.SelectedSearchYear == string.Empty) { SearchEntity value = new SearchEntity(); value.FieldName = "Year"; value.FieldValue = this.SelectedSearchYear; SearchValues.Add(value); } else { SearchEntity value = new SearchEntity(); value.FieldName = "Year"; value.FieldValue = "0"; SearchValues.Add(value); } if (this.SelectedSearchQuarter != null || this.SelectedSearchQuarter == string.Empty) { SearchEntity value = new SearchEntity(); value.FieldName = "Quarter"; value.FieldValue = this.SelectedSearchQuarter; int month1; int month2; int month3; if (Convert.ToInt32(this.SelectedSearchQuarter) == 1) { month1 = 1; month2 = 2; month3 = 3; } else if (Convert.ToInt32(this.SelectedSearchQuarter) == 2) { month1 = 4; month2 = 5; month3 = 6; } else if (Convert.ToInt32(this.SelectedSearchQuarter) == 3) { month1 = 7; month2 = 8; month3 = 9; } else { month1 = 10; month2 = 11; month3 = 12; } SearchValues.Add(value); } else { SearchEntity value = new SearchEntity(); value.FieldName = "Quarter"; value.FieldValue = "0"; SearchValues.Add(value); } if (this.IsSalesTrue == true) { SearchEntity value = new SearchEntity(); value.FieldName = "IsSales"; value.FieldValue = "true"; SearchValues.Add(value); } else { SearchEntity value = new SearchEntity(); value.FieldName = "IsSales"; value.FieldValue = "false"; SearchValues.Add(value); } if (ShowProducts == true) { SearchEntity value = new SearchEntity(); value.FieldName = "Products"; value.FieldValue = "1"; SearchValues.Add(value); } else if (ShowServices == true) { SearchEntity value = new SearchEntity(); value.FieldName = "Products"; value.FieldValue = "2"; SearchValues.Add(value); } else { SearchEntity value = new SearchEntity(); value.FieldName = "Products"; value.FieldValue = "0"; SearchValues.Add(value); } //this.PandSHistory = this.PandSHistoryInternal; jsonSearch = JsonConvert.SerializeObject(SearchValues); this.JsonData = jsonSearch; IPandSHistoryRepository purchaseRepository = new PandSHistoryRepository(); var results = purchaseRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.PandSHistoryList), "PandSHistory_List"); if (Count != 0) { this.PandSHistoryList = purchaseRepository.GetAllSalesInvoiceJson(jsonSearch, this.IncludingGSTTrue).ToList(); //changedateformat(this.PandSHistory); } this.PandSHistoryListcmb = this.PandSHistoryList.OrderBy(x => x.ProductCode).ToList(); //this.PandSHistorycmbCredit = this.PandSHistorycmb.GroupBy(x => x.CashCreditNo).Select(g => g.First()).OrderBy(x => x.CreditCashNO).Where(y => y.CashCreditNo != null).ToList(); //this.PandSHistorycmbSup = this.PandSHistory.GroupBy(x => x.CustomerName).Select(y => y.First()).OrderBy(x => x.CustomerName).Distinct().ToList(); //this.PandSHistorycmbInv = this.PandSHistory.GroupBy(x => x.InvoiceNo).Select(y => y.First()).OrderBy(x => x.SortInvoiceNo).Distinct().ToList(); //if (this.ShowAllTrue == true) // this.ShowSelectedCount = 0; //else // this.ShowSelectedCount = this.PandSHistory.Count(); DefaultList = this.PandSHistoryListcmb; //TotalInvoiceAmount = Convert.ToString(PandSHistory.Sum(e => e.InvoiceAmountValue)); //TotalCCDAmount = Convert.ToString(PandSHistory.Sum(e => e.TotalAmount)); this.TotalCusM1 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM1)); this.TotalCusM2 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM2)); this.TotalCusM3 = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM3)); this.TotalCusQuarter = Convert.ToString(PandSHistoryList.Sum(e => e.QuarterTotal)); this.TotalCusYear = Convert.ToString(PandSHistoryList.Sum(e => e.YearTotal)); } }