Exemplo n.º 1
0
 public AddPort(User loggedUser, int serverId, int port)
 {
     try
     {
         var session = DidYouFall.MvcApplication.SessionFactory.GetCurrentSession();
         Validations.Inputs   vldInput = new Validations.Inputs();
         Validations.DataBase vldDb    = new Validations.DataBase();
         vldInput.Port(port);
         vldDb.ServerOwner(loggedUser, serverId);
         var server = loggedUser.Servers.Where(i => i.Id == serverId).FirstOrDefault();
         if (!server.Ports.Contains(port))
         {
             server.Ports.Add(port);
         }
         session.Save(server);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
 public void Setup(string email, string password1, string password2, string name, string company)
 {
     try
     {
         User = new User {
             Email = email, Name = name, Company = company, Password = ToolBox.Encryption.MD5(password1)
         };
         Validations.Inputs   vldInpt = new Validations.Inputs();
         Validations.DataBase vldDb   = new Validations.DataBase();
         vldInpt.EmailString(email);
         vldInpt.PasswordString(password1, password2);
         vldDb.RegisteredEmail(email);
     }
     catch (Exception ex)
     {
         Error = ex.Message;
         User  = new User {
             Email = email, Name = name, Company = company
         };
         throw;
     }
 }
Exemplo n.º 3
0
 public void Setup(string name, string IP, string contactemail, Times verificationtime, User loggedUser)
 {
     try
     {
         Validations.Inputs   vldInpt = new Validations.Inputs();
         Validations.DataBase vldDb   = new Validations.DataBase();
         vldInpt.IPString(IP);
         vldInpt.EmailString(contactemail);
         vldDb.RegisteredIPOnUser(IP, loggedUser);
         Server = new Server {
             Name = name, IP = IP, CheckTime = verificationtime, Contactemail = contactemail, User = loggedUser
         };
     }
     catch (Exception ex)
     {
         Error   = ex.Message;
         Success = false;
         Server  = new Server {
             Name = name, CheckTime = verificationtime, Contactemail = contactemail
         };
         throw;
     }
 }