Ejemplo n.º 1
0
        /// <summary>
        /// When the user clicks the close button the application will be terminated
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            var login = new frm_Login();

            login.Show();
            //this.Close();
        }
Ejemplo n.º 2
0
 private void btn_Login_Click(object sender, EventArgs e)
 {
     //Some of the checks before saving the data into database
     if (cmb_QuestionsID1.SelectedIndex < 0 || cmb_QuestionsID2.SelectedIndex < 0)
     {
         MessageBox.Show("Please Select Your Questions", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (txt_Question1.Text == "" || txt_Question2.Text == "")
     {
         MessageBox.Show("Please Enter Your Answers", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         /// Login table holds the record of every user if the provide information is correct a new record is added
         SQL.NonScalarQuery(@"Insert Into Login(L_Username                 ,L_Password                 ,L_PhoneNo                 ,L_Email                 ,L_Address                 ,L_Role,L_Question1                ,L_Answer1                 ,L_Question2                 ,L_Answer2)
                                         values('" + txt_Username.Text + "','" + txt_Password.Text + "','" + txt_PhoneNo.Text + "','" + txt_Emial.Text + "','" + txt_Address.Text + "','" + cmb_RoleID.SelectedValue + "'," + (cmb_QuestionsID1.SelectedIndex + 1) + ",'" + txt_Question1.Text + "'," + (cmb_QuestionsID2.SelectedIndex + 6) + ",'" + txt_Question2.Text + "')");
         // A confirmation message for the user about the registration
         MessageBox.Show("User Created Successfull", "Sucess", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
         frm_Login form = new frm_Login();
         form.Show();
     }
 }