Exemplo n.º 1
0
        private void signInButton_Click(object sender, EventArgs e)
        {
            MyTestsDataSet.TeachersDataTable teachersRows = adapter.GetData();
            foreach (var row in teachersRows)
            {
                if (row["Login"].ToString() == usernameBox.Text && row["Password"].ToString() == passwordBox.Text)
                {
                    TeacherPanelForm teacherPanelForm = new TeacherPanelForm(Convert.ToInt32(row["ID_teacher"]));
                    Close();
                    teacherPanelForm.Show();
                    return;
                }
            }

            if (MessageBox.Show("Such user is not registered. Start registration?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                SignUpForm signUpForm = new SignUpForm(this);
                signUpForm.usernameBox.Text = usernameBox.Text;
                if (signUpForm.ShowDialog() == DialogResult.OK)
                {
                    usernameBox.Text = (string)adapter.GetData()[adapter.GetData().Count - 1]["Login"];
                    passwordBox.Text = (string)adapter.GetData()[adapter.GetData().Count - 1]["Password"];
                    signInButton_Click(null, null);
                }
            }
        }
Exemplo n.º 2
0
        public OpenTestForm(TeacherPanelForm parent)
        {
            InitializeComponent();
            this.parent = parent;
            Connection  = testsTableAdapter.Connection;
            Connection.Open();

            DataTable data = Connection.GetSchema("Tables");

            foreach (DataRow row in data.Rows)
            {
                string tableName = row["TABLE_NAME"].ToString();
                if (Regex.IsMatch(tableName, @"^\w*_" + parent.TeacherCreatorID))
                {
                    Button testButton = new Button();
                    testButton.Text   = tableName.Substring(0, tableName.IndexOf('_'));
                    testButton.Name   = tableName;
                    testButton.Left   = Left + 5;
                    testButton.Top    = Top + Controls.Count * (testButton.Height + 3);
                    testButton.Click += LoadTest;
                    Controls.Add(testButton);
                }
            }

            Connection.Close();
        }
Exemplo n.º 3
0
 public EditCommentForm(TeacherPanelForm parent)
 {
     InitializeComponent();
     this.parent     = parent;
     commentBox.Text = parent.CurrentTest.Comment;
 }
Exemplo n.º 4
0
 public NewTestNameForm(TeacherPanelForm parent)
 {
     InitializeComponent();
     this.parent = parent;
 }