private void button2_Click_1(object sender, EventArgs e) { if (!string.IsNullOrEmpty(QueryTable)) { if (dataGridView1.SelectedRows.Count == 1) { DialogResult drSelected = MessageBox.Show("Are you sure you want to modify this selected entry?", "Modify Entries", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (drSelected == DialogResult.Yes) { if (!string.IsNullOrEmpty(ProcessCode)) { switch (ProcessCode) { case "": frm_BillingInfo bi = new frm_BillingInfo(); bi.isUpdate = true; bi.ForUpdate_SysID = int.Parse(dataGridView1["ID", dataGridView1.SelectedRows[0].Index].Value.ToString()); bi.SelectedDG = dataGridView1; bi.ShowDialog(); break; case "Floor_Info": frm_FloorInformation fi = new frm_FloorInformation(); fi.isUpdate = true; fi.ForUpdate_SysID = int.Parse(dataGridView1["ID", dataGridView1.SelectedRows[0].Index].Value.ToString()); fi.SelectedDG = dataGridView1; fi.ShowDialog(); break; case "Unit_Info": frm_UnitInformation ui = new frm_UnitInformation(); ui.isUpdate = true; ui.ForUpdate_SysID = int.Parse(dataGridView1["ID", dataGridView1.SelectedRows[0].Index].Value.ToString()); ui.SelectedDG = dataGridView1; ui.ShowDialog(); break; case "Customer_Info": case "Tenant_Info": frm_CustomerInformation cu = new frm_CustomerInformation(); cu.isUpdate = true; cu.ForUpdate_SysID = int.Parse(dataGridView1["ID", dataGridView1.SelectedRows[0].Index].Value.ToString()); cu.SelectedDG = dataGridView1; cu.ShowDialog(); break; } } } } else { MessageBox.Show("Warning: Please select row first.", "Select only one row to", MessageBoxButtons.OK, MessageBoxIcon.Warning); } btnRefresh.PerformClick(); } }
//Add Records private void button1_Click_1(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ProcessCode)) { switch (ProcessCode) { case "Cutoff_Info": frm_CutoffInfo co = new frm_CutoffInfo(); co.StartPosition = FormStartPosition.CenterScreen; co.QueryRecords = QueryRecords; co.ShowDialog(); LoadRecords(QueryRecords, Modules); break; case "Floor_Info": frm_FloorInformation fi = new frm_FloorInformation(); fi.StartPosition = FormStartPosition.CenterScreen; fi.ShowDialog(); LoadRecords(QueryRecords, Modules); break; case "Unit_Info": frm_UnitInformation ui = new frm_UnitInformation(); ui.StartPosition = FormStartPosition.CenterScreen; ui.ShowDialog(); LoadRecords(QueryRecords, Modules); break; case "Billing_Info": frm_BillingInfo bi = new frm_BillingInfo(); bi.StartPosition = FormStartPosition.CenterScreen; bi.ShowDialog(); break; case "Tenant_Info": case "Customer_Info": frm_CustomerInformation ci = new frm_CustomerInformation(); ci.StartPosition = FormStartPosition.CenterScreen; ci.LoadQuery = QueryRecords; ci.ShowDialog(); LoadRecords(QueryRecords, Modules); break; default: break; } btnRefresh.PerformClick(); } }