private void Txt_CustomerPic_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { Txt_CustomerTlp.Focus(); } }
void Hapus() { Txt_CustomerNama.Clear(); Txt_CustomerAlamat.Clear(); Txt_CustomerKota.Clear(); Txt_CustomerPic.Clear(); Txt_CustomerTlp.Clear(); Txt_CustomerEmail.Clear(); Txt_CustomerNama.Focus(); Txt_CustomerInputBy.Text = GlobalVariable.UserId; Txt_CustomerInputTgl.Text = DateTime.Now.ToShortDateString(); }
private bool validateform() { bool output = true; if (Txt_CustomerNama.Text == "") { output = false; MessageBox.Show("Nama Pelanggan harus diisi", "Perhatian", MessageBoxButtons.OK); Txt_CustomerNama.Focus(); } else if (Txt_CustomerTlp.Text == "" && Txt_CustomerEmail.Text == "") { output = false; MessageBox.Show("No. Telepon/Email harus diisi", "Perhatian", MessageBoxButtons.OK); Txt_CustomerTlp.Focus(); } try { using (IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings[db].ConnectionString)) { var p = new DynamicParameters(); p.Add("@Cust_Id", cust_Id); p.Add("@CustomerNama", Txt_CustomerNama.Text); var Hitung = connection.ExecuteScalar <int>("dbo.SpCust_Cek_Nama", p, commandType: CommandType.StoredProcedure); if (Hitung == 1) { output = false; MessageBox.Show($"Nama Pelanggan {Txt_CustomerNama.Text} sudah ada", "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Error); Txt_CustomerNama.Focus(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } return(output); }
private void Btn_New_Click(object sender, EventArgs e) { { Txt_CustomerId.Clear(); Txt_CustomerNama.Clear(); Txt_CustomerAlamat.Clear(); Txt_CustomerKota.Clear(); Txt_CustomerPic.Clear(); Txt_CustomerTlp.Clear(); Txt_CustomerEmail.Clear(); Txt_CustomerNama.Focus(); Txt_CustomerInputBy.Text = GlobalVariable.UserId; Txt_CustomerInputTgl.Text = DateTime.Now.ToShortDateString(); Btn_Save.Show(); Btn_cancel.Show(); Btn_Update.Enabled = false; Btn_Delete.Enabled = false; Txt_Search.Enabled = false; } }