Beispiel #1
0
        private void enterBtn_Click_1(object sender, EventArgs e)
        {
            connection.Open();

            SqlCommand    sqlCommand = new SqlCommand("Select * from businessOwner", connection);
            SqlDataReader sqlData    = sqlCommand.ExecuteReader();


            int sayac = 0;

            while (sayac == owners.Count)
            {
                BusinessOwner businessOwner = new BusinessOwner();

                while (sqlData.Read())
                {
                    businessOwner.name         = sqlData["Ad"].ToString();
                    businessOwner.surname      = sqlData["Soyad"].ToString();
                    businessOwner.password     = sqlData["Sifre"].ToString();
                    businessOwner.businessName = sqlData["Kulup Adi"].ToString();
                    businessOwner.eMail        = sqlData["eMail"].ToString();
                    owners.Add(businessOwner);
                    break;
                }
                sayac++;
            }


            connection.Close();
            foreach (BusinessOwner o in owners)
            {
                if ((eMailTextBox.Text.ToString() == o.eMail.Trim()) && (passwordTextBox.Text == o.password.Trim()))
                {
                    if (remindMeChck.CheckState == CheckState.Checked)
                    {
                        Properties.Settings.Default.Username = eMailTextBox.Text;
                        Properties.Settings.Default.Password = passwordTextBox.Text;
                        Properties.Settings.Default.remme    = true;
                        Properties.Settings.Default.Save();
                    }
                    else
                    {
                        Properties.Settings.Default.Username = "";
                        Properties.Settings.Default.Password = "";
                        Properties.Settings.Default.remme    = false;
                        Properties.Settings.Default.Save();
                    }
                    Form mainMenu = new MainMenu();
                    mainMenu.Show();
                    this.Hide();
                    break;
                }
                else
                {
                    MessageBox.Show("E Mail veya şifre Yanlış");
                    break;
                }
            }
        }
Beispiel #2
0
        private void signUpBtn_Click(object sender, EventArgs e)
        {
            BusinessOwner businessOwner = new BusinessOwner();

            if (passwordBox.Text == passAgainBox.Text)
            {
                businessOwner.businessName = businessNameBox.Text;
                businessOwner.eMail        = eMailBox.Text;
                businessOwner.name         = nameBox.Text;
                businessOwner.surname      = surnameBox.Text;
                businessOwner.password     = passwordBox.Text;

                connection.Open();
                SqlCommand signUp = new SqlCommand("insert into businessOwner(Ad, Soyad, [Kulup Adi], eMail, Sifre) values (@Ad, @Soyad, @KulupAdi, @eMail, @Sifre)", connection);
                signUp.Parameters.AddWithValue("@Ad", businessOwner.name);
                signUp.Parameters.AddWithValue("@Soyad", businessOwner.surname);
                signUp.Parameters.AddWithValue("@eMail", businessOwner.eMail);
                signUp.Parameters.AddWithValue("@KulupAdi", businessOwner.businessName);
                signUp.Parameters.AddWithValue("@Sifre", businessOwner.password);

                this.Validate();
                this.membersBindingSource.EndEdit();
                this.tableAdapterManager.UpdateAll(this.databaseDataSet);

                signUp.ExecuteNonQuery();
                connection.Close();

                Form entry = new Form1();
                entry.Show();
                this.Hide();
            }
            else
            {
                passNotSameLbl.Visible = true;
            }
        }