Example #1
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);
        }
Example #2
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());
            }
        }
Example #3
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);
        }
Example #4
0
        public DTO.InitDataDefaultPricePurchase GetInitDataDefaultPrice(int userID, out Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;

            DTO.InitDataDefaultPricePurchase data = new DTO.InitDataDefaultPricePurchase();
            data.SubSuppliers      = new List <DTO.SupportFactoryRawMaterialDTO>();
            data.FactoryWarehouses = new List <Support.DTO.FactoryWarehouseDto>();
            data.StatusDefaults    = new List <Support.DTO.YesNo>();

            try
            {
                int?companyID = fwFactory.GetCompanyID(userID);
                data.FactoryWarehouses = supportFactory.GetFactoryWarehouse(companyID);
                data.StatusDefaults    = supportFactory.GetYesNo();

                using (var context = CreatContext())
                {
                    data.SubSuppliers = converter.DB2DTO_GetFactoryRawMaterial(context.PurchaseQoutationMng_GetFactoryRawMaterial_View.ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Example #5
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);
            }
        }
Example #6
0
        public DTO.InitForm GetInit(int userID, out Library.DTO.Notification notification)
        {
            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            DTO.InitForm            data           = new DTO.InitForm();
            Support.DAL.DataFactory supportFactory = new Support.DAL.DataFactory();

            Framework.DAL.DataFactory frameworkFactory = new Framework.DAL.DataFactory();
            int?companyID = frameworkFactory.GetCompanyID(userID);

            data.SupportWorkCenter       = supportFactory.GetWorkCenter();
            data.SupportProductionTeam   = supportFactory.GetProductionTeam(companyID);
            data.SupportFactoryWarehouse = supportFactory.GetFactoryWarehouse(companyID);

            return(data);
        }