FormClient.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.SqlClient;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace СУБД_Швейная_фабрика
  12. {
  13. public partial class FormClient : Form
  14. {
  15. public FormClient()
  16. {
  17. InitializeComponent();
  18. }
  19. class ClothPanel : Panel
  20. {
  21. public System.Windows.Forms.TextBox tbxDescription;
  22. public System.Windows.Forms.TextBox tbxHeight;
  23. public System.Windows.Forms.TextBox tbxWeight;
  24. public System.Windows.Forms.TextBox tbxColor;
  25. public System.Windows.Forms.TextBox tbxTitle;
  26. public System.Windows.Forms.Label label5;
  27. public System.Windows.Forms.Label label4;
  28. public System.Windows.Forms.Label label3;
  29. public System.Windows.Forms.Label label2;
  30. public System.Windows.Forms.Label label1;
  31. public System.Windows.Forms.PictureBox pbxPhoto;
  32. public ClothPanel()
  33. {
  34. // this.panel1 = new System.Windows.Forms.Panel();
  35. this.label1 = new System.Windows.Forms.Label();
  36. this.label2 = new System.Windows.Forms.Label();
  37. this.label3 = new System.Windows.Forms.Label();
  38. this.label4 = new System.Windows.Forms.Label();
  39. this.label5 = new System.Windows.Forms.Label();
  40. this.tbxTitle = new System.Windows.Forms.TextBox();
  41. this.tbxColor = new System.Windows.Forms.TextBox();
  42. this.tbxWeight = new System.Windows.Forms.TextBox();
  43. this.tbxHeight = new System.Windows.Forms.TextBox();
  44. this.tbxDescription = new System.Windows.Forms.TextBox();
  45. this.pbxPhoto = new System.Windows.Forms.PictureBox();
  46. this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  47. | System.Windows.Forms.AnchorStyles.Right)));
  48. this.BackColor = System.Drawing.Color.White;
  49. this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  50. this.Controls.Add(this.tbxDescription);
  51. this.Controls.Add(this.tbxHeight);
  52. this.Controls.Add(this.tbxWeight);
  53. this.Controls.Add(this.tbxColor);
  54. this.Controls.Add(this.tbxTitle);
  55. this.Controls.Add(this.label5);
  56. this.Controls.Add(this.label4);
  57. this.Controls.Add(this.label3);
  58. this.Controls.Add(this.label2);
  59. this.Controls.Add(this.label1);
  60. this.Controls.Add(this.pbxPhoto);
  61. this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  62. this.Location = new System.Drawing.Point(28, 27);
  63. this.MinimumSize = new System.Drawing.Size(505, 171);
  64. this.Name = "panel1";
  65. this.Size = new System.Drawing.Size(674, 171);
  66. this.TabIndex = 0;
  67. //
  68. // label1
  69. //
  70. this.label1.AutoSize = true;
  71. this.label1.Location = new System.Drawing.Point(137, 15);
  72. this.label1.Name = "label1";
  73. this.label1.Size = new System.Drawing.Size(68, 16);
  74. this.label1.TabIndex = 1;
  75. this.label1.Text = "Название:";
  76. //
  77. // label2
  78. //
  79. this.label2.AutoSize = true;
  80. this.label2.Location = new System.Drawing.Point(137, 43);
  81. this.label2.Name = "label2";
  82. this.label2.Size = new System.Drawing.Size(40, 16);
  83. this.label2.TabIndex = 2;
  84. this.label2.Text = "Цвет:";
  85. //
  86. // label3
  87. //
  88. this.label3.AutoSize = true;
  89. this.label3.Location = new System.Drawing.Point(137, 71);
  90. this.label3.Name = "label3";
  91. this.label3.Size = new System.Drawing.Size(57, 16);
  92. this.label3.TabIndex = 3;
  93. this.label3.Text = "Ширина:";
  94. //
  95. // label4
  96. //
  97. this.label4.AutoSize = true;
  98. this.label4.Location = new System.Drawing.Point(137, 99);
  99. this.label4.Name = "label4";
  100. this.label4.Size = new System.Drawing.Size(48, 16);
  101. this.label4.TabIndex = 4;
  102. this.label4.Text = "Длина:";
  103. //
  104. // label5
  105. //
  106. this.label5.AutoSize = true;
  107. this.label5.Location = new System.Drawing.Point(137, 127);
  108. this.label5.Name = "label5";
  109. this.label5.Size = new System.Drawing.Size(70, 16);
  110. this.label5.TabIndex = 5;
  111. this.label5.Text = "Описание:";
  112. //
  113. // tbxTitle
  114. //
  115. this.tbxTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  116. | System.Windows.Forms.AnchorStyles.Right)));
  117. this.tbxTitle.Location = new System.Drawing.Point(211, 12);
  118. this.tbxTitle.Name = "tbxTitle";
  119. this.tbxTitle.ReadOnly = true;
  120. this.tbxTitle.Size = new System.Drawing.Size(535, 22);
  121. this.tbxTitle.TabIndex = 6;
  122. //
  123. // tbxColor
  124. //
  125. this.tbxColor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  126. | System.Windows.Forms.AnchorStyles.Right)));
  127. this.tbxColor.Location = new System.Drawing.Point(211, 40);
  128. this.tbxColor.Name = "tbxColor";
  129. this.tbxColor.ReadOnly = true;
  130. this.tbxColor.Size = new System.Drawing.Size(535, 22);
  131. this.tbxColor.TabIndex = 7;
  132. //
  133. // tbxWeight
  134. //
  135. this.tbxWeight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  136. | System.Windows.Forms.AnchorStyles.Right)));
  137. this.tbxWeight.Location = new System.Drawing.Point(211, 68);
  138. this.tbxWeight.Name = "tbxWeight";
  139. this.tbxWeight.ReadOnly = true;
  140. this.tbxWeight.Size = new System.Drawing.Size(535, 22);
  141. this.tbxWeight.TabIndex = 8;
  142. //
  143. // tbxHeight
  144. //
  145. this.tbxHeight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  146. | System.Windows.Forms.AnchorStyles.Right)));
  147. this.tbxHeight.Location = new System.Drawing.Point(211, 96);
  148. this.tbxHeight.Name = "tbxHeight";
  149. this.tbxHeight.ReadOnly = true;
  150. this.tbxHeight.Size = new System.Drawing.Size(535, 22);
  151. this.tbxHeight.TabIndex = 9;
  152. //
  153. // tbxDescription
  154. //
  155. this.tbxDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  156. | System.Windows.Forms.AnchorStyles.Right)));
  157. this.tbxDescription.Location = new System.Drawing.Point(211, 124);
  158. this.tbxDescription.Multiline = true;
  159. this.tbxDescription.Name = "tbxDescription";
  160. this.tbxDescription.ReadOnly = true;
  161. this.tbxDescription.Size = new System.Drawing.Size(535, 19);
  162. this.tbxDescription.TabIndex = 10;
  163. //
  164. // pbxPhoto
  165. //
  166. this.pbxPhoto.Location = new System.Drawing.Point(14, 12);
  167. this.pbxPhoto.Name = "pbxPhoto";
  168. this.pbxPhoto.Size = new System.Drawing.Size(117, 131);
  169. this.pbxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  170. this.pbxPhoto.TabIndex = 0;
  171. this.pbxPhoto.TabStop = false;
  172. }
  173. }
  174. class FurnituraPanel : Panel
  175. {
  176. public System.Windows.Forms.TextBox tbxCount;
  177. public System.Windows.Forms.TextBox tbxTitle;
  178. public System.Windows.Forms.Label label5;
  179. public System.Windows.Forms.Label label1;
  180. public System.Windows.Forms.PictureBox pbxPhoto;
  181. public FurnituraPanel()
  182. {
  183. this.label1 = new System.Windows.Forms.Label();
  184. this.label5 = new System.Windows.Forms.Label();
  185. this.tbxTitle = new System.Windows.Forms.TextBox();
  186. this.tbxCount = new System.Windows.Forms.TextBox();
  187. this.pbxPhoto = new System.Windows.Forms.PictureBox();
  188. this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  189. | System.Windows.Forms.AnchorStyles.Right)));
  190. this.BackColor = System.Drawing.Color.White;
  191. this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  192. this.Controls.Add(this.tbxCount);
  193. this.Controls.Add(this.tbxTitle);
  194. this.Controls.Add(this.label5);
  195. this.Controls.Add(this.label1);
  196. this.Controls.Add(this.pbxPhoto);
  197. this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  198. this.Location = new System.Drawing.Point(35, 27);
  199. this.Name = "panel1";
  200. this.Size = new System.Drawing.Size(284, 171);
  201. this.TabIndex = 0;
  202. //
  203. // label1
  204. //
  205. this.label1.AutoSize = true;
  206. this.label1.Location = new System.Drawing.Point(3, 110);
  207. this.label1.Name = "label1";
  208. this.label1.Size = new System.Drawing.Size(68, 16);
  209. this.label1.TabIndex = 1;
  210. this.label1.Text = "Название:";
  211. //
  212. // label5
  213. //
  214. this.label5.AutoSize = true;
  215. this.label5.Location = new System.Drawing.Point(3, 138);
  216. this.label5.Name = "label5";
  217. this.label5.Size = new System.Drawing.Size(115, 16);
  218. this.label5.TabIndex = 5;
  219. this.label5.Text = "Кол-во на складе:";
  220. //
  221. // tbxTitle
  222. //
  223. this.tbxTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  224. | System.Windows.Forms.AnchorStyles.Right)));
  225. this.tbxTitle.Location = new System.Drawing.Point(77, 107);
  226. this.tbxTitle.Name = "tbxTitle";
  227. this.tbxTitle.ReadOnly = true;
  228. this.tbxTitle.Size = new System.Drawing.Size(143, 22);
  229. this.tbxTitle.TabIndex = 6;
  230. //
  231. // tbxCount
  232. //
  233. this.tbxCount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  234. | System.Windows.Forms.AnchorStyles.Right)));
  235. this.tbxCount.Location = new System.Drawing.Point(124, 135);
  236. this.tbxCount.Multiline = true;
  237. this.tbxCount.Name = "tbxCount";
  238. this.tbxCount.ReadOnly = true;
  239. this.tbxCount.Size = new System.Drawing.Size(57, 19);
  240. this.tbxCount.TabIndex = 10;
  241. //
  242. // pbxPhoto
  243. //
  244. this.pbxPhoto.Location = new System.Drawing.Point(77, 9);
  245. this.pbxPhoto.Name = "pbxPhoto";
  246. this.pbxPhoto.Size = new System.Drawing.Size(143, 92);
  247. this.pbxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  248. this.pbxPhoto.TabIndex = 0;
  249. this.pbxPhoto.TabStop = false;
  250. }
  251. }
  252. class ProductPanel : Panel
  253. {
  254. public System.Windows.Forms.TextBox tbxLenght;
  255. public System.Windows.Forms.TextBox tbxTitle;
  256. public System.Windows.Forms.Label label5;
  257. public System.Windows.Forms.Label label1;
  258. public System.Windows.Forms.PictureBox pbxPhoto;
  259. public System.Windows.Forms.TextBox tbxWight;
  260. public System.Windows.Forms.Label label2;
  261. public ProductPanel()
  262. {
  263. this.tbxLenght = new System.Windows.Forms.TextBox();
  264. this.tbxTitle = new System.Windows.Forms.TextBox();
  265. this.label5 = new System.Windows.Forms.Label();
  266. this.label1 = new System.Windows.Forms.Label();
  267. this.pbxPhoto = new System.Windows.Forms.PictureBox();
  268. this.label2 = new System.Windows.Forms.Label();
  269. this.tbxWight = new System.Windows.Forms.TextBox();
  270. this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  271. | System.Windows.Forms.AnchorStyles.Right)));
  272. this.BackColor = System.Drawing.Color.White;
  273. this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  274. this.Controls.Add(this.tbxWight);
  275. this.Controls.Add(this.label2);
  276. this.Controls.Add(this.tbxLenght);
  277. this.Controls.Add(this.tbxTitle);
  278. this.Controls.Add(this.label5);
  279. this.Controls.Add(this.label1);
  280. this.Controls.Add(this.pbxPhoto);
  281. this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  282. this.Location = new System.Drawing.Point(35, 27);
  283. this.Name = "panel1";
  284. this.Size = new System.Drawing.Size(657, 105);
  285. this.TabIndex = 0;
  286. //
  287. // tbxLenght
  288. //
  289. this.tbxLenght.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  290. | System.Windows.Forms.AnchorStyles.Right)));
  291. this.tbxLenght.Location = new System.Drawing.Point(229, 34);
  292. this.tbxLenght.Multiline = true;
  293. this.tbxLenght.Name = "tbxLenght";
  294. this.tbxLenght.ReadOnly = true;
  295. this.tbxLenght.Size = new System.Drawing.Size(328, 19);
  296. this.tbxLenght.TabIndex = 10;
  297. //
  298. // tbxTitle
  299. //
  300. this.tbxTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  301. | System.Windows.Forms.AnchorStyles.Right)));
  302. this.tbxTitle.Location = new System.Drawing.Point(229, 6);
  303. this.tbxTitle.Name = "tbxTitle";
  304. this.tbxTitle.ReadOnly = true;
  305. this.tbxTitle.Size = new System.Drawing.Size(375, 22);
  306. this.tbxTitle.TabIndex = 6;
  307. //
  308. // label5
  309. //
  310. this.label5.AutoSize = true;
  311. this.label5.Location = new System.Drawing.Point(164, 37);
  312. this.label5.Name = "label5";
  313. this.label5.Size = new System.Drawing.Size(48, 16);
  314. this.label5.TabIndex = 5;
  315. this.label5.Text = "Длина:";
  316. //
  317. // label1
  318. //
  319. this.label1.AutoSize = true;
  320. this.label1.Location = new System.Drawing.Point(155, 9);
  321. this.label1.Name = "label1";
  322. this.label1.Size = new System.Drawing.Size(68, 16);
  323. this.label1.TabIndex = 1;
  324. this.label1.Text = "Название:";
  325. //
  326. // pbxPhoto
  327. //
  328. this.pbxPhoto.Location = new System.Drawing.Point(6, 6);
  329. this.pbxPhoto.Name = "pbxPhoto";
  330. this.pbxPhoto.Size = new System.Drawing.Size(143, 92);
  331. this.pbxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
  332. this.pbxPhoto.TabIndex = 0;
  333. this.pbxPhoto.TabStop = false;
  334. //
  335. // label2
  336. //
  337. this.label2.AutoSize = true;
  338. this.label2.Location = new System.Drawing.Point(155, 64);
  339. this.label2.Name = "label2";
  340. this.label2.Size = new System.Drawing.Size(57, 16);
  341. this.label2.TabIndex = 11;
  342. this.label2.Text = "Ширина:";
  343. //
  344. // tbxWight
  345. //
  346. this.tbxWight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  347. | System.Windows.Forms.AnchorStyles.Right)));
  348. this.tbxWight.Location = new System.Drawing.Point(229, 64);
  349. this.tbxWight.Multiline = true;
  350. this.tbxWight.Name = "tbxWight";
  351. this.tbxWight.ReadOnly = true;
  352. this.tbxWight.Size = new System.Drawing.Size(328, 19);
  353. this.tbxWight.TabIndex = 12;
  354. }
  355. }
  356. class OrdersPanel : Panel
  357. {
  358. public System.Windows.Forms.TextBox tbxLenght;
  359. public System.Windows.Forms.TextBox tbxTitle;
  360. public System.Windows.Forms.Label label5;
  361. public System.Windows.Forms.Label label1;
  362. public System.Windows.Forms.TextBox tbxWight;
  363. public System.Windows.Forms.Label label2;
  364. public System.Windows.Forms.TextBox tbxCountProducts;
  365. public System.Windows.Forms.Label label8;
  366. public System.Windows.Forms.TextBox tbxCountFur;
  367. public System.Windows.Forms.Label label7;
  368. public System.Windows.Forms.TextBox tbxFur;
  369. public System.Windows.Forms.Label label6;
  370. public System.Windows.Forms.TextBox tbxClothColor;
  371. public System.Windows.Forms.Label label4;
  372. public System.Windows.Forms.TextBox tbxCloth;
  373. public System.Windows.Forms.Label label3;
  374. public OrdersPanel()
  375. {
  376. this.tbxLenght = new System.Windows.Forms.TextBox();
  377. this.tbxTitle = new System.Windows.Forms.TextBox();
  378. this.label5 = new System.Windows.Forms.Label();
  379. this.label1 = new System.Windows.Forms.Label();
  380. this.label2 = new System.Windows.Forms.Label();
  381. this.tbxWight = new System.Windows.Forms.TextBox();
  382. this.tbxCloth = new System.Windows.Forms.TextBox();
  383. this.label3 = new System.Windows.Forms.Label();
  384. this.tbxClothColor = new System.Windows.Forms.TextBox();
  385. this.label4 = new System.Windows.Forms.Label();
  386. this.tbxFur = new System.Windows.Forms.TextBox();
  387. this.label6 = new System.Windows.Forms.Label();
  388. this.tbxCountFur = new System.Windows.Forms.TextBox();
  389. this.label7 = new System.Windows.Forms.Label();
  390. this.tbxCountProducts = new System.Windows.Forms.TextBox();
  391. this.label8 = new System.Windows.Forms.Label();
  392. this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  393. | System.Windows.Forms.AnchorStyles.Right)));
  394. this.BackColor = System.Drawing.Color.White;
  395. this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  396. this.Controls.Add(this.tbxCountProducts);
  397. this.Controls.Add(this.label8);
  398. this.Controls.Add(this.tbxCountFur);
  399. this.Controls.Add(this.label7);
  400. this.Controls.Add(this.tbxFur);
  401. this.Controls.Add(this.label6);
  402. this.Controls.Add(this.tbxClothColor);
  403. this.Controls.Add(this.label4);
  404. this.Controls.Add(this.tbxCloth);
  405. this.Controls.Add(this.label3);
  406. this.Controls.Add(this.tbxWight);
  407. this.Controls.Add(this.label2);
  408. this.Controls.Add(this.tbxLenght);
  409. this.Controls.Add(this.tbxTitle);
  410. this.Controls.Add(this.label5);
  411. this.Controls.Add(this.label1);
  412. this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  413. this.Location = new System.Drawing.Point(35, 27);
  414. this.Name = "panel1";
  415. this.Size = new System.Drawing.Size(657, 145);
  416. this.TabIndex = 0;
  417. //
  418. // tbxLenght
  419. //
  420. this.tbxLenght.Location = new System.Drawing.Point(77, 37);
  421. this.tbxLenght.Multiline = true;
  422. this.tbxLenght.Name = "tbxLenght";
  423. this.tbxLenght.ReadOnly = true;
  424. this.tbxLenght.Size = new System.Drawing.Size(136, 19);
  425. this.tbxLenght.TabIndex = 10;
  426. //
  427. // tbxTitle
  428. //
  429. this.tbxTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  430. | System.Windows.Forms.AnchorStyles.Right)));
  431. this.tbxTitle.Location = new System.Drawing.Point(77, 6);
  432. this.tbxTitle.Name = "tbxTitle";
  433. this.tbxTitle.ReadOnly = true;
  434. this.tbxTitle.Size = new System.Drawing.Size(575, 22);
  435. this.tbxTitle.TabIndex = 6;
  436. //
  437. // label5
  438. //
  439. this.label5.AutoSize = true;
  440. this.label5.Location = new System.Drawing.Point(23, 40);
  441. this.label5.Name = "label5";
  442. this.label5.Size = new System.Drawing.Size(48, 16);
  443. this.label5.TabIndex = 5;
  444. this.label5.Text = "Длина:";
  445. //
  446. // label1
  447. //
  448. this.label1.AutoSize = true;
  449. this.label1.Location = new System.Drawing.Point(5, 9);
  450. this.label1.Name = "label1";
  451. this.label1.Size = new System.Drawing.Size(68, 16);
  452. this.label1.TabIndex = 1;
  453. this.label1.Text = "Название:";
  454. //
  455. // label2
  456. //
  457. this.label2.AutoSize = true;
  458. this.label2.Location = new System.Drawing.Point(229, 37);
  459. this.label2.Name = "label2";
  460. this.label2.Size = new System.Drawing.Size(57, 16);
  461. this.label2.TabIndex = 11;
  462. this.label2.Text = "Ширина:";
  463. //
  464. // tbxWight
  465. //
  466. this.tbxWight.Location = new System.Drawing.Point(290, 37);
  467. this.tbxWight.Multiline = true;
  468. this.tbxWight.Name = "tbxWight";
  469. this.tbxWight.ReadOnly = true;
  470. this.tbxWight.Size = new System.Drawing.Size(136, 19);
  471. this.tbxWight.TabIndex = 12;
  472. //
  473. // tbxCloth
  474. //
  475. this.tbxCloth.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  476. | System.Windows.Forms.AnchorStyles.Right)));
  477. this.tbxCloth.Location = new System.Drawing.Point(77, 62);
  478. this.tbxCloth.Multiline = true;
  479. this.tbxCloth.Name = "tbxCloth";
  480. this.tbxCloth.ReadOnly = true;
  481. this.tbxCloth.Size = new System.Drawing.Size(573, 19);
  482. this.tbxCloth.TabIndex = 14;
  483. //
  484. // label3
  485. //
  486. this.label3.AutoSize = true;
  487. this.label3.Location = new System.Drawing.Point(27, 62);
  488. this.label3.Name = "label3";
  489. this.label3.Size = new System.Drawing.Size(44, 16);
  490. this.label3.TabIndex = 13;
  491. this.label3.Text = "Ткань:";
  492. //
  493. // tbxClothColor
  494. //
  495. this.tbxClothColor.Location = new System.Drawing.Point(105, 84);
  496. this.tbxClothColor.Multiline = true;
  497. this.tbxClothColor.Name = "tbxClothColor";
  498. this.tbxClothColor.ReadOnly = true;
  499. this.tbxClothColor.Size = new System.Drawing.Size(136, 19);
  500. this.tbxClothColor.TabIndex = 16;
  501. //
  502. // label4
  503. //
  504. this.label4.AutoSize = true;
  505. this.label4.Location = new System.Drawing.Point(23, 84);
  506. this.label4.Name = "label4";
  507. this.label4.Size = new System.Drawing.Size(76, 16);
  508. this.label4.TabIndex = 15;
  509. this.label4.Text = "Цвет ткани:";
  510. //
  511. // tbxFur
  512. //
  513. this.tbxFur.Location = new System.Drawing.Point(321, 84);
  514. this.tbxFur.Multiline = true;
  515. this.tbxFur.Name = "tbxFur";
  516. this.tbxFur.ReadOnly = true;
  517. this.tbxFur.Size = new System.Drawing.Size(137, 19);
  518. this.tbxFur.TabIndex = 18;
  519. //
  520. // label6
  521. //
  522. this.label6.AutoSize = true;
  523. this.label6.Location = new System.Drawing.Point(247, 84);
  524. this.label6.Name = "label6";
  525. this.label6.Size = new System.Drawing.Size(76, 16);
  526. this.label6.TabIndex = 17;
  527. this.label6.Text = "Фурнитура:";
  528. //
  529. // tbxCountFur
  530. //
  531. this.tbxCountFur.Location = new System.Drawing.Point(125, 109);
  532. this.tbxCountFur.Multiline = true;
  533. this.tbxCountFur.Name = "tbxCountFur";
  534. this.tbxCountFur.ReadOnly = true;
  535. this.tbxCountFur.Size = new System.Drawing.Size(88, 19);
  536. this.tbxCountFur.TabIndex = 20;
  537. //
  538. // label7
  539. //
  540. this.label7.AutoSize = true;
  541. this.label7.Location = new System.Drawing.Point(3, 109);
  542. this.label7.Name = "label7";
  543. this.label7.Size = new System.Drawing.Size(120, 16);
  544. this.label7.TabIndex = 19;
  545. this.label7.Text = "Кол-во фурнитуры:";
  546. //
  547. // tbxCountProducts
  548. //
  549. this.tbxCountProducts.Location = new System.Drawing.Point(358, 109);
  550. this.tbxCountProducts.Multiline = true;
  551. this.tbxCountProducts.Name = "tbxCountProducts";
  552. this.tbxCountProducts.ReadOnly = true;
  553. this.tbxCountProducts.Size = new System.Drawing.Size(100, 19);
  554. this.tbxCountProducts.TabIndex = 22;
  555. //
  556. // label8
  557. //
  558. this.label8.AutoSize = true;
  559. this.label8.Location = new System.Drawing.Point(248, 109);
  560. this.label8.Name = "label8";
  561. this.label8.Size = new System.Drawing.Size(104, 16);
  562. this.label8.TabIndex = 21;
  563. this.label8.Text = "Кол-во изделий:";
  564. //
  565. }
  566. }
  567. private void FormClient_Load(object sender, EventArgs e)
  568. {
  569. SqlConnection con = new SqlConnection(FormAuthorization.StrCon);
  570. con.Open();
  571. SqlCommand cmd = new SqlCommand($@"select Fam,Name,Otch from Users where IdUser = {FormAuthorization.IdUser}", con);
  572. SqlDataReader res = cmd.ExecuteReader();
  573. res.Read();
  574. lblFIO.Text = $"{res["Fam"]} {res["Name"]} {res["Otch"]}";
  575. res.Close();
  576. con.Close();
  577. GetClothFromDB();
  578. GetFurnituraFromDB();
  579. GetProductsFromDB();
  580. GetOrdersFromDB();
  581. }
  582. //struct Cloths
  583. //{
  584. // public string id, Title, idColor, Weight, Height, Note, Photo;
  585. //}
  586. void GetOrdersFromDB()
  587. {
  588. SqlConnection con = new SqlConnection(FormAuthorization.StrCon);
  589. SqlCommand cmd = new SqlCommand($@"Select Orders.IdOrder,Products.TitleProduct,Products.Lenght,Products.Width,Orders.IdClient,Cloth.Title as ClothTitle, Colors.Title as
  590. ColorTitle,
  591. Furnitura.namefur,Orders.CountFurnitura,
  592. Orders.CountProduct
  593. from Orders join Users on Users.IdUser = Orders.IdClient join Products on
  594. Products.IdProduct = Orders.IdProduct join Cloth on Cloth.IdCloth = Orders.IdCloth join Furnitura on
  595. Furnitura.idfur = Orders.IdFur join Colors on Cloth.IdColor = Colors.IdColor
  596. where Users.IdUser = {FormAuthorization.IdUser}
  597. ", con);
  598. con.Open();
  599. SqlDataReader res = cmd.ExecuteReader();
  600. while (res.Read())
  601. {
  602. OrdersPanel or = new OrdersPanel();
  603. or.tbxTitle.Text = res["TitleProduct"].ToString();
  604. or.tbxWight.Text = res["Width"].ToString();
  605. or.tbxLenght.Text = res["Lenght"].ToString();
  606. or.tbxCloth.Text = res["ClothTitle"].ToString();
  607. or.tbxClothColor.Text = res["ColorTitle"].ToString();
  608. or.tbxCountFur.Text = res["CountFurnitura"].ToString();
  609. or.tbxFur.Text = res["namefur"].ToString();
  610. or.tbxCountProducts.Text = res["CountProduct"].ToString();
  611. tlpOrders.Controls.Add(or);
  612. }
  613. res.Close();
  614. con.Close();
  615. }
  616. void GetProductsFromDB()
  617. {
  618. SqlConnection con = new SqlConnection(FormAuthorization.StrCon);
  619. SqlCommand cmd = new SqlCommand(@"select * from Products", con);
  620. con.Open();
  621. SqlDataReader res = cmd.ExecuteReader();
  622. while (res.Read())
  623. {
  624. ProductPanel p = new ProductPanel();
  625. p.tbxTitle.Text = res["TitleProduct"].ToString();
  626. p.tbxLenght.Text = res["Lenght"].ToString();
  627. p.tbxWight.Text = res["Width"].ToString();
  628. //try
  629. //{
  630. // p.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото фурнитур\\" + res["Photo"]);
  631. //}
  632. //catch
  633. //{
  634. // p.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото фурнитур\\picture.png");
  635. //}
  636. tlpProducts.Controls.Add(p);
  637. }
  638. res.Close();
  639. con.Close();
  640. }
  641. void GetClothFromDB()
  642. {
  643. SqlConnection con = new SqlConnection(FormAuthorization.StrCon); // Возможны ошибки с названием цвета
  644. SqlCommand cmd = new SqlCommand(@"SELECT Cloth.IdCloth, Cloth.Title, Cloth.IdColor, Cloth.Weight, Cloth.Height, Cloth.Note, Cloth.Photo,
  645. Colors.IdColor AS Expr1, Colors.Title AS ColorTitle
  646. FROM Cloth INNER JOIN
  647. Colors ON Cloth.IdColor = Colors.IdColor", con);
  648. con.Open();
  649. SqlDataReader res = cmd.ExecuteReader();
  650. while (res.Read())
  651. {
  652. ClothPanel p = new ClothPanel();
  653. p.tbxTitle.Text = res["Title"].ToString();
  654. p.tbxColor.Text = res["ColorTitle"].ToString();
  655. p.tbxWeight.Text = res["Weight"].ToString();
  656. p.tbxHeight.Text = res["Height"].ToString();
  657. p.tbxDescription.Text = res["Note"].ToString();
  658. try
  659. {
  660. p.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото тканей\\" + res["Photo"]);
  661. }
  662. catch
  663. {
  664. p.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото тканей\\picture.png");
  665. }
  666. tlpPanelCloth.Controls.Add(p);
  667. }
  668. res.Close();
  669. con.Close();
  670. }
  671. void GetFurnituraFromDB()
  672. {
  673. SqlConnection con = new SqlConnection(FormAuthorization.StrCon);
  674. SqlCommand cmd = new SqlCommand(@"select * from Furnitura", con);
  675. con.Open();
  676. SqlDataReader res = cmd.ExecuteReader();
  677. while (res.Read())
  678. {
  679. FurnituraPanel f = new FurnituraPanel();
  680. f.tbxTitle.Text = res["namefur"].ToString();
  681. f.tbxCount.Text = res["countfur"].ToString();
  682. try
  683. {
  684. f.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото фурнитур\\" + res["Photo"]);
  685. }
  686. catch
  687. {
  688. f.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото фурнитур\\picture.png");
  689. }
  690. tlpFur.Controls.Add(f);
  691. }
  692. res.Close();
  693. con.Close();
  694. }
  695. private void btnEdit_Click(object sender, EventArgs e)
  696. {
  697. FormEditUser frm = new FormEditUser();
  698. this.Hide();
  699. frm.ShowDialog();
  700. this.Show();
  701. }
  702. private void btnNewOrder_Click(object sender, EventArgs e)
  703. {
  704. FormNewOrder frm = new FormNewOrder();
  705. this.Hide();
  706. frm.ShowDialog();
  707. this.Show();
  708. }
  709. private void btnFind_Click(object sender, EventArgs e)
  710. {
  711. FormClothFind frm = new FormClothFind();
  712. this.Hide();
  713. frm.ShowDialog();
  714. this.Show();
  715. }
  716. }
  717. }