private void button1_Click(object sender, EventArgs e) { connection StaffConnection = new connection(); switch (button1.Text) { case "Добавить запись": StaffConnection.insert("Сотрудники", "'"+LastName.Text + "','" + Name.Text + "','" + MoreName.Text + "','" + BirthDay.Text + "','" + NumberContract.Text + "','" + Merry.Text + "','" + WorkDate.Text + "','" + Gender.Text + "','" + Adress.Text +"','"+HaveAHome.Text + "','" + SerialPass.Text + "','" + NumberPass1.Text + "','" + DatePass.Text + "','" + PlaceOfBirth.Text + "','" + IDPass.Text + "','" + WhoGivePass.Text + "','" + Citizen.Text + "','" + INN.Text + "','" + InshuranceNumber.Text + "','" + MedicCardNumber.Text + "','" + Departament.Text + "','" + Occupation.Text + "','" + Sector.Text + "','" + Sailary.Text + "','" + MaxBonuseMoney.Text + "','" + HomeTel.Text + "','" + workTel.Text + "','" + MobTel.Text + "','" + Exp.Text+"'"); break; case "Изменить": StaffConnection.update("Сотрудники", "Фамилия ='" + LastName.Text + "', Имя = '" + Name.Text + "', Отчеcтво ='" + MoreName.Text + "', [Дата рождения] ='" + BirthDay.Text + "', [Номер контракта] ='" + NumberContract.Text + "', [Семейное положение] ='" + Merry.Text + "', [Дата приёма] ='" + WorkDate.Text + "', Пол =" + Gender.Text + "', [Адрес проживания] ='" + Adress.Text + "', [Адрес прописки] ='" + HaveAHome.Text + "', [Серия паспорта] ='" + SerialPass.Text + "', [Номер паспорта] ='" + NumberPass1.Text + "', [Дата выдачи паспорта] ='" + DatePass.Text + "', [Место рождения] ='" + PlaceOfBirth.Text + "', [Код подразделения] ='" + IDPass.Text + "', [Паспорт выдан] ='" + WhoGivePass.Text + "', Гражданство ='" + Citizen.Text + "', ИНН ='" + INN.Text + "', [Номер страхового свидетельства] ='" + InshuranceNumber.Text + "', [Номер медицинского полиса] ='" + MedicCardNumber.Text + "', Департамент ='" + Departament.Text + "', Должность ='" + Occupation.Text + "', Сектор ='" + Sector.Text + "', Оклад ='" + Sailary.Text + "', [Максимальная премия] ='" + MaxBonuseMoney.Text + ", Дом.телефон ='" + HomeTel.Text + "', Раб.телефон ='" + workTel.Text + "', Моб.телефон ='" + MobTel.Text + "', [Стаж работы] ='" + Exp.Text, "[Код сотрудника] = "+person.getID()); break; default: MessageBox.Show("Нет имени"); break; } }
private void btnChIll_Click(object sender, EventArgs e) { switch (btnChIll.Text) { case "Изменить": DateOfIle.Text = Convert.ToString(dataGridView3.Rows[dataGridView3.CurrentRow.Index].Cells[2].Value); DaysOfIle.Text = Convert.ToString(dataGridView3.Rows[dataGridView3.CurrentRow.Index].Cells[3].Value); checkBox1.Checked = (bool)dataGridView3.Rows[dataGridView3.CurrentRow.Index].Cells[4].Value; btnChIll.Text = "Сохранить"; btnChIll.BackColor = System.Drawing.Color.GreenYellow; break; case "Сохранить": btnChIll.Text = "Изменить"; btnChIll.BackColor = System.Drawing.Color.Transparent; connection IllConnection = new connection(); IllConnection.update("Больничные", " [Дата начала] ='" + DateOfIle.Text + "',[Колличество дней]='" + DaysOfIle.Text + "',[Совмещение с работой] ='" + checkBox1.Checked + "'", "[Код больничного] = " + Convert.ToString(dataGridView3.Rows[dataGridView3.CurrentRow.Index].Cells[0].Value)); dataGridView3.DataSource = FillDGV("*", "Больничные", "[Код сотрудника] = " + IDPerson); DateOfIle.Text = ""; DaysOfIle.Text = ""; checkBox1.Checked = false; break; } }
private void btnChFamily_Click(object sender, EventArgs e) { switch (btnChFamily.Text) { case"Изменить": FIO.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[2].Value); TreeOfFamily.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[3].Value); BirthDayOfFamily.Text = Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[4].Value); btnChFamily.Text = "Сохранить"; btnChFamily.BackColor = System.Drawing.Color.GreenYellow; break; case"Сохранить": btnChFamily.Text = "Изменить"; btnChFamily.BackColor = System.Drawing.Color.Transparent; connection FamilyConnection = new connection(); FamilyConnection.update("[Состав семьи]", "ФИО='" + FIO.Text + "',[Степень родства]='" + TreeOfFamily.Text + "',[Дата рождения] ='" + BirthDayOfFamily.Text + "'", "[Код семьи] = "+ Convert.ToString(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value)); dataGridView1.DataSource = FillDGV("*", "[Состав семьи]", "[Код сотрудника] = " + IDPerson); FIO.Text = ""; TreeOfFamily.Text = ""; BirthDayOfFamily.Text = ""; break; } }
private void btnChHoly_Click(object sender, EventArgs e) { switch (btnChHoly.Text) { case "Изменить": DateOfBegining.Text = Convert.ToString(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[2].Value); DateOfEnd.Text = Convert.ToString(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[3].Value); NumberOfLaw.Text = Convert.ToString(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[4].Value); btnChHoly.Text = "Сохранить"; btnChHoly.BackColor = System.Drawing.Color.GreenYellow; break; case "Сохранить": btnChHoly.Text = "Изменить"; btnChHoly.BackColor = System.Drawing.Color.Transparent; connection HolyConnection = new connection(); HolyConnection.update("Отпуска", " [Дата начала] ='" + DateOfBegining.Text + "',[Дата окончания]='" + DateOfEnd.Text + "',[№ приказа] ='" + NumberOfLaw.Text + "'", "[Код отпуска] = " + Convert.ToString(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[0].Value)); dataGridView2.DataSource = FillDGV("*", "Отпуска", "[Код сотрудника] = " + IDPerson); DateOfBegining.Text = ""; DateOfEnd.Text = ""; NumberOfLaw.Text = ""; break; } }
private void btnCHDiplom_Click(object sender, EventArgs e) { switch (btnCHDiplom.Text) { case "Изменить": NameOfUniversity.Text = Convert.ToString(dataGridView0.Rows[dataGridView0.CurrentRow.Index].Cells[2].Value); Scienist.Text = Convert.ToString(dataGridView0.Rows[dataGridView0.CurrentRow.Index].Cells[3].Value); EndYear.Text = Convert.ToString(dataGridView0.Rows[dataGridView0.CurrentRow.Index].Cells[4].Value); Qualification.Text = Convert.ToString(dataGridView0.Rows[dataGridView0.CurrentRow.Index].Cells[5].Value); btnCHDiplom.Text = "Сохранить"; btnCHDiplom.BackColor = System.Drawing.Color.GreenYellow; break; case "Сохранить": btnCHDiplom.Text = "Изменить"; btnCHDiplom.BackColor = System.Drawing.Color.Transparent; connection DiplomConnection = new connection(); DiplomConnection.update("Диплом", "[Название ВУЗа]='" + NameOfUniversity.Text + "',[Ученое звание]='" + Scienist.Text + "',[Год окончания] ='" + EndYear.Text + "',Квалификация= '" + Qualification.Text + "'", "[Код диплома] = " + Convert.ToString(dataGridView0.Rows[dataGridView0.CurrentRow.Index].Cells[0].Value)); dataGridView0.DataSource = FillDGV("*", "Диплом", "[Код сотрудника] = " + IDPerson); NameOfUniversity.Text = ""; Scienist.Text = ""; EndYear.Text = ""; Qualification.Text = ""; break; } }