Exemplo n.º 1
0
        private void PopolaCboTemplate(DropDownList drop)
        {
            TrackManagement2PageManager ObjTrackManagement2PageManager = new TrackManagement2PageManager();
            List <Template>             LstTemplate;

            LstTemplate = ObjTrackManagement2PageManager.GetTemplate().Where(x => x.disabled == false).ToList();
            if (LstTemplate != null)
            {
                foreach (Template Curr in LstTemplate)
                {
                    var listItem = new ListItem();
                    listItem.Value = Curr.id.ToString();
                    listItem.Text  = Curr.description;
                    drop.Items.Add(listItem);
                }
            }
            drop.Items.Add(new ListItem("--Select template--", "0"));
            Utility.SetDropByValue(drop, "0");
        }
        private List <TemplateDTO> LoadList()
        {
            TrackManagement2PageManager ObjTrackManagement2PageManager = new TrackManagement2PageManager();
            //List<TemplateDTO> LstTemplate;
            List <Template> LstTemplate = new List <Template>();

            LstTemplate = ObjTrackManagement2PageManager.GetTemplate();


            List <TemplateDTO> LstTemplateDto = new List <TemplateDTO>();
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Template, TemplateDTO>()
                .ForMember(dest => dest.enabled, opt => opt.MapFrom(src => (((bool)src.disabled) ? "NO" : "YES")));
            });

            IMapper mapper = config.CreateMapper();

            LstTemplateDto = mapper.Map <List <Template>, List <TemplateDTO> >(LstTemplate);

            return(LstTemplateDto);
        }