示例#1
0
 public bool Remove(sconnUser device)
 {
     try
     {
         if (Online)
         {
             // 'Remove' clears static record instead - replace with new empty record with the same Id
             sconnUser stub = new sconnUser {
                 Id = device.Id
             };
             this.Update(stub);
             return(SaveChanges());
         }
         else
         {
             this.ConfigManager.Config.UserConfig.Users.Remove(device);
             return(true);
         }
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(false);
     }
 }
示例#2
0
 public bool Update(sconnUser rcpt)
 {
     try
     {
         ConfigManager.Config.UserConfig.Users
         .Where(z => z.Id == rcpt.Id)
         .ToList()
         .ForEach(x =>
         {
             x.Login        = rcpt.Login;
             x.Password     = rcpt.Password;
             x.Enabled      = rcpt.Enabled;
             x.Group        = rcpt.Group;
             x.Permissions  = rcpt.Permissions;
             x.AllowedFrom  = rcpt.AllowedFrom;
             x.AllowedUntil = rcpt.AllowedUntil;
         }
                  );
         return(SaveChanges());
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(false);
     }
 }
        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));
        }
示例#4
0
 public bool Add(sconnUser device)
 {
     try
     {
         ConfigManager.Config.UserConfig.Users.Add(device);
         return(true);    //no adding -  filled with empty objects
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(false);
     }
 }
示例#5
0
 public sconnUser GetById(int Id)
 {
     try
     {
         if (Online)
         {
             EntityManager.Download();
         }
         sconnUser dev = ConfigManager.Config.UserConfig.Users.FirstOrDefault(d => d.Id == Id);
         return(dev);
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(null);
     }
 }
示例#6
0
 public bool RemoveById(int Id)
 {
     try
     {
         sconnUser dev = this.GetById(Id);
         if (dev != null)
         {
             return(this.Remove(dev));
         }
         return(false);
     }
     catch (Exception e)
     {
         _logger.Error(e, e.Message);
         return(false);
     }
 }
示例#7
0
 public AlarmSystemUserAddModel(sconnUser user)
 {
     this.User = user;
 }