Exemplo n.º 1
0
        public AdminForm(User user, UserActivity activity)
        {
            InitializeComponent();

            users       = dbProcessor.GetUsers();
            Activity    = activity;
            CurrentUser = user;

            AddColumnsForDG();
            AddToDataGrid(users);
            SetBox();

            FontsProjects();
            Fonts();
        }
Exemplo n.º 2
0
 private void Login(string userName, string password)
 {
     if (dbProcessor.Login(userName, password))
     {
         Form         form        = new Form();
         int          role        = processor.GetUserRole(userName);
         User         currentUser = processor.GetUsers().FirstOrDefault(x => x.EmailAddress == userName);
         UserActivity activity    = new UserActivity();
         activity.LoginTime = DateTime.Now.TimeOfDay;
         activity.UserId    = currentUser.Id;
         if (role == 1)
         {
             form = new AdminForm(currentUser, activity);
         }
         if (role == 2)
         {
             form = new UserForm(currentUser, activity);
         }
         this.Hide();
         form.Show();
     }
     else
     {
         uncorrectLoginTimes++;
         if (uncorrectLoginTimes > 3)
         {
             uncorrectLoginTimes  = 0;
             secondsLabel.Visible = true;
             loginButton.Enabled  = false;
             timer1.Enabled       = true;
             timer1.Start();
         }
     }
 }