예제 #1
0
        public void InitialDataContext(LayoutBindingModel layoutBindingModel)
        {
            SearchTextBox.Text  = string.Empty;
            _layoutBindingModel = layoutBindingModel;
            _layoutBindingModel.LayoutChanged += LayoutBindingModelOnLayoutChanged;

            _protocolsViewModel           = new ProtocolsViewModel();
            DataContext                   = _protocolsViewModel;
            _protocolsViewModel.SetLayout = _layoutBindingModel.Layout;
        }
예제 #2
0
        public ActionResult UpdateADFSIntegration(
            [Bind(Exclude = "EncryptionCertificate")] AdfsIntegrationConfiguration protocol,
            [Bind(Prefix = "protocol")] AdfsIntegrationCertInputModel cert,
            bool?removeCert)
        {
            string id = "ADFSIntegration";

            if (removeCert == true)
            {
                protocol.EncryptionCertificate = null;
            }
            else if (cert.EncryptionCertificate != null)
            {
                protocol.EncryptionCertificate = cert.Cert;
            }
            else
            {
                protocol.EncryptionCertificate = this.ConfigurationRepository.AdfsIntegration.EncryptionCertificate;
            }

            if (protocol.Enabled)
            {
                if (protocol.SamlAuthenticationEnabled && protocol.EncryptionCertificate == null)
                {
                    ModelState.AddModelError("protocol.EncryptionCertificate", "EncryptionCertificate required when SamlAuthenticationEnabled is enabled.");
                }
                if (protocol.JwtAuthenticationEnabled && protocol.EncryptionCertificate == null)
                {
                    ModelState.AddModelError("protocol.EncryptionCertificate", "EncryptionCertificate required when JwtAuthenticationEnabled is enabled.");
                }
            }

            if (ModelState.IsValid)
            {
                try
                {
                    this.ConfigurationRepository.AdfsIntegration = protocol;
                    TempData["Message"] = "Update Successful";
                    return(RedirectToAction("Protocol", new { id }));
                }
                catch (ValidationException ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
                catch
                {
                    ModelState.AddModelError("", "Error updating protocol.");
                }
            }

            var vm   = new ProtocolsViewModel(this.ConfigurationRepository);
            var orig = vm.GetProtocol(id);

            return(View("ADFSIntegration", orig));
        }
        public ActionResult Protocol(string id)
        {
            var vm       = new ProtocolsViewModel(this.ConfigurationRepository);
            var protocol = vm.GetProtocol(id);

            if (protocol == null)
            {
                return(HttpNotFound());
            }
            return(View("Protocol", protocol));
        }
        public ActionResult Protocol(string id)
        {
            var vm = new ProtocolsViewModel(this.ConfigurationRepository);

            var protocol = vm.GetProtocol(id);
            if (protocol == null) return HttpNotFound();

            if (id == "ADFSIntegration")
            {
                return View("ADFSIntegration", protocol);
            }

            return View("Protocol", protocol);
        }
 public ActionResult Menu()
 {
     var pvm = new ProtocolsViewModel(ConfigurationRepository);
     var list = pvm.Protocols.Where(x => x.Enabled).ToArray();
     if (list.Length > 0)
     {
         var vm = new ChildMenuViewModel();
         vm.Items = list.Select(x =>
             new ChildMenuItem
             {
                 Controller = "Protocol",
                 Action = "Protocol",
                 Title = x.Name,
                 RouteValues = new { id = x.NameWithoutSpaces }
             }).ToArray();
         return PartialView("ChildMenu", vm);
     }
     return new EmptyResult();
 }
예제 #6
0
        public static ViewModelSection GetNewSection(ViewModels viewType, IServiceProvider _service)
        {
            ViewModelSection retView = null;

            switch (viewType)
            {
            case ViewModels.PlaneMeeting:
                retView      = new PlaneMeetingViewModel(_service);
                retView.Name = "Інформація про засідання";
                break;

            case ViewModels.Issues:
                retView      = new IssuesViewModel(_service);
                retView.Name = "Огляд протоколів";
                break;

            case ViewModels.ReqistryOfDecisions:
                retView      = new RegistryViewModel(_service);
                retView.Name = "Реєстр рішень";
                break;

            case ViewModels.Protocols:
                retView      = new ProtocolsViewModel(_service);
                retView.Name = "Перелік протоколів";
                break;

            case ViewModels.Filter:
                retView      = new FilterViewModel(_service);
                retView.Name = "Фільтр";
                break;

            case ViewModels.CreateMeeting:
                retView      = new CreateMeetingViewModel(_service);
                retView.Name = "Планування нового засідання";
                break;

            default:
                break;
            }

            return(retView);
        }
        public ActionResult Index(ProtocolsInputModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    model.Update(this.ConfigurationRepository);
                    TempData["Message"] = Resources.ProtocolController.UpdateSuccessful;
                    return RedirectToAction("Index");
                }
                catch (ValidationException ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
                catch
                {
                    ModelState.AddModelError("", Resources.ProtocolController.ErrorUpdatingProtocols);
                }
            }

            var vm = new ProtocolsViewModel(ConfigurationRepository);
            return View("Index", vm);
        }
 public ActionResult UpdateProtocol(string id)
 {
     var vm = new ProtocolsViewModel(this.ConfigurationRepository);
     var protocol = vm.GetProtocol(id);
     if (this.TryUpdateModel(protocol.Protocol, "protocol"))
     {
         try
         {
             vm.UpdateProtocol(protocol);
             TempData["Message"] = Resources.ProtocolController.UpdateSuccessful;
             return RedirectToAction("Protocol", new { id });
         }
         catch (ValidationException ex)
         {
             ModelState.AddModelError("", ex.Message);
         }
         catch
         {
             ModelState.AddModelError("", Resources.ProtocolController.ErrorUpdatingProtocol);
         }
     }
     return View("Protocol", protocol);
 }
        public ActionResult Index(ProtocolsInputModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    model.Update(this.ConfigurationRepository);
                    TempData["Message"] = "Update Successful";
                    return(RedirectToAction("Index"));
                }
                catch (ValidationException ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
                catch
                {
                    ModelState.AddModelError("", "Error updating protocols.");
                }
            }

            var vm = new ProtocolsViewModel(ConfigurationRepository);

            return(View("Index", vm));
        }
예제 #10
0
        public ActionResult Index()
        {
            var vm = new ProtocolsViewModel(ConfigurationRepository);

            return(View("Index", vm));
        }