|
Jizzax politexnika instituti
|
bet | 18/102 | Sana | 30.05.2024 | Hajmi | 20,04 Mb. | | #257711 |
Bog'liq AKT fanidan LOBARATORIYA uslubiy ko\'rsatmaRegistratsiya bo’limi
string email;
email = Convert.ToString(textBox5.Text);
int l = email.Length;
if ( textBox1.Text == string.Empty || textBox2.Text == string.Empty || textBox3.Text == string.Empty || textBox3.Text == string.Empty ||
textBox4.Text == string.Empty || textBox5.Text == string.Empty || textBox6.Text == string.Empty)
{
MessageBox.Show("iltimos ma'lumotlarni to'ldiring");
}
if (l<=18)
{
MessageBox.Show("@mail 18 ta belgidan kam bo'lmasligi kerak ");
}
else if (email[l-1] == 'm' && email[l - 2] == 'o' && email[l - 3] == 'c' && email[l - 4] == '.'
&& email[l - 5] == 'l' && email[l - 6] == 'i' && email[l - 7] == 'a' && email[l - 8] == 'm'
&& email[l - 9] == '@')
{ SqlConnection con = new SqlConnection(@"server=DESKTOP-SOLAQLH\SQLEXPRESS;database=magazin;Integrated Security =true");
SqlCommand h = new SqlCommand("SELECT * FROM reg2 WHERE login=@login", con);
con.Open();
h.Parameters.AddWithValue("@login", textBox5.Text);
SqlDataReader dr = h.ExecuteReader();
if (dr.HasRows)
{ MessageBox.Show("siz oldin ro'yxatdan o'tgansiz");
} else
{ con.Close();
con = new SqlConnection(@"server=DESKTOP-SOLAQLH\SQLEXPRESS;database=magazin;Integrated Security =true");
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "insert into reg2 values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "')";
cmd.ExecuteNonQuery();
textBox5.Text = "";
textBox6.Text = "";
MessageBox.Show("Siz ro'yxatdan muvofiqiyatli o'tdingiz");
con.Close();
this.Hide();
Form2 g = new Form2();
g.ShowDialog();
} }
else MessageBox.Show("Email ni to'g'ri kiriting (___.@mail.com)");
Admin bo’limi
string a, b, s;
a = Convert.ToString(textBox1.Text);
b = Convert.ToString(textBox2.Text);
s = Convert.ToString(textBox3.Text);
if (a == "AA7963645" && b=="Askarov3Shohruh@gmail.com" && s=="01998") {
this.Hide();
Form3 l = new Form3();
l.ShowDialog();
}
else MassageBox.Show("xato kiritdingiz !!!")
con.Close();
SqlConnection g = new SqlConnection(@"server=DESKTOP-SOLAQLH\SQLEXPRESS;database=magazin;Integrated Security =true");
g.Open();
SqlCommand cmd = g.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "delete from kompyuter where nomi='" + textBox1.Text + "'";
cmd.ExecuteNonQuery();
komp(); g.Close();
MessageBox.Show("ma'lumot o'chdi");
if (comboBox1.Text=="nomi"){
con.Close();
SqlConnection g = new SqlConnection(@"server=DESKTOP-SOLAQLH\SQLEXPRESS;database=magazin;Integrated Security =true");
g.Open(); SqlCommand cmd = g.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "update kompyuter set nomi='"+textBox2.Text+"' where nomi='"+textBox1.Text+"'";
cmd.ExecuteNonQuery();
komp(); g.Close(); MessageBox.Show("malumot o'zgardi");
|
| |