private void OnSearch() { PurchaseManager purchaseManager = new PurchaseManager(); PurchaseOrderList.Clear(); for (Iterator i = purchaseManager.searchPurchaseOrders(SearchPurchaseByOderNo).iterator(); i.hasNext();) { PurchaseInfo purchaseInfo = (PurchaseInfo)i.next(); PurchaseInfoNJ purchaseInfoNJ = new PurchaseInfoNJ(); purchaseInfoNJ.OrderNo = purchaseInfo.getOrderNo(); purchaseInfoNJ.StatusId = purchaseInfo.getStatusId(); purchaseInfoNJ.Remarks = purchaseInfo.getRemarks(); SupplierInfo supplierInfo = new SupplierInfo(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = purchaseInfo.getSupplierInfo().getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = purchaseInfo.getSupplierInfo().getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = purchaseInfo.getSupplierInfo().getProfileInfo().getLastName(); purchaseInfoNJ.SupplierInfoNJ = supplierInfoNJ; PurchaseOrderList.Add(purchaseInfoNJ); } }
//constructor public ManagePurchaseOrderList() { //loading purchase list PurchaseManager purchaseManager = new PurchaseManager(); for (Iterator i = purchaseManager.getAllPurchaseOrders().iterator(); i.hasNext();) { PurchaseInfo purchaseInfo = (PurchaseInfo)i.next(); PurchaseInfoNJ purchaseInfoNJ = new PurchaseInfoNJ(); purchaseInfoNJ.OrderNo = purchaseInfo.getOrderNo(); purchaseInfoNJ.StatusId = purchaseInfo.getStatusId(); purchaseInfoNJ.Remarks = purchaseInfo.getRemarks(); for (Iterator j = purchaseInfo.getProductList().iterator(); j.hasNext();) { ProductInfo productInfo = (ProductInfo)j.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); productInfoNJ.Quantity = productInfo.getQuantity(); purchaseInfoNJ.ProductList.Add(productInfoNJ); } SupplierInfo supplierInfo = new SupplierInfo(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = purchaseInfo.getSupplierInfo().getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = purchaseInfo.getSupplierInfo().getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = purchaseInfo.getSupplierInfo().getProfileInfo().getLastName(); purchaseInfoNJ.SupplierInfoNJ = supplierInfoNJ; PurchaseOrderList.Add(purchaseInfoNJ); } }
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); }
protected void ADD(object sender, ListViewCommandEventArgs a) { ListViewDataItem row = a.Item as ListViewDataItem; PurchaseOrderList newItem = new PurchaseOrderList(); newItem.itemid = int.Parse((row.FindControl("itemid") as Label).Text); newItem.Description = (row.FindControl("Description") as Label).Text; newItem.QOH = int.Parse((row.FindControl("QOH") as Label).Text); newItem.QOO = int.Parse((row.FindControl("ROL") as Label).Text); newItem.ROL = int.Parse((row.FindControl("QOO") as Label).Text); newItem.Price = decimal.Parse((row.FindControl("Price") as Label).Text); newItem.Quantity = 0; int index = row.DataItemIndex; List <PurchaseOrderList> datatoberemoved = Get_listitemdata(0); List <PurchaseOrderList> datatobeadded = Get_listitemdata(1); datatoberemoved.RemoveAt(index); CurrentInventoryView.DataSource = datatoberemoved; CurrentInventoryView.DataBind(); datatobeadded.Add(newItem); PurchaseOrderView.DataSource = datatobeadded; PurchaseOrderView.DataBind(); GenerateAmounts(datatobeadded); show_everything(); }
public List <PurchaseOrderList> Get_listitemdata(int listtype) { List <PurchaseOrderList> list = new List <PurchaseOrderList>(); if (listtype == 1) { IList <ListViewDataItem> data = PurchaseOrderView.Items; foreach (ListViewDataItem item in data) { PurchaseOrderList listitem = new PurchaseOrderList(); listitem.itemid = int.Parse((item.FindControl("itemid") as Label).Text); listitem.Description = (item.FindControl("Description") as Label).Text; listitem.QOH = int.Parse((item.FindControl("QOH") as Label).Text); listitem.QOO = int.Parse((item.FindControl("ROL") as Label).Text); listitem.ROL = int.Parse((item.FindControl("QOO") as Label).Text); listitem.Price = decimal.Parse((item.FindControl("Price") as TextBox).Text); listitem.Quantity = int.Parse((item.FindControl("Quantity") as TextBox).Text); list.Add(listitem); } return(list); } else { IList <ListViewDataItem> data = CurrentInventoryView.Items; foreach (ListViewDataItem item in data) { PurchaseOrderList listitem = new PurchaseOrderList(); listitem.itemid = int.Parse((item.FindControl("itemid") as Label).Text); listitem.Description = (item.FindControl("Description") as Label).Text; listitem.QOH = int.Parse((item.FindControl("QOH") as Label).Text); listitem.QOO = int.Parse((item.FindControl("ROL") as Label).Text); listitem.ROL = int.Parse((item.FindControl("QOO") as Label).Text); listitem.Price = decimal.Parse((item.FindControl("Price") as Label).Text); listitem.Quantity = 0; list.Add(listitem); } return(list); } }
//constructor public ManagePurchaseOrder() { //loading purchase list on left panel PurchaseManager purchaseManager = new PurchaseManager(); for (Iterator i = purchaseManager.getAllPurchaseOrders().iterator(); i.hasNext();) { PurchaseInfo purchaseInfo = (PurchaseInfo)i.next(); PurchaseInfoNJ purchaseInfoNJ = new PurchaseInfoNJ(); //We will display order no in grid view on left panel purchaseInfoNJ.OrderNo = purchaseInfo.getOrderNo(); //right now after clicking on item on left panel purchase info is again retrived from the database //so we can ignore rest of the part right now if required. purchaseInfoNJ.StatusId = purchaseInfo.getStatusId(); purchaseInfoNJ.Remarks = purchaseInfo.getRemarks(); for (Iterator j = purchaseInfo.getProductList().iterator(); j.hasNext();) { ProductInfo productInfo = (ProductInfo)j.next(); ProductInfoNJ productInfoNJ = new ProductInfoNJ(); productInfoNJ.Id = productInfo.getId(); productInfoNJ.Name = productInfo.getName(); productInfoNJ.Code = productInfo.getCode(); productInfoNJ.UnitPrice = productInfo.getUnitPrice(); productInfoNJ.Quantity = productInfo.getQuantity(); purchaseInfoNJ.ProductList.Add(productInfoNJ); } SupplierInfo supplierInfo = new SupplierInfo(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = purchaseInfo.getSupplierInfo().getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = purchaseInfo.getSupplierInfo().getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = purchaseInfo.getSupplierInfo().getProfileInfo().getLastName(); purchaseInfoNJ.SupplierInfoNJ = supplierInfoNJ; PurchaseOrderList.Add(purchaseInfoNJ); } //Setting a default random Order No for Purchase Info PurchaseInfoNJ.OrderNo = Guid.NewGuid().ToString().ToUpper();; }
public async Task <Tuple <int, Stream> > UploadPurchaseOrderAsync(MemoryStream memoryStream) { using (var reader = new StreamReader(memoryStream)) using (var csv = new CsvReader(reader)) { csv.Configuration.IgnoreBlankLines = false; csv.Configuration.RegisterClassMap <PurchaseOrderHeaderMapping>(); csv.Configuration.RegisterClassMap <PurchaseOrderLineMapping>(); var headerRecords = new List <PurchaseOrderHeader>(); var lineItemRecords = new List <PurchaseOrderLine>(); var isHeader = true; while (csv.Read()) { if (isHeader) { csv.ReadHeader(); isHeader = false; continue; } if (string.IsNullOrEmpty(csv.GetField(0))) { isHeader = true; continue; } switch (csv.Context.HeaderRecord[0]) { case "External Reference": headerRecords.Add(csv.GetRecord <PurchaseOrderHeader>()); break; case "Product ID": lineItemRecords.Add(csv.GetRecord <PurchaseOrderLine>()); break; default: throw new InvalidOperationException("Unknown record type."); } } PurchaseOrderList purchaseOrders = new PurchaseOrderList(); foreach (var header in headerRecords) { var purchaseOrder = new PurchaseOrder(); purchaseOrder.ObjectNodeSenderTechnicalID = header.ExternalReference; purchaseOrder.Name.Text = header.Name; purchaseOrder.CurrencyCode = header.CurrencyCode; purchaseOrder.DeliveryTerms.IncoTerms.ClassificationCode = header.IncotermsCode; purchaseOrder.DeliveryTerms.IncoTerms.TransferLocationName = header.IncotermsLocationName; purchaseOrder.SellerParty.PartyKey.PartyID = header.SupplierId; purchaseOrder.ResponsiblePurchasingUnitParty.PartyKey.PartyID = header.PurchasingUnitId; var lineItems = lineItemRecords.FindAll(x => x.ExternalReference == header.ExternalReference); foreach (var line in lineItems) { int lineItemId = 10; var item = new Models.PurchaseOrders.PO.Item(); item.ItemID = lineItemId.ToString(); item.Quantity.Text = line.Quantity; item.Quantity.UnitCode = line.QuantityUnitCode; item.ListUnitPrice.Amount.Text = line.ListUnitPriceAmount; item.ListUnitPrice.Amount.CurrencyCode = header.CurrencyCode; item.ShipToLocation.LocationID = line.ShipToLocationId; item.DirectMaterialIndicator = "true"; item.ThirdPartyDealIndicator = "false"; item.FollowUpDelivery.EmployeeTimeConfirmationRequiredIndicator = "false"; item.FollowUpInvoice.EvaluatedReceiptSettlementIndicator = "false"; item.FollowUpInvoice.RequirementCode = "01"; purchaseOrder.Items.Add(item); lineItemId += 10; } purchaseOrders.PurchaseOrders.Add(purchaseOrder); } var purchaseOrderXml = HelperExtensions.SerializeToXml(purchaseOrders); //read createxml file string filePath = Path.Combine(HostingEnvironment.ContentRootPath, "xmlfiles/purchaseOrder.xml"); //merge xml files XmlDocument doc = new XmlDocument(); doc.Load(filePath); var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("soapenv", "http://schemas.xmlsoap.org/soap/envelope/"); nsmgr.AddNamespace("glob", "http://sap.com/xi/SAPGlobal20/Global"); var element = doc.SelectSingleNode("/soapenv:Envelope/soapenv:Body/glob:PurchaseOrderBundleMaintainRequest_sync", nsmgr); if (element != null) { var subDoc = new XmlDocument(); subDoc.LoadXml(purchaseOrderXml); var nsmgr1 = new XmlNamespaceManager(subDoc.NameTable); nsmgr1.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema"); nsmgr1.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); var purchaseOrderListNodes = subDoc.SelectNodes("//PurchaseOrderList/PurchaseOrder", nsmgr1); var sb = new StringBuilder(); foreach (XmlNode child in purchaseOrderListNodes) { sb.AppendLine("<PurchaseOrder>"); sb.AppendLine(child.InnerXml); sb.AppendLine("</PurchaseOrder>"); } var res = sb.ToString(); element.InnerXml = sb.ToString(); var basicMsgNode = doc.CreateNode(XmlNodeType.Element, "BasicMessageHeader", null); XmlNode purchaseOrderNode = doc.SelectSingleNode("//PurchaseOrder"); element.InsertBefore(basicMsgNode, purchaseOrderNode); doc.Save(filePath); StreamReader sr = new StreamReader(filePath); string soapXml = sr.ReadToEnd(); sr.Close(); var tenantSetting = await _tenantSettingService.GetSetting(); UriBuilder urlBuilder = new UriBuilder(tenantSetting.BaseUrl) { Path = "/sap/bc/srt/scs/sap/managepurchaseorderin" }; var request = new HttpRequestMessage(HttpMethod.Post, urlBuilder.ToString()); request.Headers.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("text/xml")); var byteArray = Encoding.ASCII.GetBytes($"{tenantSetting.User}:{tenantSetting.Password}"); request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)); request.Content = new StringContent(soapXml, Encoding.UTF8, "text/xml"); var response = await _client.HttpClient.SendAsync(request); if (response.IsSuccessStatusCode) { var responseData = await response.Content.ReadAsStreamAsync(); return(Tuple.Create((int)response.StatusCode, responseData)); } var errorResonseData = await response.Content.ReadAsStreamAsync(); return(Tuple.Create((int)response.StatusCode, errorResonseData)); } } return(null); }
private DataTable GetPurchaseOrderTable() { long telHlp = 0; long faxHlp = 0; string telfmt = "000-000-0000"; string szTel = ""; TimelyDepotContext db01 = new TimelyDepotContext(); DataTable table = null; DataRow row = null; PurchaseOrderList thepurchaseorderlist = null; List<PurchaseOrderList> purchaseList = new List<PurchaseOrderList>(); var qryPurchaseOrder = db.Vendors.Join(db.PurchaseOrders, vdad => vdad.VendorNo, prod => prod.VendorId, (vdad, prod) => new { vdad, prod }).OrderBy(vdod => vdod.prod.PurchaseOrderNo); if (qryPurchaseOrder.Count() > 0) { foreach (var item in qryPurchaseOrder) { thepurchaseorderlist = new PurchaseOrderList(); thepurchaseorderlist.PurchaseOrderId = item.prod.PurchaseOrderId; thepurchaseorderlist.PurchaseOrderNo = item.prod.PurchaseOrderNo; thepurchaseorderlist.SODate = item.prod.PODate; thepurchaseorderlist.VendorNo = item.prod.VendorId; //thepurchaseorderlist.VendorNo = GetCustomerDataSO(db01, item.ctad.VendorId.ToString()); thepurchaseorderlist.CompanyName = GetVendorData01(db01, item.prod.VendorId); thepurchaseorderlist.SalesOrderNo = item.prod.SalesOrderNo; thepurchaseorderlist.ShipDate = item.prod.ShipDate; thepurchaseorderlist.PaymentAmount = this.GetTotalPO01(db01, item.prod.PurchaseOrderId); purchaseList.Add(thepurchaseorderlist); } } table = new DataTable("SalesOrderList"); // Set the header DataColumn col01 = new DataColumn("PurchaseOrderNo", System.Type.GetType("System.String")); DataColumn col02 = new DataColumn("Date", System.Type.GetType("System.String")); DataColumn col03 = new DataColumn("VendorNo", System.Type.GetType("System.String")); DataColumn col04 = new DataColumn("VendorCompanyName", System.Type.GetType("System.String")); DataColumn col05 = new DataColumn("SalesOrderNo", System.Type.GetType("System.String")); DataColumn col06 = new DataColumn("ShipDate", System.Type.GetType("System.String")); DataColumn col07 = new DataColumn("Amount", System.Type.GetType("System.String")); table.Columns.Add(col01); table.Columns.Add(col02); table.Columns.Add(col03); table.Columns.Add(col04); table.Columns.Add(col05); table.Columns.Add(col06); table.Columns.Add(col07); //Set the data row foreach (var item in purchaseList) { row = table.NewRow(); row["PurchaseOrderNo"] = item.PurchaseOrderNo; row["Date"] = item.SODate; row["VendorNo"] = item.VendorNo; row["VendorCompanyName"] = item.CompanyName; row["SalesOrderNo"] = item.SalesOrderNo; row["ShipDate"] = item.ShipDate; row["Amount"] = item.PaymentAmount; table.Rows.Add(row); } return table; }
public PartialViewResult PurchaseOrderList(int? page) { int pageIndex = 0; int pageSize = PageSize; TimelyDepotContext db01 = new TimelyDepotContext(); PurchaseOrderList thepurchaseorderlist = null; List<PurchaseOrderList> customerList = new List<PurchaseOrderList>(); var qryPurchaseOrder = db.Vendors.Join(db.PurchaseOrders, vdad => vdad.VendorNo, prod => prod.VendorId, (vdad, prod) => new { vdad, prod }).OrderBy(vdod => vdod.prod.PurchaseOrderNo); if (qryPurchaseOrder.Count() > 0) { foreach (var item in qryPurchaseOrder) { thepurchaseorderlist = new PurchaseOrderList(); thepurchaseorderlist.PurchaseOrderId = item.prod.PurchaseOrderId; thepurchaseorderlist.PurchaseOrderNo = item.prod.PurchaseOrderNo; thepurchaseorderlist.SODate = item.prod.PODate; thepurchaseorderlist.VendorNo = item.prod.VendorId; //thepurchaseorderlist.VendorNo = GetCustomerDataSO(db01, item.ctad.VendorId.ToString()); thepurchaseorderlist.CompanyName = GetVendorData01(db01, item.prod.VendorId); thepurchaseorderlist.SalesOrderNo = item.prod.SalesOrderNo; thepurchaseorderlist.ShipDate = item.prod.ShipDate; thepurchaseorderlist.PaymentAmount = this.GetTotalPO01(db01, item.prod.PurchaseOrderId); customerList.Add(thepurchaseorderlist); } } //Set the page if (page == null) { pageIndex = 1; } else { pageIndex = Convert.ToInt32(page); } var onePageOfData = customerList.ToPagedList(pageIndex, pageSize); ViewBag.OnePageOfData = onePageOfData; return PartialView(customerList.ToPagedList(pageIndex, pageSize)); }
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)); } }