示例#1
0
 private void button5_Click_1(object sender, EventArgs e)
 {
     try
     {
         Admin_cls ad = new Admin_cls()
         {
             Q_no = Convert.ToInt32(Q_no_txt.Text)
         };
         if (comboBox1.Text == "Maths")
         {
             ad.M_Delete();
         }
         else if (comboBox1.Text == "English")
         {
             ad.E_Delete();
         }
         else
         {
             MessageBox.Show("Select in Combobox First");
         }
         MessageBox.Show("RECORD DELETED");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
示例#2
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                Admin_cls admin = new Admin_cls()
                {
                    new_Question = Ques_txt.Text,
                    a            = txt_a.Text,
                    b            = txt_b.Text,
                    c            = txt_c.Text,
                    d            = txt_d.Text,
                    Correct_ans  = txt_correct.Text,
                    Q_no         = Convert.ToInt32(Q_no_txt.Text)
                };
                if (comboBox1.Text == "Maths")
                {
                    admin.M_EDIT();
                }
                else if (comboBox1.Text == "English")
                {
                    admin.E_EDIT();
                }

                button3.Enabled = true;
                button5.Enabled = true;
                MessageBox.Show("Record Edited");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#3
0
        private void Q_no_txt_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (Q_no_txt.Text != "")
                {
                    Admin_cls b = new Admin_cls()
                    {
                        Q_no = Convert.ToInt32(Q_no_txt.Text)
                    };

                    if (comboBox1.Text == "Maths")
                    {
                        b.M_Search();     //searching Maths questions
                    }
                    else if (comboBox1.Text == "English")
                    {
                        b.E_Search();   //searching english questions
                    }



                    Ques_txt.Text    = b.new_Question;
                    txt_a.Text       = b.a;
                    txt_b.Text       = b.b;
                    txt_c.Text       = b.c;
                    txt_d.Text       = b.d;
                    txt_correct.Text = b.Correct_ans;
                    button3.Enabled  = false;
                    button4.Enabled  = true;
                    button5.Enabled  = true;
                    //  button5.Enabled = false;
                }
                else
                {
                    MessageBox.Show("Enter Question Number");
                    Ques_txt.Text    = "";
                    txt_a.Text       = "";
                    txt_b.Text       = "";
                    txt_c.Text       = "";
                    txt_d.Text       = "";
                    txt_correct.Text = "";
                    button3.Enabled  = true;
                    button4.Enabled  = false;
                    button5.Enabled  = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public int authentication()
 {
     try
     {
         if (com1_text == "ADMIN")
         {
             Admin_cls ad = new Admin_cls();
             ad.Check_admin(Convert.ToInt32(Login_ID));
             string pass = ad.Login_Pass.TrimEnd();
             if (Login_ID == ad.Login_ID && Login_Pass == pass.Trim() && com1_text == ad.Type.Trim())
             {
                 check = 1;    /// "ADMIN SUCCESSFUL";
                 return(check);
             }
             else if (Login_ID == ad.Login_ID && Login_Pass != pass.Trim() || com1_text == ad.Type.Trim())
             {
                 check = 2;      //"Admin Account Can't Accessable";
             }
             else if (Login_ID != ad.Login_ID && Login_Pass != pass.Trim() || com1_text == ad.Type.Trim())
             {
                 check = 3;
             }
         }
         else if (com1_text == "USER")
         {
             if (Login_ID.ToString() == "62908")
             {
                 check = 4;                   // "Admin could not be a User";
             }
             else if (Login_ID.ToString() != "62908")
             {
                 login_cls lg = new login_cls()
                 {
                     Login_ID   = Convert.ToInt32(Login_ID),
                     Login_Pass = Convert.ToInt32(Login_Pass),
                     Type       = com1_text,
                 };
                 lg.ADD();
                 return(check = 5);                               // MessageBox.Show("submitted");
             }
         }
     }
     catch (Exception)
     {
         return(check = 6);                                         //"invalid user password"
     }
     return(check);
 }
示例#5
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                Admin_cls admin = new Admin_cls()
                {
                    new_Question = Ques_txt.Text,
                    a            = txt_a.Text,
                    b            = txt_b.Text,
                    c            = txt_c.Text,
                    d            = txt_d.Text,
                    Correct_ans  = txt_correct.Text
                };
                if (comboBox1.Text == "Maths")
                {
                    admin.M_ADD();
                }

                else if (comboBox1.Text == "English")
                {
                    admin.E_ADD();
                }

                MessageBox.Show("Question Added");
                Ques_txt.Text    = "";
                txt_a.Text       = "";
                txt_b.Text       = "";
                txt_c.Text       = "";
                txt_d.Text       = "";
                txt_correct.Text = "";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }