private void RefreshData() { IPurchaseOrderListRepository purchaseRepository = new PurchaseOrderListRepository(); this.DateFormat = purchaseRepository.GetDateFormat(); this.ShowAllCount = purchaseRepository.GetAllPurOrder().Count(); GetOptionsandTaxValues(); this.JsonData = purchaseRepository.GetLastSelectionData(Convert.ToInt32(ScreenId.PurchaseOrderList)); this.PurchaseOrderList = purchaseRepository.GetAllPurOrderJson(this.JsonData, this.IncludingGSTTrue).OrderBy(e => e.SupplierName).ToList(); this.ShowSelectedCount = this.PurchaseOrderList.Count(); this.PurchaseOrderListcmb = purchaseRepository.GetAllPurOrder().OrderBy(e => e.SupplierName).ToList(); this.YearRange = purchaseRepository.GetYearRange().ToList(); //changedateformat(this.PurchaseOrderList); changeNumberformat(this.PurchaseOrderList); changeNumberformat(this.PurchaseOrderListcmb); DefaultList = this.PurchaseOrderListcmb; FullPQList = this.PurchaseOrderListcmb; this.PurchaseOrderListcmbSup = this.PurchaseOrderList.GroupBy(x => x.SupplierName).Select(y => y.First()).OrderBy(x => x.SupplierName).Distinct().ToList(); this.PurchaseOrderListcmbONo = this.PurchaseOrderList.GroupBy(x => x.OrderNo).Select(y => y.First()).OrderBy(x => x.SortOrderNo).Distinct().ToList(); //this.ShowAllCount = this.PurchaseOrderListcmb.Count(); SetDefaultSearchSelection(this.JsonData); var Updateddate = this.PurchaseOrderListcmb.Max(x => x.CreatedDateList); string date = this.DateFormat as string; this.LastUpdateDate = Convert.ToDateTime(Updateddate).ToString(date); TotalAmount = Convert.ToString(PurchaseOrderList.Sum(e => e.OAmount)); DepositTotal = Convert.ToString(PurchaseOrderList.Sum(e => e.DAmount)); //this.GetData(this.SelectedSearchSupplier); }
public void GetData(string SearchFilter, string parameter) { //IPurchaseOrderListRepository purchaseRepository = new PurchaseOrderListRepository(); //var result = purchaseRepository.GetAllPurOrder().ToList(); if (SearchFilter != null || SearchFilter == string.Empty) { if (parameter == "Supplier") { this.ShowAllCount = this.ShowAllCount; //var searchname = SearchFilter.Split('#')[0]; if (this.ShowAllTrue == true) { if (this.IncludingGSTTrue == true) { this.PurchaseOrderList = FullPQList.Where(x => (x.SupplierName == SearchFilter || x.OrderNo == SearchFilter || x.ConvertedTo == SearchFilter) && x.ExcIncGST == true).OrderBy(e => e.SupplierName).ToList().ToList(); } else { this.PurchaseOrderList = FullPQList.Where(x => (x.SupplierName == SearchFilter || x.OrderNo == SearchFilter || x.ConvertedTo == SearchFilter) && x.ExcIncGST == false).OrderBy(e => e.SupplierName).ToList().ToList(); } } else { if (this.IncludingGSTTrue == true) { this.PurchaseOrderList = DefaultList.Where(x => (x.SupplierName == SearchFilter || x.OrderNo == SearchFilter || x.ConvertedTo == SearchFilter) && x.ExcIncGST == true).OrderBy(e => e.SupplierName).ToList().ToList(); } else { this.PurchaseOrderList = DefaultList.Where(x => (x.SupplierName == SearchFilter || x.OrderNo == SearchFilter || x.ConvertedTo == SearchFilter) && x.ExcIncGST == false).OrderBy(e => e.SupplierName).ToList().ToList(); } } //DefaultList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList(); } if (parameter == "ConvertedTo") { this.ShowAllCount = this.ShowAllCount; //var searchname = SearchFilter.Split('#')[0]; if (this.ShowAllTrue == true) { var search = SearchFilter.Split(':')[1]; if (search == " PO") { this.PurchaseOrderList = FullPQList.Where(x => x.ConvertedTo == "Order").OrderBy(e => e.SupplierName).ToList().ToList(); } else if (search == " PI") { this.PurchaseOrderList = FullPQList.Where(x => x.ConvertedTo == "Invoice").OrderBy(e => e.SupplierName).ToList().ToList(); } } else { var search = SearchFilter.Split(':')[1]; if (search == " PO") { this.PurchaseOrderList = DefaultList.Where(x => x.ConvertedTo == "Order").OrderBy(e => e.SupplierName).ToList().ToList(); } else if (search == " PI") { this.PurchaseOrderList = DefaultList.Where(x => x.ConvertedTo == "Invoice").OrderBy(e => e.SupplierName).ToList().ToList(); } } //DefaultList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList(); } //if (parameter == "OrderNo") //{ // this.ShowAllCount = this.ShowAllCount; // this.PurchaseOrderList = DefaultList.Where(x => x.OrderNo == SearchFilter).ToList(); // DefaultList = DefaultList.Where(x => x.OrderNo == SearchFilter).ToList(); //} //if (parameter == "SearchYear") //{ // this.ShowAllCount = this.ShowAllCount; // this.PurchaseOrderList = DefaultList.Where(x => x.CreatedDate.Value.Year.ToString() == SearchFilter).ToList(); //} //if (parameter == "Supplier") //{ // this.ShowAllCount = this.ShowAllCount; // this.PurchaseOrderList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList(); //} //if (parameter == "Supplier") //{ // this.ShowAllCount = this.ShowAllCount; // this.PurchaseOrderList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList(); //} //if (parameter == "Supplier") //{ // this.ShowAllCount = this.ShowAllCount; // this.PurchaseOrderList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList(); //} //if (parameter == "Supplier") //{ // this.ShowAllCount = this.ShowAllCount; // this.PurchaseOrderList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList(); //} //if (parameter == "Supplier") //{ // this.ShowAllCount = this.ShowAllCount; // this.PurchaseOrderList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList(); //} } else { if (this.ShowAllTrue == true) { if (this.IncludingGSTTrue == true) { this.PurchaseOrderList = FullPQList.Where(x => x.ExcIncGST == true).OrderBy(e => e.SupplierName).ToList().ToList(); } else { this.PurchaseOrderList = FullPQList.Where(x => x.ExcIncGST == false).OrderBy(e => e.SupplierName).ToList().ToList(); } } else { if (this.IncludingGSTTrue == true) { this.PurchaseOrderList = DefaultList.Where(x => x.ExcIncGST == true).OrderBy(e => e.SupplierName).ToList().ToList(); } else { this.PurchaseOrderList = DefaultList.Where(x => x.ExcIncGST == false).OrderBy(e => e.SupplierName).ToList().ToList(); } } } //changedateformat(PurchaseOrderList); //changeNumberformat(PurchaseOrderList); TotalAmount = Convert.ToString(PurchaseOrderList.Sum(e => e.OAmount)); DepositTotal = Convert.ToString(PurchaseOrderList.Sum(e => e.DAmount)); }
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); var year = Convert.ToInt32(this.SelectedSearchYear); //DefaultList = FullPQList.Where(x => x.CreatedDate.Value.Year == year).ToList(); //if (this.IncludingGSTTrue == true) // this.PurchaseOrderListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList(); //else // this.PurchaseOrderListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList(); //this.PurchaseOrderListcmb = DefaultList; } 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); } if (this.SelectedSearchMonth != null || this.SelectedSearchMonth == string.Empty) { SearchEntity value = new SearchEntity(); value.FieldName = "Month"; value.FieldValue = this.SelectedSearchMonth; SearchValues.Add(value); var month = Convert.ToInt32(this.SelectedSearchMonth); } if (this.SelectedSearchStartDate != null && this.SelectedSearchEndDate != null) { SearchEntity value = new SearchEntity(); value.FieldName = "StartDate"; //value.FieldValue = this.SelectedSearchStartDate.ToString(); value.FieldValue = string.Format("{0:MMM/dd/yyyy}", this.SelectedSearchStartDate); SearchValues.Add(value); //string[] value = new string[2]; SearchEntity value1 = new SearchEntity(); value1.FieldName = "EndDate"; //value1.FieldValue = this.SelectedSearchEndDate.ToString(); value1.FieldValue = string.Format("{0:MMM/dd/yyyy}", this.SelectedSearchEndDate); SearchValues.Add(value); SearchValues.Add(value1); } jsonSearch = JsonConvert.SerializeObject(SearchValues); this.JsonData = jsonSearch; IPurchaseOrderListRepository purchaseRepository = new PurchaseOrderListRepository(); var results = purchaseRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.PurchaseOrderList), "Purhcase_Order_List"); if (Count != 0) { this.PurchaseOrderList = purchaseRepository.GetAllPurOrderJson(jsonSearch, this.IncludingGSTTrue); //changedateformat(this.PurchaseOrderList); changeNumberformat(this.PurchaseOrderList); } this.PurchaseOrderListcmb = this.PurchaseOrderList.OrderBy(e => e.SupplierName).ToList(); this.PurchaseOrderListcmbSup = this.PurchaseOrderList.GroupBy(x => x.SupplierName).Select(y => y.First()).OrderBy(x => x.SupplierName).Distinct().ToList(); this.PurchaseOrderListcmbONo = this.PurchaseOrderList.GroupBy(x => x.OrderNo).Select(y => y.First()).OrderBy(x => x.SortOrderNo).Distinct().ToList(); if (this.ShowAllTrue == true) { this.ShowSelectedCount = 0; } else { this.ShowSelectedCount = this.PurchaseOrderList.Count(); } DefaultList = this.PurchaseOrderListcmb; TotalAmount = Convert.ToString(PurchaseOrderList.Sum(e => e.OAmount)); DepositTotal = Convert.ToString(PurchaseOrderList.Sum(e => e.DAmount)); } }