private void cmdEdit_Click(object sender, EventArgs e) { if (((selectedGrid == enumSelectedGrid.HeaderSelected && gridUtm.SelectedCells.Count > 0) || (selectedGrid == enumSelectedGrid.DetailSelected && gridDetail.SelectedCells.Count > 0)) && (gridUtm.SelectedCells[0].OwningRow.Cells["Cabang"].Value.ToString() != GlobalVar.Gudang && gridUtm.SelectedCells[0].OwningRow.Cells["Src"].Value.ToString() == "DKN")) { DateTime TglTrans = Convert.ToDateTime(gridUtm.SelectedCells[0].OwningRow.Cells["Tanggal"].Value); string TahunBulan = TglTrans.Year.ToString() + TglTrans.Month.ToString().PadLeft(2, '0'); if (Convert.ToInt32(TahunBulan) > Convert.ToInt32(LastClosingGL)) { if (selectedGrid == enumSelectedGrid.HeaderSelected) { Guid HeaderID = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value; frmHiRegisterUpdate ifrm = new frmHiRegisterUpdate(this, HeaderID); ifrm.Show(); } else { Guid HeaderID = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["HeaderID"].Value; Guid DetailID = (Guid)gridDetail.SelectedCells[0].OwningRow.Cells["RowIDD"].Value; frmHiRegisterUpdate ifrm = new frmHiRegisterUpdate(this, HeaderID, DetailID); ifrm.Show(); } } else { MessageBox.Show("Sudah tutup buku, tidak bisa diEDIT !"); } } }
private void cmdAdd_Click(object sender, EventArgs e) { if (selectedGrid == enumSelectedGrid.HeaderSelected) { frmHiRegisterUpdate ifrm = new frmHiRegisterUpdate(this); ifrm.Show(); } else { Guid HeaderID = (Guid)gridUtm.SelectedCells[0].OwningRow.Cells["RowID"].Value; Guid DetailID = (Guid)Guid.Empty; frmHiRegisterUpdate ifrm = new frmHiRegisterUpdate(this, HeaderID, DetailID); ifrm.Show(); } }