public SparePartUpdate(DataGridViewRow row1, SparePart sparePart)
 {
     try
     {
         InitializeComponent();
         dbconnection   = new MySqlConnection(connection.connectionString);
         this.sparePart = sparePart;
         this.row1      = row1;
         SetData(row1);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
     dbconnection.Close();
 }
 public SparePartUpdate(DataRowView row1, SparePart sparePart, XtraTabControl xtraTabControlCarsContent)
 {
     try
     {
         InitializeComponent();
         dbconnection   = new MySqlConnection(connection.connectionString);
         this.sparePart = sparePart;
         this.row1      = row1;
         this.xtraTabControlCarsContent = xtraTabControlCarsContent;
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
     dbconnection.Close();
 }
        public void bindUpdateSparePartForm(DataRowView SparePartRow, SparePart sparepart)
        {
            SparePartUpdate objForm = new SparePartUpdate(SparePartRow, sparepart, xtraTabControlCarsContent);

            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();
        }
 private void Btn4_Click(object sender, EventArgs e)
 {
     try
     {
         tableLayoutPanelContent.Controls.Clear();
         resetButtonsStoreDetailsPanelStyle();
         Button btn = (Button)sender;
         btn.ForeColor = Color.Black;
         btn.BackColor = Color.White;
         SparePart objForm = new SparePart();
         objForm.TopLevel = false;
         tableLayoutPanelContent.Controls.Add(objForm);
         objForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
         objForm.Dock            = DockStyle.Fill;
         objForm.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        //Spare Part
        private void navBarItem3_LinkClicked(object sender, NavBarLinkEventArgs e)
        {
            try
            {
                restForeColorOfNavBarItem();
                NavBarItem navBarItem = (NavBarItem)sender;
                navBarItem.Appearance.ForeColor = Color.Blue;
                if (!xtraTabControlCarsContent.Visible)
                {
                    xtraTabControlCarsContent.Visible = true;
                }

                XtraTabPage xtraTabPage = getTabPage("قطع الغيار");
                if (xtraTabPage == null)
                {
                    xtraTabControlCarsContent.TabPages.Add("قطع الغيار");
                    xtraTabPage = getTabPage("قطع الغيار");
                }

                xtraTabPage.Controls.Clear();
                xtraTabControlCarsContent.SelectedTabPage = xtraTabPage;

                SparePart objForm = new SparePart(this);

                objForm.TopLevel = false;
                xtraTabPage.Controls.Add(objForm);
                objForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                objForm.Dock            = DockStyle.Fill;

                objForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }