Sotrudnik_min_othes.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 Sotrudnik_min_othes : Form
  14. {
  15. public static string parol;
  16. public static string login;
  17. public static string id;
  18. public Sotrudnik_min_othes()
  19. {
  20. InitializeComponent();
  21. fam.Text = Vnytri.Sotrudnik.familia_s;
  22. Im.Text = Vnytri.Sotrudnik.ima_s;
  23. label4.Text = Vnytri.Sotrudnik.dolgnost_s;
  24. label2.Text = login;
  25. label5.Text = parol;
  26. }
  27. private void btn_soxr_Click(object sender, EventArgs e)
  28. {
  29. using (Vnytri.Sotrudnik fl = new Vnytri.Sotrudnik())
  30. {
  31. this.Hide();
  32. fl.ShowDialog();
  33. this.Close();
  34. }
  35. }
  36. private void button1_Click(object sender, EventArgs e)
  37. {
  38. const string sql = "delete from Sotrudnik where id_sotr = @id";
  39. DataTable table = new DataTable();
  40. SqlCommand cmd = new SqlCommand(sql, DataBase.connect());
  41. SqlDataAdapter adapter = new SqlDataAdapter();
  42. cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.NVarChar, 50));
  43. cmd.Parameters["@id"].Value = id;
  44. adapter.SelectCommand = cmd;
  45. adapter.Fill(table);
  46. using (Vnytri.Sotrudnik fl = new Vnytri.Sotrudnik())
  47. {
  48. this.Hide();
  49. fl.ShowDialog();
  50. this.Close();
  51. }
  52. }
  53. }
  54. }