private void inscash() { koneksikuDataContext dbku = new koneksikuDataContext(); var chaspos = (from u in dbku.msemployees where u.position == "cashier" orderby u.employeeid descending select u).First(); string chaspost = chaspos.employeeid; int start = +1; msemployee mse = new msemployee(); if (chaspost != null) { string chasa = chaspost.Substring(3, 2); int convertchas = Convert.ToInt32(chasa); int tambah = convertchas + start; string convst = Convert.ToString("CH-0" + tambah); mse.name = "" + txtname.Text; mse.email = "" + txtemail.Text; mse.handphone = "" + txthp.Text; mse.position = "" + cmbpost.SelectedItem; mse.password = "" + txtpassword.Text; mse.employeeid = "" + convst; dbku.msemployees.InsertOnSubmit(mse); dbku.SubmitChanges(); MessageBox.Show("DATA PENGGUNA BERHASIL DI INPUT"); txtname.Text = null; txtemail.Text = null; txthp.Text = null; txtpassword.Text = null; } }
private void btnlogin_Click(object sender, EventArgs e) { var authz = (from a in dbku.msemployees select a).First(); if (txtemail.Text == null) { MessageBox.Show("EMAIL WAJIB DIISI"); } else if (tpassword == null) { MessageBox.Show("PASSWORD WAJIB DIISI"); } else if (txtemail.Text != null && tpassword.Text != null) { try { koneksikuDataContext dbku = new koneksikuDataContext(); var auth = (from z in dbku.msemployees where z.email == txtemail.Text select z).First(); nama = auth.name; password = auth.password; if (txtemail.Text == auth.email && tpassword.Text == auth.password) { position = auth.position; if (auth.password == tpassword.Text && auth.position == "admin") { AdmNav adm = new AdmNav(); adm.Show(); this.Hide(); //MessageBox.Show("Login Sukses, Anda Masuk Sebagai " + position); } else if (auth.password == tpassword.Text && auth.position == "chef") { chefnav chf = new chefnav(); chf.Show(); this.Hide(); //MessageBox.Show("Login Sukses, Anda Masuk Sebagai " + position); } else if (auth.password == tpassword.Text && auth.position == "cashier") { cashiernav chn = new cashiernav(); chn.Show(); this.Hide(); } } MessageBox.Show("Login Sukses, Anda Masuk Sebagai " + position); } catch (Exception) { MessageBox.Show("Email Atau password yang anda masukkan salah", "Peringatan!!"); } finally { } } }
private void dbind() { koneksikuDataContext dbku = new koneksikuDataContext(); msmember msm = new msmember(); DataGridView datagrid = new DataGridView(); BindingSource bs = new BindingSource(); var ambil = (from s in dbku.msmembers select s).ToList(); datagrid.ColumnCount = 6; datagrid.AutoGenerateColumns = false; DataTable dt = new DataTable(); this.dgrid.DataSource = ambil; }
private void btnregis_Click(object sender, EventArgs e) { koneksikuDataContext dbku = new koneksikuDataContext(); }