コード例 #1
0
 private void Edit_String()
 {
     for (int i = 0; i < dataGridView1.SelectedRows.Count; i++)
     {
         if (identify == "raschetniki")
         {
             Raschetniki raschetniki = new Raschetniki(MySqlOperations, MySqlQueries);
             raschetniki.textBox1.Text       = dataGridView1.SelectedRows[i].Cells[2].Value.ToString();
             raschetniki.textBox2.Text       = dataGridView1.SelectedRows[i].Cells[3].Value.ToString();
             raschetniki.textBox3.Text       = dataGridView1.SelectedRows[i].Cells[4].Value.ToString();
             raschetniki.textBox4.Text       = dataGridView1.SelectedRows[i].Cells[5].Value.ToString();
             raschetniki.textBox5.Text       = dataGridView1.SelectedRows[i].Cells[6].Value.ToString();
             raschetniki.ID                  = dataGridView1.SelectedRows[i].Cells[0].Value.ToString();
             raschetniki.Raschetniki_Closed += асчетныеСчетаToolStripMenuItem_Click;
             raschetniki.Owner               = this;
             raschetniki.button3.Visible     = true;
             raschetniki.button1.Visible     = false;
             raschetniki.AcceptButton        = raschetniki.button3;
             raschetniki.Show();
         }
         else if (identify == "otdely")
         {
             Otdely otdely = new Otdely(MySqlOperations, MySqlQueries);
             otdely.textBox1.Text   = dataGridView1.SelectedRows[i].Cells[1].Value.ToString();
             otdely.ID              = dataGridView1.SelectedRows[i].Cells[0].Value.ToString();
             otdely.Otdely_Closed  += ОтделыToolStripMenuItem_Click;
             otdely.Owner           = this;
             otdely.button3.Visible = true;
             otdely.button1.Visible = false;
             otdely.AcceptButton    = otdely.button3;
             otdely.Show();
         }
         else if (identify == "sotrudniki")
         {
             Sotrudniki sotrudniki = new Sotrudniki(MySqlOperations, MySqlQueries);
             if (sotrudniki.comboBox1.Items.Count == 0 || sotrudniki.comboBox2.Items.Count == 0 || sotrudniki.comboBox3.Items.Count == 0 || sotrudniki.comboBox4.Items.Count == 0)
             {
                 if (sotrudniki.comboBox1.Items.Count == 0 && Role[3] != '0')
                 {
                     Sotrudniki_After_Otdely(sotrudniki);
                 }
                 if (sotrudniki.comboBox2.Items.Count == 0 && Role[0] != '0')
                 {
                     Sotrudniki_After_Doljnosti(sotrudniki);
                 }
                 if (sotrudniki.comboBox3.Items.Count == 0 && Role[2] != '0')
                 {
                     Sotrudniki_After_Oklad(sotrudniki);
                 }
                 if (sotrudniki.comboBox4.Items.Count == 0 && Role[4] != '0')
                 {
                     Sotrudniki_After_RS(sotrudniki);
                 }
                 sotrudniki = new Sotrudniki(MySqlOperations, MySqlQueries)
                 {
                     ID = dataGridView1.SelectedRows[i].Cells[0].Value.ToString()
                 };
                 sotrudniki.textBox1.Text = dataGridView1.SelectedRows[i].Cells[1].Value.ToString().Split(' ')[0];
                 sotrudniki.textBox2.Text = dataGridView1.SelectedRows[i].Cells[1].Value.ToString().Split(' ')[1];
                 sotrudniki.textBox3.Text = dataGridView1.SelectedRows[i].Cells[1].Value.ToString().Split(' ')[2];
                 if (dataGridView1.SelectedRows[i].Cells[5].Value.ToString() != "")
                 {
                     sotrudniki.comboBox4.Items.Add(dataGridView1.SelectedRows[i].Cells[5].Value.ToString());
                 }
                 MySqlOperations.Search_In_ComboBox(dataGridView1.SelectedRows[i].Cells[2].Value.ToString(), sotrudniki.comboBox1);
                 MySqlOperations.Search_In_ComboBox(dataGridView1.SelectedRows[i].Cells[3].Value.ToString(), sotrudniki.comboBox2);
                 MySqlOperations.Search_In_ComboBox(dataGridView1.SelectedRows[i].Cells[4].Value.ToString(), sotrudniki.comboBox3);
                 MySqlOperations.Search_In_ComboBox(dataGridView1.SelectedRows[i].Cells[5].Value.ToString(), sotrudniki.comboBox4);
                 sotrudniki.Sotrudniki_Closed += СотрудникиToolStripMenuItem1_Click;
                 sotrudniki.Owner              = this;
                 sotrudniki.button3.Visible    = true;
                 sotrudniki.button1.Visible    = false;
                 sotrudniki.AcceptButton       = sotrudniki.button3;
                 sotrudniki.Show();
             }
             else
             {
                 sotrudniki.ID            = dataGridView1.SelectedRows[i].Cells[0].Value.ToString();
                 sotrudniki.textBox1.Text = dataGridView1.SelectedRows[i].Cells[1].Value.ToString().Split(' ')[0];
                 sotrudniki.textBox2.Text = dataGridView1.SelectedRows[i].Cells[1].Value.ToString().Split(' ')[1];
                 sotrudniki.textBox3.Text = dataGridView1.SelectedRows[i].Cells[1].Value.ToString().Split(' ')[2];
                 if (dataGridView1.SelectedRows[i].Cells[5].Value.ToString() != "")
                 {
                     sotrudniki.comboBox4.Items.Add(dataGridView1.SelectedRows[i].Cells[5].Value.ToString());
                 }
                 MySqlOperations.Search_In_ComboBox(dataGridView1.SelectedRows[i].Cells[2].Value.ToString(), sotrudniki.comboBox1);
                 MySqlOperations.Search_In_ComboBox(dataGridView1.SelectedRows[i].Cells[3].Value.ToString(), sotrudniki.comboBox2);
                 MySqlOperations.Search_In_ComboBox(dataGridView1.SelectedRows[i].Cells[4].Value.ToString(), sotrudniki.comboBox3);
                 MySqlOperations.Search_In_ComboBox(dataGridView1.SelectedRows[i].Cells[5].Value.ToString(), sotrudniki.comboBox4);
                 sotrudniki.Sotrudniki_Closed += СотрудникиToolStripMenuItem1_Click;
                 sotrudniki.Owner              = this;
                 sotrudniki.button3.Visible    = true;
                 sotrudniki.button1.Visible    = false;
                 sotrudniki.AcceptButton       = sotrudniki.button3;
                 sotrudniki.Show();
             }
         }
         else if (identify == "oklad")
         {
             Oklad oklad = new Oklad(MySqlOperations, MySqlQueries);
             oklad.dateTimePicker1.Value = DateTime.Parse(dataGridView1.SelectedRows[i].Cells[3].Value.ToString());
             oklad.dateTimePicker2.Value = DateTime.Parse(dataGridView1.SelectedRows[i].Cells[4].Value.ToString());
             oklad.textBox1.Text         = dataGridView1.SelectedRows[i].Cells[2].Value.ToString();
             oklad.ID              = dataGridView1.SelectedRows[i].Cells[0].Value.ToString();
             oklad.Oklad_Closed   += ОкладToolStripMenuItem_Click;
             oklad.Owner           = this;
             oklad.button3.Visible = true;
             oklad.button1.Visible = false;
             oklad.AcceptButton    = oklad.button3;
             oklad.Show();
         }
         else if (identify == "doljnosti")
         {
             Doljnosti doljnosti = new Doljnosti(MySqlOperations, MySqlQueries);
             doljnosti.textBox1.Text     = dataGridView1.SelectedRows[i].Cells[1].Value.ToString();
             doljnosti.ID                = dataGridView1.SelectedRows[i].Cells[0].Value.ToString();
             doljnosti.Doljnosti_Closed += ДолжностиToolStripMenuItem_Click;
             doljnosti.Owner             = this;
             doljnosti.button3.Visible   = true;
             doljnosti.button1.Visible   = false;
             doljnosti.AcceptButton      = doljnosti.button3;
             doljnosti.Show();
         }
     }
 }
