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.

84 lines
2.5 KiB

8 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
{
8 months ago
string connectionString = "Server=172.27.128.1;Port=5432;UserId=postgres;Password=postgres;Database=SQL_Servers;";
8 months ago
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(connectionString);
8 months ago
raportForm.Show();
}
private void dataBtn_Click(object sender, EventArgs e)
{
DataForm dataForm = new DataForm(connectionString);
8 months ago
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();
this.connection.Close();
8 months ago
MessageBox.Show("Database was successfuly connected!");
} catch (Exception ex)
{
MessageBox.Show($"Error! Db connection was fatal! Log: {ex.Message}");
}
}
8 months ago
private void buildingButton_MouseClick(object sender, MouseEventArgs e)
{
var crudForm = new CRUDForm(this.connectionString);
crudForm.Show();
}
private void buildingButton_Click(object sender, EventArgs e)
{
var crudForm = new CRUDForm(this.connectionString);
crudForm.Show();
}
8 months ago
}
}