コード例 #1
0
ファイル: MainForm.cs プロジェクト: D1mash/CisAccount_Ky
        private void ToolStripMenuItem1_Product_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (Form form in Application.OpenForms)
                {
                    if (form.GetType() == typeof(Form_Product))
                    {
                        form.Activate();
                        return;
                    }
                }

                Form_Product frm = new Form_Product(role, UserID);
                tabControl1.Show();
                TabPage ProductTabPage = new TabPage("Продукты");
                tabControl1.TabPages.Add(ProductTabPage);
                tabControl1.SelectedTab = ProductTabPage;
                frm.TopLevel            = false;
                frm.Visible             = true;
                frm.FormBorderStyle     = FormBorderStyle.None;
                frm.Dock = DockStyle.Fill;
                ProductTabPage.Controls.Add(frm);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logger.Error(exp, "ToolStripMenuItem1_Product_Click");
            }
        }
コード例 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string    UpdateCurrentProduct = "update d__Product set Name = '" + textBox1.Text.Trim() + "', Handling_id = " + comboBox1.SelectedValue + " where ID = " + selectID;
         DataTable dtbl = new DataTable();
         dtbl = DbConnection.DBConnect(UpdateCurrentProduct);
         this.Close();
         MessageBox.Show("Продукт изменён!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Form_Product owner = this.Owner as Form_Product;
         owner.button4_Click_Refresh_Table(null, null);
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception exp)
     {
         MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }