You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.1 KiB

9 months ago
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 Npgsql;
namespace db_lab
{
public partial class Form1 : Form
{
string connectionString = "Server=localhost;Port=5432;UserId=postgres;Password=postgres;Database=SQL_Servers;";
NpgsqlConnection connection;
public Form1()
{
InitializeComponent();
}
private void exitBtn_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void aboutBtn_Click(object sender, EventArgs e)
{
string appName = Application.ProductName;
string appVersion = Application.ProductVersion;
string developer = "Артем Вебер";
string message = $"Приложение: {appName}\nВерсия: {appVersion}\nРазработчик: {developer}";
MessageBox.Show(message, "Информация о приложении", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void raportBtn_Click(object sender, EventArgs e)
{
RaportForm raportForm = new RaportForm();
raportForm.Show();
}
private void dataBtn_Click(object sender, EventArgs e)
{
DataForm dataForm = new DataForm();
dataForm.Show();
}
private void guideBtn_Click(object sender, EventArgs e)
{
GuideForm guideForm = new GuideForm();
guideForm.Show();
}
private void dbConnectBtn_Click(object sender, EventArgs e)
{
try
{
this.connection = new NpgsqlConnection(this.connectionString);
this.connection.Open();
MessageBox.Show("Database was successfuly connected!");
} catch (Exception ex)
{
MessageBox.Show($"Error! Db connection was fatal! Log: {ex.Message}");
}
}
}
}