private void btnInputCust_Click(object sender, EventArgs e) { var cekKosong = this.Controls.OfType <MetroFramework.Controls.MetroTextBox>().Where((txt) => txt.Text.Length == 0 && txt.Visible == true); if (cekKosong.Any() || !rboPriaCust.Checked && !rboWanitaCust.Checked) { MessageBox.Show("Harap masukkan input-input yang tersedia", "Pesan"); } else { try { Dictionary <string, object> parameters = new Dictionary <string, object> { }; parameters.Add("nama", txtNamaCust.Text.ToString()); parameters.Add("alamat", txtAlamatCust.Text.ToString()); parameters.Add("no_hp", txtNoHpCust.Text.ToString()); parameters.Add("jenis_kelamin", rboPriaCust.Checked ? 1 : 0); GlobalSql.InsertData("customer", parameters); function.ClearAllText(this); MessageBox.Show("Data customer berhasil diinput", "Informasi"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnUpdateCust_Click(object sender, EventArgs e) { if (idCust != 0) { var cekKosong = this.Controls.OfType <MetroFramework.Controls.MetroTextBox>().Where((txt) => txt.Text.Length == 0 && txt.Visible == true); if (cekKosong.Any()) { MessageBox.Show("Harap masukkan input-input yang tersedia", "Pesan"); } else { try { Dictionary <string, object> parameters = new Dictionary <string, object> { }; parameters.Add("nama", txtNamaCust.Text); parameters.Add("no_hp", txtNoHpCust.Text); parameters.Add("alamat", txtAlamatCust.Text); parameters.Add("jenis_kelamin", rboPriaCust.Checked ? 1 : 0); GlobalSql.UpdateData("pos.customer", parameters, idCust); function.ClearAllText(this); MessageBox.Show("Customer berhasil di update", "Informasi"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } else { MessageBox.Show("Harap lakukan pencarian dari tombol browse"); } }
private void btnInput_Click(object sender, EventArgs e) { var cekKosong = this.Controls.OfType <MetroFramework.Controls.MetroTextBox>().Where((txt) => txt.Text.Length == 0 && txt.Visible == true); if (cekKosong.Any()) { MessageBox.Show("Harap masukkan input-input yang tersedia", "Pesan"); } else { try { Dictionary <string, object> parameters = new Dictionary <string, object> { }; parameters.Add("kode_barang", txtKode.Text.ToString()); parameters.Add("nama_barang", txtNama.Text.ToString()); parameters.Add("jumlah_awal", Convert.ToDouble(txtJumlah.Text)); parameters.Add("harga_hpp", Convert.ToDouble(txtHpp.Text)); parameters.Add("harga_jual", Convert.ToDouble(txtHargaJual.Text)); GlobalSql.InsertData("pos.item", parameters); function.ClearAllText(this); MessageBox.Show("Barang berhasil di-input", "Informasi"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public clsCustomer(string kata) { if (kata != "") { DataRow row = GlobalSql.GetDataRow("select * from customer where id = '" + kata + "'"); id = (int)row["id"]; nama = row["nama"].ToString(); nomorHp = row["no_hp"].ToString(); jenisKelamin = (gender)Convert.ToInt32(row["jenis_kelamin"]); } }
private void btnHapusSupplier_Click(object sender, EventArgs e) { if (browseSupplierUserControl1.idItem != 0) { GlobalSql.DeleteData("supplier", browseSupplierUserControl1.idItem); function.ClearAllText(this); MessageBox.Show("Supplier berhasil dihapus"); } else { MessageBox.Show("Harap isi supplier yang akan dihapus"); } }
private void btnHapusBarang_Click(object sender, EventArgs e) { if (browseItemUserControl1.idItem != 0) { GlobalSql.DeleteData("item", browseItemUserControl1.idItem); function.ClearAllText(this); MessageBox.Show("Barang berhasil dihapus"); } else { MessageBox.Show("Harap isi barang yang akan dihapus"); } }
private void btnHapusCust_Click(object sender, EventArgs e) { //MessageBox.Show(browseCustomerUserControl1.noHp); if (browseCustomerUserControl1.idItem != 0) { GlobalSql.DeleteData("customer", browseCustomerUserControl1.idItem); function.ClearAllText(this); MessageBox.Show("Customer berhasil dihapus"); } else { MessageBox.Show("Harap isi customer yang akan dihapus"); } }
public frmBrowse(string tabel, string query, Action <DataGridViewRow> overrideHandleSelect = null) { InitializeComponent(); this.tabel = tabel; dt = GlobalSql.SelectData("pos." + this.tabel); dgvBrowse.DataSource = dt; dgvBrowse.Refresh(); data = new Dictionary <string, string> { }; if (overrideHandleSelect == null) { _handleSelect = defaultHandleSelect; } else { _handleSelect = overrideHandleSelect; } }
private void btnJual_Click(object sender, EventArgs e) { if (dataItem.Count <= 0) { MessageBox.Show("Harap memilih item", "Informasi"); } else if (dataCustomer.Count <= 0) { MessageBox.Show("Harap memilih customer", "Informasi"); } else if (txtJumlahBarangJual.Text == "") { MessageBox.Show("Harap mengisi jumlah barang", "Informasi"); } else if (Convert.ToInt16(dataItem["jumlah_awal"]) < Convert.ToInt16(txtJumlahBarangJual.Text)) { MessageBox.Show("Stok item hanya tersisa : " + dataItem["jumlah_awal"], "Informasi"); } else { try { Dictionary <string, object> parameters = new Dictionary <string, object> { }; parameters.Add("id_item", Convert.ToInt16(dataItem["id"])); parameters.Add("id_customer", Convert.ToInt16(dataCustomer["id"])); parameters.Add("jumlah_barang", Convert.ToInt16(txtJumlahBarangJual.Text)); GlobalSql.InsertData("pos.penjualan", parameters); parameters = new Dictionary <string, object> { }; int sisa = Convert.ToInt16(dataItem["jumlah_awal"]) - Convert.ToInt16(txtJumlahBarangJual.Text); parameters.Add("jumlah_awal", sisa); GlobalSql.UpdateData("pos.item", parameters, Convert.ToInt16(dataItem["id"])); dataItem.Clear(); dataCustomer.Clear(); function.ClearAllText(this); MessageBox.Show("Transaksi berhasil", "Informasi"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnBeli_Click(object sender, EventArgs e) { if (dataItem.Count <= 0) { MessageBox.Show("Harap memilih item", "Informasi"); } else if (dataSupplier.Count <= 0) { MessageBox.Show("Harap memilih supplier", "Informasi"); } else if (txtJumlahBarang.Text == "") { MessageBox.Show("Harap mengisi jumlah barang", "Informasi"); } else { try { Dictionary <string, object> parameters = new Dictionary <string, object> { }; parameters.Add("id_item", Convert.ToInt16(dataItem["id"])); parameters.Add("id_supplier", Convert.ToInt16(dataSupplier["id"])); parameters.Add("jumlah_barang", Convert.ToInt16(txtJumlahBarang.Text)); GlobalSql.InsertData("pos.pembelian", parameters); parameters = new Dictionary <string, object> { }; parameters.Add("jumlah_awal", Convert.ToInt16(txtJumlahBarang.Text) + Convert.ToInt16(dataItem["jumlah_awal"])); GlobalSql.UpdateData("pos.item", parameters, Convert.ToInt16(dataItem["id"])); dataItem.Clear(); dataSupplier.Clear(); function.ClearAllText(this); MessageBox.Show("Transaksi berhasil", "Informasi"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
protected virtual void HandleTampil() { dgvBrowse.Refresh(); dt = GlobalSql.SelectData(cmbBoxTabel.SelectedItem.ToString()); dgvBrowse.DataSource = dt; }