public ActionResult View(int DeviceId)
        {
            this._provider = new UsersConfigurationService(DomainSession.GetAlarmConfigForContextWithDeviceId(this.HttpContext, DeviceId));
            AlarmSystemUserConfigModel model = new AlarmSystemUserConfigModel(this._provider.GetAll());

            return(View(model));
        }
 public AlarmUsersConfigViewModel(IAlarmConfigManager manager, IRegionManager regionManager)
 {
     Config              = new ObservableCollection <sconnUser>();
     this._manager       = (AlarmSystemConfigManager)manager;
     this._provider      = new UsersConfigurationService(_manager);
     this._regionManager = regionManager;
     GetData();
 }
        public ActionResult Edit(int Id)
        {
            AlarmSystemUserAddModel model = new AlarmSystemUserAddModel();

            this._provider = new UsersConfigurationService(DomainSession.GetAlarmConfigForContextSession(this.HttpContext));
            model.User     = _provider.GetById(Id);
            return(View(model));
        }
        public ActionResult Remove(int Id)
        {
            this._provider = new UsersConfigurationService(DomainSession.GetAlarmConfigForContextSession(this.HttpContext));
            AlarmSystemUserConfigModel model = new AlarmSystemUserConfigModel(_provider.GetAll());
            bool remRes = _provider.RemoveById(Id);

            model.Result = StatusResponseGenerator.GetStatusResponseResultForReturnParam(remRes);
            return(View(model));
        }
        public ActionResult Remove(sconnUser Rcpt)
        {
            AlarmSystemUserAddModel model = new AlarmSystemUserAddModel();

            this._provider = new UsersConfigurationService(DomainSession.GetAlarmConfigForContextSession(this.HttpContext));
            var remRes = this._provider.Remove(Rcpt);

            model.Result = StatusResponseGenerator.GetStatusResponseResultForReturnParam(remRes);
            return(View(model));
        }
        public ActionResult Search(string key)
        {
            this._provider = new UsersConfigurationService(DomainSession.GetAlarmConfigForContextSession(this.HttpContext));
            AlarmSystemUserConfigModel model = new AlarmSystemUserConfigModel(_provider.GetAll());

            if (!String.IsNullOrEmpty(key))
            {
                model.Users = model.Users.Where(d => d.Login.Contains(key)).ToList();
            }
            return(View(model));
        }
 public async Task <ActionResult> Add(AlarmSystemUserAddModel model)
 {
     try
     {
         this._provider = new UsersConfigurationService(DomainSession.GetAlarmConfigForContextSession(this.HttpContext));
         if (ModelState.IsValid)
         {
             var res = (_provider.Add(model.User));
             model.Result = StatusResponseGenerator.GetStatusResponseResultForReturnParam(res);
         }
     }
     catch (Exception e)
     {
         model.Result = StatusResponseGenerator.GetRequestResponseCriticalError();
     }
     return(View(model));
 }
Exemplo n.º 8
0
        public static IAlarmSystemConfigurationService <T> GetAlarmService <T>()
        {
            AlarmSystemConfigManager man = FakeAlarmServiceFactory.GetAlarmConfigManager();

            man.RemoteDevice = GetFakeAlarmDevice();

            IAlarmSystemConfigurationService <T> service;
            var type = typeof(T);

            if (typeof(T) == typeof(sconnAlarmZone))
            {
                service = new ZoneConfigurationService(man) as IAlarmSystemConfigurationService <T>;
            }
            else if (typeof(T) == typeof(sconnUser))
            {
                service = new UsersConfigurationService(man) as IAlarmSystemConfigurationService <T>;
            }
            else if (typeof(T) == typeof(sconnGsmRcpt))
            {
                service = new GsmConfigurationService(man) as IAlarmSystemConfigurationService <T>;
            }
            else if (typeof(T) == typeof(sconnAuthorizedDevice))
            {
                service = new AuthorizedDevicesConfigurationService(man) as IAlarmSystemConfigurationService <T>;
            }
            else
            {
                service = null;
            }
            if (service != null)
            {
                service.Online = false; //Disable online config sync for testing
            }

            return(service);
        }
 public AlarmUsersConfigViewModel()
 {
     _name          = "Users";
     this._provider = new UsersConfigurationService(_manager);
 }