private void cmdAdd_Click(object sender, EventArgs e) { switch (selectedGrid) { case enumSelectedGrid.GridArea: Master.frmWilayahUpdate ifrmChild = new Master.frmWilayahUpdate(this, "Area", null, Guid.Empty, "New"); ifrmChild.ShowDialog(); break; case enumSelectedGrid.GridWilayah: Guid _areaRowID = (Guid)gridArea.SelectedCells[0].OwningRow.Cells["RowID"].Value; String _area = gridArea.SelectedCells[0].OwningRow.Cells["Area"].Value.ToString(); Master.frmWilayahUpdate ifrmChild2 = new Master.frmWilayahUpdate(this, "Wilayah", _area, _areaRowID, "New"); ifrmChild2.ShowDialog(); break; case enumSelectedGrid.GridKolektor: Guid _rowID = (Guid)gridArea.SelectedCells[0].OwningRow.Cells["RowID"].Value; String _nama = gridArea.SelectedCells[0].OwningRow.Cells["Area"].Value.ToString(); Master.frmWilayahUpdate ifrmChild3 = new Master.frmWilayahUpdate(this, "Kolektor", _nama, _rowID, "New"); ifrmChild3.ShowDialog(); break; } LoadArea(); this.LoadKolektor(); this.LoadWilayah(); }
private void cmdEdit_Click(object sender, EventArgs e) { switch (selectedGrid) { case enumSelectedGrid.GridArea: if (gridArea.RowCount > 0) { Guid rowID = (Guid)gridArea.SelectedCells[0].OwningRow.Cells["RowID"].Value; Master.frmWilayahUpdate ifrmChild = new Master.frmWilayahUpdate(this, "Area", null, rowID, "Update"); ifrmChild.ShowDialog(); } break; case enumSelectedGrid.GridWilayah: if (gridWilayah.RowCount > 0) { Guid rowID2 = (Guid)gridWilayah.SelectedCells[0].OwningRow.Cells["WilRowID"].Value; String area2 = gridArea.SelectedCells[0].OwningRow.Cells["Area"].Value.ToString(); Master.frmWilayahUpdate ifrmChild2 = new Master.frmWilayahUpdate(this, "Wilayah", area2, rowID2, "Update"); ifrmChild2.ShowDialog(); } break; case enumSelectedGrid.GridKolektor: if (gridKolektor.RowCount > 0) { Guid rowID3 = (Guid)gridKolektor.SelectedCells[0].OwningRow.Cells["KolRowID"].Value; String area3 = gridArea.SelectedCells[0].OwningRow.Cells["Area"].Value.ToString(); Master.frmWilayahUpdate ifrmChild3 = new Master.frmWilayahUpdate(this, "Kolektor", area3, rowID3, "Update"); ifrmChild3.ShowDialog(); } break; } LoadArea(); this.LoadKolektor(); this.LoadWilayah(); }