Zakaz.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 Zakaz : 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 Zakaz()
  26. {
  27. InitializeComponent();
  28. label1.Text = familia + " " + ima + " " + othestvo;
  29. const string sql = "SELECT * From zakaz_view where Статус = 'Делается'";
  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 Zakaz_Load(object sender, EventArgs e)
  49. {
  50. }
  51. private void label1_Click(object sender, EventArgs e)
  52. {
  53. }
  54. private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
  55. {
  56. predmet = dataGridView1.CurrentRow.Cells[0].Value.ToString();
  57. gorod = dataGridView1.CurrentRow.Cells[1].Value.ToString();
  58. raion = dataGridView1.CurrentRow.Cells[2].Value.ToString();
  59. ych = dataGridView1.CurrentRow.Cells[3].Value.ToString();
  60. blank = dataGridView1.CurrentRow.Cells[4].Value.ToString();
  61. vid = dataGridView1.CurrentRow.Cells[5].Value.ToString();
  62. Izmenie.Sdelano jl = new Izmenie.Sdelano();
  63. string[] opisanie = new string[1];
  64. using (SqlConnection connection = new SqlConnection("server=ngknn.ru;Trusted_Connection=No;DataBase=31P_Trifonova_PP;User ID=31П;PWD=12357"))
  65. {
  66. connection.Open();
  67. 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);
  68. opisanie[0] = command8.ExecuteScalar().ToString();
  69. Izmenie.Sdelano.id = opisanie[0];
  70. }
  71. using (Izmenie.Sdelano fl = new Izmenie.Sdelano())
  72. {
  73. this.Hide();
  74. fl.ShowDialog();
  75. this.Close();
  76. }
  77. }
  78. private void panel1_Paint(object sender, PaintEventArgs e)
  79. {
  80. }
  81. }
  82. }