void item_Click(object sender, EventArgs e) { try { dbconnection.Open(); ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender; string str = clickedItem.Text; string carNumber = str.Split(',')[0]; string query = "select Car_ID from cars where Car_Number=" + carNumber; MySqlCommand com = new MySqlCommand(query, dbconnection); string id = com.ExecuteScalar().ToString(); //// open carsManager Tap if (!xtraTabControlMainContainer.TabPages.Contains(xtraTabPageCars)) { xtraTabControlMainContainer.TabPages.Insert(index, CarsTP); index++; } xtraTabControlMainContainer.SelectedTabPage = xtraTabControlMainContainer.TabPages[xtraTabControlMainContainer.TabPages.IndexOf(xtraTabPageCars)]; //// open carsContent Tap if (!xtraTabControlCarsContent.Visible) { xtraTabControlCarsContent.Visible = true; } //// CarLicenseUpdate objForm = new CarLicenseUpdate(id, carNumber, xtraTabControlCarsContent, this); objForm.TopLevel = false; XtraTabPage xtraTabPage = getTabPage(xtraTabControlCarsContent, "تعديل رخصة العربية"); if (xtraTabPage == null) { xtraTabControlCarsContent.TabPages.Add("تعديل رخصة العربية"); xtraTabPage = getTabPage(xtraTabControlCarsContent, "تعديل رخصة العربية"); } xtraTabPage.Controls.Clear(); xtraTabPage.Controls.Add(objForm); xtraTabControlCarsContent.SelectedTabPage = xtraTabPage; objForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; objForm.Dock = DockStyle.Fill; objForm.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } dbconnection.Close(); }
public void bindCarLicenseForm(DataRowView carRow, Cars cars) { try { dbconnection.Open(); String query = "select Car_License_ID from car_license where Car_ID=" + carRow[0].ToString(); MySqlCommand com = new MySqlCommand(query, dbconnection); if (com.ExecuteScalar() == null) { CarLicenseRecord objForm = new CarLicenseRecord(carRow, cars, xtraTabControlCarsContent, this); objForm.TopLevel = false; XtraTabPage xtraTabPage = getTabPage(xtraTabControlCarsContent, "تسجيل رخصة العربية"); if (xtraTabPage == null) { xtraTabControlCarsContent.TabPages.Add("تسجيل رخصة العربية"); xtraTabPage = getTabPage(xtraTabControlCarsContent, "تسجيل رخصة العربية"); } xtraTabPage.Controls.Clear(); xtraTabPage.Controls.Add(objForm); xtraTabControlCarsContent.SelectedTabPage = xtraTabPage; objForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; objForm.Dock = DockStyle.Fill; objForm.Show(); } else { CarLicenseUpdate objForm = new CarLicenseUpdate(carRow, cars, xtraTabControlCarsContent, this); objForm.TopLevel = false; XtraTabPage xtraTabPage = getTabPage(xtraTabControlCarsContent, "تعديل رخصة العربية"); if (xtraTabPage == null) { xtraTabControlCarsContent.TabPages.Add("تعديل رخصة العربية"); xtraTabPage = getTabPage(xtraTabControlCarsContent, "تعديل رخصة العربية"); } xtraTabPage.Controls.Clear(); xtraTabPage.Controls.Add(objForm); xtraTabControlCarsContent.SelectedTabPage = xtraTabPage; objForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; objForm.Dock = DockStyle.Fill; objForm.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } dbconnection.Close(); }