|
|
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=172.27.128.1;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(connectionString);
|
|
|
raportForm.Show();
|
|
|
}
|
|
|
|
|
|
private void dataBtn_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
DataForm dataForm = new DataForm(connectionString);
|
|
|
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();
|
|
|
MessageBox.Show("Database was successfuly connected!");
|
|
|
} catch (Exception ex)
|
|
|
{
|
|
|
MessageBox.Show($"Error! Db connection was fatal! Log: {ex.Message}");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|