fork download
  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.  
  11. namespace Sfera_CRM
  12. {
  13. public partial class AddWorkerFRM : Form
  14. {
  15. public AddWorkerFRM()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void Back_Click(object sender, EventArgs e)
  21. {
  22. Config.forms["menuFRM"].Show();
  23. Hide();
  24. }
  25.  
  26. private void Add_Click(object sender, EventArgs e)
  27. {
  28. List<string> errors = new List<string>();
  29.  
  30. if (second_name.Text.Length == 0)
  31. {
  32. errors.Add("Введите фамилию сотрудника");
  33. }
  34.  
  35. if (name.Text.Length == 0)
  36. {
  37. errors.Add("Введите имя сотрудника");
  38. }
  39.  
  40. if (position.Text.Length == 0)
  41. {
  42. errors.Add("Введите должность сотрудника");
  43. }
  44.  
  45. if (phone.Text.Length == 0)
  46. {
  47. errors.Add("Введите телефон сотрудника");
  48. }
  49.  
  50. if (login.Text.Length == 0)
  51. {
  52. errors.Add("Введите логин сотрудника");
  53. }
  54.  
  55. if (pass.Text.Length == 0)
  56. {
  57. errors.Add("Введите пароль сотрудника");
  58. }
  59.  
  60. if (repass.Text.Length == 0)
  61. {
  62. errors.Add("Повторите пароль сотрудника");
  63. }
  64.  
  65. if (pass.Text != repass.Text)
  66. {
  67. errors.Add("Введённые пароли не совпадают");
  68. }
  69.  
  70. if (errors.Count == 0)
  71. {
  72. Mapping mp = new Mapping();
  73. string position_text = Config.position[position.SelectedItem.ToString()];
  74.  
  75. string sql_query = String.Format("INSERT INTO Workers VALUES (N'{0} {1} {2}', N'{3}', {4}, N'{5}', N'{6}')", second_name.Text,
  76. name.Text,
  77. third_name.Text,
  78. position_text,
  79. phone.Text,
  80. login.Text,
  81. pass.Text
  82. );
  83.  
  84.  
  85. mp.CRUD(sql_query);
  86. MessageBox.Show("Сотрудник успешно добавлен");
  87.  
  88. Config.forms["menuFRM"].Show();
  89. Hide();
  90.  
  91. }
  92. else
  93. {
  94. MessageBox.Show(errors[0]);
  95. }
  96.  
  97. }
  98.  
  99. private void AddWorkerFRM_Load(object sender, EventArgs e)
  100. {
  101.  
  102. }
  103. }
  104. }
  105.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing `System.Data' assembly reference?
prog.cs(9,22): error CS0234: The type or namespace name `Forms' does not exist in the namespace `System.Windows'. Are you missing `System.Windows.Forms' assembly reference?
prog.cs(13,41): error CS0246: The type or namespace name `Form' could not be found. Are you missing an assembly reference?
Compilation failed: 3 error(s), 0 warnings
stdout
Standard output is empty