private void cmdEdit_Click(object sender, EventArgs e) { if (gridTransfer.SelectedCells.Count > 0) { Guid rowIDTransferBankDetail = (Guid)gridTransfer.SelectedCells[0].OwningRow.Cells["RowIDDetail"].Value; if (_isFromPiutang == false) { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmUpdate = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, rowIDTransferBankDetail, Guid.Empty, string.Empty, false, _reff, _noreff, string.Empty); Program.MainForm.RegisterChild(ifrmUpdate); ifrmUpdate.ShowDialog(); } else { if (_cmbJU == "TRK") { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmUpdate1 = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, rowIDTransferBankDetail, _rowIDTransferBank, _recordIDTransferBank2, true, _reff, _noreff, _jp); Program.MainForm.RegisterChild(ifrmUpdate1); ifrmUpdate1.ShowDialog(); } else if (_cmbJU == "TRM") { Kasir.frmBuktiTransferMasukDetailUpdate ifrmUpdate2 = new Kasir.frmBuktiTransferMasukDetailUpdate(this, rowIDTransferBankDetail, _rowIDTransferBank, _recordIDTransferBank2); Program.MainForm.RegisterChild(ifrmUpdate2); ifrmUpdate2.ShowDialog(); } } } else { MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void cmdAdd_Click(object sender, EventArgs e) { switch (selectedGrid) { case enumSelectedGrid.HeaderSelected: Kasir.frmBuktiTransferKeluarUpdate ifrmChild = new Kasir.frmBuktiTransferKeluarUpdate(this, string.Empty, false, string.Empty, string.Empty, string.Empty); Program.MainForm.RegisterChild(ifrmChild); ifrmChild.ShowDialog(); break; case enumSelectedGrid.DetailSelected: DateTime _Tanggal = (DateTime)gridUtm.SelectedCells[0].OwningRow.Cells["TglBBM"].Value; if (GlobalVar.Gudang != "2808") { if (PeriodeClosing.IsKasirClosed(_Tanggal)) { MessageBox.Show("Sudah Closing!"); return; } } Guid rowID = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value; string bankID = gridUtm.SelectedCells[0].OwningRow.Cells["BankID"].Value.ToString(); Kasir.frmBuktiTransferKeluarDetailUpdate ifrmDetail = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, string.Empty, rowID, 0, false, string.Empty, string.Empty, string.Empty, string.Empty, bankID); Program.MainForm.RegisterChild(ifrmDetail); ifrmDetail.ShowDialog(); break; } }
private void cmdEdit_Click(object sender, EventArgs e) { Guid rowID = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value; DateTime _Tanggal = (DateTime)gridUtm.SelectedCells[0].OwningRow.Cells["TglBBM"].Value; if (GlobalVar.Gudang != "2808") { if (PeriodeClosing.IsKasirClosed(_Tanggal)) { MessageBox.Show("Sudah Closing!"); return; } } switch (selectedGrid) { case enumSelectedGrid.HeaderSelected: if (gridUtm.RowCount > 0) { Kasir.frmBuktiTransferKeluarUpdate ifrmChild = new Kasir.frmBuktiTransferKeluarUpdate(this, rowID, false, string.Empty, string.Empty, string.Empty, string.Empty); Program.MainForm.RegisterChild(ifrmChild); ifrmChild.ShowDialog(); } else { MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case enumSelectedGrid.DetailSelected: Guid rowIDDetail = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["RowIDDetail"].Value; if (gridDetail.RowCount > 0) { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmDetail = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, rowIDDetail, rowID, string.Empty, false, string.Empty, string.Empty, string.Empty); Program.MainForm.RegisterChild(ifrmDetail); ifrmDetail.ShowDialog(); } else { MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } }
private void cmdAdd_Click(object sender, EventArgs e) { if (_rowIDTransferBank != Guid.Empty) { string nmrBBK = string.Empty; string recordIDDetail = string.Empty; nmrBBK = lblNoBkk.Text; total = numericTextBox1.GetDoubleValue; if (lookupBank1.BankID != "[CODE]") { _BankID = lookupBank1.BankID; } if (_isFromPiutang == false) { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmDetail = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, _recordIDTransferBank, _rowIDTransferBank, total, false, string.Empty, string.Empty, _cmbJU, nmrBBK, _BankID); Program.MainForm.RegisterChild(ifrmDetail); ifrmDetail.ShowDialog(); } else { if (_cmbJU == "TRK") { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmDetail2 = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, _recordIDTransferBank2, _rowIDTransferBank, total, true, _nip, _jp, _cmbJU, nmrBBK, _BankID); Program.MainForm.RegisterChild(ifrmDetail2); ifrmDetail2.ShowDialog(); } else if (_cmbJU == "TRM") { Kasir.frmBuktiTransferMasukDetailUpdate ifrmDetail3 = new Kasir.frmBuktiTransferMasukDetailUpdate(this, _recordIDTransferBank2, _rowIDTransferBank, _BankID, total, _nip, _jp, _cmbJU, nmrBBK, _kredit, _uraianPK); Program.MainForm.RegisterChild(ifrmDetail3); ifrmDetail3.ShowDialog(); } } } }
private void frmBuktiTransferKeluarUpdate_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Insert: if (_rowIDTransferBank != Guid.Empty) { string nmrBBK = string.Empty; string recordIDDetail = string.Empty; nmrBBK = lblNoBkk.Text; total = numericTextBox1.GetDoubleValue; if (lookupBank1.BankID != "[CODE]") { _BankID = lookupBank1.BankID; } if (_isFromPiutang == false) { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmDetail = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, _recordIDTransferBank, _rowIDTransferBank, total, false, string.Empty, string.Empty, _cmbJU, nmrBBK, _BankID); Program.MainForm.RegisterChild(ifrmDetail); ifrmDetail.ShowDialog(); } else { if (_cmbJU == "TRK") { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmDetail2 = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, _recordIDTransferBank2, _rowIDTransferBank, total, true, _nip, _jp, _cmbJU, nmrBBK, _BankID); Program.MainForm.RegisterChild(ifrmDetail2); ifrmDetail2.ShowDialog(); } else if (_cmbJU == "TRM") { Kasir.frmBuktiTransferMasukDetailUpdate ifrmDetail3 = new Kasir.frmBuktiTransferMasukDetailUpdate(this, _recordIDTransferBank2, _rowIDTransferBank, _BankID, total, _nip, _jp, _cmbJU, nmrBBK, _kredit, _uraianPK); Program.MainForm.RegisterChild(ifrmDetail3); ifrmDetail3.ShowDialog(); } } } break; case Keys.Space: if (gridTransfer.Focused == true) { if (gridTransfer.SelectedCells.Count > 0) { Guid rowIDTransferBankDetail = (Guid)gridTransfer.SelectedCells[0].OwningRow.Cells["RowIDDetail"].Value; if (_isFromPiutang == false) { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmUpdate = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, rowIDTransferBankDetail, Guid.Empty, string.Empty, false, _reff, _noreff, string.Empty); Program.MainForm.RegisterChild(ifrmUpdate); ifrmUpdate.ShowDialog(); } else { if (_cmbJU == "TRK") { Kasir.frmBuktiTransferKeluarDetailUpdate ifrmUpdate1 = new Kasir.frmBuktiTransferKeluarDetailUpdate(this, rowIDTransferBankDetail, _rowIDTransferBank, _recordIDTransferBank2, true, _reff, _noreff, _jp); Program.MainForm.RegisterChild(ifrmUpdate1); ifrmUpdate1.ShowDialog(); } else if (_cmbJU == "TRM") { Kasir.frmBuktiTransferMasukDetailUpdate ifrmUpdate2 = new Kasir.frmBuktiTransferMasukDetailUpdate(this, rowIDTransferBankDetail, _rowIDTransferBank, _recordIDTransferBank2); Program.MainForm.RegisterChild(ifrmUpdate2); ifrmUpdate2.ShowDialog(); } } } else { MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } break; case Keys.Delete: if (gridTransfer.SelectedCells.Count > 0) { Guid rowIDTransferBankDetail = (Guid)gridTransfer.SelectedCells[0].OwningRow.Cells["RowIDDetail"].Value; if (MessageBox.Show(Messages.Question.AskDelete, "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { using (Database db = new Database(GlobalVar.DBName)) { if (_isFromPiutang == false) { db.BeginTransaction(); Class.TransferBank.DeleteDetail(db, rowIDTransferBankDetail); db.Commands.Clear(); db.Commands.Add(db.CreateCommand("usp_BankDetail_DELETE")); db.Commands[0].Parameters.Add(new Parameter("@rowIDDetail", SqlDbType.UniqueIdentifier, rowIDTransferBankDetail)); db.Commands[0].Parameters.Add(new Parameter("@headerIDBank1", SqlDbType.UniqueIdentifier, _rowIDBank)); db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy2", SqlDbType.VarChar, SecurityManager.UserID)); db.Commands[0].ExecuteNonQuery(); db.CommitTransaction(); } else { db.BeginTransaction(); db.Commands.Clear(); Class.TransferBank.DeleteDetail(db, rowIDTransferBankDetail); Class.TransferBank.UpdateUraianPinjaman(db, _rowIDTransferBank); db.Commands.Clear(); db.Commands.Add(db.CreateCommand("usp_BankDetail_DELETE")); db.Commands[0].Parameters.Add(new Parameter("@rowIDDetail", SqlDbType.UniqueIdentifier, rowIDTransferBankDetail)); db.Commands[0].Parameters.Add(new Parameter("@headerIDBank1", SqlDbType.UniqueIdentifier, _rowIDBank)); db.Commands[0].Parameters.Add(new Parameter("@LastUpdatedBy2", SqlDbType.VarChar, SecurityManager.UserID)); db.Commands[0].ExecuteNonQuery(); db.CommitTransaction(); } } gridTransfer.Rows.Remove(gridTransfer.SelectedCells[0].OwningRow); #region "Tambahan" int i = 0; int n = 0; i = gridTransfer.SelectedCells[0].RowIndex; n = gridTransfer.SelectedCells[0].ColumnIndex; DataRowView dv = (DataRowView)gridTransfer.SelectedCells[0].OwningRow.DataBoundItem; DataRow dr = dv.Row; dr.Delete(); dt.AcceptChanges(); gridTransfer.Focus(); gridTransfer.RefreshEdit(); if (gridTransfer.RowCount > 0) { if (i == 0) { gridTransfer.CurrentCell = gridTransfer.Rows[0].Cells[n]; gridTransfer.RefreshEdit(); } else { gridTransfer.CurrentCell = gridTransfer.Rows[i - 1].Cells[n]; gridTransfer.RefreshEdit(); } } #endregion } } else { MessageBox.Show("Belum Ada Data", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case Keys.Escape: this.Close(); break; } }