- •Аннотация.
- •Оглавление
- •Введение.
- •Цель курсовой работы.
- •Задание на выполнение курсовой работы.
- •Концептуальная модель данных.
- •Логическая структура данных.
- •Этапы реализации системы.
- •6.1. Запросы.
- •6.2. Индексы.
- •6.3. Роли.
- •6.4. Процедуры.
- •6.5. Триггеры.
- •Руководство пользователя-клиента.
- •Руководство инструктора.
- •Руководство администратора.
- •Список литературы
- •Листинг программ. Интерфейс для пользователя hikingtrips. Файл Form2.Cs
- •Файл Form1.Cs
- •Файл Form4.Cs
- •Файл Form3.Cs
- •Файл Form5.Cs
- •Файл Form6.Cs
- •Листинг программ. Интерфейс для инструктора hikingtripsinstructors. Файл Form1.Cs
- •Файл Form2.Cs
Файл Form6.Cs
using MySql.Data.MySqlClient;
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;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.Drawing.Printing;
using System.Drawing;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Runtime.InteropServices.JavaScript.JSType;
using System.Reflection.Metadata;
namespace hikingtrips
{
public partial class Form6 : Form
{
private const string connectionString = "server=localhost;database=hikingtrips;uid=root;password=Fuckingpassword2;";
string y;
public class PurchaseData
{
public DateTime PurchaseDate { get; set; }
public int TotalAmount { get; set; }
}
public Form6(string userontrip)
{
InitializeComponent();
this.y = userontrip;
}
private void button1_Click(object sender, EventArgs e)
{
string feedback = textBox1.Text;
SaveFeedback(feedback);
}
private void SaveFeedback(string feedback)
{
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
connection.Open();
string query = "INSERT INTO review (user, text) VALUES (@user, @text)";
using (MySqlCommand command = new MySqlCommand(query, connection))
{
command.Parameters.AddWithValue("@user", y);
command.Parameters.AddWithValue("@text", feedback);
command.ExecuteNonQuery();
}
}
}
}
}
ПРИЛОЖЕНИЕ 2.
Листинг программ. Интерфейс для инструктора hikingtripsinstructors. Файл Form1.Cs
using MySql.Data.MySqlClient;
using System;
using System.Security.Policy;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
namespace hikingtripsforinstructors
{
public partial class Form1 : Form
{
private const string connectionString = "server=localhost;database=hikingtrips;uid=root;password=Fuckingpassword2;";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string username = textBox1.Text;
string password = textBox2.Text;
AuthenticateInstructor(username, password);
}
private void AuthenticateInstructor(string username, string password)
{
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
connection.Open();
string checkUserQuery = "SELECT * FROM login_password_instructors WHERE instructor_login = @Username";
using (MySqlCommand checkUserCommand = new MySqlCommand(checkUserQuery, connection))
{
checkUserCommand.Parameters.AddWithValue("@Username", username);
int userCount = Convert.ToInt32(checkUserCommand.ExecuteScalar());
if (userCount > 0)
{
string passwordQuery = "SELECT instructor_password, instructor_login FROM login_password_instructors WHERE instructor_login = @Username";
using (MySqlCommand passwordCommand = new MySqlCommand(passwordQuery, connection))
{
passwordCommand.Parameters.AddWithValue("@Username", username);
MySqlDataReader reader2 = passwordCommand.ExecuteReader();
if (reader2.Read())
{
string storedPassword = reader2["instructor_password"].ToString();
if (storedPassword == password)
{
MessageBox.Show("The login was completed successfully!", "Congratulations!", MessageBoxButtons.OK, MessageBoxIcon.Information);
Form2 frm2 = new Form2();
frm2.Show();
}
else
{
MessageBox.Show("The password is incorrect.", "Sorry.", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
reader2.Close();
}
}
}
else
{
MessageBox.Show("The instructor with this username was not found.", "Sorry.", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
}
}
