private void dataGridHeader_SelectionRowChanged(object sender, EventArgs e) { if (FormTools.IsRowSelected(dgvHeader)) { RefreshDataPembelianDetail(); } }
private void DeleteDetail2() { if (FormTools.IsRowSelected(dgvDetail2)) { Guid rowID = (Guid)dgvDetail2.SelectedCells[0].OwningRow.Cells["RowID3"].Value; if (MessageBox.Show("Hapus record ini?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { using (Database db = new Database()) { DataTable dt = new DataTable(); db.Commands.Add(db.CreateCommand("usp_bkl_mMemberService_DELETE")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID)); dt = db.Commands[0].ExecuteDataTable(); } MessageBox.Show("Record telah dihapus"); this.RefreshData(FormTools.detailIndex.detail2); } catch (Exception ex) { Error.LogError(ex); } } } }
private void cmdDelete_Click(object sender, EventArgs e) { if (!FormTools.IsRowSelected(dgMain)) { MessageBox.Show(Messages.Error.RowNotSelected); return; } deleteData(); }
private bool CekAddEditDel() { bool cek = true; if (!FormTools.IsRowSelected(dgvHeader)) { cek = false; goto SelesaiCek; } SelesaiCek: return(cek); }
private void cmdEdit_Click(object sender, EventArgs e) { if (!FormTools.IsRowSelected(dgMain)) { return; } Guid rowID; rowID = (Guid)dgMain.SelectedCells[0].OwningRow.Cells["RowID"].Value; frmStandarBiayaServiceUpdate ifrmChild = new frmStandarBiayaServiceUpdate(this, rowID); ifrmChild.ShowDialog(); }
private bool CekAddEditDel(ISA.Controls.CustomGridView dg) { bool cek = true; if (!FormTools.IsRowSelected(dg)) { cek = false; goto SelesaiCek; } SelesaiCek: return(cek); }
private void dgvDetail2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete) { DeleteDetail2(); } else { if (!this.MaximizeBox && FormTools.IsRowSelected(dgvDetail2) && e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; ConfirmSelect(); } } }
private void cmdEDIT_Click(object sender, EventArgs e) { if (!FormTools.IsRowSelected(dgMain)) { return; } Guid rowID; rowID = (Guid)dgMain.SelectedCells[0].OwningRow.Cells["RowID"].Value; frmStandarServiceUpdate ifrmChild = new frmStandarServiceUpdate(this, rowID); //ifrmChild.MdiParent = Program.MainForm; //Program.MainForm.RegisterChild(ifrmChild); ifrmChild.ShowDialog(); }
private void ConfirmSelect() { if (!this.MaximizeBox) { if (FormTools.IsRowSelected(dgvHeader)) { _customerServiceRowID = (Guid)dgvHeader.SelectedCells[0].OwningRow.Cells["RowID"].Value; _idCust = dgvHeader.SelectedCells[0].OwningRow.Cells["idcust"].Value.ToString(); _kodeCust = dgvHeader.SelectedCells[0].OwningRow.Cells["kd_cust"].Value.ToString(); _namaCust = dgvHeader.SelectedCells[0].OwningRow.Cells["Nama"].Value.ToString(); _noID = dgvHeader.SelectedCells[0].OwningRow.Cells["no_id"].Value.ToString(); _alamat = dgvHeader.SelectedCells[0].OwningRow.Cells["alamat"].Value.ToString(); _kota = dgvHeader.SelectedCells[0].OwningRow.Cells["kota"].Value.ToString(); _daerah = dgvHeader.SelectedCells[0].OwningRow.Cells["daerah"].Value.ToString(); _noTelp = dgvHeader.SelectedCells[0].OwningRow.Cells["telpon"].Value.ToString(); } if (FormTools.IsRowSelected(dgvDetail1)) { _motorServiceRowID = (Guid)dgvDetail1.SelectedCells[0].OwningRow.Cells["RowID2"].Value; _kodeCust = dgvDetail1.SelectedCells[0].OwningRow.Cells["kd_cust2"].Value.ToString(); _pemilik = dgvDetail1.SelectedCells[0].OwningRow.Cells["pemilik"].Value.ToString(); _noID = dgvDetail1.SelectedCells[0].OwningRow.Cells["no_id2"].Value.ToString(); _alamat = dgvDetail1.SelectedCells[0].OwningRow.Cells["alamat2"].Value.ToString(); _kota = dgvDetail1.SelectedCells[0].OwningRow.Cells["kota2"].Value.ToString(); _daerah = dgvDetail1.SelectedCells[0].OwningRow.Cells["daerah2"].Value.ToString(); _noTelp = dgvDetail1.SelectedCells[0].OwningRow.Cells["no_telp2"].Value.ToString(); _noPol = dgvDetail1.SelectedCells[0].OwningRow.Cells["no_pol"].Value.ToString();; _kodeSpm = dgvDetail1.SelectedCells[0].OwningRow.Cells["kode"].Value.ToString();; _jnsSpm = dgvDetail1.SelectedCells[0].OwningRow.Cells["jns_spm"].Value.ToString();; _spm = dgvDetail1.SelectedCells[0].OwningRow.Cells["spm"].Value.ToString();; _noMesin = dgvDetail1.SelectedCells[0].OwningRow.Cells["no_mesin"].Value.ToString();; _noRangka = dgvDetail1.SelectedCells[0].OwningRow.Cells["no_rangka"].Value.ToString();; _warna = dgvDetail1.SelectedCells[0].OwningRow.Cells["warna"].Value.ToString();; _tahun = dgvDetail1.SelectedCells[0].OwningRow.Cells["tahun"].Value.ToString();; } if (FormTools.IsRowSelected(dgvDetail2)) { _memberServiceRowID = (Guid)dgvDetail2.SelectedCells[0].OwningRow.Cells["RowID3"].Value; _idMember = dgvDetail2.SelectedCells[0].OwningRow.Cells["id_member"].Value.ToString(); } this.DialogResult = DialogResult.OK; this.Close(); } }
private void cmdDELETE_Click(object sender, EventArgs e) { if (!FormTools.IsRowSelected(dgMain)) { MessageBox.Show(Messages.Error.RowNotSelected); return; } //if (!FormTools.IsLinkData()) //{ // MessageBox.Show(Messages.Error.RowNotSelected); // return; //} deleteData(); }
private void cmdADD_Click(object sender, EventArgs e) { Guid headerID; try { ISA.Bengkel.BaseForm ifrmChild; switch (selectedGrid) { case enumSelectedGrid.HeaderSelected: ifrmChild = new frmCustomerUpdate(this); ifrmChild.ShowDialog(); break; case enumSelectedGrid.Detail1Selected: //ifrmChild = new frmCustomerUpdate(this); //ifrmChild.ShowDialog(); //break; if (!FormTools.IsRowSelected(dgvHeader)) { return; } headerID = (Guid)dgvHeader.SelectedCells[0].OwningRow.Cells["RowID"].Value; ifrmChild = new frmCustMotorUpdate(this, headerID, FormTools.enumFormMode.New); ifrmChild.ShowDialog(); break; //case enumSelectedGrid.Detail2Selected: // if (!FormTools.IsRowSelected(dgvHeader)) // { // return; // } // headerID = (Guid)dgvHeader.SelectedCells[0].OwningRow.Cells["RowID"].Value; // ifrmChild = new frmCustMemberUpdate(this, headerID, FormTools.enumFormMode.New); // ifrmChild.ShowDialog(); // break; } } catch (System.Exception ex) { Error.LogError(ex); } }
private void dgvDetail1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Insert) { cmdADD.PerformClick(); } else if (e.KeyCode == Keys.Space) { cmdEDIT.PerformClick(); } else if (e.KeyCode == Keys.Delete) { DeleteDetail1(); } else { if (!this.MaximizeBox && FormTools.IsRowSelected(dgvDetail1) && e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; ConfirmSelect(); } } }