Esempio n. 1
0
 public ServiceCallResult <IEnumerable <ApplicationAttributeViewModel> > GetApplicationAttributeViews()
 {
     try
     {
         var data       = _dbrepository.GetApplicationAttributes();
         var viewModels = new List <ApplicationAttributeViewModel>();
         foreach (var d in data)
         {
             viewModels.Add(Mappers <ApplicationAttribute, ApplicationAttributeViewModel> .MapToViewModel(d));
         }
         return(ServiceCallResult <IEnumerable <ApplicationAttributeViewModel> > .CreateSuccessResult(String.Format(UserMessageResource.GetListSuccess, FieldNamesResource.RequestView), viewModels.OrderBy(o => o.Id)));
     }
     catch (Exception ex)
     {
         return(ServiceCallResult <IEnumerable <ApplicationAttributeViewModel> > .CreateErrorResult(String.Format(UserMessageResource.GetListError, FieldNamesResource.RequestView) + " " + ex.Message, new List <ApplicationAttributeViewModel>()));
     }
 }
Esempio n. 2
0
        public ServiceCallResult <DropDownDataViewModel> GetDropDownData()
        {
            try
            {
                var vm   = new DropDownDataViewModel();
                var apps = _dbrepository.GetAppNames();
                vm.AppNames = new List <AppNameViewModel>();
                foreach (var a in apps)
                {
                    vm.AppNames.Add(Mappers <Application, AppNameViewModel> .MapToViewModel(a));
                }

                var regions = _dbrepository.GetRegions();
                vm.Regions = new List <RegionViewModel>();
                foreach (var r in regions)
                {
                    vm.Regions.Add(Mappers <Region, RegionViewModel> .MapToViewModel(r));
                }

                var sbus = _dbrepository.GetSBUs();
                vm.SBUs = new List <SBUViewModel>();
                foreach (var s in sbus)
                {
                    vm.SBUs.Add(Mappers <SBU, SBUViewModel> .MapToViewModel(s));
                }

                var owningsites = _dbrepository.GetOwningSites();
                vm.OwningSites = new List <OwningSiteViewModel>();
                foreach (var o in owningsites)
                {
                    vm.OwningSites.Add(Mappers <OwningSite, OwningSiteViewModel> .MapToViewModel(o));
                }


                var booleanDropDowns = _dbrepository.GetBooleanDropDowns();
                vm.BooleanDropDowns = new List <BooleanDropDownViewModel>();
                foreach (var b in booleanDropDowns)
                {
                    vm.BooleanDropDowns.Add(Mappers <BooleanDropDown, BooleanDropDownViewModel> .MapToViewModel(b));
                }
                var developmentTeams = _dbrepository.GetDevelopmentTeams();
                vm.DevelopmentTeams = new List <DevelopmentTeamViewModel>();
                foreach (var d in developmentTeams)
                {
                    vm.DevelopmentTeams.Add(Mappers <DevelopmentTeam, DevelopmentTeamViewModel> .MapToViewModel(d));
                }
                var gateStatuses = _dbrepository.GetGateStatuses();
                vm.GateStatuses = new List <GateStatusViewModel>();
                foreach (var g in gateStatuses)
                {
                    vm.GateStatuses.Add(Mappers <GateStatus, GateStatusViewModel> .MapToViewModel(g));
                }
                var gates = _dbrepository.GetGates();
                vm.Gates = new List <GateViewModel>();
                foreach (var g in gates)
                {
                    vm.Gates.Add(Mappers <Gate, GateViewModel> .MapToViewModel(g));
                }

                var owningStreams = _dbrepository.GetOwningStreams();
                vm.OwningStreams = new List <OwningStreamViewModel>();
                foreach (var o in owningStreams)
                {
                    vm.OwningStreams.Add(Mappers <OwningStream, OwningStreamViewModel> .MapToViewModel(o));
                }
                var impactedStreams = _dbrepository.GetImpactedStreams();
                vm.ImpactedStreams = new List <ImpactedStreamViewModel>();
                foreach (var i in impactedStreams)
                {
                    vm.ImpactedStreams.Add(Mappers <ImpactedStream, ImpactedStreamViewModel> .MapToViewModel(i));
                }
                var modules = _dbrepository.GetModules();
                vm.Modules = new List <ModuleViewModel>();
                foreach (var m in modules)
                {
                    vm.Modules.Add(Mappers <Module, ModuleViewModel> .MapToViewModel(m));
                }
                var oraclePreProdEnvironments = _dbrepository.GetOraclePreProdEnvironments();
                vm.OraclePreProdEnvironments = new List <OraclePreProdEnvironmentViewModel>();
                foreach (var o in oraclePreProdEnvironments)
                {
                    vm.OraclePreProdEnvironments.Add(Mappers <OraclePreProdEnvironment, OraclePreProdEnvironmentViewModel> .MapToViewModel(o));
                }
                var statuses = _dbrepository.GetStatuses();
                vm.Statuses = new List <StatusViewModel>();
                foreach (var s in statuses)
                {
                    vm.Statuses.Add(Mappers <Status, StatusViewModel> .MapToViewModel(s));
                }
                var applicationAttributes = _dbrepository.GetApplicationAttributes();
                vm.ApplicationAttributes = new List <ApplicationAttributeViewModel>();
                foreach (var s in applicationAttributes)
                {
                    vm.ApplicationAttributes.Add(Mappers <ApplicationAttribute, ApplicationAttributeViewModel> .MapToViewModel(s));
                }

                return(ServiceCallResult <DropDownDataViewModel> .CreateSuccessResult(String.Format(UserMessageResource.GetListSuccess, FieldNamesResource.RequestView), vm));
            }
            catch (Exception ex)
            {
                return(ServiceCallResult <DropDownDataViewModel> .CreateErrorResult(String.Format(UserMessageResource.GetListError, FieldNamesResource.RequestView) + " " + ex.Message, new DropDownDataViewModel()));
            }
        }