示例#1
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.GridProvinsi:
                Master.frmKotaUpdate ifrmChild = new Master.frmKotaUpdate(this, "Provinsi", null, Guid.Empty);
                ifrmChild.ShowDialog();
                break;

            case enumSelectedGrid.GridKota:
                Guid   _provRowID = (Guid)gridProvinsi.SelectedCells[0].OwningRow.Cells["ProvRowID"].Value;
                String _provinsi  = gridProvinsi.SelectedCells[0].OwningRow.Cells["Provinsi"].Value.ToString();
                Master.frmKotaUpdate ifrmChild2 = new Master.frmKotaUpdate(this, "Kota", _provinsi, _provRowID);
                ifrmChild2.ShowDialog();
                break;

            case enumSelectedGrid.GridKecamatan:
                if (gridKota.RowCount > 0)
                {
                    Guid   _kotaRowID = (Guid)gridKota.SelectedCells[0].OwningRow.Cells["KotaRowID"].Value;
                    String _kota      = gridKota.SelectedCells[0].OwningRow.Cells["Kota"].Value.ToString();
                    Master.frmKotaUpdate ifrmChild3 = new Master.frmKotaUpdate(this, "Kecamatan", _kota, _kotaRowID);
                    ifrmChild3.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Data Kota masih kosong");
                }
                break;

            case enumSelectedGrid.GridKelurahan:
                if (gridKecamatan.RowCount > 0)
                {
                    Guid   _kecRowID  = (Guid)gridKecamatan.SelectedCells[0].OwningRow.Cells["KecRowID"].Value;
                    String _kecamatan = gridKecamatan.SelectedCells[0].OwningRow.Cells["Kecamatan"].Value.ToString();
                    Master.frmKotaUpdate ifrmChild4 = new Master.frmKotaUpdate(this, "Kelurahan", _kecamatan, _kecRowID);
                    ifrmChild4.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Data Kecamatan masih kosong");
                }
                break;
            }
        }
示例#2
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            switch (selectedGrid)
            {
            case enumSelectedGrid.GridProvinsi:
                if (gridProvinsi.RowCount > 0)
                {
                    Guid rowID = (Guid)gridProvinsi.SelectedCells[0].OwningRow.Cells["ProvRowID"].Value;
                    Master.frmKotaUpdate ifrmChild = new Master.frmKotaUpdate(this, "Provinsi", rowID);
                    ifrmChild.ShowDialog();
                }
                break;

            case enumSelectedGrid.GridKota:
                if (gridKota.RowCount > 0)
                {
                    Guid rowID2 = (Guid)gridKota.SelectedCells[0].OwningRow.Cells["KotaRowID"].Value;
                    Master.frmKotaUpdate ifrmChild2 = new Master.frmKotaUpdate(this, "Kota", rowID2);
                    ifrmChild2.ShowDialog();
                }
                break;

            case enumSelectedGrid.GridKecamatan:
                if (gridKecamatan.RowCount > 0)
                {
                    Guid rowID3 = (Guid)gridKecamatan.SelectedCells[0].OwningRow.Cells["KecRowID"].Value;
                    Master.frmKotaUpdate ifrmChild3 = new Master.frmKotaUpdate(this, "Kecamatan", rowID3);
                    ifrmChild3.ShowDialog();
                }
                break;

            case enumSelectedGrid.GridKelurahan:
                if (gridKelurahan.RowCount > 0)
                {
                    Guid rowID4 = (Guid)gridKelurahan.SelectedCells[0].OwningRow.Cells["KelRowID"].Value;
                    Master.frmKotaUpdate ifrmChild4 = new Master.frmKotaUpdate(this, "Kelurahan", rowID4);
                    ifrmChild4.ShowDialog();
                }
                break;
            }
        }