void panggilnama(String nip) { Loginpage frm1 = new Loginpage(); koneksi(); String sql = "Select * from teacher"; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { if (NIK == (String)rdr[0]) { tbNip.Text = rdr.GetString(0); tbNama.Text = rdr.GetString(1); tbUsername.Text = rdr.GetString(2); tbEmail.Text = rdr.GetString(3); tbPass.Text = rdr.GetString(4); tbNewPass.Text = ""; tbRepeat.Text = ""; tbPhone.Text = rdr.GetString(5); } } rdr.Close(); conn.Close(); }
private void button2_Click(object sender, EventArgs e) { Loginpage frm1 = new Loginpage(); if (tbNewPass.Text == "" && tbRepeat.Text == "") { koneksi(); String sql = "UPDATE teacher SET Name = '" + tbNama.Text + "', Password ='******', Phone ='" + tbPhone.Text + "' WHERE NIK = '" + NIK + "'"; MySqlCommand cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); conn.Close(); MessageBox.Show("Your account data has been successfully changed"); home = new HomepageTeacher(); home.Show(); this.Hide(); } else if (tbNewPass.Text == tbRepeat.Text) { koneksi(); String sql = "UPDATE teacher SET Name = '" + tbNama.Text + "', Password ='******', Phone ='" + tbPhone.Text + "' WHERE NIK = '" + NIK + "'"; MySqlCommand cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); conn.Close(); MessageBox.Show("Your account data has been successfully changed"); home = new HomepageTeacher(); home.Show(); this.Hide(); } else { MessageBox.Show("Sorry your new password and repeat password doesn't same"); } }
private void button2_Click(object sender, EventArgs e) { MessageBox.Show("Please check your E-mail!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); login = new Loginpage(); login.Show(); this.Hide(); }
void panggilnama() { Loginpage frm1 = new Loginpage(); koneksi(); String sql = "Select Name,Email,jk,nik from teacher "; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { if (frm1.getemail() == rdr.GetString(1)) { String jk = ""; if (rdr.GetString(2) == "Male") { jk = "Mr."; } else if (rdr.GetString(2) == "Female") { jk = "Mrs."; } label2.Text = "Welcome, " + jk + rdr.GetString(0); NIK = rdr.GetString(3); } } rdr.Close(); conn.Close(); }
void panggilnama(String nis) { Loginpage frm1 = new Loginpage(); koneksi(); String sql = "Select * from student"; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { if (nis == (String)rdr[0]) { textBox1.Text = rdr.GetString(1); textBox2.Text = rdr.GetString(2); textBox3.Text = rdr.GetString(3); textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = rdr.GetString(4); textBox7.Text = rdr.GetString(0); } } rdr.Close(); conn.Close(); }
private void button1_Click(object sender, EventArgs e) { if (Deletestudent(tbemail.Text, tbpass.Text) == true) { MessageBox.Show("Your Account is Deleted"); login = new Loginpage(); login.Show(); this.Hide(); } }
string getNIK() { Loginpage frm1 = new Loginpage(); koneksi(); String sql = "Select nik from teacher where email = '" + frm1.getemail() + "'"; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader rdr = cmd.ExecuteReader(); String n = ""; while (rdr.Read()) { n = rdr.GetString(0); } conn.Close(); return(n); }
private void button2_Click(object sender, EventArgs e) { seting = new Seting(); Loginpage frm1 = new Loginpage(); koneksi(); //ganti back Color seting seting.BackColor = this.BackColor; seting.Show(); this.Hide(); String s = "SELECT nis FROM student WHERE email = '" + frm1.getemail() + "'"; MySqlCommand c = new MySqlCommand(s, conn); Object result = c.ExecuteScalar(); String nis1 = (String)result; String sql = ""; if (BackColor == Color.FromArgb(238, 142, 160)) { sql = "UPDATE student SET Theme = 1 WHERE NIS = '" + nis1 + "'"; } else if (BackColor == Color.FromArgb(249, 157, 42)) { sql = "UPDATE student SET Theme = 2 WHERE NIS = '" + nis1 + "'"; } else if (BackColor == Color.FromArgb(224, 43, 48)) { sql = "UPDATE student SET Theme = 3 WHERE NIS = '" + nis1 + "'"; } else if (BackColor == Color.FromArgb(95, 189, 102)) { sql = "UPDATE student SET Theme = 4 WHERE NIS = '" + nis1 + "'"; } else if (BackColor == Color.FromArgb(0, 192, 192)) { sql = "UPDATE student SET Theme = 5 WHERE NIS = '" + nis1 + "'"; } MySqlCommand cmd = new MySqlCommand(sql, conn); cmd.ExecuteNonQuery(); conn.Close(); }
void panggilnama() { Loginpage frm1 = new Loginpage(); koneksi(); String sql = "Select Name,Email,NIS from student "; //where Email='"+frm1.getemail()+"'" MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { if (frm1.getemail() == rdr.GetString(1)) { labeluser.Text = "Welcome, " + rdr.GetString(0); this.nis = rdr.GetString(2); } } conn.Close(); }
private void button2_Click(object sender, EventArgs e) { koneksi(); String s = "SELECT nis FROM student where nis = '" + tbnis.Text + "'"; MySqlCommand c = new MySqlCommand(s, conn); Object r = c.ExecuteScalar(); String nis = (String)r; String sq = "SELECT email FROM student where email = '" + tbemail.Text + "'"; MySqlCommand cm = new MySqlCommand(sq, conn); Object re = cm.ExecuteScalar(); String email = (String)re; if (nis == tbnis.Text) { MessageBox.Show("NIS ALREADY USED"); } else if (email == tbemail.Text) { MessageBox.Show("Email ALREADY USED"); } else if (tbpass.Text != tbpass1.Text) { MessageBox.Show("Your Password and Reapeat Password Doesn't Same"); } else { String sql = "INSERT INTO student values ('" + tbnis.Text + "','" + tbname.Text + "','" + tbemail.Text + "','" + tbpass.Text + "','" + tbphone.Text + "')"; MySqlCommand cmd1 = new MySqlCommand(sql, conn); cmd1.ExecuteNonQuery(); //buat tabel forgot password jika akunnya student String sql2 = "INSERT INTO forgot_student values('" + tbnis.Text + "','" + tbquestion.Text + "','" + tbanswer.Text + "')"; MySqlCommand cmd2 = new MySqlCommand(sql2, conn); cmd2.ExecuteNonQuery(); MessageBox.Show("Your Account Save"); login = new Loginpage(); login.Show(); this.Hide(); } conn.Close(); }
public DataTable baca() { Loginpage frm1 = new Loginpage(); koneksi(); String s = "SELECT username FROM teacher WHERE email = '" + frm1.getemail() + "'"; MySqlCommand c = new MySqlCommand(s, conn); Object result = c.ExecuteScalar(); String username = (String)result; String sql = "SELECT name, nis FROM student WHERE username = '******'"; DataColumn column = new DataColumn(); column.ColumnName = "no."; column.DataType = System.Type.GetType("System.Int32"); column.AutoIncrement = true; column.AutoIncrementSeed = 1; column.AutoIncrementStep = 1; DataTable dt = new DataTable(); try { dt.Columns.Add(column); MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataAdapter data = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); data.Fill(dt); dataGridView1.DataSource = dt; dataGridView1.Columns[0].Width = 30; dataGridView1.Columns[1].Width = 240; dataGridView1.Columns[2].Width = 230; dataGridView1.BackgroundColor = Color.White; } catch (Exception ali) { MessageBox.Show(ali.Message); } conn.Close(); return(dt); }
public DataTable baca() { Loginpage frm1 = new Loginpage(); koneksi(); String s = "SELECT username FROM student WHERE email = '" + frm1.getemail() + "'"; MySqlCommand c = new MySqlCommand(s, conn); Object result = c.ExecuteScalar(); String username = (String)result; String sq = "SELECT nik FROM teacher WHERE username = '******'"; MySqlCommand cm = new MySqlCommand(sq, conn); Object r = cm.ExecuteScalar(); String nik = (String)r; String sql = "SELECT day, time, room, course, teacher FROM schedule WHERE nik = '" + nik + "'"; DataTable dt = new DataTable(); try { MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataAdapter data = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); data.Fill(dt); dataGridView1.DataSource = dt; dataGridView1.Columns[0].Width = 60; dataGridView1.Columns[1].Width = 50; dataGridView1.Columns[2].Width = 60; dataGridView1.Columns[3].Width = 267; dataGridView1.Columns[4].Width = 100; dataGridView1.BackgroundColor = Color.White; } catch (Exception ali) { MessageBox.Show(ali.Message); } conn.Close(); return(dt); }
private void Seting_Load(object sender, EventArgs e) { koneksi(); Loginpage frm1 = new Loginpage(); String sql = "SELECT Theme FROM student WHERE email = '" + frm1.getemail() + "'"; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { //if (nis == rdr.GetString(0)) //{ if (rdr.GetInt16(0) == 1) { this.BackColor = Color.FromArgb(238, 142, 160); } else if (rdr.GetInt16(0) == 2) { this.BackColor = Color.FromArgb(249, 157, 42); } else if (rdr.GetInt16(0) == 3) { this.BackColor = Color.FromArgb(224, 43, 48); } else if (rdr.GetInt16(0) == 4) { this.BackColor = Color.FromArgb(95, 189, 102); } else if (rdr.GetInt16(0) == 5) { this.BackColor = Color.FromArgb(0, 192, 192); } //} } conn.Close(); }
private void btnsignup_Click(object sender, EventArgs e) { String jeniskelamin = ""; if (rdlaki.Checked) { jeniskelamin = "Male"; } else if (rdperempuan.Checked) { jeniskelamin = "Female"; } koneksi(); String s = "SELECT nik FROM teacher where nik = '" + tbnik.Text + "'"; MySqlCommand c = new MySqlCommand(s, conn); Object r = c.ExecuteScalar(); String nis = (String)r; String sq = "SELECT email FROM teacher where email = '" + tbemail.Text + "'"; MySqlCommand cm = new MySqlCommand(sq, conn); Object re = cm.ExecuteScalar(); String email = (String)re; String user = "******" + tbUser.Text + "'"; MySqlCommand cmd = new MySqlCommand(user, conn); Object user1 = cmd.ExecuteScalar(); String username = (String)user1; if (nis == tbnik.Text) { MessageBox.Show("NIK ALREADY USED"); } else if (email == tbemail.Text) { MessageBox.Show("Email ALREADY USED"); } else if (tbpass.Text != tbpass1.Text) { MessageBox.Show("Your Password and Reapeat Password Doesn't Same"); } else if (username == tbUser.Text) { MessageBox.Show("Username Already Used"); } else { String sql = "INSERT INTO teacher values ('" + tbnik.Text + "','" + tbName.Text + "','" + tbUser.Text + "','" + tbemail.Text + "','" + tbpass.Text + "','" + tbphone.Text + "','" + jeniskelamin + "')"; MySqlCommand cmd1 = new MySqlCommand(sql, conn); cmd1.ExecuteNonQuery(); //buat tabel forgot password jika akunnya teacher String sql2 = "INSERT INTO forgot_teacher values('" + tbnik.Text + "','" + question.Text + "','" + tbanswer.Text + "')"; MySqlCommand cmd2 = new MySqlCommand(sql2, conn); cmd2.ExecuteNonQuery(); MessageBox.Show("Your Account Save"); login = new Loginpage(); login.Show(); this.Hide(); } conn.Close(); }
private void label7_Click_1(object sender, EventArgs e) { login = new Loginpage(); login.Show(); this.Hide(); }
private void button3_Click(object sender, EventArgs e) { login = new Loginpage(); login.Show(); this.Hide(); }
public Homepage(Loginpage parent) { InitializeComponent(); frm1 = Parent; }
public TeacherEditAcc(Loginpage parent) { InitializeComponent(); frm1 = Parent; }