コード例 #2
0
 private void Insert_String()
 {
     if (identify == "raschetniki")
     {
         Raschetniki raschetniki = new Raschetniki(MySqlOperations, MySqlQueries);
         raschetniki.Raschetniki_Closed += асчетныеСчетаToolStripMenuItem_Click;
         raschetniki.Owner           = this;
         raschetniki.button1.Visible = true;
         raschetniki.button3.Visible = false;
         raschetniki.AcceptButton    = raschetniki.button1;
         raschetniki.Show();
     }
     else if (identify == "otdely")
     {
         Otdely otdely = new Otdely(MySqlOperations, MySqlQueries);
         otdely.Otdely_Closed  += ОтделыToolStripMenuItem_Click;
         otdely.Owner           = this;
         otdely.button1.Visible = true;
         otdely.button3.Visible = false;
         otdely.AcceptButton    = otdely.button1;
         otdely.Show();
     }
     else if (identify == "sotrudniki")
     {
         Sotrudniki sotrudniki = new Sotrudniki(MySqlOperations, MySqlQueries);
         sotrudniki.Sotrudniki_Closed += СотрудникиToolStripMenuItem1_Click;
         sotrudniki.Owner              = this;
         if (sotrudniki.comboBox1.Items.Count == 0 && Role[3] != '0')
         {
             Sotrudniki_After_Otdely(sotrudniki);
         }
         if (sotrudniki.comboBox2.Items.Count == 0 && Role[0] != '0')
         {
             Sotrudniki_After_Doljnosti(sotrudniki);
         }
         if (sotrudniki.comboBox3.Items.Count == 0 && Role[2] != '0')
         {
             Sotrudniki_After_Oklad(sotrudniki);
         }
         if (sotrudniki.comboBox4.Items.Count == 0 && Role[4] != '0')
         {
             Sotrudniki_After_RS(sotrudniki);
         }
         sotrudniki.button1.Visible = true;
         sotrudniki.button3.Visible = false;
         sotrudniki.AcceptButton    = sotrudniki.button1;
         sotrudniki.Show();
     }
     else if (identify == "oklad")
     {
         Oklad oklad = new Oklad(MySqlOperations, MySqlQueries);
         oklad.Oklad_Closed   += ОкладToolStripMenuItem_Click;
         oklad.Owner           = this;
         oklad.button1.Visible = true;
         oklad.button3.Visible = false;
         oklad.AcceptButton    = oklad.button1;
         oklad.Show();
     }
     else if (identify == "doljnosti")
     {
         Doljnosti doljnosti = new Doljnosti(MySqlOperations, MySqlQueries);
         doljnosti.Doljnosti_Closed += ДолжностиToolStripMenuItem_Click;
         doljnosti.Owner             = this;
         doljnosti.button1.Visible   = true;
         doljnosti.button3.Visible   = false;
         doljnosti.AcceptButton      = doljnosti.button1;
         doljnosti.Show();
     }
     else if (identify == "vyplaty")
     {
         Vyplaty vyplaty = new Vyplaty(MySqlOperations, MySqlQueries);
         vyplaty.Vyplaty_Closed += ВыплатыЗарплатыToolStripMenuItem_Click;
         vyplaty.Owner           = this;
         vyplaty.Show();
     }
 }