Пример #1
0
        //
        // GET: /ClientProfileGroup/Create

        public ActionResult Create()
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ClientProfileGroupVM clientProfileGroupVM = new ClientProfileGroupVM();

            //GDS List
            GDSRepository gDSRepository = new GDSRepository();
            SelectList    gDSs          = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName");

            clientProfileGroupVM.GDSs = gDSs;

            //BackOfficeSystem List removing 'All' option
            BackOfficeSystemRepository backOfficeSystemRepository = new BackOfficeSystemRepository();
            SelectList backOffices = new SelectList(backOfficeSystemRepository.GetAllBackOfficeSystems().ToList(), "BackOfficeSytemId", "BackOfficeSystemDescription");

            clientProfileGroupVM.BackOffices = backOffices;

            //Hierarchy List
            TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository();
            SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName");

            clientProfileGroupVM.HierarchyTypes = hierarchyTypesList;

            ClientProfileGroup ClientProfileGroup = new ClientProfileGroup();

            clientProfileGroupVM.ClientProfileGroup = ClientProfileGroup;

            return(View(clientProfileGroupVM));
        }
        // GET: /GDSEndWarningConfiguration/Edit
        public ActionResult Edit(int id)
        {
            //Get Item From Database
            GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration();

            gdsEndWarningConfiguration = gdsEndWarningConfigurationRepository.GetGroup(id);

            //Check Exists
            if (gdsEndWarningConfiguration == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }
            //Check Access
            if (!rolesRepository.HasWriteAccessToGDSEndWarningConfiguration())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            GDSEndWarningConfigurationVM gdsEndWarningConfigurationVM = new GDSEndWarningConfigurationVM();

            gdsEndWarningConfigurationVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration;

            //GDS List
            GDSRepository gDSRepository = new GDSRepository();
            SelectList    gDSs          = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName", gdsEndWarningConfiguration.GDSCode);

            gdsEndWarningConfigurationVM.GDSs = gDSs;

            //GDSEndWarningBehaviorTypes
            GDSEndWarningBehaviorTypeRepository gdsEndWarningBehaviorTypeRepository = new GDSEndWarningBehaviorTypeRepository();
            SelectList gdsEndWarningBehaviorTypes = new SelectList(gdsEndWarningBehaviorTypeRepository.GetAllGDSEndWarningBehaviorTypes().ToList(), "GDSEndWarningBehaviorTypeId", "GDSEndWarningBehaviorTypeDescription", gdsEndWarningConfiguration.GDSEndWarningBehaviorTypeId);

            gdsEndWarningConfigurationVM.GDSEndWarningBehaviorTypes = gdsEndWarningBehaviorTypes;

            //Automated Commands
            if (gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands == null ||
                (gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands != null && gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands.Count < 1))
            {
                List <AutomatedCommand> automatedCommands = new List <AutomatedCommand>();
                AutomatedCommand        automatedCommand  = new AutomatedCommand()
                {
                    CommandExecutionSequenceNumber = 1
                };
                automatedCommands.Add(automatedCommand);
                ViewData["AutomatedCommands"] = automatedCommands;
            }
            else
            {
                ViewData["AutomatedCommands"] = gdsEndWarningConfigurationVM.GDSEndWarningConfiguration.AutomatedCommands;
            }

            ViewData["WarningMessage"] = gdsEndWarningConfiguration.IdentifyingWarningMessage;

            return(View(gdsEndWarningConfigurationVM));
        }
        //
        // GET: /ClientProfileAdminGroup/Create

        public ActionResult Create()
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ClientProfileAdminGroupVM clientProfileAdminGroupVM = new ClientProfileAdminGroupVM();

            //GDS List
            GDSRepository gDSRepository = new GDSRepository();
            SelectList    gDSs          = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName");

            clientProfileAdminGroupVM.GDSs = gDSs;

            //BackOfficeSystem List

            //Only show All option if user has a global role
            string adminUserGuid = System.Web.HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            //if adminUserGuid is global
            RolesRepository            rolesRepository            = new RolesRepository();
            BackOfficeSystemRepository backOfficeSystemRepository = new BackOfficeSystemRepository();

            if (rolesRepository.HasWriteAccessToGroupHierarchyLevel(groupName, "Global"))
            {
                SelectList backOffices = new SelectList(backOfficeSystemRepository.GetAllBackOfficeSystems().ToList(), "BackOfficeSytemId", "BackOfficeSystemDescription");
                clientProfileAdminGroupVM.BackOffices = backOffices;
            }
            else
            {
                SelectList backOffices = new SelectList(backOfficeSystemRepository.GetBackOfficeSystemsExceptAll().ToList(), "BackOfficeSytemId", "BackOfficeSystemDescription");
                clientProfileAdminGroupVM.BackOffices = backOffices;
            }


            //Hierarchy List
            TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository();
            SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName");

            clientProfileAdminGroupVM.HierarchyTypes = hierarchyTypesList;

            ClientProfileAdminGroup clientProfileAdminGroup = new ClientProfileAdminGroup();

            clientProfileAdminGroupVM.ClientProfileAdminGroup = clientProfileAdminGroup;

            return(View(clientProfileAdminGroupVM));
        }
        //
        // GET: /GDSEndWarningConfiguration/Create

        public ActionResult Create()
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            GDSEndWarningConfigurationVM gdsEndWarningConfigurationVM = new GDSEndWarningConfigurationVM();

            //GDS List
            GDSRepository gDSRepository = new GDSRepository();
            SelectList    gDSs          = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName");

            gdsEndWarningConfigurationVM.GDSs = gDSs;

            //GDSEndWarningBehaviorTypes
            GDSEndWarningBehaviorTypeRepository gdsEndWarningBehaviorTypeRepository = new GDSEndWarningBehaviorTypeRepository();
            SelectList gdsEndWarningBehaviorTypes = new SelectList(gdsEndWarningBehaviorTypeRepository.GetAllGDSEndWarningBehaviorTypes().ToList(), "GDSEndWarningBehaviorTypeId", "GDSEndWarningBehaviorTypeDescription");

            gdsEndWarningConfigurationVM.GDSEndWarningBehaviorTypes = gdsEndWarningBehaviorTypes;

            //Automated Commands
            List <AutomatedCommand> automatedCommands = new List <AutomatedCommand>();
            AutomatedCommand        automatedCommand  = new AutomatedCommand();

            automatedCommands.Add(automatedCommand);
            gdsEndWarningConfigurationVM.AutomatedCommands = automatedCommands;

            GDSEndWarningConfiguration gdsEndWarningConfiguration = new GDSEndWarningConfiguration();

            gdsEndWarningConfigurationVM.GDSEndWarningConfiguration = gdsEndWarningConfiguration;

            return(View(gdsEndWarningConfigurationVM));
        }