Exemplo n.º 1
0
        //Selection Changed Event
        private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter userAdp = new DataSet1TableAdapters.usersTableAdapter();

            DataRowView row = dataGrid1.SelectedItem as DataRowView;

            try
            {
                if (row.Row["userId"] != null)
                {
                    int oo = int.Parse(row.Row["userId"].ToString());

                    DataTable dt = userAdp.GetSecLoginId(oo);

                    this.userName.Text = dt.Rows[0]["userName"].ToString();
                    this.userPass.Text = dt.Rows[0]["userPass"].ToString();
                    this.FName.Text    = row.Row[2].ToString();

                    this.LName.Text = row.Row[3].ToString();
                }
            }
            catch (System.Exception)
            {
            }
        }
Exemplo n.º 2
0
        private void addSt_Click(object sender, RoutedEventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter    userAdp = new DataSet1TableAdapters.usersTableAdapter();
            DataSet1TableAdapters.studentsTableAdapter stAdp   = new DataSet1TableAdapters.studentsTableAdapter();
            userAdp.addUser(userName.Text, userPass.Text, userType.Text);
            int?id = (int?)userAdp.getUserID(userName.Text);

            stAdp.addStudent(id, FName.Text, LName.Text);
        }
Exemplo n.º 3
0
        private void editSecretary_Click(object sender, RoutedEventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter       userAdo = new DataSet1TableAdapters.usersTableAdapter();
            DataSet1TableAdapters.secretariesTableAdapter secAdp  = new DataSet1TableAdapters.secretariesTableAdapter();
            int?id = (int?)userAdo.getUserID(userName.Text);

            secAdp.UpdateSec(FName.Text, LName.Text, (int)id);
            MessageBox.Show("modified successfully");
            updateSec();
        }
Exemplo n.º 4
0
        private void editTeacher_Click(object sender, RoutedEventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter    userAdo = new DataSet1TableAdapters.usersTableAdapter();
            DataSet1TableAdapters.trainersTableAdapter traAdp  = new DataSet1TableAdapters.trainersTableAdapter();
            int?id = (int?)userAdo.getUserID(userName.Text);

            traAdp.UpdateTrainer(FName.Text, LName.Text, Class.Text, (int)id);
            MessageBox.Show("modified successfully");
            updateTr();
        }
Exemplo n.º 5
0
        private void deleteTeacher_Click(object sender, RoutedEventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter    userAdo = new DataSet1TableAdapters.usersTableAdapter();
            DataSet1TableAdapters.trainersTableAdapter traAdp  = new DataSet1TableAdapters.trainersTableAdapter();
            int?id = (int?)userAdo.getUserID(userName.Text);

            traAdp.DeleteTrainer(id);
            userAdo.DeleteUser((int)id);
            MessageBox.Show("Deleted successfully");
            updateTr();
        }
Exemplo n.º 6
0
        private void editStudent_Click(object sender, RoutedEventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter    userAdo = new DataSet1TableAdapters.usersTableAdapter();
            DataSet1TableAdapters.studentsTableAdapter stAdp   = new DataSet1TableAdapters.studentsTableAdapter();
            int?id = (int?)userAdo.getUserID(userName.Text);

            stAdp.UpdateStudent(FName.Text, LName.Text, Class.Text, (int)id);
            MessageBox.Show("modified successfully");
            updateCsRecords();
            updateFBRecords();
            updateJee();
        }
Exemplo n.º 7
0
        private void deleteStudent_Click_1(object sender, RoutedEventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter    userAdo = new DataSet1TableAdapters.usersTableAdapter();
            DataSet1TableAdapters.studentsTableAdapter stAdp   = new DataSet1TableAdapters.studentsTableAdapter();
            int?id = (int?)userAdo.getUserID(userName.Text);

            stAdp.DeleteStudent(id);
            userAdo.DeleteUser((int)id);
            MessageBox.Show("Deleted successfully");
            updateCsRecords();
            updateFBRecords();
            updateJee();
        }
Exemplo n.º 8
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBoxPass.Text == textBoxPassConfirm.Text)
     {
         DataSet1TableAdapters.usersTableAdapter ada = new DataSet1TableAdapters.usersTableAdapter();
         ada.InsertQueryNewUser(textBoxUserName.Text, textBoxPass.Text);
         MessageBox.Show("Registration Complete!");
         Close();
     }
     else
     {
         MessageBox.Show("Passwords Did Not Match!");
     }
 }
