Sotrudniki.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Data.SqlClient;
  11. namespace Blanki_ekzamena.Izmenie
  12. {
  13. public partial class Sotrudniki : Form
  14. {
  15. public static string parol;
  16. public static string login;
  17. public static string id;
  18. public Sotrudniki()
  19. {
  20. InitializeComponent();
  21. fam.Text = Vnytri.Sotrudnik.familia_s;
  22. Im.Text=Vnytri.Sotrudnik.ima_s;
  23. label1.Text=Vnytri.Sotrudnik.othestvo;
  24. label4.Text=Vnytri.Sotrudnik.dolgnost_s;
  25. label2.Text = login;
  26. label5.Text = parol;
  27. }
  28. private void Sotrudniki_Load(object sender, EventArgs e)
  29. {
  30. }
  31. private void btn_soxr_Click(object sender, EventArgs e)
  32. {
  33. using (Vnytri.Sotrudnik fl = new Vnytri.Sotrudnik())
  34. {
  35. this.Hide();
  36. fl.ShowDialog();
  37. this.Close();
  38. }
  39. }
  40. private void label5_Click(object sender, EventArgs e)
  41. {
  42. }
  43. private void button1_Click(object sender, EventArgs e)
  44. {
  45. const string sql = "delete from Sotrudnik where id_sotr = @id";
  46. DataTable table = new DataTable();
  47. SqlCommand cmd = new SqlCommand(sql, DataBase.connect());
  48. SqlDataAdapter adapter = new SqlDataAdapter();
  49. cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.NVarChar, 50));
  50. cmd.Parameters["@id"].Value = id;
  51. adapter.SelectCommand = cmd;
  52. adapter.Fill(table);
  53. using (Vnytri.Sotrudnik fl = new Vnytri.Sotrudnik())
  54. {
  55. this.Hide();
  56. fl.ShowDialog();
  57. this.Close();
  58. }
  59. }
  60. }
  61. }