Example #1
0
 private void Search_qpaper_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_mysql == null)
         {
             _mysql = new MysqlClass(constring);
         }
         string query = string.Empty;
         query = "Select * from qpaper where dept='" + search_class_dept.Text + "' and sem ='" + search_sem.Text + "'";
         DataSet ds = _mysql.ExecuteQueryReturnDataset(query);
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             qpaper_grid.ItemsSource = ds.Tables[0].DefaultView;
         }
         else
         {
             MessageBox.Show("Question Paper details not found", "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         }
         _mysql.CloseConnection();
         _mysql = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
 public bool addTimeTable(string day, string time, string cls, string sem, string sub, string staffid)
 {
     try
     {
         if (_mysql == null)
         {
             _mysql = new MysqlClass(constring);
         }
         string query = "insert into timetable(day,time,course,sem,subject,staffid) values ('" + day + "','" + time + "','" + cls + "','" + sem + "','" + sub + "','" + staffid + "')";
         _mysql.Execute_query(query);
         _mysql.CloseConnection();
         _mysql = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Stop);
         return(false);
     }
     return(true);
 }
Example #3
0
 private void Search_assignment_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_mysql == null)
         {
             _mysql = new MysqlClass(constring);
         }
         string query = string.Empty;
         if (from_date.Text != string.Empty && search_class_dept.SelectedIndex != 0 && search_sem.SelectedIndex != 0)
         {
             query = "Select * from assignments where dept='" + search_class_dept.Text + "' and sem ='" + search_sem.Text + "'and start_date ='" + from_date.Text + "'";
         }
         else if (from_date.Text != string.Empty && search_class_dept.SelectedIndex == 0 && search_sem.SelectedIndex == 0)
         {
             query = "Select * from assignments where start_date='" + from_date.Text + "'";
         }
         else
         {
             query = "Select * from assignments where dept='" + search_class_dept.Text + "' and sem ='" + search_sem.Text + "'";
         }
         DataSet ds = _mysql.ExecuteQueryReturnDataset(query);
         if (ds != null && ds.Tables[0].Rows.Count > 0)
         {
             assign_grid.ItemsSource = ds.Tables[0].DefaultView;
         }
         else
         {
             MessageBox.Show("Assignments details not found", "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Exclamation);
         }
         _mysql.CloseConnection();
         _mysql = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #4
0
 private void btn_add_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string pass = getpassword();
         if (!validate())
         {
             return;
         }
         if (IsAlreadyRegistered(reg_no.Text))
         {
             MessageBox.Show("The Student record with " + reg_no.Text + " already Exists", "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Warning);
             return;
         }
         if (_mysql == null)
         {
             _mysql = new MysqlClass(constring);
         }
         string query = "insert into std_register(name,reg_no,password,dept,sem,designation,ph_no,email,address,gender,dob) values ('" + std_name.Text + "','" + reg_no.Text + "','" + pass + "','" + class_dept.Text + "','" + sem.Text + "','student','" + ph_no.Text + "','" + email.Text + "','" + address.Text + "','" + gender.Text + "','" + dob.Text + "')";
         _mysql.Execute_query(query);
         _mysql.CloseConnection();
         _mysql = null;
         bool status = emailClass.SendEmail(email.Text, Username_emailId, "Application - Registration", "Dear " + std_name.Text + "," + message1 + "Username: "******" Password: "******"Student Detail added sucessfully", "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Information);
         }
         else
         {
             if (_mysql == null)
             {
                 _mysql = new MysqlClass(constring);
             }
             string delquery = "delete from std_register where reg_no = '" + reg_no.Text + "'";
             _mysql.Execute_query(delquery);
             _mysql.CloseConnection();
             _mysql = null;
             MessageBox.Show("Check your internet connection", "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         loadgrid();
         clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
 }
Example #5
0
 private void Btn_reset_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!validate())
         {
             return;
         }
         if (_mysql == null)
         {
             _mysql = new MysqlClass(constring);
         }
         string  user     = ValidationFile._getusername;
         string  password = curr_pass.Password;
         string  query    = "Select * from login where username='******'  and password='******'";
         DataSet dataSet  = _mysql.ExecuteQueryReturnDataset(query);
         if (dataSet.Tables[0].Rows.Count > 0)
         {
             if (new_pass.Password != con_pass.Password)
             {
                 MessageBox.Show("The new password and confirm password doesn't match.", "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Error);
             }
             else
             {
                 string updatequery = "update login set password = '******' where username='******'";
                 if (change_pass(updatequery))
                 {
                     clear();
                     MessageBox.Show("The password has been changed.", "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Information);
                 }
             }
         }
         else
         {
             MessageBox.Show("The current password is invalid.", "St. Anne's Admin DashBoard", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         _mysql.CloseConnection();
         _mysql = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }