예제 #1
0
        public DTO.BookingMng.InitFormData GetInitData(out Library.DTO.Notification notification)
        {
            DTO.BookingMng.InitFormData data = new DTO.BookingMng.InitFormData();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            data.Seasons   = new List <DTO.Support.Season>();
            data.Clients   = new List <DTO.Support.Client>();
            data.Suppliers = new List <DTO.Support.Supplier>();

            try
            {
                data.Seasons   = supportFactory.GetSeason().ToList();
                data.Clients   = supportFactory.GetClient().ToList();
                data.Suppliers = supportFactory.GetSupplier().ToList();
            }
            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);
        }
예제 #2
0
        public DTO.WarehouseCIMng.DataContainer GetDataContainer(int id, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DAL.Support.DataFactory factory = new Support.DataFactory();
            //try to get data
            try
            {
                using (WarehouseCIMngEntities context = CreateContext())
                {
                    DTO.WarehouseCIMng.DataContainer dtoItem = new DTO.WarehouseCIMng.DataContainer();

                    if (id > 0)
                    {
                        WarehouseCIMng_WarehouseCI_View dbItem;
                        dbItem = context.WarehouseCIMng_WarehouseCI_View
                                 .Include("WarehouseCIMng_WarehouseCIDetail_View")
                                 .Include("WarehouseCIMng_WarehouseCIExtDetail_View")
                                 .FirstOrDefault(o => o.WarehouseCIID == id);
                        DTO.WarehouseCIMng.WarehouseCI WarehouseCIDTO = converter.DB2DTO_WarehouseCI(dbItem);
                        dtoItem.WarehouseCIData = WarehouseCIDTO;
                    }
                    else
                    {
                        dtoItem.WarehouseCIData = new DTO.WarehouseCIMng.WarehouseCI();
                        dtoItem.WarehouseCIData.WarehouseCIDetails    = new List <DTO.WarehouseCIMng.WarehouseCIDetail>();
                        dtoItem.WarehouseCIData.WarehouseCIExtDetails = new List <DTO.WarehouseCIMng.WarehouseCIExtDetail>();
                    }

                    dtoItem.Clients    = factory.GetClient().ToList();
                    dtoItem.Currency   = factory.GetCurrency().ToList();
                    dtoItem.WareHouses = factory.GetWareHouse().ToList();
                    //dtoItem.TurnOverLedgerAccount = factory.T
                    return(dtoItem);
                }
            }
            catch (Exception ex)
            {
                notification = new Library.DTO.Notification()
                {
                    Message = ex.Message, Type = Library.DTO.NotificationType.Warning
                };
                return(new DTO.WarehouseCIMng.DataContainer());
            }
        }
예제 #3
0
        public DTO.DDCMng.EditFormData GetData(int id, string season, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.DDCMng.EditFormData data = new DTO.DDCMng.EditFormData();
            data.Data         = new DTO.DDCMng.DDC();
            data.Data.Details = new List <DTO.DDCMng.DDCDetail>();

            //try to get data
            try
            {
                using (DDCMngEntities context = CreateContext())
                {
                    if (id <= 0)
                    {
                        data.Data.Season = season;
                        foreach (DTO.Support.Client dtoClient in supportFactory.GetClient())
                        {
                            data.Data.Details.Add(new DTO.DDCMng.DDCDetail()
                            {
                                ClientID = dtoClient.ClientID, ClientUD = dtoClient.ClientUD, ClientNM = dtoClient.ClientNM
                            });
                        }
                    }
                    else
                    {
                        data.Data = converter.DB2DTO_DDC(context.DDCMng_DDC_View.FirstOrDefault(o => o.DDCID == id));
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }