private void btnAdd_Click(object sender, EventArgs e) { PetaIDchoose = 0; AdminPetaNew addNewLantai = new AdminPetaNew(); addNewLantai.Show(); }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { try { this.dataGridView1.Rows[e.RowIndex].Cells["No"].ReadOnly = true; this.dataGridView1.Rows[e.RowIndex].Cells["Judul"].ReadOnly = true; PetaIDchoose = (int)dataGridView1.Rows[e.RowIndex].Cells["No"].Value; if (e.ColumnIndex == dataGridView1.Columns["Detail"].Index && e.RowIndex >= 0) { AdminPetaNew addNewLantai = new AdminPetaNew(); addNewLantai.Show(); } else if (e.ColumnIndex == dataGridView1.Columns["Delete"].Index && e.RowIndex >= 0) { SqlCommand command = new SqlCommand("DELETE FROM Peta WHERE No=" + PetaIDchoose, con); if (MessageBox.Show("Are you sure want to delete this record ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ExecMyQuery(command, "Data Deleted"); } } else { //preview jumlah pointer SqlCommand command = new SqlCommand("SELECT COUNT(*) FROM Ruang WHERE PetaID = " + PetaIDchoose, con); con.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { tbCountPoint.Text = reader.GetInt32(0).ToString(); } } else { tbCountPoint.Text = "0"; } reader.Close(); con.Close(); //preview gambar lantai PreviewImage(PetaIDchoose); //preview pointer List <Control> listPointer = pictureBox1.Controls.Cast <Control>().ToList(); foreach (Control control in listPointer) { pictureBox1.Controls.Remove(control); control.Dispose(); } LoadPointer(PetaIDchoose); } } catch { return; } }
private void AdminPetaNew_Load(object sender, EventArgs e) { _obj = this; AdminPetaNewLantai newLantai = new AdminPetaNewLantai(); newLantai.Dock = DockStyle.Fill; panelEdit.Controls.Add(newLantai); newLantai.LoadLantai(LantaiID); }