Esempio n. 1
0
 public void Button2_Click(object sender, EventArgs e)
 {
     if (Checkname())
     {
         if (Checkinput())
         {
             try
             {
                 Register_Login_Connection registerChef = new Register_Login_Connection();
                 registerChef.InsertNewChef(regname.Text, regage.Text, reggender.Text, regemail.Text, regpassword.Text);
                 Checkemail();
                 MessageBox.Show($"Successfully register new chef -> {regname.Text}", "Successfully registered", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 regPanel.Visible = false;
                 panel1.Visible   = true;
                 chefName.Text    = null;
                 password.Text    = null;
             }
             catch (Exception)
             {
                 MessageBox.Show("Please check input", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("Please enter valid input", "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Please pick another chef name", "Chef name already exists", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 2
0
        public void CheckLoginDetails()
        {
            Register_Login_Connection test = new Register_Login_Connection();
            List <string>             list = test.CheckLoginDetails("Ivo", "123");

            Assert.That(list.Count, Is.EqualTo(3), "Some useful error message");
        }
Esempio n. 3
0
        private bool Checkname()
        {
            Register_Login_Connection checknames = new Register_Login_Connection();

            if (checknames.CheckChefName(regname.Text))
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 4
0
 public void Cook_Click(object sender, EventArgs e)
 {
     if (Checklogininput())//checking input
     {
         Register_Login_Connection login     = new Register_Login_Connection();
         List <string>             logininfo = login.CheckLoginDetails(chefName.Text, password.Text);
         if (logininfo.Count != 0)
         {
             Cokbook child = new Cokbook(chefName.Text, password.Text, logininfo[0], logininfo[1], logininfo[2]); //create new isntance of form
             child.FormClosed += new FormClosedEventHandler(Child_FormClosed);                                    //add handler to catch when child form is closed
             child.Show();                                                                                        //show child
             this.Hide();                                                                                         //hide parent
         }
         else
         {
             MessageBox.Show("Please enter correct information", "Invalid information", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }