private void StudentsEmailAddressTutor_FormClosed(object sender, FormClosedEventArgs e) { this.Close(); MenuTutor t = (MenuTutor)this.Owner; t.Show(); }
private void button1_Click(object sender, EventArgs e) { //this.Hide(); switch (curr.getperm()) { case 2: { OTutor l = new OTutor(curr.getid(), curr.getfname(), curr.getlname(), curr.getmail()); c.Close(); MenuTutor f = new MenuTutor(c, l); this.Hide(); f.ShowDialog(this); break; } case 3: { OLecture l = new OLecture(curr.getid(), curr.getfname(), curr.getlname(), curr.getmail()); c.Close(); MenuLecturer f = new MenuLecturer(l, c); this.Hide(); f.ShowDialog(this); break; } } //OLecture l = new OLecture(curr.getid(),curr.getfname(),curr.getlname(),curr.getmail()); //c.Close(); //MenuLecturer f = new MenuLecturer(l, c); //this.Hide(); //f.ShowDialog(this); // MenuLecturer Studet_teacher_form = new MenuLecturer(); // Studet_teacher_form.ShowDialog(this); }
private void TutorSearchEmail_FormClosed(object sender, FormClosedEventArgs e) { this.Close(); MenuTutor f = (MenuTutor)this.Owner; f.Show(); }
/*this func send massege if user name empy*/ private void Login_Click(object sender, EventArgs e) { SqlConnection c = new SqlConnection(scn); if (string.IsNullOrEmpty(Usertxt.Text)) //if string empty { MessageBox.Show("Please enter your user name", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); //shoe warning Usertxt.Focus(); //focus on username box return; //end }//end click if (string.IsNullOrEmpty(txtPassword.Text)) //if string empty { MessageBox.Show("Please enter your user password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); //shoe warning Usertxt.Focus(); //focus on username box return; //end } String q = "select Users.userid,Users.permission,Users.first_name,Users.last_name,Users.Email from Users where username like '" + Usertxt.Text.ToString() + "' and Users.password like '" + txtPassword.Text + "'"; SqlDataAdapter da = new SqlDataAdapter(q, c); DataTable dt = new DataTable(); if (c.State != ConnectionState.Open) { c.Open(); } da.Fill(dt); if (dt.Rows.Count == 0) { MessageBox.Show("incorect username and password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);//shoe warning } else if (dt.Rows.Count >= 2) { MessageBox.Show("more then one account", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);//shoe warning } else { if (dt.Rows[0].Field <int>("permission") == 5) { c.Close(); //c is bussy so close c.Open(); //open to new connection. da = new SqlDataAdapter("select Year from Student where username like '" + Usertxt.Text.ToString() + "'", c); //get year DataTable dr = new DataTable(); // da.Fill(dr); OStudent s = new OStudent(dt.Rows[0].Field <int>("userid").ToString(), dt.Rows[0].Field <String>("first_name").ToString(), dt.Rows[0].Field <String>("last_name").ToString(), dt.Rows[0].Field <String>("Email").ToString(), dr.Rows[0].Field <String>("Year")[0]); c.Close(); MainStudent f = new MainStudent(s, scn); this.Hide(); f.ShowDialog(this); } if (dt.Rows[0].Field <int>("permission") == 1) { c.Close();//c is bussy so close MenuStudentCoordinator f = new MenuStudentCoordinator(scn); this.Hide(); f.ShowDialog(this); } if (dt.Rows[0].Field <int>("permission") == 3) { c.Close();//c is bussy so close OLecture l = new OLecture(dt.Rows[0].Field <int>("userid").ToString(), dt.Rows[0].Field <String>("first_name").ToString(), dt.Rows[0].Field <String>("last_name").ToString(), dt.Rows[0].Field <String>("Email").ToString()); c.Close(); MenuLecturer f = new MenuLecturer(l, c); this.Hide(); f.ShowDialog(this); } if (dt.Rows[0].Field <int>("permission") == 2) { c.Close();//c is bussy so close OTutor t = new OTutor(dt.Rows[0].Field <int>("userid").ToString(), dt.Rows[0].Field <String>("first_name").ToString(), dt.Rows[0].Field <String>("last_name").ToString(), dt.Rows[0].Field <String>("Email").ToString()); c.Close(); MenuTutor f = new MenuTutor(c, t); this.Hide(); f.ShowDialog(this); } } }