Пример #1
0
        private void  асценкиToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (Form form in Application.OpenForms)
                {
                    if (form.GetType() == typeof(ServiceCostForm))
                    {
                        form.Activate();
                        return;
                    }
                }

                ServiceCostForm ServiceCostForm = new ServiceCostForm(role);
                tabControl1.Show();
                TabPage CarriageTabPage = new TabPage("Расценки");
                tabControl1.TabPages.Add(CarriageTabPage);
                tabControl1.SelectedTab         = CarriageTabPage;
                ServiceCostForm.TopLevel        = false;
                ServiceCostForm.Visible         = true;
                ServiceCostForm.FormBorderStyle = FormBorderStyle.None;
                ServiceCostForm.Dock            = DockStyle.Fill;
                CarriageTabPage.Controls.Add(ServiceCostForm);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logger.Error(exp, "РасценкиToolStripMenuItem_Click");
            }
        }
Пример #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string FillServiceCost = "exec dbo.FillServiceCost '" + textBox2.Text.Trim() + "','" + dateTimePicker1.Value.Date.ToString() + "','" + dateTimePicker2.Value.Date.ToString() + "'," + textBox1.Text.Replace(",", ".") + "," + comboBox2.SelectedValue.ToString();
         DbConnection.DBConnect(FillServiceCost);
         this.Close();
         MessageBox.Show("Запись добавлена!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         ServiceCostForm main = this.Owner as ServiceCostForm;
         main.Btn_Refresh_Click(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);
     }
 }