Пример #1
0
        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);
        }
Пример #2
0
        //
        // CUSTOM
        //
        public DTO.SearchFilterData GetSearchFilter(int userId, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.SearchFilterData data = new DTO.SearchFilterData();
            //data.Companies = new List<Support.DTO.InternalCompany>();

            try
            {
                Framework.DAL.DataFactory frameworkFactory = new Framework.DAL.DataFactory();
                int?companyID = frameworkFactory.GetCompanyID(userId);

                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                data.Employees = supportFactory.GetEmployee();

                using (FactoryWarehouseEntities context = CreateContext())
                {
                    data.Branches = AutoMapper.Mapper.Map <List <FactoryWarehouseMng_Branch_View>, List <DTO.BranchDTO> >(context.FactoryWarehouseMng_Branch_View.Where(o => o.CompanyID == companyID).ToList());
                }
                //data.Companies = supportFactory.GetInternalCompany().ToList();
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
Пример #3
0
        public DTO.InitForm GetInitForm(out Library.DTO.Notification notification)
        {
            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            DTO.InitForm data = new DTO.InitForm();
            data.Countries = new List <Support.DTO.ManufacturerCountry>();

            try
            {
                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                data.Countries = supportFactory.GetManufacturerCountry();
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;

                if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                {
                    notification.DetailMessage.Add(ex.InnerException.Message);
                }
            }

            return(data);
        }
Пример #4
0
        public DTO.InitForm GetInitData(int userId, out Library.DTO.Notification notification)
        {
            DTO.InitForm              initData         = new DTO.InitForm();
            Support.DAL.DataFactory   supportFactory   = new Support.DAL.DataFactory();
            Framework.DAL.DataFactory frameworkFactory = new Framework.DAL.DataFactory();

            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            try
            {
                initData.WorkCenters = supportFactory.GetWorkCenter();

                int?companyID = frameworkFactory.GetCompanyID(userId);
                initData.ProductionTeams   = supportFactory.GetProductionTeam(companyID);
                initData.FactoryWarehouses = supportFactory.GetFactoryWarehouse(companyID);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(initData);
        }
Пример #5
0
        public object GetInitData(int userID, int branchID, out Library.DTO.Notification notification)
        {
            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;
            int?CompanyID = fwFactory.GetCompanyID(userID);

            DTO.InitFormDTO data = new DTO.InitFormDTO();

            try
            {
                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                data.ProductionItemGroups = this.GetProductionItemGroup().ToList();
                using (var context = CreateContext())
                {
                    data.FactoryWarehouseDtos = converter.DB2DTO_FactoryWarehouses(context.StockStatusQntRpt_FactoryWarehouse_View.Where(o => o.BranchID == branchID).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Пример #6
0
        public override DTO.SearchFormData GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            DTO.SearchFormData searchFormData = new DTO.SearchFormData();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();
            totalRows = 0;

            string factoryMaterialUD          = string.Empty;
            string factoryMaterialNM          = string.Empty;
            string factoryMaterialEnglishName = string.Empty;
            int?   factoryMaterialGroupID     = null;

            if (filters.ContainsKey("factoryMaterialUD"))
            {
                factoryMaterialUD = filters["factoryMaterialUD"].ToString();
            }
            if (filters.ContainsKey("factoryMaterialNM"))
            {
                factoryMaterialNM = filters["factoryMaterialNM"].ToString();
            }
            if (filters.ContainsKey("factoryMaterialEnglishName"))
            {
                factoryMaterialEnglishName = filters["factoryMaterialEnglishName"].ToString();
            }
            if (filters.ContainsKey("factoryMaterialGroupID") && filters["factoryMaterialGroupID"] != null)
            {
                factoryMaterialGroupID = Convert.ToInt32(filters["factoryMaterialGroupID"]);
            }

            try
            {
                using (FactoryMaterialEntities context = CreateContext())
                {
                    totalRows = context.FactoryMaterialMng_function_SearchFactoryMaterial(orderBy, orderDirection, factoryMaterialUD, factoryMaterialNM, factoryMaterialEnglishName, factoryMaterialGroupID).Count();
                    var result = context.FactoryMaterialMng_function_SearchFactoryMaterial(orderBy, orderDirection, factoryMaterialUD, factoryMaterialNM, factoryMaterialEnglishName, factoryMaterialGroupID);
                    searchFormData.Data = converter.DB2DTO_FactoryMaterialSearch(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());

                    foreach (var item in searchFormData.Data)
                    {
                        item.FactoryMaterialImages = converter.DB2DTO_FactoryMaterialImage(context.FactoryMaterialMng_FactoryMaterialImage_View.Where(o => o.FactoryMaterialID == item.FactoryMaterialID).ToList());
                    }
                }
                searchFormData.FactoryMaterialGroups = support_factory.GetFactoryMaterialGroup();
                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);
            }
        }
Пример #7
0
        public InitFormData GetInitData(Hashtable filters, out Notification notification)
        {
            InitFormData data = new InitFormData()
            {
                Season          = new List <Support.DTO.Season>(),
                PriceDifference = new List <Support.DTO.PriceDifference>(),
                QuotationStatus = new List <Support.DTO.QuotationStatus>()
            };

            notification = new Notification()
            {
                Type = NotificationType.Success
            };

            string season = (filters.ContainsKey("Season") && filters["Season"] != null && !string.IsNullOrEmpty(filters["Season"].ToString().Replace("'", "''"))) ? filters["Season"].ToString().Trim() : Helper.GetCurrentSeason();

            try
            {
                Support.DAL.DataFactory factory = new Support.DAL.DataFactory();

                data.Season          = factory.GetSeason();
                data.PriceDifference = factory.GetPriceDifference(season);
                data.QuotationStatus = factory.GetQuotationStatus();

                return(data);
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = ex.Message;

                return(null);
            }
        }
Пример #8
0
        public object GetInitData(int userID, out Notification notification)
        {
            DTO.EditForm data = new EditForm()
            {
                Season = new List <Support.DTO.Season>(), Factory = new List <Support.DTO.Factory>()
            };
            notification = new Notification()
            {
                Type = NotificationType.Success
            };

            try
            {
                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();

                data.Season  = supportFactory.GetSeason().ToList();
                data.Factory = supportFactory.GetFactory(userID).ToList();
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Пример #9
0
        public DTO.ReportData GetProductionSchedule(int userId, Hashtable filters, out Notification notification)
        {
            DTO.ReportData data = new DTO.ReportData();
            notification = new Library.DTO.Notification {
                Type = Library.DTO.NotificationType.Success
            };
            try
            {
                int?   workOrderID      = null;
                string workOrderUD      = null;
                int?   workCenterID     = null;;
                int?   productionTeamID = null;

                if (filters["workOrderID"] != null)
                {
                    workOrderID = Convert.ToInt32(filters["workOrderID"]);
                }
                if (filters["workOrderUD"] != null)
                {
                    workOrderUD = filters["workOrderUD"].ToString();
                }
                if (filters["workCenterID"] != null)
                {
                    workCenterID = Convert.ToInt32(filters["workCenterID"]);
                }
                if (filters["productionTeamID"] != null)
                {
                    productionTeamID = Convert.ToInt32(filters["productionTeamID"]);
                }

                Module.Support.DAL.DataFactory   support_factory = new Support.DAL.DataFactory();
                Module.Framework.DAL.DataFactory fw_factory      = new Framework.DAL.DataFactory();
                int?companyID = fw_factory.GetCompanyID(userId);

                data.WorkCenters          = support_factory.GetWorkCenter();
                data.ProductionTeams      = support_factory.GetProductionTeam(companyID);
                data.FactoryWarehouseDtos = support_factory.GetFactoryWarehouse(companyID);

                using (ProductionScheduleRptEntities context = CreateContext())
                {
                    var x = context.ProductionScheduleRpt_ProductionSchedule_View.Where(o => o.WorkOrderUD.Contains(workOrderUD == null || workOrderUD == "" ? o.WorkOrderUD : workOrderUD) &&
                                                                                        o.WorkCenterID == (workCenterID.HasValue ? workCenterID.Value : o.WorkCenterID) &&
                                                                                        o.ProductionTeamID == (productionTeamID.HasValue ? productionTeamID.Value : o.ProductionTeamID)
                                                                                        );
                    data.ProductionSchedules = converter.DB2DTO_ProductionSchedule(x.ToList());
                    return(data);
                }
            }
            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(new DTO.ReportData());
            }
        }
Пример #10
0
        public DTO.InitFormData GetInitData(int userId, out Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;

            DTO.InitFormData data = new InitFormData();
            data.SubSupplier = new List <FactoryRawMaterialDto>();
            data.Seasons     = new List <Support.DTO.Season>();

            try
            {
                Framework.DAL.DataFactory fwFactory = new Framework.DAL.DataFactory();
                int?companyID = fwFactory.GetCompanyID(userId);

                Module.Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                data.Seasons = supportFactory.GetSeason();

                using (var context = CreateContext())
                {
                    data.SubSupplier = converter.DB2DTO_GetFactoryRawMaterial(context.PurchaseOrderMng_FactoryRawMaterial_View.ToList());
                }
            }
            catch (Exception ex)
            {
                Exception ex_1 = Library.Helper.GetInnerException(ex);
                notification.Type    = NotificationType.Error;
                notification.Message = ex_1.Message;
            }

            return(data);
        }
Пример #11
0
        public DTO.InitDTO GetInitDataReport(int userId, out Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            Support.DAL.DataFactory spF  = new Support.DAL.DataFactory();
            DTO.InitDTO             data = new InitDTO();
            int?companyID = fw_factory.GetCompanyID(userId);

            try
            {
                using (var context = CreateContext())
                {
                    data.productionTeams = AutoMapper.Mapper.Map <List <SupportMng_ProductionTeam_View>, List <Support.DTO.ProductionTeam> >(context.SupportMng_ProductionTeam_View.ToList()).ToList();
                }
                data.clients = spF.GetClient().ToList();

                return(data);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
                return(data);
            }
        }
Пример #12
0
        public DTO.ReportData GetFactoryOrderProductionStatusRpt(int userId, Hashtable filters, out Notification notification)
        {
            DTO.ReportData data = new DTO.ReportData();
            notification = new Library.DTO.Notification {
                Type = Library.DTO.NotificationType.Success
            };
            try
            {
                string   workOrderUD       = null;
                string   proformaInvoiceNo = null;;
                string   clientUD          = null;
                DateTime?fromLDS           = null;
                DateTime?toLDS             = null;

                if (filters["workOrderUD"] != null)
                {
                    workOrderUD = filters["workOrderUD"].ToString();
                }
                if (filters["clientUD"] != null)
                {
                    clientUD = filters["clientUD"].ToString();
                }
                if (filters["proformaInvoiceNo"] != null)
                {
                    proformaInvoiceNo = filters["proformaInvoiceNo"].ToString();
                }
                if (filters["fromLDS"] != null && filters["fromLDS"].ToString() != "")
                {
                    fromLDS = filters["fromLDS"].ToString().ConvertStringToDateTime();
                }
                if (filters["toLDS"] != null && filters["toLDS"].ToString() != "")
                {
                    toLDS = filters["toLDS"].ToString().ConvertStringToDateTime();
                }

                Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();
                using (FactoryOrderProductionStatusRptEntities context = CreateContext())
                {
                    var x = context.FactoryOrderProductionStatusRpt_FactoryOrderProductionStatus_View.Where(o => o.WorkOrderUD.Contains(workOrderUD == null || workOrderUD == "" ? o.WorkOrderUD : workOrderUD) &&
                                                                                                            o.ClientUD.Contains(clientUD == null || clientUD == "" ? o.ClientUD : clientUD) &&
                                                                                                            o.ProformaInvoiceNo.Contains(proformaInvoiceNo == null || proformaInvoiceNo == "" ? o.ProformaInvoiceNo : proformaInvoiceNo) &&
                                                                                                            o.LDS >= (fromLDS.HasValue ? fromLDS.Value : o.LDS) &&
                                                                                                            o.LDS <= (toLDS.HasValue ? toLDS.Value : o.LDS)
                                                                                                            );
                    data.FactoryOrderProductionStatuses = converter.DB2DTO_FactoryOrderProductionStatus(x.ToList());
                    return(data);
                }
            }
            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(new DTO.ReportData());
            }
        }
Пример #13
0
        public object GetInitData(out Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;

            DTO.EditFormData data = new DTO.EditFormData();
            data.SupportSupplier = new List <Support.DTO.FactoryRawMaterialData>();
            data.SupportQualityInspectionType          = new List <DTO.QualityInspectionTypeData>();
            data.SupportQualityInspectionCorrectAction = new List <DTO.QualityInspectionCorrectActionData>();

            try
            {
                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                data.SupportSupplier = supportFactory.GetSubSupplier(out notification);

                using (var context = CreateContext())
                {
                    data.SupportQualityInspectionType          = converter.DB2DTO_QualityInspectionTypes(context.QualityInspectionRpt_QualityInspectionType_View.ToList());
                    data.SupportQualityInspectionCorrectAction = converter.DB2DTO_QualityInspectionCorrectActions(context.QualityInspectionRpt_QualityInspectionCorrectAction_View.ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Пример #14
0
        public override object GetInitData(int userId, out Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;

            InitFormDTO data = new InitFormDTO();

            try
            {
                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                data.Factories = supportFactory.GetFactory().ToList();

                using (CompanyBranchMngEntities context = CreateContext())
                {
                    data.Locations = dataConverter.DB2DTO_Location(context.CompanyBranchMng_Location_View.ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Пример #15
0
        public DTO.InitForm GetInitData(int iRequesterID, out Library.DTO.Notification notification)
        {
            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            DTO.InitForm initForm = new DTO.InitForm();
            initForm.FactoryWarehouses = new List <Support.DTO.FactoryWarehouseDto>();

            try
            {
                Framework.DAL.DataFactory fwFactory = new Framework.DAL.DataFactory();
                int?companyID = fwFactory.GetCompanyID(iRequesterID);

                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                initForm.FactoryWarehouses = supportFactory.GetFactoryWarehouse(companyID);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;

                if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message.Trim()))
                {
                    notification.DetailMessage.Add(ex.InnerException.Message);
                }
            }

            return(initForm);
        }
Пример #16
0
        public DTO.InitForm GetInitData(out Library.DTO.Notification notification)
        {
            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            DTO.InitForm initForm = new DTO.InitForm();
            initForm.Season = new List <Support.DTO.Season>();

            try
            {
                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();

                initForm.Season = supportFactory.GetSeason();
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;

                if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message))
                {
                    notification.DetailMessage.Add(ex.InnerException.Message);
                }
            }

            return(initForm);
        }
Пример #17
0
 public DTO.SupportData GetSupportData(out Library.DTO.Notification notification)
 {
     notification = new Library.DTO.Notification()
     {
         Type = Library.DTO.NotificationType.Success
     };
     DTO.SupportData supportData = new DTO.SupportData();
     try
     {
         Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();
         supportData.FactoryAreas = support_factory.GetFactoryArea();
         return(supportData);
     }
     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(supportData);
     }
 }
Пример #18
0
        public InitForm GetInitData(out Notification notification)
        {
            InitForm initForm = new InitForm();

            initForm.Seasons           = new List <Support.DTO.Season>();
            initForm.CostInvoice2Types = new List <DTO.CostInvoice2Type>();

            notification      = new Notification();
            notification.Type = NotificationType.Success;

            try
            {
                using (var context = CreateContext())
                {
                    initForm.CostInvoice2Types = converter.DB2DTO_CostInvoice2Types(context.CostInvoice2Mng_CostInvoice2Type_View.ToList());
                }

                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                initForm.Seasons = supportFactory.GetSeason();
            }
            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(initForm);
        }
Пример #19
0
        public DTO.EditFormData GetData(int userId, int id, out Library.DTO.Notification notification)
        {
            DTO.EditFormData editFormData = new DTO.EditFormData();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            try
            {
                //get companyID
                Module.Framework.DAL.DataFactory fw_factory = new Framework.DAL.DataFactory();
                int?companyID = fw_factory.GetCompanyID(userId);
                using (WarehouseTransferMngEntities context = CreateContext())
                {
                    if (id > 0)
                    {
                        WarehouseTransferMng_WarehouseTransfer_View dbItem;
                        dbItem            = context.WarehouseTransferMng_WarehouseTransfer_View.FirstOrDefault(o => o.WarehouseTransferID == id);
                        editFormData.Data = converter.DB2DTO_WarehouseTransfer(dbItem);
                        editFormData.Data.WarehouseTransferProductDTOs = new List <DTO.WarehouseTransferProductDTO>();

                        //get item from
                        List <WarehouseTransferMng_WarehouseTransferProduct_View> transferItem = context.WarehouseTransferMng_WarehouseTransferProduct_View.Where(o => o.WarehouseTransferID == id).ToList();
                        DTO.WarehouseTransferProductDTO dtoTransferItem;
                        foreach (var item in transferItem)
                        {
                            dtoTransferItem = new DTO.WarehouseTransferProductDTO();
                            dtoTransferItem.WarehouseTransferProductID = item.WarehouseTransferProductID;
                            dtoTransferItem.ProductionItemID           = item.ProductionItemID;
                            dtoTransferItem.Quantity             = item.Quantity;
                            dtoTransferItem.QNTBarCode           = item.QNTBarCode;
                            dtoTransferItem.ProductionItemUD     = item.ProductionItemUD;
                            dtoTransferItem.ProductionItemNM     = item.ProductionItemNM;
                            dtoTransferItem.ProductionItemTypeNM = item.ProductionItemTypeNM;

                            editFormData.Data.WarehouseTransferProductDTOs.Add(dtoTransferItem);
                        }
                    }
                    else
                    {
                        editFormData.Data = new DTO.WarehouseTransferDTO();
                        editFormData.Data.WarehouseTransferProductDTOs = new List <DTO.WarehouseTransferProductDTO>();
                        editFormData.Data.WarehouseTransferDetails     = new List <DTO.WarehouseTransferDetailDTO>();
                        editFormData.Data.ReceiptDate = DateTime.Now.ToString("dd/MM/yyyy");
                    }
                }
                //get support list
                Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();
                editFormData.FactoryWarehouses = support_factory.GetFactoryWarehouse(companyID);
                return(editFormData);
            }
            catch (Exception ex)
            {
                Exception iEx = Library.Helper.GetInnerException(ex);
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = iEx.Message;
                return(editFormData);
            }
        }
Пример #20
0
        public DTO.EditFormData GetData(int userId, int id, out Library.DTO.Notification notification)
        {
            DTO.EditFormData editFormData = new DTO.EditFormData();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            Module.Support.DAL.DataFactory   support_factory = new Support.DAL.DataFactory();
            Module.Framework.DAL.DataFactory fwFactory       = new Module.Framework.DAL.DataFactory();
            //Details
            editFormData.Data = new DTO.LabelingPackaging();
            editFormData.Data.LabelingPackagingDetails          = new List <DTO.LabelingPackagingDetail>();
            editFormData.Data.LabelingPackagingSparepartDetails = new List <DTO.LabelingPackagingSparepartDetail>();
            editFormData.Data.LabelingPackagingRemarks          = new List <DTO.LabelingPackagingRemark>();

            try
            {
                using (LPOverviewEntities context = CreateContext())
                {
                    if (id > 0)
                    {
                        LabelingPackagingMng_LabelingPackaging_View dbItem;
                        dbItem = context.LabelingPackagingMng_LabelingPackaging_View.FirstOrDefault(o => o.LabelingPackagingID == id);

                        //check permission on factory
                        int FactoryID = Convert.ToInt32(dbItem.FactoryID);
                        if (fwFactory.CheckFactoryPermission(userId, FactoryID) == 0)
                        {
                            throw new Exception("You do not have access permission on this factory");
                        }
                        editFormData.Data = converter.DB2DTO_LabelingPackaging(dbItem);
                    }
                    else
                    {
                        editFormData.Data = new DTO.LabelingPackaging();
                        editFormData.Data.LabelingPackagingDetails          = new List <DTO.LabelingPackagingDetail>();
                        editFormData.Data.LabelingPackagingSparepartDetails = new List <DTO.LabelingPackagingSparepartDetail>();
                        editFormData.Data.LabelingPackagingRemarks          = new List <DTO.LabelingPackagingRemark>();
                        editFormData.Data.LabelingPackagingOtherFiles       = new List <DTO.LabelingPackagingOtherFile>();
                    }
                    //editFormData.Factories = support_factory.GetFactory(userId);
                    return(editFormData);
                }
            }
            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(editFormData);
            }
        }
Пример #21
0
        public override DTO.SearchFormDataDTO GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            DTO.SearchFormDataDTO data = new DTO.SearchFormDataDTO();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;
            Module.Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();

            string factoryFinishedProductUD = string.Empty;
            string factoryFinishedProductNM = string.Empty;
            int?   factoryTeamID            = null;
            int?   factoryStepID            = null;

            if (filters.ContainsKey("factoryFinishedProductUD"))
            {
                factoryFinishedProductUD = filters["factoryFinishedProductUD"].ToString();
            }
            if (filters.ContainsKey("factoryFinishedProductNM"))
            {
                factoryFinishedProductNM = filters["factoryFinishedProductNM"].ToString();
            }
            if (filters.ContainsKey("factoryTeamID") && filters["factoryTeamID"] != null)
            {
                factoryTeamID = Convert.ToInt32(filters["factoryTeamID"].ToString());
            }
            if (filters.ContainsKey("factoryStepID") && filters["factoryStepID"] != null)
            {
                factoryStepID = Convert.ToInt32(filters["factoryStepID"].ToString());
            }

            try
            {
                using (FactoryFinishedProductEntities context = CreateContext())
                {
                    totalRows = context.FactoryFinishedProductMng_function_SearchFactoryFinishedProduct(orderBy, orderDirection, factoryFinishedProductUD, factoryFinishedProductNM, factoryTeamID, factoryStepID).Count();
                    var result = context.FactoryFinishedProductMng_function_SearchFactoryFinishedProduct(orderBy, orderDirection, factoryFinishedProductUD, factoryFinishedProductNM, factoryTeamID, factoryStepID);
                    data.Data = converter.DB2DTO_FactoryFinishedProductSearch(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
                data.FactoryTeams = supportFactory.GetFactoryTeam();
                data.FactorySteps = supportFactory.GetFactoryStep();
                return(data);
            }
            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(new DTO.SearchFormDataDTO());
            }
        }
Пример #22
0
        public override SearchFormDataDTO GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification)
        {
            DTO.SearchFormDataDTO data = new DTO.SearchFormDataDTO();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;
            Module.Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();

            string NotificationGroupUD = null;
            string NotificationGroupNM = null;
            string Description         = null;


            if (filters.ContainsKey("NotificationGroupUD") && filters["NotificationGroupUD"] != null && !string.IsNullOrEmpty(filters["NotificationGroupUD"].ToString().Trim().Replace("'", "''")))
            {
                NotificationGroupUD = filters["NotificationGroupUD"].ToString();
            }
            if (filters.ContainsKey("NotificationGroupNM") && filters["NotificationGroupNM"] != null && !string.IsNullOrEmpty(filters["NotificationGroupNM"].ToString().Trim().Replace("'", "''")))
            {
                NotificationGroupNM = filters["NotificationGroupNM"].ToString();
            }
            if (filters.ContainsKey("Description") && filters["Description"] != null && !string.IsNullOrEmpty(filters["Description"].ToString().Trim().Replace("'", "''")))
            {
                Description = filters["Description"].ToString();
            }


            try
            {
                using (var context = CreateContext())
                {
                    totalRows = context.NotificationMng_function_SearchResult(NotificationGroupUD, NotificationGroupNM, Description, orderBy, orderDirection).Count();
                    var result = context.NotificationMng_function_SearchResult(NotificationGroupUD, NotificationGroupNM, Description, orderBy, orderDirection);
                    data.Data = converter.DB2DTO_SearchResult(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
                //data.FactorySteps = supportFactory.GetFactoryStep();
                return(data);
            }
            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(new DTO.SearchFormDataDTO());
            }
        }
Пример #23
0
        public override EditData GetData(int id, out Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };

            EditData data = new EditData()
            {
                Data        = new ProductionTeamDto(),
                WorkCenters = new System.Collections.Generic.List <Support.DTO.WorkCenter>(),
                Employees   = new System.Collections.Generic.List <Support.DTO.Employee>()
            };

            try
            {
                if (id > 0)
                {
                    using (var context = this.CreateContext())
                    {
                        var item = context.ProductionTeam_ProductionTeam_View.FirstOrDefault(o => o.ProductionTeamID == id);
                        if (item == null)
                        {
                            notification = new Notification()
                            {
                                Type = NotificationType.Error, Message = "Can not find data."
                            };
                        }
                        else
                        {
                            data.Data = this.converter.DB2DTO_ProductionTeam(item);
                        }
                    }
                }
                Module.Support.DAL.DataFactory            support_factory = new Support.DAL.DataFactory();
                Module.Support.DTO.FactoryRawMaterialData support_factoryRawMaterialData = new Support.DTO.FactoryRawMaterialData();

                data.WorkCenters             = support_factory.GetWorkCenter();
                data.Employees               = support_factory.GetEmployee();
                data.factoryRawMaterialDatas = support_factory.GetSubSupplier(out notification);
            }
            catch (System.Exception ex)
            {
                notification = new Notification()
                {
                    Type = NotificationType.Error, Message = ex.Message
                };
            }

            return(data);
        }
Пример #24
0
        public object GetEditData(int userId, int purchasingCreditNoteID, int?creditNoteType, int?purchasingInvoiceID, int?supplierID, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification {
                Type = Library.DTO.NotificationType.Success
            };
            Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();

            DTO.PurchasingCreditNote dtoCreditNote = new DTO.PurchasingCreditNote();
            dtoCreditNote.PurchasingCreditNoteDetails          = new List <DTO.PurchasingCreditNoteDetail>();
            dtoCreditNote.PurchasingCreditNoteSparepartDetails = new List <DTO.PurchasingCreditNoteSparepartDetail>();
            dtoCreditNote.PurchasingCreditNoteExtendDetails    = new List <DTO.PurchasingCreditNoteExtendDetail>();

            try
            {
                if (purchasingCreditNoteID > 0)
                {
                    dtoCreditNote = factory.GetPurchasingCreditNote(userId, purchasingCreditNoteID, out notification);
                }
                else
                {
                    if (creditNoteType == 1) //FOB - CREDIT NOTE
                    {
                        DTO.PurchasingInvoice dtoInvoice = factory.GetPurchasingInvoice(userId, purchasingInvoiceID, out notification);
                        dtoCreditNote = converter.DTO2DTO_PurchasingCreditNote(dtoInvoice);
                        dtoCreditNote.CreditNoteType = creditNoteType;
                        dtoCreditNote.PurchasingCreditNoteDetails          = new List <DTO.PurchasingCreditNoteDetail>();
                        dtoCreditNote.PurchasingCreditNoteSparepartDetails = new List <DTO.PurchasingCreditNoteSparepartDetail>();
                        dtoCreditNote.PurchasingCreditNoteExtendDetails    = new List <DTO.PurchasingCreditNoteExtendDetail>();
                    }
                    else if (creditNoteType == 2) // OTHER - CREDIT NOTE
                    {
                        dtoCreditNote.CreditNoteType = creditNoteType;
                        dtoCreditNote.SupplierID     = supplierID;
                        dtoCreditNote.SupplierNM     = support_factory.GetSupplier(userId).Where(o => o.SupplierID == supplierID).FirstOrDefault().SupplierNM;
                        dtoCreditNote.Season         = Library.Helper.GetCurrentSeason();
                    }
                }
                dtoCreditNote.Seasons = support_factory.GetSeason();
                return(dtoCreditNote);
            }
            catch (Exception ex)
            {
                notification = new Library.DTO.Notification()
                {
                    Type = Library.DTO.NotificationType.Error
                };
                notification.Message = ex.Message;
                return(dtoCreditNote);
            }
        }
Пример #25
0
        public DTO.EditData Get(int id, out Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };
            DTO.EditData data = new EditData()
            {
                Data = new OPSequenceDto()
            };

            try
            {
                if (id > 0)
                {
                    using (OPSequenceEntities context = CreateContext())
                    {
                        OPSequence_OPSequence_View dbItem = context.OPSequence_OPSequence_View.FirstOrDefault(s => s.OPSequenceID == id);

                        if (dbItem == null)
                        {
                            notification = new Notification()
                            {
                                Type = NotificationType.Error, Message = "Can not find data."
                            };
                            return(data);
                        }

                        data.Data = converter.DB2DTO_Get(dbItem);
                    }
                }
                else
                {
                    data.Data.OPSequenceDetails = new List <OPSequenceDetailDto>();
                }

                Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();
                data.WorkCenters = support_factory.GetWorkCenter();
            }
            catch (Exception ex)
            {
                notification = new Notification()
                {
                    Type = NotificationType.Error, Message = ex.Message
                };
                return(data);
            }

            return(data);
        }
Пример #26
0
        public DTO.EditFormData GetData1(int userId, int id, int branchID, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.EditFormData data = new DTO.EditFormData();
            data.Data            = new DTO.FactoryWarehouse();
            data.PalletOverviews = new List <DTO.PalletOverview>();
            data.Employees       = new List <Support.DTO.Employee>();
            data.Data.FactoryWarehousePallets = new List <DTO.FactoryWarehousePallet>();
            int?eCompanyID = fwFactory.GetCompanyID(userId);

            //try to get data
            try
            {
                using (FactoryWarehouseEntities context = CreateContext())
                {
                    if (id > 0)
                    {
                        var w = context.FactoryWarehouse_FactoryWarehouse_View.FirstOrDefault(o => o.FactoryWarehouseID == id && o.CompanyID == eCompanyID);
                        if (data.Data == null)
                        {
                            throw new Exception("Can not found the profile to edit");
                        }
                        data.Data = converter.DB2DTO_FactoryWarehouse(w);
                    }

                    // Set default Branch.
                    if (data.Data.BranchID == null || data.Data.BranchID == 0)
                    {
                        data.Data.BranchID = branchID;
                    }

                    // Get support Branch.
                    data.Branches = AutoMapper.Mapper.Map <List <FactoryWarehouseMng_Branch_View>, List <DTO.BranchDTO> >(context.FactoryWarehouseMng_Branch_View.Where(o => o.CompanyID == eCompanyID).ToList());
                }
                Support.DAL.DataFactory dalSupportMng = new Support.DAL.DataFactory();
                data.Employees = dalSupportMng.GetEmployee();
            }

            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
Пример #27
0
        public DTO.EditFormData GetData(int userId, int id, out Library.DTO.Notification notification)
        {
            DTO.EditFormData editFormData = new DTO.EditFormData();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            Module.Support.DAL.DataFactory   support_factory = new Support.DAL.DataFactory();
            Module.Framework.DAL.DataFactory fwFactory       = new Module.Framework.DAL.DataFactory();
            try
            {
                using (FactoryStockReceiptEntities context = CreateContext())
                {
                    //auto create production item
                    context.FactoryStockReceiptMng_function_CreateProductionItem();
                    if (id > 0)
                    {
                        FactoryStockReceiptMng_FactoryStockReceipt_View dbItem;
                        dbItem = context.FactoryStockReceiptMng_FactoryStockReceipt_View.FirstOrDefault(o => o.FactoryStockReceiptID == id);
                        //check permission on factory
                        if (fwFactory.CheckFactoryPermission(userId, dbItem.FactoryID.Value) == 0)
                        {
                            throw new Exception("You do not have access permission on this factory");
                        }
                        editFormData.Data = converter.DB2DTO_FactoryStockReceipt(dbItem);
                    }
                    else
                    {
                        editFormData.Data = new DTO.FactoryStockReceipt();
                        editFormData.Data.FactoryStockReceiptDetails = new List <DTO.FactoryStockReceiptDetail>();
                    }
                    editFormData.Factories = support_factory.GetFactory(userId);

                    return(editFormData);
                }
            }
            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(editFormData);
            }
        }
Пример #28
0
        public DTO.ReportData GetMasterProductionScheduleRpt(int userId, Hashtable filters, out Notification notification)
        {
            DTO.ReportData data = new DTO.ReportData();
            notification = new Library.DTO.Notification {
                Type = Library.DTO.NotificationType.Success
            };
            try
            {
                string workOrderUD       = null;
                int?   workCenterID      = null;;
                string proformaInvoiceNo = null;

                if (filters["workOrderUD"] != null)
                {
                    workOrderUD = filters["workOrderUD"].ToString();
                }
                if (filters["workCenterID"] != null)
                {
                    workCenterID = Convert.ToInt32(filters["workCenterID"]);
                }
                if (filters["proformaInvoiceNo"] != null)
                {
                    proformaInvoiceNo = filters["proformaInvoiceNo"].ToString();
                }

                Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();
                data.WorkCenters = support_factory.GetWorkCenter();
                using (MasterProductionScheduleRptEntities context = CreateContext())
                {
                    var x = context.MasterProductionScheduleRpt_MasterProductionSchedule_View.Where(o => o.WorkOrderUD.Contains(workOrderUD == null || workOrderUD == "" ? o.WorkOrderUD : workOrderUD) &&
                                                                                                    o.WorkCenterID == (workCenterID.HasValue ? workCenterID.Value : o.WorkCenterID) &&
                                                                                                    o.WorkOrderUD.Contains(workOrderUD == null || workOrderUD == "" ? o.WorkOrderUD : workOrderUD));
                    data.MasterProductionSchedules = converter.DB2DTO_MasterProductionSchedule(x.ToList());
                    return(data);
                }
            }
            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(new DTO.ReportData());
            }
        }
Пример #29
0
        public override EditForm GetData(int id, out Notification notification)
        {
            EditForm editForm = new EditForm();

            editForm.CostInvoice2 = new DTO.CostInvoice2();
            editForm.CostInvoice2.CostInvoice2Clients   = new List <DTO.CostInvoice2Client>();
            editForm.CostInvoice2.CostInvoice2Factories = new List <DTO.CostInvoice2Factory>();

            // Support data
            editForm.CostInvoice2Creditors = new List <DTO.CostInvoice2Creditor>();
            editForm.CostInvoice2Types     = new List <DTO.CostInvoice2Type>();
            editForm.Currencies            = new List <Support.DTO.Currency>();
            editForm.Seasons = new List <Support.DTO.Season>();

            notification      = new Notification();
            notification.Type = NotificationType.Success;

            try
            {
                using (var context = CreateContext())
                {
                    if (id > 0)
                    {
                        editForm.CostInvoice2 = converter.DB2DTO_CostInvoice2(context.CostInvoice2Mng_CostInvoice2_View.FirstOrDefault(o => o.CostInvoice2ID == id));
                    }

                    editForm.CostInvoice2Creditors = converter.DB2DTO_CostInvoice2Creditors(context.CostInvoice2Mng_CostInvoice2Creditor_View.ToList());
                    editForm.CostInvoice2Types     = converter.DB2DTO_CostInvoice2Types(context.CostInvoice2Mng_CostInvoice2Type_View.ToList());
                }

                Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();
                editForm.Currencies = supportFactory.GetCurrency();
                editForm.Seasons    = supportFactory.GetSeason();
            }
            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(editForm);
        }
Пример #30
0
 public override DTO.EditFormData GetData(int id, out Library.DTO.Notification notification)
 {
     DTO.EditFormData editFormData = new DTO.EditFormData();
     notification = new Library.DTO.Notification()
     {
         Type = Library.DTO.NotificationType.Success
     };
     Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();
     try
     {
         using (FactoryNormEntities context = CreateContext())
         {
             if (id > 0)
             {
                 FactoryNormMng_FactoryNorm_View dbItem;
                 dbItem            = context.FactoryNormMng_FactoryNorm_View.FirstOrDefault(o => o.FactoryNormID == id);
                 editFormData.Data = converter.DB2DTO_FactoryNorm(dbItem);
             }
             else
             {
                 editFormData.Data = new DTO.FactoryNorm();
                 editFormData.Data.FactoryFinishedProductNorms = new List <DTO.FactoryFinishedProductNorm>();
                 foreach (var item in editFormData.Data.FactoryFinishedProductNorms)
                 {
                     item.FactoryMaterialNorms = new List <DTO.FactoryMaterialNorm>();
                 }
             }
             //get support list
             //editFormData.Units = support_factory.GetUnit(1);
             editFormData.FactoryGoodsProcedures = support_factory.GetFactoryGoodsProcedure();
             editFormData.MaterialGroupTypes     = support_factory.GetMaterialGroupType();
             return(editFormData);
         }
     }
     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(editFormData);
     }
 }