1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- namespace Дол_Восток
- {
- public partial class GLavn : Form
- {
- string queryText = null;
- SqlCommand query = null;
- public GLavn()
- {
- InitializeComponent();
- }
- private void GLavn_Load(object sender, EventArgs e)
- {
- switch (tabControl1.SelectedIndex)
- {
- case 0:
- queryText = $"select kod_sotrudnic as '№', surname as 'Фамилия', name as 'Имя', patronymic as 'Отчество', dolgnost as 'Должность' from Sotrudnic join dolgnost on dolgnost.kod_dolgnost = sotrudnic.kod_dolgnost";
- break;
- case 1:
- break;
- }
- SqlDataAdapter dataAdapter = new SqlDataAdapter($"select kod_sotrudnic as '№', surname as 'Фамилия', name as 'Имя', patronymic as 'Отчество', dolgnost as 'Должность' from Sotrudnic join dolgnost on dolgnost.kod_dolgnost = sotrudnic.kod_dolgnost", db_helper.sqlConnection);
- DataSet dataSet = new DataSet();
- dataAdapter.Fill(dataSet);
- Sotrudnici.DataSource = dataSet.Tables[0];
- }
- private void GLavn_FormClosing(object sender, FormClosingEventArgs e)
- {
- Application.Exit();
- }
- private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e)
- {
- }
- private void bt_add_Click(object sender, EventArgs e)
- {
- }
- private void bt_delete_Click(object sender, EventArgs e)
- {
- string row = Sotrudnici.Rows[Sotrudnici.CurrentCell.RowIndex].Cells[0].Value.ToString();
- query = new SqlCommand($"select kod_passport from sotrudnic where kod_sotrudnic like '{row}'", db_helper.sqlConnection);
- string kodPassport = query.ExecuteScalar().ToString();
- query = new SqlCommand($"select kod_experience from sotrudnic where kod_sotrudnic like '{row}'", db_helper.sqlConnection);
- string kodExperience = query.ExecuteScalar().ToString();
- MessageBox.Show($"kod_sotrudnic = {row}\nkod_passport = {kodPassport}\nkod_experience = {kodExperience}");
- }
- private void bt_change_Click(object sender, EventArgs e)
- {
- }
- }
- }
|