Exemple #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            CompanyJob cj = new CompanyJob(this.Email);

            cj.Show();
            this.Hide();
        }
Exemple #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do you want to Create Account?", "Create Account", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                string email = txtEmail.Text;
                string pass  = txtPassword.Text;

                if (!VerifyEmail(email))
                {
                    MessageBox.Show("Invalid Email !!");
                }
                else
                {
                    try
                    {
                        SqlConnection con = new SqlConnection(@"Data Source = DESKTOP-1CCJE90\SAMIA; Initial Catalog = ProjectOOP2; Integrated Security = True");
                        con.Open();

                        string     query = "insert into UserTable (Email, Password, Status) values('" + email + "', '" + pass + "', '" + 0 + "');";
                        SqlCommand cmd   = new SqlCommand(query, con);
                        cmd.ExecuteNonQuery();


                        string     query2 = "insert into Company (Email) values('" + email + "');";
                        SqlCommand cmdd   = new SqlCommand(query2, con);
                        cmdd.ExecuteNonQuery();
                        con.Close();
                        MessageBox.Show("Welcome!!! Have a nice journey with us.");
                        CompanyJob form = new CompanyJob(this.txtEmail.Text);
                        form.Show();
                        this.Hide();
                    }

                    catch
                    {
                        MessageBox.Show("Please give valid input");
                    }
                }
            }
        }
Exemple #3
0
        private void btnLogIn_Click(object sender, EventArgs e)
        {

            string Email = txtEmail.Text;
            string Password = txtPassword.Text;

            using (SqlConnection con = new SqlConnection(@"Data Source = SOHAN; Initial Catalog = ProjectOOP2; Integrated Security = True"))
              {
                 con.Open();
            try
            {
                using (SqlCommand command = new SqlCommand("SELECT * FROM UserTable WHERE email = @Email", con))
                {
                    command.Parameters.Add(new SqlParameter("Email", Email));
                    SqlDataReader reader = command.ExecuteReader();

                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            if (Password.Equals(reader["password"].ToString()))
                            {
                                    if(Convert.ToInt32(reader["Status"]).Equals(0))
                                    {
                                        CompanyJob cjob = new CompanyJob(this.txtEmail.Text);
                                        cjob.Show();
                                        this.Close();
                                    }

                                    else if (Convert.ToInt32(reader["Status"]).Equals(1))
                                    {
                                        JobClient cjob = new JobClient(this.txtEmail.Text);
                                        cjob.Show();
                                        this.Close();
                                    }

                                    else
                                    {
                                        AdminJob cjob = new AdminJob(this.txtEmail.Text);
                                        cjob.Show();
                                        this.Close();
                                    }

                                }
                            else 
                                {
                                    MessageBox.Show("Password Does not Match. Try Again.");
                                }
                        }
                        else
                            {
                                MessageBox.Show("Email Does not exist.");
                            }
                    }

                }
            }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
    }