Esempio n. 1
0
        public override EditData GetData(int id, out Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };
            EditData data = new EditData()
            {
                Data          = new PriceConfigurationDto(),
                SupportSeason = new List <Support.DTO.Season>()
            };

            try
            {
                if (id > 0)
                {
                    using (PriceConfigurationEntities context = CreateContext())
                    {
                        PriceConfiguration_PriceConfiguration_View dbItem = context.PriceConfiguration_PriceConfiguration_View.FirstOrDefault(o => o.PriceConfigurationID == id);

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

                            return(data);
                        }
                    }
                }
                else
                {
                    data.Data.PriceConfigurationDetailOfFCS           = new List <PriceConfigurationDetailDto>();
                    data.Data.PriceConfigurationDetailOfMaterialColor = new List <PriceConfigurationDetailDto>();
                    data.Data.PriceConfigurationDetailOfFrameMaterial = new List <PriceConfigurationDetailDto>();
                    data.Data.PriceConfigurationDetailOfCushionColor  = new List <PriceConfigurationDetailDto>();
                    data.Data.PriceConfigurationDetailOfPackingMethod = new List <PriceConfigurationDetailDto>();
                }

                data.SupportSeason          = supportFactory.GetSeason().ToList();
                data.SupportFSCType         = supportFactory.GetFSCType().ToList();
                data.SupportProductElement  = supportFactory.GetProductElement().ToList();
                data.SupportPackagingMethod = supportFactory.GetPackagingMethod().ToList();

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

                return(data);
            }
        }
Esempio n. 2
0
 public DTO.PriceConfigurationDto DB2DTO_Get(PriceConfiguration_PriceConfiguration_View dbItem)
 {
     return(AutoMapper.Mapper.Map <PriceConfiguration_PriceConfiguration_View, DTO.PriceConfigurationDto>(dbItem));
 }