MainMenu.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 proba
  12. {
  13. public partial class MainMenu : Form
  14. {
  15. DataBase dataBase = new DataBase();
  16. public MainMenu()
  17. {
  18. InitializeComponent();
  19. dataBase.openConnection();
  20. SqlCommand sqlCommand_role = new SqlCommand($"SELECT R.role From Employee E inner join Roles R ON E.id_role = R.id_role WHERE E.login = '{PosleVHODA.login}'", dataBase.GetConnection());
  21. string role = sqlCommand_role.ExecuteScalar().ToString();
  22. if (role == "Администратор")
  23. {
  24. pictureBox_Employee.Visible = true;
  25. label_editingEmployee.Visible = true;
  26. label_employee.Visible = true;
  27. }
  28. else if(role == "Кассир")
  29. {
  30. pictureBox_personal_area.Visible = true;
  31. label_personal_area.Visible = true;
  32. }
  33. dataBase.closeConnection();
  34. }
  35. private void ButtonPostavshiki_Click(object sender, EventArgs e)
  36. {
  37. this.Hide();
  38. Postavshiki postavshiki = new Postavshiki();
  39. postavshiki.Show();
  40. }
  41. private void ButtonNomenklatura_Click(object sender, EventArgs e)
  42. {
  43. this.Hide();
  44. Nomenklatura nomenklatura = new Nomenklatura();
  45. nomenklatura.ShowDialog();
  46. }
  47. public void global_FormClosed(object sender, EventArgs e)
  48. {
  49. Application.Exit();
  50. }
  51. private void button_nomenklaturaAdd_Click(object sender, EventArgs e)
  52. {
  53. this.Hide();
  54. Nomenklaturaadd nomenklatura_Add = new Nomenklaturaadd();
  55. nomenklatura_Add.ShowDialog();
  56. }
  57. private void ButtonProdaja_Click(object sender, EventArgs e)
  58. {
  59. this.Hide();
  60. Sales sales = new Sales();
  61. sales.ShowDialog();
  62. }
  63. private void label10_Click(object sender, EventArgs e)
  64. {
  65. this.Hide();
  66. Postavshiki_add postavshiki_Add = new Postavshiki_add();
  67. postavshiki_Add.ShowDialog();
  68. }
  69. private void button_Country_Click(object sender, EventArgs e)
  70. {
  71. this.Hide();
  72. Country country = new Country();
  73. country.ShowDialog();
  74. }
  75. private void button_Country_add_Click(object sender, EventArgs e)
  76. {
  77. this.Hide();
  78. CountryAdd countryAdd = new CountryAdd();
  79. countryAdd.ShowDialog();
  80. }
  81. private void button_salesList_Click(object sender, EventArgs e)
  82. {
  83. this.Hide();
  84. Form2 form2 = new Form2();
  85. form2.ShowDialog();
  86. }
  87. private void button_genre_Click(object sender, EventArgs e)
  88. {
  89. this.Hide();
  90. Genre genre = new Genre();
  91. genre.ShowDialog();
  92. }
  93. private void label_genre_add_Click(object sender, EventArgs e)
  94. {
  95. this.Hide();
  96. Genre_add genre_Add = new Genre_add();
  97. genre_Add.ShowDialog();
  98. }
  99. private void button_Performer_Click(object sender, EventArgs e)
  100. {
  101. this.Hide();
  102. Performer performer = new Performer();
  103. performer.ShowDialog();
  104. }
  105. private void label_performer_Click(object sender, EventArgs e)
  106. {
  107. this.Hide();
  108. Performer_add performer_Add = new Performer_add();
  109. performer_Add.ShowDialog();
  110. }
  111. private void button_edition_Click(object sender, EventArgs e)
  112. {
  113. this.Hide();
  114. Издатель издатель = new Издатель();
  115. издатель.ShowDialog();
  116. }
  117. private void label_efition_Click(object sender, EventArgs e)
  118. {
  119. this.Hide();
  120. EditionAdd editionAdd = new EditionAdd();
  121. editionAdd.ShowDialog();
  122. }
  123. private void label_personal_area_Click(object sender, EventArgs e)
  124. {
  125. this.Hide();
  126. PersonalArea personalArea = new PersonalArea();
  127. personalArea.ShowDialog();
  128. }
  129. private void pictureBox_personal_area_Click(object sender, EventArgs e)
  130. {
  131. this.Hide();
  132. PersonalArea personalArea = new PersonalArea();
  133. personalArea.ShowDialog();
  134. }
  135. private void label_editingEmployee_Click(object sender, EventArgs e)
  136. {
  137. this.Hide();
  138. Employee employee = new Employee();
  139. employee.ShowDialog();
  140. }
  141. private void pictureBox_Employee_Click(object sender, EventArgs e)
  142. {
  143. this.Hide();
  144. Employee employee = new Employee();
  145. employee.ShowDialog();
  146. }
  147. }
  148. }