public object GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { totalRows = 0; notification = new Library.DTO.Notification(); notification.Type = Library.DTO.NotificationType.Success; DTO.SearchFormData data = new DTO.SearchFormData(); try { string bifaCompany = filters.ContainsKey("bifaCompany") && filters["bifaCompany"] != null && !string.IsNullOrEmpty(filters["bifaCompany"].ToString()) ? filters["bifaCompany"].ToString() : null; string taxCode = filters.ContainsKey("taxCode") && filters["taxCode"] != null && !string.IsNullOrEmpty(filters["taxCode"].ToString()) ? filters["taxCode"].ToString() : null; string bifaIndustry = filters.ContainsKey("bifaIndustry") && filters["bifaIndustry"] != null && !string.IsNullOrEmpty(filters["bifaIndustry"].ToString()) ? filters["bifaIndustry"].ToString() : null; string bifaCity = filters.ContainsKey("bifaCity") && filters["bifaCity"] != null && !string.IsNullOrEmpty(filters["bifaCity"].ToString()) ? filters["bifaCity"].ToString() : null; bool? isActive = filters.ContainsKey("isActive") && filters["isActive"] != null && !string.IsNullOrEmpty(filters["isActive"].ToString()) ? (bool?)System.Convert.ToBoolean(filters["isActive"].ToString()) : null; using (var context = CreateContext()) { totalRows = context.BifaCompanyMng_function_BifaCompanySearchResult(bifaCompany, taxCode, bifaIndustry, bifaCity, isActive, orderBy, orderDirection).Count(); data.Data = AutoMapper.Mapper.Map <System.Collections.Generic.List <BifaCompanyMng_BifaCompanySearchResult_View>, System.Collections.Generic.List <DTO.BifaCompanySearchResult> >(context.BifaCompanyMng_function_BifaCompanySearchResult(bifaCompany, taxCode, bifaIndustry, bifaCity, isActive, orderBy, orderDirection).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } } catch (System.Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Helper.GetInnerException(ex).Message; } return(data); }
public DTO.SearchFormData GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.SearchFormData data = new DTO.SearchFormData(); data.Data = new List <DTO.OutsourcingCostSearchDTO>(); data.WorkCenters = new List <DTO.WorkCenterDTO>(); totalRows = 0; string OutsourcingCostUD = null; string OutsourcingCostNM = null; string OutsourcingCostNMEN = null; int? WorkCenterID = null; bool? IsAdditionalCost = null; if (filters.ContainsKey("OutsourcingCostUD") && !string.IsNullOrEmpty(filters["OutsourcingCostUD"].ToString())) { OutsourcingCostUD = filters["OutsourcingCostUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("OutsourcingCostNM") && !string.IsNullOrEmpty(filters["OutsourcingCostNM"].ToString())) { OutsourcingCostNM = filters["OutsourcingCostNM"].ToString().Replace("'", "''"); } if (filters.ContainsKey("OutsourcingCostNMEN") && !string.IsNullOrEmpty(filters["OutsourcingCostNMEN"].ToString())) { OutsourcingCostNMEN = filters["OutsourcingCostNMEN"].ToString().Replace("'", "''"); } if (filters.ContainsKey("WorkCenterID") && !string.IsNullOrEmpty(filters["WorkCenterID"].ToString())) { WorkCenterID = Convert.ToInt32(filters["WorkCenterID"]); } if (filters.ContainsKey("IsAdditionalCost") && !string.IsNullOrEmpty(filters["IsAdditionalCost"].ToString())) { IsAdditionalCost = (filters["IsAdditionalCost"].ToString() == "true") ? true : false; } //try to get data try { using (var context = CreateContext()) { totalRows = context.OutsourcingCostMng_function_SearchOutsourceCost(OutsourcingCostUD, OutsourcingCostNM, OutsourcingCostNMEN, WorkCenterID, IsAdditionalCost, orderBy, orderDirection).Count(); var result = context.OutsourcingCostMng_function_SearchOutsourceCost(OutsourcingCostUD, OutsourcingCostNM, OutsourcingCostNMEN, WorkCenterID, IsAdditionalCost, orderBy, orderDirection); data.Data = converter.DB2DTO_OutsourcingCostSearch(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } using (var context = CreateContext()) { data.WorkCenters = converter.DB2DTO_GetWorkCenter(context.OutsourcingCostMng_WorkCenter_View.ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public object GetDataWithFilter(int userID, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { totalRows = 0; notification = new Library.DTO.Notification(); notification.Type = Library.DTO.NotificationType.Success; DTO.SearchFormData data = new DTO.SearchFormData(); try { string fromDate = filters.ContainsKey("fromDate") && filters["fromDate"] != null && !string.IsNullOrEmpty(filters["fromDate"].ToString().Trim()) ? filters["fromDate"].ToString().Trim() : null; string toDate = filters.ContainsKey("toDate") && filters["toDate"] != null && !string.IsNullOrEmpty(filters["toDate"].ToString().Trim()) ? filters["toDate"].ToString().Trim() : null; int? supplierID = filters.ContainsKey("supplierID") && filters["supplierID"] != null && !string.IsNullOrEmpty(filters["supplierID"].ToString().Trim()) ? (int?)Convert.ToInt32(filters["supplierID"].ToString().Trim()) : null; string status = filters.ContainsKey("status") && filters["status"] != null && !string.IsNullOrEmpty(filters["status"].ToString().Trim()) ? filters["status"].ToString().Trim() : null; using (var context = CreateContext()) { totalRows = context.PurchaseOrderTrackingRpt_function_PurchaseOrderTrackingSearchResult(fromDate, toDate, supplierID, status, orderBy, orderDirection).Count(); data.PurchaseOrderTracking = converter.DB2DTO_PurchaseOrderTracking(context.PurchaseOrderTrackingRpt_function_PurchaseOrderTrackingSearchResult(fromDate, toDate, supplierID, status, orderBy, orderDirection).ToList()); data.PurchaseOrderTrackingWeek = converter.DB2DTO_WeekInfo(context.PurchaseOrderTrackingRpt_function_WeekInfo(fromDate, toDate).ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
public DTO.SearchFormData GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.SearchFormData data = new DTO.SearchFormData(); data.Data = new List <DTO.DraftCommercialInvoiceSearchDTO>(); data.Seasons = new List <DTO.Season>(); //data.WorkCenters = new List<DTO.WorkCenterDTO>(); totalRows = 0; string invoiceNo = null; string clientUD = null; string clientNM = null; string clientInvoiceNo = null; string season = null; if (filters.ContainsKey("invoiceNo") && !string.IsNullOrEmpty(filters["invoiceNo"].ToString())) { invoiceNo = filters["invoiceNo"].ToString().Replace("'", "''"); } if (filters.ContainsKey("clientUD") && !string.IsNullOrEmpty(filters["clientUD"].ToString())) { clientUD = filters["clientUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("clientNM") && !string.IsNullOrEmpty(filters["clientNM"].ToString())) { clientNM = filters["clientNM"].ToString().Replace("'", "''"); } if (filters.ContainsKey("clientInvoiceNo") && !string.IsNullOrEmpty(filters["clientInvoiceNo"].ToString())) { clientInvoiceNo = filters["clientInvoiceNo"].ToString().Replace("'", "''"); } if (filters.ContainsKey("season") && !string.IsNullOrEmpty(filters["season"].ToString())) { season = filters["season"].ToString().Replace("'", "''"); } //try to get data try { using (var context = CreateContext()) { totalRows = context.DraftCommercialInvoiceMng_function_SearchDraftCommercialInvoice(invoiceNo, clientUD, clientNM, clientInvoiceNo, season, orderBy, orderDirection).Count(); var result = context.DraftCommercialInvoiceMng_function_SearchDraftCommercialInvoice(invoiceNo, clientUD, clientNM, clientInvoiceNo, season, orderBy, orderDirection); data.Data = converter.DB2DTO_SearchDraftCommercialInvoice(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } //data.WorkCenters = converter.DB2DTO_GetWorkCenter(context.OutsourcingCostMng_WorkCenter_View.ToList()); data.Seasons = GetSeason().ToList(); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public SearchFormData GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification) { DTO.SearchFormData searchFormData = new DTO.SearchFormData(); notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; totalRows = 0; try { string outSourcingCostTypeUD = ""; string outSourcingCostTypeNM = ""; string outSourcingCostTypeNMEN = ""; int? productionItemGroupID = null; if (filters.ContainsKey("outsourcingCostTypeUD") && !string.IsNullOrEmpty(filters["outsourcingCostTypeUD"].ToString())) { outSourcingCostTypeUD = filters["outsourcingCostTypeUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("outsourcingCostTypeNM") && !string.IsNullOrEmpty(filters["outsourcingCostTypeNM"].ToString())) { outSourcingCostTypeNM = filters["outsourcingCostTypeNM"].ToString().Replace("'", "''"); } if (filters.ContainsKey("outsourcingCostTypeNMEN") && !string.IsNullOrEmpty(filters["outsourcingCostTypeNMEN"].ToString())) { outSourcingCostTypeNMEN = filters["outsourcingCostTypeNMEN"].ToString().Replace("'", "''"); } if (filters.ContainsKey("productionItemGroupID") && !string.IsNullOrEmpty(filters["productionItemGroupID"].ToString())) { productionItemGroupID = Convert.ToInt32(filters["productionItemGroupID"]); } using (OutsourcingCostTypeMngEntities context = CreateContext()) { totalRows = context.OutsourcingCostTypeMng_function_SearchOutSourcingCostTypeMng(outSourcingCostTypeUD, outSourcingCostTypeNM, outSourcingCostTypeNMEN, productionItemGroupID, orderBy, orderDirection).Count(); var result = context.OutsourcingCostTypeMng_function_SearchOutSourcingCostTypeMng(outSourcingCostTypeUD, outSourcingCostTypeNM, outSourcingCostTypeNMEN, productionItemGroupID, orderBy, orderDirection); searchFormData.Data = converter.DB2DTO_OutSourcingCostTypeSearchResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } return(searchFormData); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; notification.DetailMessage.Add(ex.Message); if (ex.GetBaseException() != null) { notification.DetailMessage.Add(ex.GetBaseException().Message); } return(searchFormData); } }
public DTO.SearchFormData GetDataWithFilter(int userID, Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification) { totalRows = 0; notification = new Notification(); notification.Type = NotificationType.Success; DTO.SearchFormData data = new DTO.SearchFormData(0); try { int? factoryWarehouseID = filters.ContainsKey("factoryWarhouseID") && filters["factoryWarhouseID"] != null && !string.IsNullOrEmpty(filters["factoryWarhouseID"].ToString().Trim()) ? (int?)Convert.ToInt32(filters["factoryWarhouseID"].ToString()) : null; int? productionTeamID = filters.ContainsKey("productionTeamID") && filters["productionTeamID"] != null && !string.IsNullOrEmpty(filters["productionTeamID"].ToString().Trim()) ? (int?)Convert.ToInt32(filters["productionTeamID"].ToString()) : null; string startDate = filters.ContainsKey("startDate") && filters["startDate"] != null ? filters["startDate"].ToString() : null; string endDate = filters.ContainsKey("endDate") && filters["endDate"] != null ? filters["endDate"].ToString() : null; int?companyID = null; using (InventoryRptEntities context = CreateContext()) { if (factoryWarehouseID.HasValue) { if (factoryWarehouseID.Value == 46) { totalRows = context.InventoryRpt_function_InventoryFinishProduct(companyID, factoryWarehouseID, productionTeamID, startDate, endDate).Count(); } else { totalRows = 0; } } else { if (productionTeamID.HasValue) { } } data.InventoryOverviewClient = converter.DB2DTO_InventoryOverviewClient(context.InventoryRpt_InventoryOverviewWithClient_View.ToList()); } } catch (Exception ex) { notification.Type = NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
public object GetDataWithFilters(int userID, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { totalRows = 0; notification = new Library.DTO.Notification(); notification.Type = Library.DTO.NotificationType.Success; int getTypeID = (filters.ContainsKey("getTypeSearch") && filters["getTypeSearch"] != null && !string.IsNullOrEmpty(filters["getTypeSearch"].ToString().Trim())) ? Convert.ToInt32(filters["getTypeSearch"].ToString().Trim()) : 0; DTO.SearchFormData data = new DTO.SearchFormData(getTypeID); try { using (var context = CreateContext()) { if (getTypeID == 1) { string defaultNameSearch = (filters.ContainsKey("defaultNameSearch") && filters["defaultNameSearch"] != null && !string.IsNullOrEmpty(filters["defaultNameSearch"].ToString().Trim())) ? filters["defaultNameSearch"].ToString().Trim() : null; string defaultTypeSearch = (filters.ContainsKey("defaultTypeSearch") && filters["defaultTypeSearch"] != null && !string.IsNullOrEmpty(filters["defaultTypeSearch"].ToString().Trim())) ? filters["defaultTypeSearch"].ToString().Trim() : null; string defaultUnitSearch = (filters.ContainsKey("defaultUnitSearch") && filters["defaultUnitSearch"] != null && !string.IsNullOrEmpty(filters["defaultUnitSearch"].ToString().Trim())) ? filters["defaultUnitSearch"].ToString().Trim() : null; totalRows = context.ProductBreakDownPAL_function_ProductBreakDownDefaultCategoryPALSearchResult(defaultNameSearch, defaultTypeSearch, defaultUnitSearch, orderBy, orderDirection).Count(); data.ProductBreakDownDefaultCategoryPALSearchResult = converter.DB2DTO_DefaultPALSearchResult(context.ProductBreakDownPAL_function_ProductBreakDownDefaultCategoryPALSearchResult(defaultNameSearch, defaultTypeSearch, defaultUnitSearch, orderBy, orderDirection).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } if (getTypeID == 2) { string modelSearch = (filters.ContainsKey("modelSearch") && filters["modelSearch"] != null && !string.IsNullOrEmpty(filters["modelSearch"].ToString())) ? filters["modelSearch"].ToString() : null; string clientSearch = (filters.ContainsKey("clientSearch") && filters["clientSearch"] != null && !string.IsNullOrEmpty(filters["clientSearch"].ToString())) ? filters["clientSearch"].ToString() : null; string productSearch = (filters.ContainsKey("productSearch") && filters["productSearch"] != null && !string.IsNullOrEmpty(filters["productSearch"].ToString())) ? filters["productSearch"].ToString() : null; string sampleSearch = (filters.ContainsKey("sampleSearch") && filters["sampleSearch"] != null && !string.IsNullOrEmpty(filters["sampleSearch"].ToString())) ? filters["sampleSearch"].ToString() : null; string currencySearch = (filters.ContainsKey("currencySearch") && filters["currencySearch"] != null && !string.IsNullOrEmpty(filters["currencySearch"].ToString())) ? filters["currencySearch"].ToString() : null; totalRows = context.ProductBreakDownPAL_function_ProductBreakDownPALSearchResult(clientSearch, modelSearch, productSearch, sampleSearch, currencySearch, orderBy, orderDirection).Count(); data.ProductBreakDownPALSearchResult = converter.DB2DTO_ProductBreakDownPALSearchResult(context.ProductBreakDownPAL_function_ProductBreakDownPALSearchResult(clientSearch, modelSearch, productSearch, sampleSearch, currencySearch, orderBy, orderDirection).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
public DTO.SearchFormData GetDataWithFilters(int userID, int?paymentType, int?bankAccount, string startDate, string endDate, out Library.DTO.Notification notification) { notification = new Notification(); notification.Type = NotificationType.Success; DTO.SearchFormData data = new DTO.SearchFormData(); try { using (var context = CreateContext()) { var result = context.CashBookRpt_Function_SearchResult(paymentType, bankAccount, startDate, endDate).ToList(); data.CashBookRpt_SearchResultDtos = converter.DB2DTO_SearchResults(result); data.Beginning = context.CashBookRpt_Function_GetBeginning(paymentType, bankAccount, startDate).FirstOrDefault(); } } catch (Exception ex) { notification.Type = NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
// get list Factory Sale Order public DTO.SearchFormData GetDataWithFilter(int UserId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.SearchFormData data = new DTO.SearchFormData(); data.lstFactorySalesOrder = new List <DTO.FactorySalesOrderSearchDTO>(); totalRows = 0; //try to get data try { string factorySaleOrderUD = null; string factorySaleQuotationUD = null; int? factoryRawMaterialID = null; int? factorySaleOrderStatusID = null; string postingDate = null; string expectedPaidDate = null; string documentDate = null; if (filters.ContainsKey("factorySaleOrderUD") && !string.IsNullOrEmpty(filters["factorySaleOrderUD"].ToString())) { factorySaleOrderUD = filters["factorySaleOrderUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("factorySaleQuotationUD") && !string.IsNullOrEmpty(filters["factorySaleQuotationUD"].ToString())) { factorySaleQuotationUD = filters["factorySaleQuotationUD"].ToString().Replace("'", "''"); } if (filters.ContainsKey("factoryRawMaterialID") && !string.IsNullOrEmpty(filters["factoryRawMaterialID"].ToString())) { factoryRawMaterialID = Convert.ToInt32(filters["factoryRawMaterialID"]); } if (filters.ContainsKey("factorySaleOrderStatusID") && !string.IsNullOrEmpty(filters["factorySaleOrderStatusID"].ToString())) { factorySaleOrderStatusID = Convert.ToInt32(filters["factorySaleOrderStatusID"]); } if (filters.ContainsKey("postingDate") && !string.IsNullOrEmpty(filters["postingDate"].ToString())) { postingDate = filters["postingDate"].ToString().Replace("'", "''"); } if (filters.ContainsKey("expectedPaidDate") && !string.IsNullOrEmpty(filters["expectedPaidDate"].ToString())) { expectedPaidDate = filters["expectedPaidDate"].ToString().Replace("'", "''"); } if (filters.ContainsKey("documentDate") && !string.IsNullOrEmpty(filters["documentDate"].ToString())) { documentDate = filters["documentDate"].ToString().Replace("'", "''"); } DateTime?valpostingDate = postingDate.ConvertStringToDateTime(); DateTime?valexpectedPaidDate = expectedPaidDate.ConvertStringToDateTime(); DateTime?valdocumentDate = documentDate.ConvertStringToDateTime(); using (FactorySalesOrderMngEntities context = CreateContext()) { data.lstListRawMaterial = converter.GetListRawMaterial(context.FactorySaleQuotationMng_FactorySaleQuotation_ListRawMaterial_View.ToList()); //filter List Customer by company var userInformation = _AccountMngFactory.GetUserInformation(UserId, out notification); if (data.lstListRawMaterial != null && data.lstListRawMaterial.Count > 0) { data.lstListRawMaterial = data.lstListRawMaterial.Where(x => x.CompanyID.HasValue).ToList(); if (data.lstListRawMaterial.Count > 0) { if (userInformation != null) { data.lstListRawMaterial.Where(x => x.CompanyID == userInformation.CompanyID).ToList(); } } } data.lstStatus = converter.GetListStatus(context.SupportMng_FactorySaleQuotationStatus_View.ToList()); data.lstSaleQuotation = converter.GetListFactorySaleQuotation(context.FactorySaleOrderMng_ListFactorySaleQuotion_View.ToList()); totalRows = context.FactorySaleOrderMng_function_SearchResult(factorySaleOrderUD, factoryRawMaterialID, factorySaleQuotationUD, factorySaleOrderStatusID, valpostingDate, valexpectedPaidDate, valdocumentDate, orderBy, orderDirection).Count(); var result = context.FactorySaleOrderMng_function_SearchResult(factorySaleOrderUD, factoryRawMaterialID, factorySaleQuotationUD, factorySaleOrderStatusID, valpostingDate, valexpectedPaidDate, valdocumentDate, orderBy, orderDirection); data.lstFactorySalesOrder = converter.FactorySaleOrderGetList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public DTO.SearchFormData GetDataWithFilter(int userId, System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.SearchFormData data = new DTO.SearchFormData(); data.Data = new List <DTO.ProductSearchResultDTO>(); totalRows = 0; //try to get data try { using (WEXStockOverviewRptEntities context = CreateContext()) { string ArticleCode = null; string SubEANCode = null; string Description = null; string ProductTypeNM = null; bool? NoImage = false; int? ItemSourceID = null; if (filters.ContainsKey("ArticleCode") && !string.IsNullOrEmpty(filters["ArticleCode"].ToString())) { ArticleCode = filters["ArticleCode"].ToString().Replace("'", "''"); } if (filters.ContainsKey("SubEANCode") && !string.IsNullOrEmpty(filters["SubEANCode"].ToString())) { SubEANCode = filters["SubEANCode"].ToString().Replace("'", "''"); } if (filters.ContainsKey("Description") && !string.IsNullOrEmpty(filters["Description"].ToString())) { Description = filters["Description"].ToString().Replace("'", "''"); } if (filters.ContainsKey("ProductTypeNM") && !string.IsNullOrEmpty(filters["ProductTypeNM"].ToString())) { ProductTypeNM = filters["ProductTypeNM"].ToString().Replace("'", "''"); } if (filters.ContainsKey("NoImage") && filters["NoImage"] != null && !string.IsNullOrEmpty(filters["NoImage"].ToString())) { NoImage = (filters["NoImage"].ToString() == "true") ? true : false; } if (filters.ContainsKey("ItemSourceID") && filters["ItemSourceID"] != null && !string.IsNullOrEmpty(filters["ItemSourceID"].ToString())) { ItemSourceID = Convert.ToInt32(filters["ItemSourceID"]); } totalRows = context.WEXStockOverviewRpt_function_SearchProduct(ArticleCode, SubEANCode, Description, ProductTypeNM, NoImage, ItemSourceID, orderBy, orderDirection).Count(); var result = context.WEXStockOverviewRpt_function_SearchProduct(ArticleCode, SubEANCode, Description, ProductTypeNM, NoImage, ItemSourceID, orderBy, orderDirection); //data.Data = converter.DB2DTO_ProductSearchResultList(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList()); data.Data = converter.DB2DTO_ProductSearchResultList(result.ToList()); if (!fwFactory.HasSpecialPermission(userId, Module.Framework.ConstantIdentifier.SPECIAL_PERMISSION_WEX_VVP)) { data.Data.ForEach(o => o.VVPPrice = null); } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public DTO.SearchFormData GetDataWithFilters(int userID, int?factoryWarsehouseID, int?productionTeamID, string startDate, string endDate, out Library.DTO.Notification notification) { notification = new Notification(); notification.Type = NotificationType.Success; DTO.SearchFormData data = new DTO.SearchFormData(factoryWarsehouseID.Value); try { Framework.DAL.DataFactory fwFactory = new Framework.DAL.DataFactory(); int?companyID = fwFactory.GetCompanyID(userID); int?factoryWID = (factoryWarsehouseID <= 0) ? (int?)null : factoryWarsehouseID; int?productionTID = (productionTeamID <= 0) ? (int?)null : productionTeamID; if (!factoryWID.HasValue && !productionTID.HasValue) { notification.Type = NotificationType.Error; notification.Message = "Please select one Factory Warehouse or one Production Team to search"; return(data); } using (var context = CreateContext()) { var ListFrameMaterialColor = context.FrameMaterialColorMng_FrameMaterialColor_View.ToList(); if (factoryWID.HasValue && factoryWID.Value == 46) { data.InventoryFinishProduct = converter.DB2DTO_InventoryFinishProducts(context.InventoryRpt_function_InventoryFinishProduct(companyID, factoryWID, productionTID, startDate, endDate).ToList()); data.InventoryFinishProductDetail = converter.DB2DTO_InventoryFinishProductDetail(context.InventoryRpt_function_InventoryFinishProductDetail(companyID, factoryWID, productionTID, startDate, endDate).ToList()); } else { if (factoryWID.HasValue) { data.InventoryOverview = converter.DB2DTO_SearchResults(context.InventoryOverviewRpt_function_GetInventoryWithFactoryWarehouse(factoryWID.Value, startDate, endDate).ToList()); data.InventoryOverviewDetail = converter.DB2DTO_InventoryDetail(context.InventoryOverviewDetailRpt_function_GetInventoryWithFactoryWarehouse(factoryWID.Value, startDate, endDate).ToList()); } if (productionTID.HasValue) { data.InventoryOverview = converter.DB2DTO_SearchResults(context.InventoryOverviewRpt_function_GetInventoryWithProductionTeam(productionTID.Value, startDate, endDate, companyID).ToList()); data.InventoryOverviewDetail = converter.DB2DTO_InventoryDetail(context.InventoryOverviewDetailRpt_function_GetInventoryWithProductionTeam(productionTID.Value, startDate, endDate, companyID).ToList()); } data.InventoryOverviewClient = converter.DB2DTO_InventoryOverviewClient(context.InventoryRpt_InventoryOverviewWithClient_View.ToList()); } if (factoryWID.HasValue && (factoryWID.Value == 40 || factoryWID.Value == 42 || factoryWID.Value == 66 || factoryWID.Value == 67)) { if (data.InventoryOverview != null) { foreach (var item in data.InventoryOverview) { if (item.ProductionItemTypeID == 1 && !string.IsNullOrEmpty(item.ProductionItemUD)) { var frameColorCode = ""; if (item.ProductionItemUD.LastIndexOf('-') > 0) { frameColorCode = item.ProductionItemUD.Substring(0, item.ProductionItemUD.LastIndexOf('-')); } if (frameColorCode.Length >= 8) { frameColorCode = frameColorCode.Substring(6, 2); foreach (var color in ListFrameMaterialColor) { if (frameColorCode == color.FrameMaterialColorUD) { item.FrameMaterialColorNM = color.FrameMaterialColorNM; } } } } } } } } } catch (Exception ex) { notification.Type = NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }