Operator.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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
  12. {
  13. public partial class Operator : Form
  14. {
  15. public static string familia;
  16. public static string ima;
  17. public static string othestvo;
  18. public static string predmet;
  19. public static string gorod;
  20. public static string raion;
  21. public static string ych;
  22. public static string blank;
  23. public static string vid;
  24. public static string status;
  25. public Operator()
  26. {
  27. InitializeComponent();
  28. label1.Text = familia + " " + ima + " " + othestvo + " - Оператор";
  29. const string sql = "SELECT * From zakaz_view where Статус = 'Делается' OR Статус = 'Готово'";
  30. using (SqlCommand sqlCommand = new SqlCommand(sql, DataBase.connect()))
  31. {
  32. try
  33. {
  34. using (SqlDataReader dataReader = sqlCommand.ExecuteReader())
  35. {
  36. DataTable dataTable = new DataTable();
  37. dataTable.Load(dataReader);
  38. this.dataGridView1.DataSource = dataTable;
  39. dataReader.Close();
  40. }
  41. }
  42. catch
  43. {
  44. MessageBox.Show("Ошибка подключения");
  45. }
  46. }
  47. }
  48. private void panel1_Paint(object sender, PaintEventArgs e)
  49. {
  50. }
  51. private void Operator_Load(object sender, EventArgs e)
  52. {
  53. }
  54. private void button1_Click(object sender, EventArgs e)
  55. {
  56. using (Vnytri.zakaz fd = new Vnytri.zakaz())
  57. {
  58. this.Hide();
  59. fd.ShowDialog();
  60. this.Close();
  61. }
  62. }
  63. private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  64. {
  65. predmet = dataGridView1.CurrentRow.Cells[0].Value.ToString();
  66. gorod = dataGridView1.CurrentRow.Cells[1].Value.ToString();
  67. raion = dataGridView1.CurrentRow.Cells[2].Value.ToString();
  68. ych = dataGridView1.CurrentRow.Cells[3].Value.ToString();
  69. blank = dataGridView1.CurrentRow.Cells[4].Value.ToString();
  70. vid = dataGridView1.CurrentRow.Cells[5].Value.ToString();
  71. status = dataGridView1.CurrentRow.Cells[6].Value.ToString();
  72. Operator jl = new Operator();
  73. string[] opisanie = new string[1];
  74. if (status == "Готово")
  75. {
  76. using (SqlConnection connection = new SqlConnection("server=ngknn.ru;Trusted_Connection=No;DataBase=31P_Trifonova_PP;User ID=31П;PWD=12357"))
  77. {
  78. connection.Open();
  79. SqlCommand command8 = new SqlCommand("select [id_table] from [dbo].[Zakaz] where [Predmet] ='" + predmet + "' and [Gorod] = '" + gorod + "'and [Raion]='" + raion + "'and [Uchebnoye_uchrezhdeniye] ='" + ych + "'and [Blank] ='" + blank + "'and [Kol_vo] ='" + vid + "' and [Statys] ='Готово'", connection);
  80. opisanie[0] = command8.ExecuteScalar().ToString();
  81. Izmenie.Gotovo.id = opisanie[0];
  82. }
  83. using (Izmenie.Gotovo fl = new Izmenie.Gotovo())
  84. {
  85. this.Hide();
  86. fl.ShowDialog();
  87. this.Close();
  88. }
  89. }
  90. else
  91. {
  92. MessageBox.Show("Данный бланк еще не готов", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Information);
  93. }
  94. }
  95. }
  96. }