private void sign_in_Click(object sender, EventArgs e) { SqlCommand isExist = new SqlCommand(); isExist.CommandText = "SELECT * FROM Kullanıcı WHERE kullanıcı_adı='" + UNametextBox.Text + "' AND sifre='" + PasstextBox.Text + "';"; isExist.Connection = conn; if (conn.State == ConnectionState.Closed) { conn.Open(); } if (isExist.ExecuteScalar() != null) { SqlDataAdapter adap = new SqlDataAdapter(isExist); System.Data.DataTable tablo = new System.Data.DataTable(); adap.Fill(tablo); int adm = (int)tablo.Rows[0][2]; gsm_form yeni = new gsm_form(this, UNametextBox.Text, adm); yeni.Show(); this.Hide(); } else { UNametextBox.Clear(); PasstextBox.Clear(); MessageBox.Show("Kullanıcı Adı ya da Şifreniz Hatalı", "Giriş Hatası"); } }
private void PasstextBox_Click(object sender, EventArgs e) { PasstextBox.Clear(); PassPanel.BackColor = Color.FromArgb(100, 149, 237); PasstextBox.ForeColor = Color.FromArgb(100, 149, 237); UsernametextBox.ForeColor = Color.Black; UsernamePanel.BackColor = Color.Black; }
private void button2_Click(object sender, EventArgs e) { DataTable user = new DataTable(); //Maal Dhukaite hobe avabe user = insertQr.queryexecution("Insert into USERINFO (FirstName,LastName,UserName,MobileNo,Email,Password) values ('" + FNtextBox.Text + "','" + LNtextBox.Text + "','" + UNtextBox.Text + "','" + MobNotextBox.Text + "','" + EmailtextBox.Text + "','" + PasstextBox.Text + "')"); MessageBox.Show("User Registered Successfully"); FNtextBox.Clear(); LNtextBox.Clear(); UNtextBox.Clear(); MobNotextBox.Clear(); FNtextBox.Clear(); EmailtextBox.Clear(); PasstextBox.Clear(); }
private void Login_Button_Click(object sender, EventArgs e) { User JSON = new User(); JSON.id = IDtextBox.Text; JSON.pass = PasstextBox.Text; socket = IO.Socket("http://localhost:8005"); socket.Emit("LoginReq", JsonConvert.SerializeObject(JSON)); socket.On("LoginRes", (data) => { string message = (string)data; if (message == "success") { socket.Close(); Program.ac.MainForm = new MainForm(IDtextBox.Text, PasstextBox.Text); closeForm(this); Application.Run(Program.ac); } else { socket.Close(); MessageBox.Show("ID나 패스워드가 틀렸습니다."); IDtextBox.Clear(); PasstextBox.Clear(); } }); if (checkBox_saveData.Checked == true) { System.IO.FileStream fs = new System.IO.FileStream(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\login.dat", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite); System.IO.StreamWriter writer = new System.IO.StreamWriter(fs, System.Text.Encoding.Default); if (checkBox_AutoLogin.Checked == true) { if (flag) { writer.WriteLine("I"); } else { writer.WriteLine("T"); } writer.WriteLine(IDtextBox.Text); writer.WriteLine(PasstextBox.Text); writer.Close(); } else { writer.WriteLine("F"); writer.WriteLine(IDtextBox.Text); writer.WriteLine(PasstextBox.Text); writer.Close(); } writer.Close(); } else { if (System.IO.File.Exists(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\login.dat")) { System.IO.File.Delete(Environment.GetEnvironmentVariable("FreezerPC", EnvironmentVariableTarget.Machine) + "\\login.dat"); } } }
private void pass(object sender, EventArgs e) { PasstextBox.Clear(); }