public ActionResult _FilterPost(SaleOrderCancelFilterViewModel vm) { List <SaleOrderCancelLineViewModel> temp = _SaleOrderCancelLineService.GetSaleOrderLineForMultiSelect(vm).ToList(); SaleOrderCancelMasterDetailModel svm = new SaleOrderCancelMasterDetailModel(); svm.SaleOrderCancelViewModels = temp; return(PartialView("_Results", svm)); }
public ActionResult _CreateMultiple(int id, int bid) { SaleOrderCancelFilterViewModel vm = new SaleOrderCancelFilterViewModel(); vm.SaleOrderCancelHeaderId = id; vm.BuyerId = bid; SaleOrderCancelHeader H = new SaleOrderCancelHeaderService(_unitOfWork).Find(id); var settings = new SaleOrderSettingsService(_unitOfWork).GetSaleOrderSettings(H.DocTypeId, H.DivisionId, H.SiteId); vm.SaleOrderSettings = Mapper.Map <SaleOrderSettings, SaleOrderSettingsViewModel>(settings); vm.DocumentTypeSettings = new DocumentTypeSettingsService(_unitOfWork).GetDocumentTypeSettingsForDocument(H.DocTypeId); return(PartialView("_Filters", vm)); }
public IEnumerable <SaleOrderCancelLineViewModel> GetSaleOrderLineForMultiSelect(SaleOrderCancelFilterViewModel svm) { string[] ProductIdArr = null; if (!string.IsNullOrEmpty(svm.ProductId)) { ProductIdArr = svm.ProductId.Split(",".ToCharArray()); } else { ProductIdArr = new string[] { "NA" }; } string[] Dimension1IdArr = null; if (!string.IsNullOrEmpty(svm.Dimension1Id)) { Dimension1IdArr = svm.Dimension1Id.Split(",".ToCharArray()); } else { Dimension1IdArr = new string[] { "NA" }; } string[] Dimension2IdArr = null; if (!string.IsNullOrEmpty(svm.Dimension2Id)) { Dimension2IdArr = svm.Dimension2Id.Split(",".ToCharArray()); } else { Dimension2IdArr = new string[] { "NA" }; } string[] SaleOrderIdArr = null; if (!string.IsNullOrEmpty(svm.SaleOrderId)) { SaleOrderIdArr = svm.SaleOrderId.Split(",".ToCharArray()); } else { SaleOrderIdArr = new string[] { "NA" }; } string[] ProductGroupIdArr = null; if (!string.IsNullOrEmpty(svm.ProductGroupId)) { ProductGroupIdArr = svm.ProductGroupId.Split(",".ToCharArray()); } else { ProductGroupIdArr = new string[] { "NA" }; } var temp = (from p in db.ViewSaleOrderBalanceForCancellation join product in db.Product on p.ProductId equals product.ProductId into table2 from tab2 in table2.DefaultIfEmpty() join D1 in db.Dimension1 on p.Dimension1Id equals D1.Dimension1Id into Dimension1Table from Dimension1Tab in Dimension1Table.DefaultIfEmpty() join D2 in db.Dimension2 on p.Dimension2Id equals D2.Dimension2Id into Dimension2Table from Dimension2Tab in Dimension2Table.DefaultIfEmpty() where (string.IsNullOrEmpty(svm.ProductId) ? 1 == 1 : ProductIdArr.Contains(p.ProductId.ToString())) && (svm.BuyerId == 0? 1 == 1 : p.BuyerId == svm.BuyerId) && (string.IsNullOrEmpty(svm.SaleOrderId) ? 1 == 1 : SaleOrderIdArr.Contains(p.SaleOrderHeaderId.ToString())) && (string.IsNullOrEmpty(svm.ProductGroupId) ? 1 == 1 : ProductGroupIdArr.Contains(tab2.ProductGroupId.ToString())) && (string.IsNullOrEmpty(svm.Dimension1Id) ? 1 == 1 : Dimension1IdArr.Contains(p.Dimension1Id.ToString())) && (string.IsNullOrEmpty(svm.Dimension2Id) ? 1 == 1 : Dimension2IdArr.Contains(p.Dimension2Id.ToString())) && p.BalanceQty > 0 select new SaleOrderCancelLineViewModel { BalanceQty = p.BalanceQty, Qty = p.BalanceQty, DocNo = p.SaleOrderNo, ProductName = tab2.ProductName, ProductId = p.ProductId, Dimension1Name = Dimension1Tab.Dimension1Name, Dimension1Id = p.Dimension1Id, Dimension2Name = Dimension2Tab.Dimension2Name, Dimension2Id = p.Dimension2Id, SaleOrderCancelHeaderId = svm.SaleOrderCancelHeaderId, SaleOrderLineId = p.SaleOrderLineId }); return(temp); }