private void logAdmin_Click(object sender, EventArgs e) { if (tbEmail.Text == "" || tbEmail.Text.IndexOf('@') < 1 || tbEmail.Text == "") { MessageBox.Show("Your information are either incorrect or uncomplete"); } else { CheckLogModel Model = new CheckLogModel(); Model.Email = tbEmail.Text.Trim(); Model.Password = tbPassword.Text.Trim(); foreach (IDataConnection db in GlobalConf.Connections) { if (db.CheckAdmin(Model)) { HomePageAdmin h = new HomePageAdmin(tbEmail.Text); h.ShowDialog(); } else { MessageBox.Show("You are not an Admin!"); } } } }
private void kryptonButton1_Click(object sender, EventArgs e) { if (tbEmail.Text == "" || tbEmail.Text.IndexOf('@') < 1 || tbEmail.Text.IndexOf(".com") < 1 || tbPassword.Text == "") { MessageBox.Show("Your information are either incorrect or uncomplete"); } else { CheckLogModel Model = new CheckLogModel(); Model.Email = tbEmail.Text.Trim(); Model.Password = tbPassword.Text.Trim(); foreach (IDataConnection db in GlobalConf.Connections) { if (db.CheckMember(Model)) { HomePage h = new HomePage(tbEmail.Text); h.ShowDialog(); //this.Hide(); } else { MessageBox.Show("You are not registered!"); } } } }
/// <summary> /// MEMBER LOG IN VERIFICATION /// </summary> public bool CheckAdmin(CheckLogModel Model) { using (SqlConnection connection = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { connection.Open(); string query = "SELECT* FROM tblPerson WHERE email='" + Model.Email + "' AND password='******' AND type='Admin'"; using (SqlCommand cmd = new SqlCommand(query, connection)) { using (SqlDataReader dr = cmd.ExecuteReader()) { if (!dr.Read()) { return(false); } else { return(true); } } } } }