Ejemplo n.º 1
0
        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;
            int?companyID = fwFactory.GetCompanyID(userID);

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

            try
            {
                int?alertLevel         = (filters.ContainsKey("AlertLevel") && filters["AlertLevel"] != null && !string.IsNullOrEmpty(filters["AlertLevel"].ToString())) ? (int?)Convert.ToInt32(filters["AlertLevel"].ToString()) : null;
                int?factoryWarehouseID = (filters.ContainsKey("FactoryWarehouseID") && filters["FactoryWarehouseID"] != null && !string.IsNullOrEmpty(filters["FactoryWarehouseID"].ToString())) ? (int?)Convert.ToInt32(filters["FactoryWarehouseID"].ToString()) : null;
                int?materialGroupID    = (filters.ContainsKey("MaterialGroupID") && filters["MaterialGroupID"] != null && !string.IsNullOrEmpty(filters["MaterialGroupID"].ToString())) ? (int?)Convert.ToInt32(filters["MaterialGroupID"].ToString()) : null;

                using (var context = CreateContext())
                {
                    var dbItem = context.StockStatusQntRpt_function_GetDataStockStatusQnt(alertLevel, factoryWarehouseID, materialGroupID, orderBy, orderDirection).Where(o => o.CompanyID == companyID).ToList();
                    data.stockStatusQntDTOs = converter.DB2DTO_StockStatus(dbItem.ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Ejemplo n.º 2
0
        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.SearchFormDTO data = new DTO.SearchFormDTO();

            try
            {
                string season            = (filters.ContainsKey("Season") && filters["Season"] != null && !string.IsNullOrEmpty(filters["Season"].ToString())) ? filters["Season"].ToString() : null;
                int?   factoryID         = (filters.ContainsKey("FactoryID") && filters["FactoryID"] != null && !string.IsNullOrEmpty(filters["FactoryID"].ToString())) ? (int?)Convert.ToInt32(filters["FactoryID"].ToString()) : null;
                string clientUD          = (filters.ContainsKey("ClientUD") && filters["ClientUD"] != null && !string.IsNullOrEmpty(filters["ClientUD"].ToString())) ? filters["ClientUD"].ToString() : null;
                string proformaInvoiceNo = (filters.ContainsKey("ProformaInvoice") && filters["ProformaInvoice"] != null && !string.IsNullOrEmpty(filters["ProformaInvoice"].ToString())) ? filters["ProformaInvoice"].ToString() : null;

                using (var context = CreateContext())
                {
                    var dbItem = context.ProductionSummaryRpt_function_GetDataProductionSummary(factoryID, season, clientUD, proformaInvoiceNo);
                    data.ProductionSummaries = converter.DB2DTO_ProductionSummary(dbItem.ToList());

                    var dbItemDetail = context.ProductionSummaryRpt_function_GetDataProductionSummaryDetail(factoryID, season, clientUD, proformaInvoiceNo);
                    data.ProductionSummaryDetails = converter.DB2DTO_ProductionSummaryDetail(dbItemDetail.ToList());

                    var dbWorkCenter = context.ProductionSummaryRpt_WorkCenter_View.Take(4);
                    data.WorkCenters = converter.DB2DTO_WorkCenter(dbWorkCenter.ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
Ejemplo n.º 3
0
        public DTO.SearchFormDTO GetDataWithFilter(int userID, Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;

            totalRows = 0;

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

            int?   productionTeamID      = null;
            string clientUD              = null;
            string proformaInvoiceNo     = null;
            string modelUD               = null;
            string modelNM               = null;
            string workOrderUD           = null;
            int?   workOrderStatusID     = null;
            string productionItemTypeIDs = null;

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

                if (filters.ContainsKey("productionTeamID") && filters["productionTeamID"] != null)
                {
                    productionTeamID = Convert.ToInt32(filters["productionTeamID"]);
                }

                if (filters.ContainsKey("clientUD") && filters["clientUD"] != null)
                {
                    clientUD = filters["clientUD"].ToString();
                }

                if (filters.ContainsKey("proformaInvoiceNo") && filters["proformaInvoiceNo"] != null)
                {
                    proformaInvoiceNo = filters["proformaInvoiceNo"].ToString();
                }

                if (filters.ContainsKey("modelUD") && filters["modelUD"] != null)
                {
                    modelUD = filters["modelUD"].ToString();
                }

                if (filters.ContainsKey("modelNM") && filters["modelNM"] != null)
                {
                    modelNM = filters["modelNM"].ToString();
                }

                if (filters.ContainsKey("workOrderUD") && filters["workOrderUD"] != null)
                {
                    workOrderUD = filters["workOrderUD"].ToString();
                }

                if (filters.ContainsKey("workOrderStatusID") && filters["workOrderStatusID"] != null)
                {
                    workOrderStatusID = Convert.ToInt32(filters["workOrderStatusID"]);
                }

                if (filters.ContainsKey("productionItemTypeIDs") && filters["productionItemTypeIDs"] != null)
                {
                    productionItemTypeIDs = filters["productionItemTypeIDs"].ToString();
                }

                using (var context = CreateContext())
                {
                    totalRows = context.OutsourceRpt_function_GetWorkOrder(productionTeamID, clientUD, proformaInvoiceNo, modelUD, modelNM, workOrderUD, workOrderStatusID, productionItemTypeIDs, companyID).Count();
                    data.OutsourceWorkOrder = AutoMapper.Mapper.Map <List <OutsourceRpt_WorkOrder_View>, List <DTO.OutsourceWorkOrderDTO> >(context.OutsourceRpt_function_GetWorkOrder(productionTeamID, clientUD, proformaInvoiceNo, modelUD, modelNM, workOrderUD, workOrderStatusID, productionItemTypeIDs, companyID).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }