예제 #1
0
        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("تسجيل رخصة العربية");
                    if (xtraTabPage == null)
                    {
                        xtraTabControlCarsContent.TabPages.Add("تسجيل رخصة العربية");
                        xtraTabPage = getTabPage("تسجيل رخصة العربية");
                    }
                    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("تعديل رخصة العربية");
                    if (xtraTabPage == null)
                    {
                        xtraTabControlCarsContent.TabPages.Add("تعديل رخصة العربية");
                        xtraTabPage = getTabPage("تعديل رخصة العربية");
                    }
                    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();
        }
예제 #2
0
 private void btnCarLicense_Click(object sender, EventArgs e)
 {
     try
     {
         if (row1 != null)
         {
             dbconnection.Open();
             String       query = "select Car_License_ID from car_license where Car_ID=" + row1.Cells["car_id"].Value;
             MySqlCommand com   = new MySqlCommand(query, dbconnection);
             if (com.ExecuteScalar() == null)
             {
                 if (carLicenseRecord == null)
                 {
                     carLicenseRecord = new CarLicenseRecord(row1, this);
                     carLicenseRecord.Show();
                     carLicenseRecord.Focus();
                 }
                 else
                 {
                     carLicenseRecord.Show();
                     carLicenseRecord.Focus();
                 }
             }
             else
             {
                 if (carLicenseUpdate == null)
                 {
                     carLicenseUpdate = new CarLicenseUpdate(row1, this);
                     carLicenseUpdate.Show();
                     carLicenseUpdate.Focus();
                 }
                 else
                 {
                     carLicenseUpdate.Show();
                     carLicenseUpdate.Focus();
                 }
             }
         }
         else
         {
             MessageBox.Show("Select row");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     dbconnection.Close();
 }