public DTO.InitFormData GetInitData(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData data = new DTO.InitFormData(); data.UserGroups = new List <Support.DTO.UserGroup>(); data.Employees = new List <DTO.NotYetMappedEmployee>(); //try to get data try { data.UserGroups = supportFactory.GetUserGroup().ToList(); using (User2MngEntities context = CreateContext()) { data.Employees = converter.DB2DTO_NotYetMappedEmployeeList(context.User2Mng_NotYetMappedEmployee_View.ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public object GetInitData(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification(); notification.Type = Library.DTO.NotificationType.Success; DTO.InitFormData data = new DTO.InitFormData(); try { using (var context = CreateContext()) { data.BifaCities = converter.DB2DTO_SupportBifaCities(context.BifaCompanyMng_SupportBifaCity_View.ToList()); data.BifaIndustries = converter.DB2DTO_SupportBifaIndustries(context.BifaCompanyMng_SupportBifaIndustry_View.ToList()); data.BifaClubs = converter.DB2DTO_SupportBifaClubs(context.BifaCompanyMng_SupportBifaClub_View.ToList()); data.BifaPhoneTypes = converter.DB2DTO_SupportPhoneType(context.SupportMng_BifaPhoneType_View.ToList()); data.BifaPositionGroups = converter.DB2DTO_SupportPositionGroup(context.SupportMng_BifaPositionGroup_View.ToList()); } } catch (System.Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Helper.GetInnerException(ex).Message; } return(data); }
public object GetInitData(int userID, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification(); notification.Type = Library.DTO.NotificationType.Success; DTO.InitFormData data = new DTO.InitFormData(); try { Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory(); data.SupportSeason = supportFactory.GetSeason(); data.SupportFactory = supportFactory.GetFactory(userID); using (var context = CreateContext()) { context.FactoryPlanningMng_function_AddFactoryPlanningData(); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
public object GetInitData(int userID, System.Collections.Hashtable filters, out Library.DTO.Notification notification) { 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.InitFormData data = new DTO.InitFormData(getTypeID); try { using (var context = CreateContext()) { if (getTypeID == 1) { data.SupportProductBreakDownCalculationTypePAL = converter.DB2DTO_CalculationTypePAL(context.ProductBreakDownPAL_ProductBreakDownCalculationTypePAL_View.ToList()); data.SupportProductBreakDownOptionPricePAL = converter.DB2DTO_OptionPricePAL(context.ProductBreakDownPAL_OptionToGetPricePAL_View.ToList()); data.SupportProductBreakDownOptionQuantityPAL = converter.DB2DTO_OptionQuantityPAL(context.ProductBreakDownPAL_OptionToGetQuantityPAL_View.ToList()); } if (getTypeID == 2) { } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
public DTO.InitFormData GetInitData(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData data = new DTO.InitFormData(); data.Seasons = new List <Support.DTO.Season>(); data.Factories = new List <Support.DTO.Factory>(); data.SampleProductStatuses = new List <Support.DTO.SampleProductStatus>(); data.SampleOrderStatuses = new List <Support.DTO.SampleOrderStatus>(); //try to get data try { data.Seasons = supportFactory.GetSeason().ToList(); data.SampleProductStatuses = supportFactory.GetSampleProductStatus().ToList(); data.SampleOrderStatuses = supportFactory.GetSampleOrderStatus().ToList(); using (SampleOrderOverviewRptEntities context = CreateContext()) { data.Factories = converter.DB2DTO_Factory(context.SampleOrderOverviewRpt_Factory_View.ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public DTO.InitFormData GetInitData(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData data = new DTO.InitFormData(); return(data); }
public DTO.InitFormData GetInitData(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData data = new DTO.InitFormData(); data.UserGroups = new List <Support.DTO.UserGroup>(); data.Users = new List <Support.DTO.User>(); data.Offices = new List <Support.DTO.InternalCompany>(); data.Modules = new List <DTO.Module>(); //try to get data try { data.UserGroups = supportFactory.GetUserGroup().ToList(); data.Users = supportFactory.GetUsers().ToList(); data.Offices = supportFactory.GetInternalCompany().ToList(); using (PermissionOverviewRptEntities context = CreateContext()) { data.Modules = converter.DB2DTO_Module(context.PermissionOverviewRpt_Module_View.ToList()); // decorate permission list int index = 1; foreach (DTO.Module module in data.Modules.Where(o => o.ParentID == 0).OrderBy(o => o.DisplayOrder)) { module.DisplayOrder = index; module.IsParent = true; index++; foreach (DTO.Module subModule in data.Modules.Where(o => o.ParentID == module.ModuleID).OrderBy(o => o.DisplayOrder)) { subModule.DisplayText = "-----" + subModule.DisplayText; subModule.DisplayOrder = index; subModule.IsParent = false; index++; } } } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public DTO.InitFormData GetInitData(int userID, int?branchID, out Notification notification) { DTO.InitFormData initData = new DTO.InitFormData(); initData.FactoryWarehouse = new List <DTO.FactoryWarehouseDTO>(); initData.ProductionTeam = new List <Support.DTO.ProductionTeam>(); notification = new Notification(); notification.Type = NotificationType.Success; try { // Declare data factory of support to get data. Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory(); // Get company of end-user. Framework.DAL.DataFactory frameworkFactory = new Framework.DAL.DataFactory(); int?companyID = frameworkFactory.GetCompanyID(userID); //initData.FactoryWarehouse = supportFactory.GetFactoryWarehouse(companyID); initData.ProductionTeam = supportFactory.GetProductionTeam(companyID); using (InventoryRptEntities context = CreateContext()) { initData.FactoryWarehouse = AutoMapper.Mapper.Map <List <InventoryRpt_FactoryWarehouse_View>, List <DTO.FactoryWarehouseDTO> >(context.InventoryRpt_FactoryWarehouse_View.Where(o => o.CompanyID == companyID).ToList()); if (branchID.HasValue) // Has branch with end-user { initData.FactoryWarehouse = initData.FactoryWarehouse.Where(o => o.BranchID == branchID).ToList(); } } } catch (Exception ex) { notification.Type = NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } } return(initData); }
public object GetInitData(int userID, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification(); notification.Type = Library.DTO.NotificationType.Success; DTO.InitFormData data = new DTO.InitFormData(); try { Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory(); data.SupportSeason = supportFactory.GetSeason(); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
// // CUSTOM FUNCTION HERE // public DTO.InitFormData GetInitData(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData data = new DTO.InitFormData(); data.supportProductionItemGroupSearchViews = new List <SupportProductionItemGroupSearchView>(); try { using (var context = CreateContext()) { data.supportProductionItemGroupSearchViews = converter.DB2DTO_SpProductionItemGroup(context.MRP_SupportProductionItemGroup_SearchView.ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
public DTO.InitFormData GetInitData(int userId, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData data = new DTO.InitFormData(); data.Suppliers = new List <Support.DTO.Supplier>(); try { data.Suppliers = supportFactory.GetSupplier(userId); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public DTO.InitFormData GetInitData(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData data = new DTO.InitFormData(); data.Seasons = new List <Support.DTO.Season>(); //try to get data try { data.Seasons = supportFactory.GetSeason().ToList(); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public override object GetInitData(int userId, out Notification notification) { DTO.InitFormData data = new DTO.InitFormData(); notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; try { using (ProductionStatisticsMngEntities context = CreateContext()) { var wc = context.WorkCenter.Where(o => o.IsVirtual.HasValue && o.IsVirtual.Value).ToList(); data.WorkCenterDTOs = AutoMapper.Mapper.Map <List <WorkCenter>, List <DTO.WorkCenterDTO> >(wc); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
public DTO.InitFormData GetInit(out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData result = new DTO.InitFormData(); result.Clients = new List <Support.DTO.Client>(); result.ClientPaymentMethods = new List <Support.DTO.ClientPaymentMethod>(); try { result.Clients = supportFactory.GetClient(); result.ClientPaymentMethods = supportFactory.GetClientPaymentMethod(); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(result); }
public DTO.InitFormData GetInitData(int userId, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; var data = new DTO.InitFormData { Seasons = new List <Support.DTO.Season>() }; try { data.Seasons = _supportFactory.GetSeason(); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public object GetInitData(int userID, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification(); notification.Type = Library.DTO.NotificationType.Success; DTO.InitFormData data = new DTO.InitFormData(); try { using (var context = CreateContext()) { data.SupportItemGroup = converter.DB2DTO_SupportItemGroup(context.PurchaseOrderTrackingRpt_SupportProductionItemGroup_View.ToList()); data.SupportSupplier = converter.DB2DTO_SupportSupplier(context.PurchaseOrderTrackingRpt_SupportSupplier_View.ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }
public DTO.InitFormData GetInitData(int userId, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; DTO.InitFormData data = new DTO.InitFormData(); data.Suppliers = new List <Support.DTO.Supplier>(); data.Seasons = new List <Support.DTO.Season>(); try { Task task1 = Task.Factory.StartNew(() => { data.Suppliers = supportFactory.GetSupplier(userId); }); Task task2 = Task.Factory.StartNew(() => { data.Seasons = supportFactory.GetSeason(); }); Task.WaitAll(task1, task2); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; } return(data); }
public object GetInitDataCustomFunction(int userID, bool canEdit, bool canRead, out Library.DTO.Notification notification) { // Refered coding // Define notification notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; // Define init data DTO.InitFormData data = new DTO.InitFormData() { Factories = new List <Support.DTO.Factory>(), SampleOrderStatuses = new List <Support.DTO.SampleOrderStatus>(), SampleProductStatuses = new List <Support.DTO.SampleProductStatus>(), Seasons = new List <Support.DTO.Season>() }; try { data.Seasons = supportFactory.GetSeason().ToList(); data.SampleProductStatuses = supportFactory.GetSampleProductStatus().ToList(); data.SampleOrderStatuses = supportFactory.GetSampleOrderStatus().ToList(); using (var context = CreateContext()) { data.Factories = converter.DB2DTO_Factory(context.SampleOrderOverviewRpt_function_GetFactory(userID, canEdit, canRead).ToList()); } } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = Library.Helper.GetInnerException(ex).Message; } return(data); }