Exemplo n.º 1
0
        private void ToolStripMenuItem3_Brigade_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (Form form in Application.OpenForms)
                {
                    if (form.GetType() == typeof(BrigadeForm))
                    {
                        form.Activate();
                        return;
                    }
                }

                BrigadeForm frm = new BrigadeForm(role);
                tabControl1.Show();
                TabPage BrigadeTabPage = new TabPage("Бригадиры");
                tabControl1.TabPages.Add(BrigadeTabPage);
                tabControl1.SelectedTab = BrigadeTabPage;
                frm.TopLevel            = false;
                frm.Visible             = true;
                frm.FormBorderStyle     = FormBorderStyle.None;
                frm.Dock = DockStyle.Fill;
                BrigadeTabPage.Controls.Add(frm);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logger.Error(exp, "ToolStripMenuItem3_Brigade_Click");
            }
        }
Exemplo n.º 2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         UpdateCurrentBrigade = "update d__Brigade " +
                                "set Name = '" + textBox1.Text.Trim() + "', " +
                                "Surname = '" + textBox2.Text.Trim() + "'," +
                                "Lastname = '" + textBox3.Text.Trim() + "', " +
                                "FIO = '" + textBox2.Text.Trim() + ' ' + textBox1.Text.Substring(0, 1) + '.' + textBox3.Text.Substring(0, 1) + '.' + "'" +
                                "where ID = " + selectID;
         DataTable dtbl = new DataTable();
         dtbl = DbConnection.DBConnect(UpdateCurrentBrigade);
         this.Close();
         MessageBox.Show("Запись изменена!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         BrigadeForm main = this.Owner as BrigadeForm;
         main.Refreshh();
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception exp)
     {
         MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 3
0
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         AddNewBrigade = "insert into d__Brigade values('" + textBox1.Text.Trim() + "','" + textBox2.Text.Trim() + "','" + textBox3.Text.Trim() + "','" + textBox2.Text.Trim() + ' ' + textBox1.Text.Substring(0, 1) + '.' + textBox3.Text.Substring(0, 1) + '.' + "')";
         DataTable dataTable = new DataTable();
         dataTable = DbConnection.DBConnect(AddNewBrigade);
         this.Close();
         MessageBox.Show("Сотрудник добавлен!", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         BrigadeForm main = this.Owner as BrigadeForm;
         main.Refreshh();
     }
     catch (SqlException ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception exp)
     {
         MessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }