-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
355 lines (321 loc) · 14.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>👀🔥💥Казино 777👀🔥💥</title>
<style>
body {
font-family: Arial, sans-serif;
}
.code-container {
background-color: #2d2d2d;
color: #2d2d2d; /* Changed for better readability */
padding: 10px;
border-radius: 5px;
margin-top: 20px;
white-space: pre;
overflow-x: auto;
position: relative;
}
.copy-button, .download-button {
margin-top: 10px;
background-color: #2d2d2d;
border: 1px solid #f8f8f2;
color: #f8f8f2;
cursor: pointer;
padding: 5px 10px;
}
select {
margin-top: 20px;
}
.preview {
margin-top: 10px;
padding: 10px;
border: 1px solid #ccc;
}
.file-preview img {
width: 100%;
max-width: 300px;
margin-top: 10px;
}
.file-preview a {
display: block;
margin-top: 10px;
}
</style>
</head>
<body>
Выбери форму или чет другое.. :<select id="codeSelector" onchange="switchCode()">
<option value="version1">LoginForm</option>
<option value="version2">RegisterForm</option>
<option value="version3">UnitTests</option>
<option value="version4">VSDX && WORD</option>
</select>
<button class="copy-button" onclick="copyCode()">Copy All</button>
<button id="downloadButton" class="download-button" style="display: none;" onclick="downloadFile()">Download</button>
<a href="https://demo.statuxia.tech/" align="right">Анонимус Чатиус</a>
<div id="filePreview" class="preview file-preview" style="display: none;"></div>
<div id="codeDisplay" class="code-container"></div>
<script>
const codeVersions = {
version1: `
using System;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace gubar
{
public partial class LoginForm : Form
{
public LoginForm()
{
InitializeComponent();
}
public void button2Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"Data Source=TEXPY\\SQLEXPRESS;Initial Catalog=demo;Integrated Security=True;");
conn.Open();
string query = "SELECT * FROM users WHERE login=@Login AND password=@Password";
try
{
SqlCommand command = new SqlCommand(query, conn);
command.Parameters.AddWithValue("@Login", text_Login.Text);
command.Parameters.AddWithValue("@Password", text_Pass.Text);
using (SqlDataReader reader = command.ExecuteReader())
{
if (reader.HasRows)
{
reader.Read();
string role = reader["type"].ToString();
Form formx;
switch (role)
{
case "Менеджер":
formx = new ManagerForm();
break;
case "Мастер":
formx = new MasterForm();
break;
case "Оператор":
formx = new OperatorForm();
break;
case "Заказчик":
formx = new CustomerForm();
break;
default:
MessageBox.Show("Неизвестная должность.");
return;
}
FormManager.ShowForm(formx);
}
else
{
MessageBox.Show($"Неверный логин или пароль.");
}
}
}
catch (Exception error)
{
Console.WriteLine("Ошибка:" + error.Message);
}
finally
{
conn.Close();
}
}
private void toRegisterButton_Click(object sender, EventArgs e)
{
RegisterForm form = new RegisterForm();
form.Show();
this.Hide();
}
}
}
`,
version2: `
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace gubar
{
public partial class RegisterForm : Form
{
public RegisterForm()
{
InitializeComponent();
}
private void registerButton_Click(object sender, EventArgs e)
{
string fio = text_fio.Text;
string phone = text_phone.Text;
string login = text_login.Text;
string password = text_password.Text;
if (string.IsNullOrWhiteSpace(fio) || string.IsNullOrWhiteSpace(phone) ||
string.IsNullOrWhiteSpace(login) || string.IsNullOrWhiteSpace(password))
{
MessageBox.Show("Все поля должны быть заполнены.");
return;
}
string connectionString = @"Data Source=TEXPY\\SQLEXPRESS;Initial Catalog=demo;Integrated Security=True;";
string query = "INSERT INTO users (fio, phone, login, password, type) VALUES (@Fio, @Phone, @Login, @Password, 'Заказчик')";
using (SqlConnection conn = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(query, conn);
command.Parameters.AddWithValue("@Fio", fio);
command.Parameters.AddWithValue("@Phone", phone);
command.Parameters.AddWithValue("@Login", login);
command.Parameters.AddWithValue("@Password", password);
try
{
conn.Open();
int result = command.ExecuteNonQuery();
if (result > 0)
{
MessageBox.Show("Регистрация прошла успешно.");
this.Hide();
LoginForm loginForm = new LoginForm();
loginForm.ShowDialog();
this.Close();
}
else
{
MessageBox.Show("Ошибка регистрации. Попробуйте еще раз.");
}
}
catch (Exception ex)
{
MessageBox.Show("Ошибка при подключении к базе данных: " + ex.Message);
}
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
LoginForm loginForm = new LoginForm();
loginForm.ShowDialog();
this.Close();
}
private void RegisterForm_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
}
}
`,
version3: `
using gubar; //изменить на своё проект после всех действий ниже
using Microsoft.VisualStudio.TestTools.UnitTesting;
// Тыкаем на название проекта ПКМ, находим добавить, тыкаем "Создать проект", затем тыкаем Проект модульного теста (.NET Framework)
// Название ставим любое. Затем, ебашим значится, зависимости, после создания отдельного проекта у нас в обозревателе решений.
// Это можно сделать, нажав ПКМ на UnitTestProject1 (это название вашего проекта, по умолчанию оно такое.) и находим там "Зависимости"
// И ставим там галочку для нашего проекта. Первый пункт окончен.
// Второй пункт. Нажимаем в нашем этом UnitTestProject1 на "Ссылки" и жмём "Добавить ссылки". Там в окне, нужно найти "Проекты" и доабвить наш проект в зависимость!!!
// Так же, необходимо добавить ссылку System.Windows.Forms чтобы мы могли тестировать наши формы. Если вы всё сделали верно - вы молодцы, если нет - анлак :)
// Так же, необходимо не забыть изменить все необходимые поля и формы на PUBLIC в .Designer вашей формы.
// А теперь смотрите, сверху есть вкладка "Тест" там жмякаете "Запустить все тесты" и все тесты должны будут выполнится, если вы всё верно написали.
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()//верный логин и пароль
{
{
var loginForm = new LoginForm();
loginForm.text_Login.Text = "login1";// Тестовое значение для входа
loginForm.text_Pass.Text = "pass1";// Тестовое значение для входа
loginForm.button2Click(null, null);//"Нажатие" на кнопку
Assert.IsFalse(loginForm.Visible);
}
}
[TestMethod]
public void TestMethod2() // NEверный логин и пароль
{
var loginForm = new LoginForm();
loginForm.text_Login.Text = "123"; // Тестовое значение для входа
loginForm.text_Pass.Text = "123"; // Тестовое значение для входа
loginForm.button2Click(null, null); // "Нажатие" на кнопку
Assert.IsFalse(loginForm.Visible);
}
}
}
`,
version4: [
{ name: 'functionSchema.vsdx', type: 'file', content: 'Схема функции' },
{ name: 'ProgrammSchema.vsdx', type: 'file', content: 'Схема программы' },
{ name: 'ERDiag.vsdx', type: 'file', content: 'ER-ДИАГРАММА' },
{ name: 'ProgrammUpdateExamples.docx', type: 'file', content: 'Улучшение ПО' },
{ name: 'AdminRukovod.docx', type: 'file', content: 'Улучшение ПО' },
{ name: 'Specification.docx', type: 'file', content: 'Спецификация' },
{ name: 'FIGURES_VISIO.png', type: 'image', src: 'FIGURES_VISIO.png' },
{ name: 'FIGURES_VISIO2.png', type: 'image', src: 'FIGURES_VISIO2.png' },
{ name: 'GOST_VISIO.pdf', type: 'pdf', src: 'GOST_VISIO.pdf' },
{ name: 'PrimaryKEYS_VISIO.png', type: 'image', src: 'PrimaryKEYS_VISIO.png' }
// добавьте другие файлы
]
};
function switchCode() {
const selectedVersion = document.getElementById('codeSelector').value;
const codeDisplay = document.getElementById('codeDisplay');
const downloadButton = document.getElementById('downloadButton');
const filePreview = document.getElementById('filePreview');
if (selectedVersion === 'version4') {
filePreview.innerHTML = codeVersions[selectedVersion].map(item => {
if (item.type === 'image') {
return `<img src="${item.src}" alt="${item.name}" class="file-preview-img">`;
} else if (item.type === 'pdf') {
return `<a href="${item.src}" target="_blank">${item.name}</a>`;
} else if (item.type === 'file') {
return `<a href="#" onclick="downloadFile('${item.name}')">${item.name}</a>`;
} else {
return '';
}
}).join('');
codeDisplay.innerText = '';
downloadButton.style.display = 'none';
filePreview.style.display = 'block';
} else {
if (selectedVersion === 'version1' || selectedVersion === 'version2') {
const imageSrc = selectedVersion === 'version1' ? 'LoginForm.png' : 'RegisterForm.png';
codeDisplay.innerHTML = `<img src="${imageSrc}" alt="${selectedVersion} Image" style="width:100%;max-width:300px;"><pre>${codeVersions[selectedVersion]}</pre>`;
} else {
codeDisplay.innerHTML = `<pre>${codeVersions[selectedVersion]}</pre>`;
}
downloadButton.style.display = 'inline-block';
filePreview.style.display = 'none';
}
}
function copyCode() {
const codeContainer = document.getElementById('codeDisplay');
const range = document.createRange();
range.selectNodeContents(codeContainer);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
try {
document.execCommand('copy');
alert('Содержимое скопировано!');
} catch (err) {
alert('Не удалось скопировать содержимое');
}
selection.removeAllRanges();
}
function downloadFile(fileName) {
const file = codeVersions.version4.find(f => f.name === fileName);
const blob = new Blob([file.content], { type: 'application/octet-stream' });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
link.click();
}
switchCode();
</script>
</body>
</html>