// ==> Back to Admin Home Page
        // ==> When Back Button is clicked
        private void BackBtn_Click(object sender, EventArgs e)
        {
            mainAdminForm form = new mainAdminForm();

            this.Hide();
            form.Show();
        }
Exemplo n.º 2
0
 private void BackBtn_Click(object sender, EventArgs e)
 {
     if (errorSerchId.Visible == true || idTextBox.Text == "ID")
     {
         this.Hide();
         mainAdminForm form = new mainAdminForm();
         form.Show();
         return;
     }
     if (QuestionTextbox.Text != "Question" || OpATextBox.Text != "OptionA" ||
         OpCTextBox.Text != "OptionC" ||
         OpDTextBox.Text != "OptionD" ||
         OpBTextBox.Text != "OptionB" ||
         idTextBox.Text != "ID" || catagoryCombo.SelectedIndex != 0)
     {
         if (showMessageBox() == true)
         {
             return;
         }
         else
         {
             this.Hide();
             mainAdminForm form = new mainAdminForm();
             form.Show();
         }
     }
 }
Exemplo n.º 3
0
        // ==> Operatons occurs when InsertBtn is pressed or clicked
        // ==> Question will store in Database table questions
        private void insetBtn_Click(object sender, EventArgs e)
        {
            // If any text box field is empty show error
            if (idTextBox.Text != "ID" && QuestionTextbox.Text != "Question" && OpATextBox.Text != "OptionA" &&
                OpBTextBox.Text != "OptionB" && OpCTextBox.Text != "OptionC" &&
                OpDTextBox.Text != "OptionD" && (ARadioBtn.Checked || BRadioBtn.Checked ||
                                                 CRadioBtn.Checked || DRadioBtn.Checked))
            {
                // If catagory isn't selected show error
                if (catagoryCombo.SelectedIndex == 0)
                {
                    errorMessageLabel.Text = "Kindly select Catagory";
                    errorMessageLabel.Show();
                    return;
                }

                // else insert all input in database
                if (mysql.insertQuesinDB(idTextBox.Text, QuestionTextbox.Text, OpATextBox.Text, OpBTextBox.Text
                                         , OpCTextBox.Text, OpDTextBox.Text, catagoryCombo.Text, getCorretOption()) == true)
                {
                    MessageBox.Show("Congratulation!!!Data Inserted Successfully"
                                    , "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Hide();
                    mainAdminForm form = new mainAdminForm();
                    form.Show();
                }
                else
                {
                    // if Data Insertion in database Failed
                    // Message box shown
                    DialogResult result = MessageBox.Show("Some Error Occured!!! Try Again?"
                                                          , "Failed", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                    if (result == DialogResult.Retry)
                    {
                        // Format Form if admin try again
                        idTextBox.Text              = "ID";
                        QuestionTextbox.Text        = "Question";
                        OpATextBox.Text             = "OptionA";
                        OpBTextBox.Text             = "OptionB";
                        OpCTextBox.Text             = "OptionC";
                        OpDTextBox.Text             = "OptionD";
                        catagoryCombo.SelectedIndex = 0;
                    }
                    // Back to admin Panel
                    else
                    {
                        this.Hide();
                        mainAdminForm form = new mainAdminForm();
                        form.Show();
                    }
                }
            }
            else
            {
                errorMessageLabel.Text = "Kindly fill all the fields";
                errorMessageLabel.Show();
                return;
            }
        }
Exemplo n.º 4
0
        private void cancelBtn_Click(object sender, EventArgs e)
        {
            if (QuestionTextbox.Text != "Question" || OpATextBox.Text != "OptionA" ||
                OpCTextBox.Text != "OptionC" ||
                OpDTextBox.Text != "OptionD" ||
                OpBTextBox.Text != "OptionB" ||
                catagoryCombo.SelectedIndex != 0)
            {
                if (showMessageBox() == true)
                {
                    return;
                }
            }
            this.Hide();
            mainAdminForm form = new mainAdminForm();

            form.Show();
        }
Exemplo n.º 5
0
        private void updateBtn_Click(object sender, EventArgs e)
        {
            if (mysql.updateQuestionbyID(idTextBox.Text, QuestionTextbox.Text, OpATextBox.Text, OpBTextBox.Text
                                         , OpCTextBox.Text, OpDTextBox.Text, catagoryCombo.Text, getCorretOption()) == true)

            {
                MessageBox.Show("Congratulation!!!Data Updated Successfully"
                                , "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Hide();
                mainAdminForm form = new mainAdminForm();
                form.Show();
            }
            else
            {
                // if Data Deletation in database Failed
                // Message box shown
                DialogResult result = MessageBox.Show("Some Error Occured!!! Try Again?"
                                                      , "Failed", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                if (result == DialogResult.Retry)
                {
                    HideandShow();
                    reInitialize();
                    idTextBox.Text    = "ID";
                    errorSerchId.Text = "";
                    errorSerchId.Hide();
                    catagoryCombo.SelectedIndex = 0;
                    return;
                }
                // Back to admin Panel
                else
                {
                    this.Hide();
                    mainAdminForm form = new mainAdminForm();
                    form.Show();
                }
            }
        }
Exemplo n.º 6
0
        private void removeBtn_Click(object sender, EventArgs e)
        {
            // if question id is valid then specified data will be deleted
            if (mysql.removeQuestionbyID(idTextBox.Text) == true)

            {
                MessageBox.Show("Congratulation!!!Data Deleted Successfully"
                                , "Congratulation", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Hide();
                mainAdminForm form = new mainAdminForm();
                form.Show();
            }
            else
            {
                // if Data Deletation in database Failed
                // Message box shown
                DialogResult result = MessageBox.Show("Some Error Occured!!! Try Again?"
                                                      , "Failed", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);
                if (result == DialogResult.Retry)
                {
                    HideandShow();
                    reInitialize();
                    idTextBox.Text    = "ID";
                    errorSerchId.Text = "";
                    errorSerchId.Hide();
                    return;
                }
                // Back to admin Panel
                else
                {
                    this.Hide();
                    mainAdminForm form = new mainAdminForm();
                    form.Show();
                }
            }
        }