Добавьте файлы проекта.
This commit is contained in:
parent
424b9d8b1d
commit
5b2deefe54
22
App.config
Normal file
22
App.config
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<configSections>
|
||||||
|
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||||
|
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||||
|
</configSections>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
|
</startup>
|
||||||
|
<entityFramework>
|
||||||
|
<providers>
|
||||||
|
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||||
|
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||||
|
</providers>
|
||||||
|
</entityFramework>
|
||||||
|
<system.data>
|
||||||
|
<DbProviderFactories>
|
||||||
|
<remove invariant="System.Data.SQLite.EF6" />
|
||||||
|
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
|
||||||
|
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
|
||||||
|
</system.data>
|
||||||
|
</configuration>
|
63
Form1.Designer.cs
generated
Normal file
63
Form1.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
namespace WindowsFormsApp1
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Обязательная переменная конструктора.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Освободить все используемые ресурсы.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Код, автоматически созданный конструктором форм Windows
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||||
|
/// содержимое этого метода с помощью редактора кода.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||||
|
this.buttonLogin = new System.Windows.Forms.Button();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// buttonLogin
|
||||||
|
//
|
||||||
|
this.buttonLogin.Location = new System.Drawing.Point(778, 428);
|
||||||
|
this.buttonLogin.Name = "buttonLogin";
|
||||||
|
this.buttonLogin.Size = new System.Drawing.Size(10, 10);
|
||||||
|
this.buttonLogin.TabIndex = 0;
|
||||||
|
this.buttonLogin.Text = "button1";
|
||||||
|
this.buttonLogin.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
|
this.Controls.Add(this.buttonLogin);
|
||||||
|
this.Name = "Form1";
|
||||||
|
this.Text = "Form1";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Timer timer1;
|
||||||
|
private System.Windows.Forms.Button buttonLogin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
929
Form1.cs
Normal file
929
Form1.cs
Normal file
@ -0,0 +1,929 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Data.SQLite;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace WindowsFormsApp1
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
// Путь к файлу SQLite
|
||||||
|
private string connectionString = @"Data Source=EmployeeDB.db;Version=3;";
|
||||||
|
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.AcceptButton = buttonLogin;
|
||||||
|
this.Text = "Авторизация";
|
||||||
|
this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
|
||||||
|
// Добавляем компоненты
|
||||||
|
InitializeLoginComponents();
|
||||||
|
|
||||||
|
// Создаем базу данных, если она не существует
|
||||||
|
CreateDatabaseIfNotExists();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateDatabaseIfNotExists()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!File.Exists("EmployeeDB.db"))
|
||||||
|
{
|
||||||
|
SQLiteConnection.CreateFile("EmployeeDB.db");
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
|
||||||
|
// Создаем таблицу пользователей
|
||||||
|
string createUsersTable = @"CREATE TABLE IF NOT EXISTS Users (
|
||||||
|
UserID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
Login TEXT NOT NULL,
|
||||||
|
Password TEXT NOT NULL)";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(createUsersTable, connection))
|
||||||
|
{
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Создаем admin пользователя
|
||||||
|
string insertAdmin = @"INSERT INTO Users (Login, Password) VALUES ('admin', 'admin')";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(insertAdmin, connection))
|
||||||
|
{
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Создаем таблицу сотрудников
|
||||||
|
string createEmployeesTable = @"CREATE TABLE IF NOT EXISTS Employees (
|
||||||
|
EmployeeID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
LastName TEXT NOT NULL,
|
||||||
|
FirstName TEXT NOT NULL,
|
||||||
|
MiddleName TEXT,
|
||||||
|
Position TEXT,
|
||||||
|
Department TEXT)";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(createEmployeesTable, connection))
|
||||||
|
{
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Создаем таблицу посещаемости
|
||||||
|
string createAttendanceTable = @"CREATE TABLE IF NOT EXISTS Attendance (
|
||||||
|
AttendanceID INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
EmployeeID INTEGER NOT NULL,
|
||||||
|
ArrivalTime TEXT NOT NULL,
|
||||||
|
DepartureTime TEXT,
|
||||||
|
FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID))";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(createAttendanceTable, connection))
|
||||||
|
{
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка инициализации базы данных: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeLoginComponents()
|
||||||
|
{
|
||||||
|
// Заголовок
|
||||||
|
Label lblHeader = new Label
|
||||||
|
{
|
||||||
|
Text = "Вход в систему учета посещаемости",
|
||||||
|
Font = new Font("Arial", 14, FontStyle.Bold),
|
||||||
|
Width = 350,
|
||||||
|
TextAlign = ContentAlignment.MiddleCenter,
|
||||||
|
Location = new Point(70, 20)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Поле логина
|
||||||
|
Label lblLogin = new Label
|
||||||
|
{
|
||||||
|
Text = "Логин:",
|
||||||
|
Location = new Point(70, 70),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
TextBox txtLogin = new TextBox
|
||||||
|
{
|
||||||
|
Name = "txtLogin",
|
||||||
|
Location = new Point(170, 70),
|
||||||
|
Width = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
// Поле пароля
|
||||||
|
Label lblPassword = new Label
|
||||||
|
{
|
||||||
|
Text = "Пароль:",
|
||||||
|
Location = new Point(70, 100),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
TextBox txtPassword = new TextBox
|
||||||
|
{
|
||||||
|
Name = "txtPassword",
|
||||||
|
Location = new Point(170, 100),
|
||||||
|
Width = 200,
|
||||||
|
PasswordChar = '*'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Кнопка входа
|
||||||
|
Button buttonLogin = new Button
|
||||||
|
{
|
||||||
|
Name = "buttonLogin",
|
||||||
|
Text = "Войти",
|
||||||
|
Location = new Point(200, 150),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
buttonLogin.Click += ButtonLogin_Click;
|
||||||
|
|
||||||
|
// Добавляем все компоненты на форму
|
||||||
|
this.Controls.Add(lblHeader);
|
||||||
|
this.Controls.Add(lblLogin);
|
||||||
|
this.Controls.Add(txtLogin);
|
||||||
|
this.Controls.Add(lblPassword);
|
||||||
|
this.Controls.Add(txtPassword);
|
||||||
|
this.Controls.Add(buttonLogin);
|
||||||
|
|
||||||
|
// Устанавливаем размеры формы
|
||||||
|
this.Width = 480;
|
||||||
|
this.Height = 250;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonLogin_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string login = this.Controls["txtLogin"].Text;
|
||||||
|
string password = this.Controls["txtPassword"].Text;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
string query = "SELECT COUNT(*) FROM Users WHERE Login = @Login AND Password = @Password";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(query, connection))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("@Login", login);
|
||||||
|
command.Parameters.AddWithValue("@Password", password);
|
||||||
|
int count = Convert.ToInt32(command.ExecuteScalar());
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Вход выполнен успешно!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
|
||||||
|
// Скрываем текущую форму
|
||||||
|
this.Hide();
|
||||||
|
|
||||||
|
// Открываем главную форму приложения
|
||||||
|
MainForm mainForm = new MainForm(connectionString);
|
||||||
|
mainForm.FormClosed += (s, args) => this.Close();
|
||||||
|
mainForm.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Неверный логин или пароль!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка входа: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Форма для работы с таблицами
|
||||||
|
public class MainForm : Form
|
||||||
|
{
|
||||||
|
private string connectionString;
|
||||||
|
private TabControl tabControl;
|
||||||
|
private TabPage tabEmployees;
|
||||||
|
private TabPage tabAttendance;
|
||||||
|
private DataGridView dgvEmployees;
|
||||||
|
private DataGridView dgvAttendance;
|
||||||
|
|
||||||
|
public MainForm(string connString)
|
||||||
|
{
|
||||||
|
connectionString = connString;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
LoadEmployeeData();
|
||||||
|
LoadAttendanceData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.Text = "Система учета посещаемости";
|
||||||
|
this.Width = 800;
|
||||||
|
this.Height = 600;
|
||||||
|
this.StartPosition = FormStartPosition.CenterScreen;
|
||||||
|
|
||||||
|
// Создаем вкладки
|
||||||
|
tabControl = new TabControl
|
||||||
|
{
|
||||||
|
Dock = DockStyle.Fill
|
||||||
|
};
|
||||||
|
|
||||||
|
// Вкладка "Сотрудники"
|
||||||
|
tabEmployees = new TabPage
|
||||||
|
{
|
||||||
|
Text = "Сотрудники"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Вкладка "Посещаемость"
|
||||||
|
tabAttendance = new TabPage
|
||||||
|
{
|
||||||
|
Text = "Посещаемость"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Панель для кнопок сотрудников
|
||||||
|
Panel panelEmployeesButtons = new Panel
|
||||||
|
{
|
||||||
|
Dock = DockStyle.Top,
|
||||||
|
Height = 50
|
||||||
|
};
|
||||||
|
|
||||||
|
// Кнопки для управления сотрудниками
|
||||||
|
Button btnAddEmployee = new Button
|
||||||
|
{
|
||||||
|
Text = "Добавить сотрудника",
|
||||||
|
Width = 150,
|
||||||
|
Location = new Point(10, 10)
|
||||||
|
};
|
||||||
|
btnAddEmployee.Click += BtnAddEmployee_Click;
|
||||||
|
|
||||||
|
Button btnEditEmployee = new Button
|
||||||
|
{
|
||||||
|
Text = "Редактировать",
|
||||||
|
Width = 150,
|
||||||
|
Location = new Point(170, 10)
|
||||||
|
};
|
||||||
|
btnEditEmployee.Click += BtnEditEmployee_Click;
|
||||||
|
|
||||||
|
Button btnDeleteEmployee = new Button
|
||||||
|
{
|
||||||
|
Text = "Удалить",
|
||||||
|
Width = 150,
|
||||||
|
Location = new Point(330, 10)
|
||||||
|
};
|
||||||
|
btnDeleteEmployee.Click += BtnDeleteEmployee_Click;
|
||||||
|
|
||||||
|
// Добавляем кнопки на панель
|
||||||
|
panelEmployeesButtons.Controls.Add(btnAddEmployee);
|
||||||
|
panelEmployeesButtons.Controls.Add(btnEditEmployee);
|
||||||
|
panelEmployeesButtons.Controls.Add(btnDeleteEmployee);
|
||||||
|
|
||||||
|
// Таблица для сотрудников
|
||||||
|
dgvEmployees = new DataGridView
|
||||||
|
{
|
||||||
|
AllowUserToAddRows = false,
|
||||||
|
AllowUserToDeleteRows = false,
|
||||||
|
ReadOnly = true,
|
||||||
|
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
|
||||||
|
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
|
||||||
|
Dock = DockStyle.Fill
|
||||||
|
};
|
||||||
|
|
||||||
|
// ВАЖНО: сначала добавляем DataGridView, затем панель кнопок
|
||||||
|
// Это обеспечивает правильное расположение элементов сверху вниз
|
||||||
|
tabEmployees.Controls.Add(dgvEmployees);
|
||||||
|
tabEmployees.Controls.Add(panelEmployeesButtons);
|
||||||
|
|
||||||
|
// Панель для кнопок посещаемости
|
||||||
|
Panel panelAttendanceButtons = new Panel
|
||||||
|
{
|
||||||
|
Dock = DockStyle.Top,
|
||||||
|
Height = 50
|
||||||
|
};
|
||||||
|
|
||||||
|
// Кнопки для управления посещаемостью
|
||||||
|
Button btnArrival = new Button
|
||||||
|
{
|
||||||
|
Text = "Отметить прибытие",
|
||||||
|
Width = 150,
|
||||||
|
Location = new Point(10, 10)
|
||||||
|
};
|
||||||
|
btnArrival.Click += BtnArrival_Click;
|
||||||
|
|
||||||
|
Button btnDeparture = new Button
|
||||||
|
{
|
||||||
|
Text = "Отметить убытие",
|
||||||
|
Width = 150,
|
||||||
|
Location = new Point(170, 10)
|
||||||
|
};
|
||||||
|
btnDeparture.Click += BtnDeparture_Click;
|
||||||
|
|
||||||
|
// Добавляем кнопки на панель
|
||||||
|
panelAttendanceButtons.Controls.Add(btnArrival);
|
||||||
|
panelAttendanceButtons.Controls.Add(btnDeparture);
|
||||||
|
|
||||||
|
// Таблица для посещаемости
|
||||||
|
dgvAttendance = new DataGridView
|
||||||
|
{
|
||||||
|
AllowUserToAddRows = false,
|
||||||
|
AllowUserToDeleteRows = false,
|
||||||
|
ReadOnly = true,
|
||||||
|
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill,
|
||||||
|
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
|
||||||
|
Dock = DockStyle.Fill
|
||||||
|
};
|
||||||
|
|
||||||
|
// ВАЖНО: сначала добавляем DataGridView, затем панель кнопок
|
||||||
|
tabAttendance.Controls.Add(dgvAttendance);
|
||||||
|
tabAttendance.Controls.Add(panelAttendanceButtons);
|
||||||
|
|
||||||
|
// Добавляем вкладки в контрол
|
||||||
|
tabControl.TabPages.Add(tabEmployees);
|
||||||
|
tabControl.TabPages.Add(tabAttendance);
|
||||||
|
|
||||||
|
// Добавляем контрол вкладок на форму
|
||||||
|
this.Controls.Add(tabControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void LoadEmployeeData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
string query = "SELECT EmployeeID, LastName, FirstName, MiddleName, Position, Department FROM Employees";
|
||||||
|
SQLiteDataAdapter adapter = new SQLiteDataAdapter(query, connection);
|
||||||
|
DataTable dt = new DataTable();
|
||||||
|
adapter.Fill(dt);
|
||||||
|
dgvEmployees.DataSource = dt;
|
||||||
|
|
||||||
|
// Переименовываем колонки для отображения
|
||||||
|
if (dt.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
dgvEmployees.Columns["EmployeeID"].HeaderText = "ID";
|
||||||
|
dgvEmployees.Columns["LastName"].HeaderText = "Фамилия";
|
||||||
|
dgvEmployees.Columns["FirstName"].HeaderText = "Имя";
|
||||||
|
dgvEmployees.Columns["MiddleName"].HeaderText = "Отчество";
|
||||||
|
dgvEmployees.Columns["Position"].HeaderText = "Должность";
|
||||||
|
dgvEmployees.Columns["Department"].HeaderText = "Отдел";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка загрузки данных сотрудников: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadAttendanceData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
// Изменен синтаксис конкатенации для SQLite
|
||||||
|
string query = @"SELECT a.AttendanceID, e.EmployeeID,
|
||||||
|
e.LastName || ' ' || e.FirstName || ' ' || COALESCE(e.MiddleName, '') as FullName,
|
||||||
|
a.ArrivalTime, a.DepartureTime
|
||||||
|
FROM Attendance a
|
||||||
|
JOIN Employees e ON a.EmployeeID = e.EmployeeID
|
||||||
|
ORDER BY a.ArrivalTime DESC";
|
||||||
|
SQLiteDataAdapter adapter = new SQLiteDataAdapter(query, connection);
|
||||||
|
DataTable dt = new DataTable();
|
||||||
|
adapter.Fill(dt);
|
||||||
|
dgvAttendance.DataSource = dt;
|
||||||
|
|
||||||
|
// Переименовываем колонки для отображения
|
||||||
|
if (dt.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
dgvAttendance.Columns["AttendanceID"].HeaderText = "ID записи";
|
||||||
|
dgvAttendance.Columns["EmployeeID"].HeaderText = "ID сотрудника";
|
||||||
|
dgvAttendance.Columns["FullName"].HeaderText = "ФИО";
|
||||||
|
dgvAttendance.Columns["ArrivalTime"].HeaderText = "Время прибытия";
|
||||||
|
dgvAttendance.Columns["DepartureTime"].HeaderText = "Время убытия";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка загрузки данных посещаемости: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Обработчики событий для кнопок
|
||||||
|
private void BtnAddEmployee_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EmployeeForm form = new EmployeeForm(connectionString, 0);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadEmployeeData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnEditEmployee_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dgvEmployees.SelectedRows.Count > 0)
|
||||||
|
{
|
||||||
|
int employeeId = Convert.ToInt32(dgvEmployees.SelectedRows[0].Cells["EmployeeID"].Value);
|
||||||
|
EmployeeForm form = new EmployeeForm(connectionString, employeeId);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadEmployeeData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите сотрудника для редактирования", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnDeleteEmployee_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dgvEmployees.SelectedRows.Count > 0)
|
||||||
|
{
|
||||||
|
int employeeId = Convert.ToInt32(dgvEmployees.SelectedRows[0].Cells["EmployeeID"].Value);
|
||||||
|
string employeeName = dgvEmployees.SelectedRows[0].Cells["LastName"].Value.ToString() + " " +
|
||||||
|
dgvEmployees.SelectedRows[0].Cells["FirstName"].Value.ToString();
|
||||||
|
|
||||||
|
DialogResult result = MessageBox.Show($"Вы уверены, что хотите удалить сотрудника {employeeName}?",
|
||||||
|
"Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
|
if (result == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
// Начинаем транзакцию
|
||||||
|
using (SQLiteTransaction transaction = connection.BeginTransaction())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Сначала удаляем записи посещаемости
|
||||||
|
string deleteAttendance = "DELETE FROM Attendance WHERE EmployeeID = @EmployeeID";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(deleteAttendance, connection, transaction))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("@EmployeeID", employeeId);
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Затем удаляем сотрудника
|
||||||
|
string deleteEmployee = "DELETE FROM Employees WHERE EmployeeID = @EmployeeID";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(deleteEmployee, connection, transaction))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("@EmployeeID", employeeId);
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Фиксируем изменения
|
||||||
|
transaction.Commit();
|
||||||
|
MessageBox.Show("Сотрудник успешно удален", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
LoadEmployeeData();
|
||||||
|
LoadAttendanceData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Откатываем изменения при ошибке
|
||||||
|
transaction.Rollback();
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка при удалении сотрудника: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Выберите сотрудника для удаления", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnArrival_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AttendanceForm form = new AttendanceForm(connectionString, true);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadAttendanceData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnDeparture_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AttendanceForm form = new AttendanceForm(connectionString, false);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadAttendanceData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Форма для добавления/редактирования сотрудника
|
||||||
|
public class EmployeeForm : Form
|
||||||
|
{
|
||||||
|
private string connectionString;
|
||||||
|
private int employeeId;
|
||||||
|
private TextBox txtLastName;
|
||||||
|
private TextBox txtFirstName;
|
||||||
|
private TextBox txtMiddleName;
|
||||||
|
private TextBox txtPosition;
|
||||||
|
private TextBox txtDepartment;
|
||||||
|
|
||||||
|
public EmployeeForm(string connString, int id)
|
||||||
|
{
|
||||||
|
connectionString = connString;
|
||||||
|
employeeId = id;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
if (employeeId > 0)
|
||||||
|
{
|
||||||
|
this.Text = "Редактирование сотрудника";
|
||||||
|
LoadEmployeeData();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Text = "Добавление нового сотрудника";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.Width = 400;
|
||||||
|
this.Height = 300;
|
||||||
|
this.StartPosition = FormStartPosition.CenterParent;
|
||||||
|
this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
|
||||||
|
// Поля для ввода данных
|
||||||
|
Label lblLastName = new Label
|
||||||
|
{
|
||||||
|
Text = "Фамилия:",
|
||||||
|
Location = new Point(30, 20),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
txtLastName = new TextBox
|
||||||
|
{
|
||||||
|
Location = new Point(150, 20),
|
||||||
|
Width = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
Label lblFirstName = new Label
|
||||||
|
{
|
||||||
|
Text = "Имя:",
|
||||||
|
Location = new Point(30, 50),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
txtFirstName = new TextBox
|
||||||
|
{
|
||||||
|
Location = new Point(150, 50),
|
||||||
|
Width = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
Label lblMiddleName = new Label
|
||||||
|
{
|
||||||
|
Text = "Отчество:",
|
||||||
|
Location = new Point(30, 80),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
txtMiddleName = new TextBox
|
||||||
|
{
|
||||||
|
Location = new Point(150, 80),
|
||||||
|
Width = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
Label lblPosition = new Label
|
||||||
|
{
|
||||||
|
Text = "Должность:",
|
||||||
|
Location = new Point(30, 110),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
txtPosition = new TextBox
|
||||||
|
{
|
||||||
|
Location = new Point(150, 110),
|
||||||
|
Width = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
Label lblDepartment = new Label
|
||||||
|
{
|
||||||
|
Text = "Отдел:",
|
||||||
|
Location = new Point(30, 140),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
txtDepartment = new TextBox
|
||||||
|
{
|
||||||
|
Location = new Point(150, 140),
|
||||||
|
Width = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
// Кнопки
|
||||||
|
Button btnSave = new Button
|
||||||
|
{
|
||||||
|
Text = "Сохранить",
|
||||||
|
DialogResult = DialogResult.OK,
|
||||||
|
Location = new Point(150, 180),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
btnSave.Click += BtnSave_Click;
|
||||||
|
|
||||||
|
Button btnCancel = new Button
|
||||||
|
{
|
||||||
|
Text = "Отмена",
|
||||||
|
DialogResult = DialogResult.Cancel,
|
||||||
|
Location = new Point(260, 180),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
// Добавляем компоненты на форму
|
||||||
|
this.Controls.Add(lblLastName);
|
||||||
|
this.Controls.Add(txtLastName);
|
||||||
|
this.Controls.Add(lblFirstName);
|
||||||
|
this.Controls.Add(txtFirstName);
|
||||||
|
this.Controls.Add(lblMiddleName);
|
||||||
|
this.Controls.Add(txtMiddleName);
|
||||||
|
this.Controls.Add(lblPosition);
|
||||||
|
this.Controls.Add(txtPosition);
|
||||||
|
this.Controls.Add(lblDepartment);
|
||||||
|
this.Controls.Add(txtDepartment);
|
||||||
|
this.Controls.Add(btnSave);
|
||||||
|
this.Controls.Add(btnCancel);
|
||||||
|
|
||||||
|
this.AcceptButton = btnSave;
|
||||||
|
this.CancelButton = btnCancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadEmployeeData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
string query = "SELECT LastName, FirstName, MiddleName, Position, Department FROM Employees WHERE EmployeeID = @EmployeeID";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(query, connection))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("@EmployeeID", employeeId);
|
||||||
|
using (SQLiteDataReader reader = command.ExecuteReader())
|
||||||
|
{
|
||||||
|
if (reader.Read())
|
||||||
|
{
|
||||||
|
txtLastName.Text = reader["LastName"].ToString();
|
||||||
|
txtFirstName.Text = reader["FirstName"].ToString();
|
||||||
|
txtMiddleName.Text = reader["MiddleName"].ToString();
|
||||||
|
txtPosition.Text = reader["Position"].ToString();
|
||||||
|
txtDepartment.Text = reader["Department"].ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка при загрузке данных сотрудника: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(txtLastName.Text) || string.IsNullOrWhiteSpace(txtFirstName.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Фамилия и имя обязательны для заполнения", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
this.DialogResult = DialogResult.None;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
string query;
|
||||||
|
|
||||||
|
if (employeeId > 0)
|
||||||
|
{
|
||||||
|
// Обновление существующего сотрудника
|
||||||
|
query = @"UPDATE Employees SET
|
||||||
|
LastName = @LastName,
|
||||||
|
FirstName = @FirstName,
|
||||||
|
MiddleName = @MiddleName,
|
||||||
|
Position = @Position,
|
||||||
|
Department = @Department
|
||||||
|
WHERE EmployeeID = @EmployeeID";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Добавление нового сотрудника
|
||||||
|
query = @"INSERT INTO Employees (LastName, FirstName, MiddleName, Position, Department)
|
||||||
|
VALUES (@LastName, @FirstName, @MiddleName, @Position, @Department)";
|
||||||
|
}
|
||||||
|
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(query, connection))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("@LastName", txtLastName.Text);
|
||||||
|
command.Parameters.AddWithValue("@FirstName", txtFirstName.Text);
|
||||||
|
command.Parameters.AddWithValue("@MiddleName", txtMiddleName.Text);
|
||||||
|
command.Parameters.AddWithValue("@Position", txtPosition.Text);
|
||||||
|
command.Parameters.AddWithValue("@Department", txtDepartment.Text);
|
||||||
|
|
||||||
|
if (employeeId > 0)
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("@EmployeeID", employeeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка при сохранении данных: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
this.DialogResult = DialogResult.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Форма для отметки посещаемости
|
||||||
|
public class AttendanceForm : Form
|
||||||
|
{
|
||||||
|
private string connectionString;
|
||||||
|
private bool isArrival;
|
||||||
|
private ComboBox cmbEmployees;
|
||||||
|
|
||||||
|
public AttendanceForm(string connString, bool arrival)
|
||||||
|
{
|
||||||
|
connectionString = connString;
|
||||||
|
isArrival = arrival;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
LoadEmployees();
|
||||||
|
|
||||||
|
this.Text = isArrival ? "Отметка прибытия" : "Отметка убытия";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.Width = 400;
|
||||||
|
this.Height = 200;
|
||||||
|
this.StartPosition = FormStartPosition.CenterParent;
|
||||||
|
this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||||
|
this.MaximizeBox = false;
|
||||||
|
this.MinimizeBox = false;
|
||||||
|
|
||||||
|
// Заголовок
|
||||||
|
Label lblHeader = new Label
|
||||||
|
{
|
||||||
|
Text = isArrival ? "Отметка прибытия сотрудника" : "Отметка убытия сотрудника",
|
||||||
|
Font = new Font("Arial", 12, FontStyle.Bold),
|
||||||
|
Location = new Point(50, 20),
|
||||||
|
Width = 300,
|
||||||
|
TextAlign = ContentAlignment.MiddleCenter
|
||||||
|
};
|
||||||
|
|
||||||
|
// Выбор сотрудника
|
||||||
|
Label lblEmployee = new Label
|
||||||
|
{
|
||||||
|
Text = "Сотрудник:",
|
||||||
|
Location = new Point(30, 60),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
cmbEmployees = new ComboBox
|
||||||
|
{
|
||||||
|
Location = new Point(130, 60),
|
||||||
|
Width = 220,
|
||||||
|
DropDownStyle = ComboBoxStyle.DropDownList
|
||||||
|
};
|
||||||
|
|
||||||
|
// Кнопки
|
||||||
|
Button btnSave = new Button
|
||||||
|
{
|
||||||
|
Text = "Отметить",
|
||||||
|
DialogResult = DialogResult.OK,
|
||||||
|
Location = new Point(130, 100),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
btnSave.Click += BtnSave_Click;
|
||||||
|
|
||||||
|
Button btnCancel = new Button
|
||||||
|
{
|
||||||
|
Text = "Отмена",
|
||||||
|
DialogResult = DialogResult.Cancel,
|
||||||
|
Location = new Point(250, 100),
|
||||||
|
Width = 100
|
||||||
|
};
|
||||||
|
|
||||||
|
// Добавляем компоненты на форму
|
||||||
|
this.Controls.Add(lblHeader);
|
||||||
|
this.Controls.Add(lblEmployee);
|
||||||
|
this.Controls.Add(cmbEmployees);
|
||||||
|
this.Controls.Add(btnSave);
|
||||||
|
this.Controls.Add(btnCancel);
|
||||||
|
|
||||||
|
this.AcceptButton = btnSave;
|
||||||
|
this.CancelButton = btnCancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadEmployees()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
string query = "SELECT EmployeeID, LastName || ' ' || FirstName || ' ' || COALESCE(MiddleName, '') as FullName FROM Employees ORDER BY LastName, FirstName";
|
||||||
|
SQLiteDataAdapter adapter = new SQLiteDataAdapter(query, connection);
|
||||||
|
DataTable dt = new DataTable();
|
||||||
|
adapter.Fill(dt);
|
||||||
|
|
||||||
|
cmbEmployees.DataSource = dt;
|
||||||
|
cmbEmployees.DisplayMember = "FullName";
|
||||||
|
cmbEmployees.ValueMember = "EmployeeID";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка при загрузке списка сотрудников: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (cmbEmployees.SelectedValue == null)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Необходимо выбрать сотрудника", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
this.DialogResult = DialogResult.None;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
|
||||||
|
if (isArrival)
|
||||||
|
{
|
||||||
|
// Отметка прибытия - создаем новую запись
|
||||||
|
string query = "INSERT INTO Attendance (EmployeeID, ArrivalTime) VALUES (@EmployeeID, @ArrivalTime)";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(query, connection))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("@EmployeeID", cmbEmployees.SelectedValue);
|
||||||
|
command.Parameters.AddWithValue("@ArrivalTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
command.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Отметка убытия - ищем последнюю запись с прибытием для данного сотрудника
|
||||||
|
string query = @"UPDATE Attendance SET DepartureTime = @DepartureTime
|
||||||
|
WHERE EmployeeID = @EmployeeID AND DepartureTime IS NULL
|
||||||
|
AND AttendanceID = (SELECT AttendanceID FROM Attendance
|
||||||
|
WHERE EmployeeID = @EmployeeID AND DepartureTime IS NULL
|
||||||
|
ORDER BY ArrivalTime DESC LIMIT 1)";
|
||||||
|
using (SQLiteCommand command = new SQLiteCommand(query, connection))
|
||||||
|
{
|
||||||
|
command.Parameters.AddWithValue("@EmployeeID", cmbEmployees.SelectedValue);
|
||||||
|
command.Parameters.AddWithValue("@DepartureTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
int rowsAffected = command.ExecuteNonQuery();
|
||||||
|
|
||||||
|
if (rowsAffected == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Для данного сотрудника нет открытых записей о прибытии",
|
||||||
|
"Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
this.DialogResult = DialogResult.None;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Посещаемость успешно отмечена", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Ошибка при сохранении данных: " + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
this.DialogResult = DialogResult.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
123
Form1.resx
Normal file
123
Form1.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
22
Program.cs
Normal file
22
Program.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace WindowsFormsApp1
|
||||||
|
{
|
||||||
|
static class Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Главная точка входа для приложения.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main()
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
33
Properties/AssemblyInfo.cs
Normal file
33
Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Общие сведения об этой сборке предоставляются следующим набором
|
||||||
|
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||||
|
// связанных со сборкой.
|
||||||
|
[assembly: AssemblyTitle("WindowsFormsApp1")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("WindowsFormsApp1")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||||
|
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||||
|
// COM, следует установить атрибут ComVisible в TRUE для этого типа.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
|
||||||
|
[assembly: Guid("58e43c91-f1b2-46c1-a569-552c7a6e1d05")]
|
||||||
|
|
||||||
|
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||||
|
//
|
||||||
|
// Основной номер версии
|
||||||
|
// Дополнительный номер версии
|
||||||
|
// Номер сборки
|
||||||
|
// Редакция
|
||||||
|
//
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
Properties/Resources.Designer.cs
generated
Normal file
71
Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программным средством.
|
||||||
|
// Версия среды выполнения: 4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
|
||||||
|
// код создан повторно.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace WindowsFormsApp1.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
|
||||||
|
// класс с помощью таких средств, как ResGen или Visual Studio.
|
||||||
|
// Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
|
||||||
|
// с параметром /str или заново постройте свой VS-проект.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources
|
||||||
|
{
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if ((resourceMan == null))
|
||||||
|
{
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsApp1.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Переопределяет свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
117
Properties/Resources.resx
Normal file
117
Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
30
Properties/Settings.Designer.cs
generated
Normal file
30
Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace WindowsFormsApp1.Properties
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
Properties/Settings.settings
Normal file
7
Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
113
WindowsFormsApp1.csproj
Normal file
113
WindowsFormsApp1.csproj
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{58E43C91-F1B2-46C1-A569-552C7A6E1D05}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<RootNamespace>WindowsFormsApp1</RootNamespace>
|
||||||
|
<AssemblyName>WindowsFormsApp1</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
<NuGetPackageImportStamp>
|
||||||
|
</NuGetPackageImportStamp>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\lib\net46\System.Data.SQLite.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Data.SQLite.EF6.1.0.119.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
|
||||||
|
<HintPath>packages\System.Data.SQLite.Linq.1.0.119.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Deployment" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Form1.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Form1.Designer.cs">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<EmbeddedResource Include="Form1.resx">
|
||||||
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Error Condition="!Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
|
||||||
|
<Error Condition="!Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
|
||||||
|
<Error Condition="!Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
|
||||||
|
</Target>
|
||||||
|
<Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
|
||||||
|
<Import Project="packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.119.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
|
||||||
|
</Project>
|
25
WindowsFormsApp1.sln
Normal file
25
WindowsFormsApp1.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.13.35828.75 d17.13
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp1", "WindowsFormsApp1.csproj", "{58E43C91-F1B2-46C1-A569-552C7A6E1D05}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{58E43C91-F1B2-46C1-A569-552C7A6E1D05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{58E43C91-F1B2-46C1-A569-552C7A6E1D05}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{58E43C91-F1B2-46C1-A569-552C7A6E1D05}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{58E43C91-F1B2-46C1-A569-552C7A6E1D05}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {38090D2C-ED9E-412B-8102-3DCF86037F7A}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
9
packages.config
Normal file
9
packages.config
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="EntityFramework" version="6.4.4" targetFramework="net472" />
|
||||||
|
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.119.0" targetFramework="net472" />
|
||||||
|
<package id="System.Data.SQLite" version="1.0.119.0" targetFramework="net472" />
|
||||||
|
<package id="System.Data.SQLite.Core" version="1.0.119.0" targetFramework="net472" />
|
||||||
|
<package id="System.Data.SQLite.EF6" version="1.0.119.0" targetFramework="net472" />
|
||||||
|
<package id="System.Data.SQLite.Linq" version="1.0.119.0" targetFramework="net472" />
|
||||||
|
</packages>
|
Loading…
x
Reference in New Issue
Block a user