Exemplo n.º 9
0
        private void loginBtn_Click(object sender, RoutedEventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter userAdp = new DataSet1TableAdapters.usersTableAdapter();
            DataTable dt = userAdp.GetDataByLogin(userName.Text, userPass.Text);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["userType"].Equals("admin"))
                {
                    Admin admin = new Admin();
                    admin.Show();
                    this.Hide();
                    admin.Closed += (s, args) => this.Close();
                    admin.Show();
                }
                else if (dt.Rows[0]["userType"].Equals("student"))
                {
                    Student student = new Student();
                    student.Show();
                    this.Hide();
                    student.Closed += (s, args) => this.Close();
                    student.Show();
                }
                else if (dt.Rows[0]["userType"].Equals("trainer"))
                {
                    Trainer trainer = new Trainer();
                    trainer.Show();
                    this.Hide();
                    trainer.Closed += (s, args) => this.Close();
                    trainer.Show();
                }
                else
                {
                    Secretary secretary = new Secretary();
                    secretary.Show();
                    this.Hide();
                    secretary.Closed += (s, args) => this.Close();
                    secretary.Show();
                }
            }
            else
            {
                MessageBox.Show("Some or all of your entries are incorrect, try again");
                return;
            }
        }
Exemplo n.º 10
0
        //Implemented buttons

        private void addSecretary_Click_1(object sender, RoutedEventArgs e)
        {
            if (userName.Text == string.Empty || userPass.Text == string.Empty || FName.Text == string.Empty || LName.Text == string.Empty)
            {
                MessageBox.Show("Something missing, please retry");
                return;
            }
            else
            {
                DataSet1TableAdapters.usersTableAdapter       userAdp = new DataSet1TableAdapters.usersTableAdapter();
                DataSet1TableAdapters.secretariesTableAdapter secAdp  = new DataSet1TableAdapters.secretariesTableAdapter();
                userAdp.addUser(userName.Text, userPass.Text, "secretary");
                int?id = (int?)userAdp.getUserID(userName.Text);
                secAdp.addSecretary(id, FName.Text, LName.Text);
                MessageBox.Show("Added successfully");
            }
            updateSec();
        }
Exemplo n.º 11
0
        //Implemented Buttons

        private void addTeacher_Click(object sender, RoutedEventArgs e)
        {
            if (userName.Text == string.Empty || userPass.Text == string.Empty || FName.Text == string.Empty || LName.Text == string.Empty || Class.Text == string.Empty)
            {
                MessageBox.Show("Something missing, please retry");
                return;
            }
            else
            {
                DataSet1TableAdapters.usersTableAdapter    userAdp = new DataSet1TableAdapters.usersTableAdapter();
                DataSet1TableAdapters.trainersTableAdapter trAdp   = new DataSet1TableAdapters.trainersTableAdapter();
                userAdp.addUser(userName.Text, userPass.Text, "trainer");
                int?id = (int?)userAdp.getUserID(userName.Text);
                trAdp.addTrainer(id, FName.Text, LName.Text, Class.Text);
                MessageBox.Show("Added successfully");
            }
            updateTr();
        }
Exemplo n.º 12
0
 //Implemented Buttons
 private void addStudent_Click(object sender, RoutedEventArgs e)
 {
     if (userName.Text == string.Empty || userPass.Text == string.Empty || FName.Text == string.Empty || LName.Text == string.Empty || Class.Text == string.Empty)
     {
         MessageBox.Show("Something missing, please retry");
         return;
     }
     else
     {
         DataSet1TableAdapters.usersTableAdapter    userAdp = new DataSet1TableAdapters.usersTableAdapter();
         DataSet1TableAdapters.studentsTableAdapter stAdp   = new DataSet1TableAdapters.studentsTableAdapter();
         userAdp.addUser(userName.Text, userPass.Text, "student");
         int?id = (int?)userAdp.getUserID(userName.Text);
         stAdp.AddStudent(id, FName.Text, LName.Text, Class.Text);
         MessageBox.Show("Added successfully");
     }
     updateCsRecords();
     updateFBRecords();
     updateJee();
 }
Exemplo n.º 13
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            DataSet1TableAdapters.usersTableAdapter userAda = new DataSet1TableAdapters.usersTableAdapter();
            DataTable dt = userAda.GetDataByUserAndPass(metroTextBoxUser.Text, metroTextBoxPassword.Text);

            if (dt.Rows.Count <= 0)
            {
                //failed login
                MessageBox.Show("Login Unsuccessful");
                loginFlag = false;
            }
            else
            {
                //valid login
                MessageBox.Show("Login Successful");
                UserID    = int.Parse(dt.Rows[0]["UserID"].ToString());
                loginFlag = true;

                this.Hide();
            }
        }