示例#1
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);
            }
        }
示例#2
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);
        }
示例#3
0
        public InitFormData GetInitData(out Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };

            InitFormData data = new InitFormData()
            {
                CashBookTypes           = new List <CashBookTypeData>(),
                CashBookSourceOfFlows   = new List <CashBookSourceOfFlowData>(),
                CashBookLocations       = new List <CashBookLocationData>(),
                CashBookPostCosts       = new List <CashBookPostCostData>(),
                CashBookCostItems       = new List <CashBookCostItemData>(),
                CashBookCostItemDetails = new List <CashBookCostItemDetailData>(),
                CashBookPaidBys         = new List <CashBookPaidByData>()
            };

            try
            {
                using (var context = CreateContext())
                {
                    data.CashBookTypes           = converter.DB2DTO_CashBookType(context.CashBookMng_CashBookType_View.ToList());
                    data.CashBookSourceOfFlows   = converter.DB2DTO_CashBookSourceOfFlow(context.CashBookMng_CashBookSourceOfFlow_View.ToList());
                    data.CashBookLocations       = converter.DB2DTO_CashBookLocation(context.CashBookMng_CashBookLocation_View.ToList());
                    data.CashBookPostCosts       = converter.DB2DTO_CashBookPostCost(context.CashBookMng_CashBookPostCost_View.ToList());
                    data.CashBookCostItems       = converter.DB2DTO_CashBookCostItem(context.CashBookMng_CashBookCostItem_View.ToList());
                    data.CashBookCostItemDetails = converter.DB2DTO_CashBookCostItemDetail(context.CashBookMng_CashBookCostItemDetail_View.ToList());
                    data.CashBookPaidBys         = converter.DB2DTO_CashBookPaidBy(context.CashBookMng_CashBookPaidBy2_View.ToList());
                }

                return(data);
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = ex.Message;
                return(data);
            }
        }
示例#4
0
        public InitFormData GetInitData(int userID, out Notification notification)
        {
            InitFormData data = new InitFormData();

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

            try
            {
                using (var context = CreateContext())
                {
                    // Get data factory warehouse
                    var employee = context.SupportMng_BaseEmployee_View.FirstOrDefault(o => o.UserID == userID);
                    if (employee != null)
                    {
                        data.FactoryWarehouses = Mapper.Map <List <InventoryCostRpt_FactoryWarehouse_View>, List <FactoryWarehouseData> >(context.InventoryCostRpt_FactoryWarehouse_View.Where(o => o.CompanyID == employee.CompanyID).ToList());
                        if (employee.BranchID.HasValue)
                        {
                            data.FactoryWarehouses = data.FactoryWarehouses.Where(o => o.BranchID == employee.BranchID).ToList();
                        }
                    }

                    // Get data production type
                    data.ProductionItemTypes = Mapper.Map <List <InventoryCostRpt_ProductionItemType_View>, List <ProductionItemTypeData> >(context.InventoryCostRpt_ProductionItemType_View.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(data);
        }