//Prihlasenie ak užívateľ zadal správne údaje
        private void materialButton1_Click(object sender, EventArgs e)
        {
            var user = Login();

            if (user == null)
            {
                return;
            }
            else
            {
                if (materialCheckbox1.Checked == true && ConfigurationManager.AppSettings["NameToRemember"] != NameBox.Text)
                {
                    var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                    config.AppSettings.Settings.Remove("NameToRemember");
                    config.AppSettings.Settings.Remove("RememberPassword");

                    config.AppSettings.Settings.Add("NameToRemember", NameBox.Text);
                    config.AppSettings.Settings.Add("RememberPassword", "true");
                    config.Save(ConfigurationSaveMode.Minimal);
                    ConfigurationManager.RefreshSection("AppSettings");
                }
                else if (materialCheckbox1.Checked == false)
                {
                    var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                    config.AppSettings.Settings.Remove("NameToRemember");
                    config.AppSettings.Settings.Remove("RememberPassword");
                    config.AppSettings.Settings.Add("NameToRemember", string.Empty);
                    config.AppSettings.Settings.Add("RememberPassword", "false");
                    config.Save(ConfigurationSaveMode.Minimal);
                    ConfigurationManager.RefreshSection("AppSettings");
                }

                this.Hide();

                var group = new Choose_Group(user);
                group.FormClosed += (s, args) => this.Show();
                group.Show();
                user             = null;
                FirstPssBox.Text = string.Empty;
            }
        }
Example #2
0
 // Otvorenie inej skupiny v rámci skupín používateľa
 private void Open_Btn_Click(object sender, EventArgs e)
 {
     try
     {
         var          choose = new Choose_Group(currentUser);
         DialogResult result = choose.ShowDialog();
         if (result == DialogResult.Yes)
         {
             studentSkupina = choose.GetGroup();
         }
         Student_Grid.DataSource  = null;
         Activity_Grid.DataSource = null;
         GetTable();
         GetActivities();
     }
     catch (Exception ex)
     {
         Logger logger = new Logger();
         logger.LogError(ex);
     }
 }