main
Artem-Darius Weber 8 months ago
parent a601011e38
commit a6cf93fed0

@ -0,0 +1,39 @@
namespace db_lab
{
partial class BuildingRepository
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "BuildingRepository";
}
#endregion
}
}

@ -0,0 +1,85 @@
using Npgsql;
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;
namespace db_lab
{
public partial class BuildingRepository : Form
{
private NpgsqlConnection connection;
public BuildingRepository(string connectionString)
{
this.connection = new NpgsqlConnection(connectionString);
}
public DataTable ReadBuildings(int pageSize, int pageNumber)
{
string query = $"SELECT * FROM Building ORDER BY id LIMIT {pageSize} OFFSET {(pageNumber - 1) * pageSize}";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
public void DeleteBuilding(int id)
{
string query = $"DELETE FROM Building WHERE id = {id}";
using (var cmd = new NpgsqlCommand(query, connection))
{
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public void AddBuilding(int floorCount, string address, int creatingUserId, string buildingType)
{
string query = "INSERT INTO Building (floor_count, address, creating_user_id, building_type) VALUES (@floor_count, @address, @creating_user_id, @building_type)";
using (var cmd = new NpgsqlCommand(query, connection))
{
cmd.Parameters.AddWithValue("floor_count", floorCount);
cmd.Parameters.AddWithValue("address", address);
cmd.Parameters.AddWithValue("creating_user_id", creatingUserId);
cmd.Parameters.AddWithValue("building_type", buildingType);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public void UpdateBuilding(int id, int floorCount, string address, int creatingUserId, string buildingType)
{
string query = "UPDATE Building SET floor_count = @floor_count, address = @address, creating_user_id = @creating_user_id, building_type = @building_type WHERE id = @id";
using (var cmd = new NpgsqlCommand(query, connection))
{
cmd.Parameters.AddWithValue("floor_count", floorCount);
cmd.Parameters.AddWithValue("address", address);
cmd.Parameters.AddWithValue("creating_user_id", creatingUserId);
cmd.Parameters.AddWithValue("building_type", buildingType);
cmd.Parameters.AddWithValue("id", id);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public DataRow GetBuildingById(int id)
{
string query = $"SELECT * FROM Building WHERE id = {id}";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt.Rows.Count > 0 ? dt.Rows[0] : null;
}
}
}

@ -0,0 +1,221 @@
namespace db_lab
{
partial class CRUDForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.buildingBtn = new System.Windows.Forms.Button();
this.DepartmentBtn = new System.Windows.Forms.Button();
this.RoomsBtn = new System.Windows.Forms.Button();
this.EquipmentBtn = new System.Windows.Forms.Button();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.flowLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.buildingBtn);
this.flowLayoutPanel1.Controls.Add(this.DepartmentBtn);
this.flowLayoutPanel1.Controls.Add(this.RoomsBtn);
this.flowLayoutPanel1.Controls.Add(this.EquipmentBtn);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Left;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(200, 450);
this.flowLayoutPanel1.TabIndex = 0;
//
// buildingBtn
//
this.buildingBtn.Location = new System.Drawing.Point(3, 3);
this.buildingBtn.Name = "buildingBtn";
this.buildingBtn.Size = new System.Drawing.Size(75, 23);
this.buildingBtn.TabIndex = 0;
this.buildingBtn.Text = "Building";
this.buildingBtn.UseVisualStyleBackColor = true;
this.buildingBtn.Click += new System.EventHandler(this.buildingBtn_Click);
//
// DepartmentBtn
//
this.DepartmentBtn.Location = new System.Drawing.Point(84, 3);
this.DepartmentBtn.Name = "DepartmentBtn";
this.DepartmentBtn.Size = new System.Drawing.Size(75, 23);
this.DepartmentBtn.TabIndex = 1;
this.DepartmentBtn.Text = "Department";
this.DepartmentBtn.UseVisualStyleBackColor = true;
this.DepartmentBtn.Click += new System.EventHandler(this.DepartmentBtn_Click);
//
// RoomsBtn
//
this.RoomsBtn.Location = new System.Drawing.Point(3, 32);
this.RoomsBtn.Name = "RoomsBtn";
this.RoomsBtn.Size = new System.Drawing.Size(75, 23);
this.RoomsBtn.TabIndex = 2;
this.RoomsBtn.Text = "Rooms";
this.RoomsBtn.UseVisualStyleBackColor = true;
this.RoomsBtn.Click += new System.EventHandler(this.RoomsBtn_Click);
//
// EquipmentBtn
//
this.EquipmentBtn.Location = new System.Drawing.Point(84, 32);
this.EquipmentBtn.Name = "EquipmentBtn";
this.EquipmentBtn.Size = new System.Drawing.Size(75, 23);
this.EquipmentBtn.TabIndex = 3;
this.EquipmentBtn.Text = "Equipment";
this.EquipmentBtn.UseVisualStyleBackColor = true;
this.EquipmentBtn.Click += new System.EventHandler(this.EquipmentBtn_Click);
//
// dataGridView1
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(3, 3);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(511, 411);
this.dataGridView1.TabIndex = 4;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 86.16666F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 13.83333F));
this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(200, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 92.88889F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 7.111111F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(600, 450);
this.tableLayoutPanel1.TabIndex = 1;
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Controls.Add(this.button1);
this.flowLayoutPanel2.Controls.Add(this.button2);
this.flowLayoutPanel2.Controls.Add(this.button3);
this.flowLayoutPanel2.Controls.Add(this.button4);
this.flowLayoutPanel2.Controls.Add(this.button5);
this.flowLayoutPanel2.Location = new System.Drawing.Point(520, 3);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(77, 411);
this.flowLayoutPanel2.TabIndex = 6;
//
// button1
//
this.button1.Location = new System.Drawing.Point(3, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 5;
this.button1.Text = "Next";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnNext_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(3, 32);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 6;
this.button2.Text = "Prev";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.btnPrev_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(3, 61);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 7;
this.button3.Text = "Delete";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.btnDelete_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(3, 90);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 8;
this.button4.Text = "Add";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.btnAdd_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(3, 119);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 9;
this.button5.Text = "Edit";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.btnEdit_Click);
//
// CRUDForm
//
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.tableLayoutPanel1);
this.Controls.Add(this.flowLayoutPanel1);
this.Name = "CRUDForm";
this.Text = "CRUDForm";
this.flowLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button buildingBtn;
private System.Windows.Forms.Button DepartmentBtn;
private System.Windows.Forms.Button RoomsBtn;
private System.Windows.Forms.Button EquipmentBtn;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
}
}

@ -0,0 +1,107 @@
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;
namespace db_lab
{
public partial class CRUDForm : Form
{
private BuildingRepository buildingRepository;
private int pageSize = 10;
private int currentPage = 1;
private string connectionString;
public CRUDForm(string connectionString)
{
InitializeComponent();
this.connectionString = connectionString;
buildingRepository = new BuildingRepository(connectionString); // Инициализация BuildingRepository
LoadData();
}
private void LoadData()
{
DataTable dt = buildingRepository.ReadBuildings(pageSize, currentPage);
dataGridView1.DataSource = dt;
}
private void btnNext_Click(object sender, EventArgs e)
{
currentPage++;
LoadData();
}
private void btnPrev_Click(object sender, EventArgs e)
{
if (currentPage > 1)
{
currentPage--;
LoadData();
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dataGridView1.SelectedRows)
{
int id = Convert.ToInt32(row.Cells["id"].Value);
buildingRepository.DeleteBuilding(id);
}
LoadData();
}
private void btnAdd_Click(object sender, EventArgs e)
{
EditFormBuilding editForm = new EditFormBuilding(buildingRepository);
editForm.ShowDialog();
LoadData();
}
private void btnEdit_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count == 1)
{
int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["id"].Value);
EditFormBuilding editForm = new EditFormBuilding(buildingRepository, id);
editForm.ShowDialog();
LoadData();
}
else
{
MessageBox.Show("Please select a single row to edit.");
}
}
// another
private void buildingBtn_Click(object sender, EventArgs e)
{
var crudForm = new CRUDForm(this.connectionString);
crudForm.Show();
}
private void DepartmentBtn_Click(object sender, EventArgs e)
{
var form = new DepartmentForm(this.connectionString);
form.Show();
}
private void RoomsBtn_Click(object sender, EventArgs e)
{
var form = new RoomForm(this.connectionString);
form.Show();
}
private void EquipmentBtn_Click(object sender, EventArgs e)
{
var form = new EquipmentForm(this.connectionString);
form.Show();
}
}
}

@ -0,0 +1,120 @@
<?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>
</root>

@ -0,0 +1,137 @@
namespace db_lab
{
partial class DepartmentForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.flowLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.button1);
this.flowLayoutPanel1.Controls.Add(this.button2);
this.flowLayoutPanel1.Controls.Add(this.button3);
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(588, 12);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(200, 426);
this.flowLayoutPanel1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(3, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Next";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnNext_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(84, 3);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Prev";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.btnPrev_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(3, 32);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 2;
this.button3.Text = "Delete";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.btnDelete_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(84, 32);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 3;
this.button4.Text = "Add";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.btnAdd_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(3, 61);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 4;
this.button5.Text = "Edit";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.btnEdit_Click);
//
// dataGridView1
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(570, 426);
this.dataGridView1.TabIndex = 1;
//
// DepartmentForm
//
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.dataGridView1);
this.Controls.Add(this.flowLayoutPanel1);
this.Name = "DepartmentForm";
this.Text = "DepartmentForm";
this.flowLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.DataGridView dataGridView1;
}
}

@ -0,0 +1,79 @@
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;
namespace db_lab
{
public partial class DepartmentForm : Form
{
private DepartmentRepository departmentRepository;
private int pageSize = 10;
private int currentPage = 1;
public DepartmentForm(string connectionString)
{
InitializeComponent();
departmentRepository = new DepartmentRepository(connectionString);
LoadData();
}
private void LoadData()
{
DataTable dt = departmentRepository.ReadDepartments(pageSize, currentPage);
dataGridView1.DataSource = dt;
}
private void btnNext_Click(object sender, EventArgs e)
{
currentPage++;
LoadData();
}
private void btnPrev_Click(object sender, EventArgs e)
{
if (currentPage > 1)
{
currentPage--;
LoadData();
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dataGridView1.SelectedRows)
{
int code = Convert.ToInt32(row.Cells["code"].Value);
departmentRepository.DeleteDepartment(code);
}
LoadData();
}
private void btnAdd_Click(object sender, EventArgs e)
{
EditDepartmentForm editForm = new EditDepartmentForm(departmentRepository);
editForm.ShowDialog();
LoadData();
}
private void btnEdit_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count == 1)
{
int code = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["code"].Value);
EditDepartmentForm editForm = new EditDepartmentForm(departmentRepository, code);
editForm.ShowDialog();
LoadData();
}
else
{
MessageBox.Show("Please select a single row to edit.");
}
}
}
}

@ -0,0 +1,120 @@
<?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>
</root>

@ -0,0 +1,84 @@
using Npgsql;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Npgsql;
using System.Threading.Tasks;
namespace db_lab
{
public class DepartmentRepository
{
private NpgsqlConnection connection;
public DepartmentRepository(string connectionString)
{
this.connection = new NpgsqlConnection(connectionString);
}
public DataTable ReadDepartments(int pageSize, int pageNumber)
{
string query = $"SELECT * FROM Department ORDER BY code LIMIT {pageSize} OFFSET {(pageNumber - 1) * pageSize}";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
public void DeleteDepartment(int code)
{
string query = $"DELETE FROM Department WHERE code = {code}";
using (var cmd = new NpgsqlCommand(query, connection))
{
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public void AddDepartment(int code, string name, int floor, int creatingUserId, int buildingId)
{
string query = "INSERT INTO Department (code, name, floor, creating_user_id, building_id) VALUES (@code, @name, @floor, @creating_user_id, @building_id)";
using (var cmd = new NpgsqlCommand(query, connection))
{
cmd.Parameters.AddWithValue("code", code);
cmd.Parameters.AddWithValue("name", name);
cmd.Parameters.AddWithValue("floor", floor);
cmd.Parameters.AddWithValue("creating_user_id", creatingUserId);
cmd.Parameters.AddWithValue("building_id", buildingId);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public void UpdateDepartment(int code, string name, int floor, int creatingUserId, int buildingId)
{
string query = "UPDATE Department SET name = @name, floor = @floor, creating_user_id = @creating_user_id, building_id = @building_id WHERE code = @code";
using (var cmd = new NpgsqlCommand(query, connection))
{
cmd.Parameters.AddWithValue("code", code);
cmd.Parameters.AddWithValue("name", name);
cmd.Parameters.AddWithValue("floor", floor);
cmd.Parameters.AddWithValue("creating_user_id", creatingUserId);
cmd.Parameters.AddWithValue("building_id", buildingId);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public DataRow GetDepartmentByCode(int code)
{
string query = $"SELECT * FROM Department WHERE code = {code}";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt.Rows.Count > 0 ? dt.Rows[0] : null;
}
}
}

@ -0,0 +1,171 @@
namespace db_lab
{
partial class EditDepartmentForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBoxCode = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBoxName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBoxFloor = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBoxCreatingUserId = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBoxBuildingId = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBoxCode
//
this.textBoxCode.Location = new System.Drawing.Point(13, 13);
this.textBoxCode.Name = "textBoxCode";
this.textBoxCode.Size = new System.Drawing.Size(100, 20);
this.textBoxCode.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(129, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(67, 13);
this.label1.TabIndex = 1;
this.label1.Text = "textBoxCode";
//
// textBoxName
//
this.textBoxName.Location = new System.Drawing.Point(13, 40);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(100, 20);
this.textBoxName.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(132, 46);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(70, 13);
this.label2.TabIndex = 3;
this.label2.Text = "textBoxName";
//
// textBoxFloor
//
this.textBoxFloor.Location = new System.Drawing.Point(13, 67);
this.textBoxFloor.Name = "textBoxFloor";
this.textBoxFloor.Size = new System.Drawing.Size(100, 20);
this.textBoxFloor.TabIndex = 4;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(132, 73);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 13);
this.label3.TabIndex = 5;
this.label3.Text = "textBoxFloor";
//
// textBoxCreatingUserId
//
this.textBoxCreatingUserId.Location = new System.Drawing.Point(13, 94);
this.textBoxCreatingUserId.Name = "textBoxCreatingUserId";
this.textBoxCreatingUserId.Size = new System.Drawing.Size(100, 20);
this.textBoxCreatingUserId.TabIndex = 6;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(135, 100);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(112, 13);
this.label4.TabIndex = 7;
this.label4.Text = "textBoxCreatingUserId";
//
// textBoxBuildingId
//
this.textBoxBuildingId.Location = new System.Drawing.Point(13, 121);
this.textBoxBuildingId.Name = "textBoxBuildingId";
this.textBoxBuildingId.Size = new System.Drawing.Size(100, 20);
this.textBoxBuildingId.TabIndex = 8;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(132, 127);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 13);
this.label5.TabIndex = 9;
this.label5.Text = "textBoxBuildingId";
//
// button1
//
this.button1.Location = new System.Drawing.Point(13, 148);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(234, 62);
this.button1.TabIndex = 10;
this.button1.Text = "Save";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnSave_Click);
//
// EditDepartmentForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(256, 218);
this.Controls.Add(this.button1);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBoxBuildingId);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBoxCreatingUserId);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBoxFloor);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBoxCode);
this.Name = "EditDepartmentForm";
this.Text = "EditDepartmentForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxCode;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxName;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBoxFloor;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBoxCreatingUserId;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBoxBuildingId;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button button1;
}
}

@ -0,0 +1,61 @@
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;
namespace db_lab
{
public partial class EditDepartmentForm : Form
{
private DepartmentRepository departmentRepository;
private int? departmentCode;
public EditDepartmentForm(DepartmentRepository departmentRepository, int? departmentCode = null)
{
InitializeComponent();
this.departmentRepository = departmentRepository;
this.departmentCode = departmentCode;
if (departmentCode.HasValue)
{
LoadRecordData(departmentCode.Value);
}
}
private void LoadRecordData(int code)
{
DataRow row = departmentRepository.GetDepartmentByCode(code);
if (row != null)
{
textBoxCode.Text = row["code"].ToString();
textBoxName.Text = row["name"].ToString();
textBoxFloor.Text = row["floor"].ToString();
textBoxCreatingUserId.Text = row["creating_user_id"].ToString();
textBoxBuildingId.Text = row["building_id"].ToString();
}
}
private void btnSave_Click(object sender, EventArgs e)
{
int code = int.Parse(textBoxCode.Text);
string name = textBoxName.Text;
int floor = int.Parse(textBoxFloor.Text);
int creatingUserId = int.Parse(textBoxCreatingUserId.Text);
int buildingId = int.Parse(textBoxBuildingId.Text);
if (departmentCode.HasValue)
{
departmentRepository.UpdateDepartment(code, name, floor, creatingUserId, buildingId);
}
else
{
departmentRepository.AddDepartment(code, name, floor, creatingUserId, buildingId);
}
this.Close();
}
}
}

@ -0,0 +1,120 @@
<?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>
</root>

@ -0,0 +1,149 @@
namespace db_lab
{
partial class EditEquipmentForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBoxIpAddress = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBoxSshSettings = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBoxName = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBoxRoomId = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBoxIpAddress
//
this.textBoxIpAddress.Location = new System.Drawing.Point(12, 12);
this.textBoxIpAddress.Name = "textBoxIpAddress";
this.textBoxIpAddress.Size = new System.Drawing.Size(100, 20);
this.textBoxIpAddress.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(128, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(89, 13);
this.label1.TabIndex = 1;
this.label1.Text = "textBoxIpAddress";
//
// textBoxSshSettings
//
this.textBoxSshSettings.Location = new System.Drawing.Point(13, 39);
this.textBoxSshSettings.Name = "textBoxSshSettings";
this.textBoxSshSettings.Size = new System.Drawing.Size(100, 20);
this.textBoxSshSettings.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(131, 45);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(98, 13);
this.label2.TabIndex = 3;
this.label2.Text = "textBoxSshSettings";
//
// textBoxName
//
this.textBoxName.Location = new System.Drawing.Point(13, 66);
this.textBoxName.Name = "textBoxName";
this.textBoxName.Size = new System.Drawing.Size(100, 20);
this.textBoxName.TabIndex = 4;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(134, 72);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(70, 13);
this.label3.TabIndex = 5;
this.label3.Text = "textBoxName";
//
// textBoxRoomId
//
this.textBoxRoomId.Location = new System.Drawing.Point(12, 93);
this.textBoxRoomId.Name = "textBoxRoomId";
this.textBoxRoomId.Size = new System.Drawing.Size(100, 20);
this.textBoxRoomId.TabIndex = 6;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(134, 99);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(79, 13);
this.label4.TabIndex = 7;
this.label4.Text = "textBoxRoomId";
//
// button1
//
this.button1.Location = new System.Drawing.Point(13, 120);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(216, 58);
this.button1.TabIndex = 8;
this.button1.Text = "Save";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnSave_Click);
//
// EditEquipmentForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(229, 183);
this.Controls.Add(this.button1);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBoxRoomId);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBoxName);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBoxSshSettings);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBoxIpAddress);
this.Name = "EditEquipmentForm";
this.Text = "EditEquipmentForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxIpAddress;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxSshSettings;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBoxName;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBoxRoomId;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button1;
}
}

@ -0,0 +1,59 @@
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;
namespace db_lab
{
public partial class EditEquipmentForm : Form
{
private EquipmentRepository equipmentRepository;
private int? equipmentId;
public EditEquipmentForm(EquipmentRepository equipmentRepository, int? equipmentId = null)
{
InitializeComponent();
this.equipmentRepository = equipmentRepository;
this.equipmentId = equipmentId;
if (equipmentId.HasValue)
{
LoadRecordData(equipmentId.Value);
}
}
private void LoadRecordData(int id)
{
DataRow row = equipmentRepository.GetEquipmentById(id);
if (row != null)
{
textBoxIpAddress.Text = row["ip_address"].ToString();
textBoxSshSettings.Text = row["ssh_settings"].ToString();
textBoxName.Text = row["name"].ToString();
textBoxRoomId.Text = row["room_id"].ToString();
}
}
private void btnSave_Click(object sender, EventArgs e)
{
string ipAddress = textBoxIpAddress.Text;
string sshSettings = textBoxSshSettings.Text;
string name = textBoxName.Text;
int roomId = int.Parse(textBoxRoomId.Text);
if (equipmentId.HasValue)
{
equipmentRepository.UpdateEquipment(equipmentId.Value, ipAddress, sshSettings, name, roomId);
}
else
{
equipmentRepository.AddEquipment(ipAddress, sshSettings, name, roomId);
}
this.Close();
}
}
}

@ -0,0 +1,120 @@
<?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>
</root>

@ -0,0 +1,149 @@
namespace db_lab
{
partial class EditFormBuilding
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBoxFloorCount = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBoxAddress = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBoxCreatingUserId = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBoxBuildingType = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBoxFloorCount
//
this.textBoxFloorCount.Location = new System.Drawing.Point(12, 12);
this.textBoxFloorCount.Name = "textBoxFloorCount";
this.textBoxFloorCount.Size = new System.Drawing.Size(100, 20);
this.textBoxFloorCount.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(133, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(93, 13);
this.label1.TabIndex = 1;
this.label1.Text = "textBoxFloorCount";
//
// textBoxAddress
//
this.textBoxAddress.Location = new System.Drawing.Point(13, 39);
this.textBoxAddress.Name = "textBoxAddress";
this.textBoxAddress.Size = new System.Drawing.Size(100, 20);
this.textBoxAddress.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(136, 45);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 13);
this.label2.TabIndex = 3;
this.label2.Text = "textBoxAddress";
//
// textBoxCreatingUserId
//
this.textBoxCreatingUserId.Location = new System.Drawing.Point(13, 66);
this.textBoxCreatingUserId.Name = "textBoxCreatingUserId";
this.textBoxCreatingUserId.Size = new System.Drawing.Size(100, 20);
this.textBoxCreatingUserId.TabIndex = 4;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(139, 72);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(112, 13);
this.label3.TabIndex = 5;
this.label3.Text = "textBoxCreatingUserId";
//
// textBoxBuildingType
//
this.textBoxBuildingType.Location = new System.Drawing.Point(13, 93);
this.textBoxBuildingType.Name = "textBoxBuildingType";
this.textBoxBuildingType.Size = new System.Drawing.Size(100, 20);
this.textBoxBuildingType.TabIndex = 6;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(139, 99);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(103, 13);
this.label4.TabIndex = 7;
this.label4.Text = "textBoxBuildingType";
//
// button1
//
this.button1.Location = new System.Drawing.Point(13, 120);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(238, 80);
this.button1.TabIndex = 8;
this.button1.Text = "Save";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnSave_Click);
//
// EditFormBuilding
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(263, 214);
this.Controls.Add(this.button1);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBoxBuildingType);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBoxCreatingUserId);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBoxAddress);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBoxFloorCount);
this.Name = "EditFormBuilding";
this.Text = "EditFormBuilding";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxFloorCount;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxAddress;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBoxCreatingUserId;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBoxBuildingType;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button button1;
}
}

@ -0,0 +1,59 @@
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;
namespace db_lab
{
public partial class EditFormBuilding : Form
{
private BuildingRepository buildingRepository;
private int? recordId;
public EditFormBuilding(BuildingRepository buildingRepository, int? recordId = null)
{
this.buildingRepository = buildingRepository;
this.recordId = recordId;
InitializeComponent();
if (recordId.HasValue)
{
LoadRecordData(recordId.Value);
}
}
private void LoadRecordData(int id)
{
DataRow row = buildingRepository.GetBuildingById(id);
if (row != null)
{
textBoxFloorCount.Text = row["floor_count"].ToString();
textBoxAddress.Text = row["address"].ToString();
textBoxCreatingUserId.Text = row["creating_user_id"].ToString();
textBoxBuildingType.Text = row["building_type"].ToString();
}
}
private void btnSave_Click(object sender, EventArgs e)
{
int floorCount = int.Parse(textBoxFloorCount.Text);
string address = textBoxAddress.Text;
int creatingUserId = int.Parse(textBoxCreatingUserId.Text);
string buildingType = textBoxBuildingType.Text;
if (recordId.HasValue)
{
buildingRepository.UpdateBuilding(recordId.Value, floorCount, address, creatingUserId, buildingType);
}
else
{
buildingRepository.AddBuilding(floorCount, address, creatingUserId, buildingType);
}
this.Close();
}
}
}

@ -0,0 +1,120 @@
<?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>
</root>

@ -0,0 +1,193 @@
namespace db_lab
{
partial class EditRoomForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.textBoxRoomType = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBoxRoomNumber = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBoxFloor = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBoxCreatingUserId = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBoxBuildingId = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textBoxRoomName = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// textBoxRoomType
//
this.textBoxRoomType.Location = new System.Drawing.Point(13, 13);
this.textBoxRoomType.Name = "textBoxRoomType";
this.textBoxRoomType.Size = new System.Drawing.Size(100, 20);
this.textBoxRoomType.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(131, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(94, 13);
this.label1.TabIndex = 1;
this.label1.Text = "textBoxRoomType";
//
// textBoxRoomNumber
//
this.textBoxRoomNumber.Location = new System.Drawing.Point(13, 40);
this.textBoxRoomNumber.Name = "textBoxRoomNumber";
this.textBoxRoomNumber.Size = new System.Drawing.Size(100, 20);
this.textBoxRoomNumber.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(134, 46);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(107, 13);
this.label2.TabIndex = 3;
this.label2.Text = "textBoxRoomNumber";
//
// textBoxFloor
//
this.textBoxFloor.Location = new System.Drawing.Point(13, 67);
this.textBoxFloor.Name = "textBoxFloor";
this.textBoxFloor.Size = new System.Drawing.Size(100, 20);
this.textBoxFloor.TabIndex = 4;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(137, 73);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 13);
this.label3.TabIndex = 5;
this.label3.Text = "textBoxFloor";
//
// textBoxCreatingUserId
//
this.textBoxCreatingUserId.Location = new System.Drawing.Point(13, 94);
this.textBoxCreatingUserId.Name = "textBoxCreatingUserId";
this.textBoxCreatingUserId.Size = new System.Drawing.Size(100, 20);
this.textBoxCreatingUserId.TabIndex = 6;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(134, 100);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(112, 13);
this.label4.TabIndex = 7;
this.label4.Text = "textBoxCreatingUserId";
//
// textBoxBuildingId
//
this.textBoxBuildingId.Location = new System.Drawing.Point(13, 121);
this.textBoxBuildingId.Name = "textBoxBuildingId";
this.textBoxBuildingId.Size = new System.Drawing.Size(100, 20);
this.textBoxBuildingId.TabIndex = 8;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(134, 127);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 13);
this.label5.TabIndex = 9;
this.label5.Text = "textBoxBuildingId";
//
// textBoxRoomName
//
this.textBoxRoomName.Location = new System.Drawing.Point(13, 148);
this.textBoxRoomName.Name = "textBoxRoomName";
this.textBoxRoomName.Size = new System.Drawing.Size(100, 20);
this.textBoxRoomName.TabIndex = 10;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(137, 154);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(98, 13);
this.label6.TabIndex = 11;
this.label6.Text = "textBoxRoomName";
//
// button1
//
this.button1.Location = new System.Drawing.Point(13, 175);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(233, 58);
this.button1.TabIndex = 12;
this.button1.Text = "Save";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnSave_Click);
//
// EditRoomForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(263, 242);
this.Controls.Add(this.button1);
this.Controls.Add(this.label6);
this.Controls.Add(this.textBoxRoomName);
this.Controls.Add(this.label5);
this.Controls.Add(this.textBoxBuildingId);
this.Controls.Add(this.label4);
this.Controls.Add(this.textBoxCreatingUserId);
this.Controls.Add(this.label3);
this.Controls.Add(this.textBoxFloor);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBoxRoomNumber);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBoxRoomType);
this.Name = "EditRoomForm";
this.Text = "EditRoomForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBoxRoomType;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBoxRoomNumber;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBoxFloor;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBoxCreatingUserId;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBoxBuildingId;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBoxRoomName;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button button1;
}
}

@ -0,0 +1,63 @@
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;
namespace db_lab
{
public partial class EditRoomForm : Form
{
private RoomRepository roomRepository;
private int? roomId;
public EditRoomForm(RoomRepository roomRepository, int? roomId = null)
{
InitializeComponent();
this.roomRepository = roomRepository;
this.roomId = roomId;
if (roomId.HasValue)
{
LoadRecordData(roomId.Value);
}
}
private void LoadRecordData(int id)
{
DataRow row = roomRepository.GetRoomById(id);
if (row != null)
{
textBoxRoomType.Text = row["room_type"].ToString();
textBoxRoomNumber.Text = row["room_number"].ToString();
textBoxFloor.Text = row["floor"].ToString();
textBoxCreatingUserId.Text = row["creating_user_id"].ToString();
textBoxBuildingId.Text = row["building_id"].ToString();
textBoxRoomName.Text = row["room_name"].ToString();
}
}
private void btnSave_Click(object sender, EventArgs e)
{
string roomType = textBoxRoomType.Text;
int roomNumber = int.Parse(textBoxRoomNumber.Text);
int floor = int.Parse(textBoxFloor.Text);
int creatingUserId = int.Parse(textBoxCreatingUserId.Text);
int buildingId = int.Parse(textBoxBuildingId.Text);
string roomName = textBoxRoomName.Text;
if (roomId.HasValue)
{
roomRepository.UpdateRoom(roomId.Value, roomType, roomNumber, floor, creatingUserId, buildingId, roomName);
}
else
{
roomRepository.AddRoom(roomType, roomNumber, floor, creatingUserId, buildingId, roomName);
}
this.Close();
}
}
}

@ -0,0 +1,120 @@
<?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>
</root>

@ -0,0 +1,137 @@
namespace db_lab
{
partial class EquipmentForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.flowLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.button1);
this.flowLayoutPanel1.Controls.Add(this.button2);
this.flowLayoutPanel1.Controls.Add(this.button3);
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(688, 12);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(100, 426);
this.flowLayoutPanel1.TabIndex = 0;
//
// dataGridView1
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(13, 13);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(655, 425);
this.dataGridView1.TabIndex = 1;
//
// button1
//
this.button1.Location = new System.Drawing.Point(3, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Next";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnNext_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(3, 32);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Prev";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.btnPrev_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(3, 61);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 2;
this.button3.Text = "Delete";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.btnDelete_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(3, 90);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 3;
this.button4.Text = "Add";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.btnAdd_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(3, 119);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 4;
this.button5.Text = "Edit";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.btnEdit_Click);
//
// EquipmentForm
//
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.dataGridView1);
this.Controls.Add(this.flowLayoutPanel1);
this.Name = "EquipmentForm";
this.Text = "EquipmentForm";
this.flowLayoutPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
}
}

@ -0,0 +1,79 @@
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;
namespace db_lab
{
public partial class EquipmentForm : Form
{
private EquipmentRepository equipmentRepository;
private int pageSize = 10;
private int currentPage = 1;
public EquipmentForm(string connectionString)
{
InitializeComponent();
equipmentRepository = new EquipmentRepository(connectionString);
LoadData();
}
private void LoadData()
{
DataTable dt = equipmentRepository.ReadEquipments(pageSize, currentPage);
dataGridView1.DataSource = dt;
}
private void btnNext_Click(object sender, EventArgs e)
{
currentPage++;
LoadData();
}
private void btnPrev_Click(object sender, EventArgs e)
{
if (currentPage > 1)
{
currentPage--;
LoadData();
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dataGridView1.SelectedRows)
{
int id = Convert.ToInt32(row.Cells["id"].Value);
equipmentRepository.DeleteEquipment(id);
}
LoadData();
}
private void btnAdd_Click(object sender, EventArgs e)
{
EditEquipmentForm editForm = new EditEquipmentForm(equipmentRepository);
editForm.ShowDialog();
LoadData();
}
private void btnEdit_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count == 1)
{
int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["id"].Value);
EditEquipmentForm editForm = new EditEquipmentForm(equipmentRepository, id);
editForm.ShowDialog();
LoadData();
}
else
{
MessageBox.Show("Please select a single row to edit.");
}
}
}
}

@ -0,0 +1,120 @@
<?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>
</root>

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Npgsql;
namespace db_lab
{
public class EquipmentRepository
{
private NpgsqlConnection connection;
public EquipmentRepository(string connectionString)
{
this.connection = new NpgsqlConnection(connectionString);
}
public DataTable ReadEquipments(int pageSize, int pageNumber)
{
string query = $"SELECT * FROM Equipment ORDER BY id LIMIT {pageSize} OFFSET {(pageNumber - 1) * pageSize}";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
public void DeleteEquipment(int id)
{
string query = $"DELETE FROM Equipment WHERE id = {id}";
using (var cmd = new NpgsqlCommand(query, connection))
{
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public void AddEquipment(string ipAddress, string sshSettings, string name, int roomId)
{
string query = "INSERT INTO Equipment (ip_address, ssh_settings, name, room_id) VALUES (@ip_address, @ssh_settings, @name, @room_id)";
using (var cmd = new NpgsqlCommand(query, connection))
{
cmd.Parameters.AddWithValue("ip_address", ipAddress);
cmd.Parameters.AddWithValue("ssh_settings", sshSettings ?? (object)DBNull.Value);
cmd.Parameters.AddWithValue("name", name);
cmd.Parameters.AddWithValue("room_id", roomId);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public void UpdateEquipment(int id, string ipAddress, string sshSettings, string name, int roomId)
{
string query = "UPDATE Equipment SET ip_address = @ip_address, ssh_settings = @ssh_settings, name = @name, room_id = @room_id WHERE id = @id";
using (var cmd = new NpgsqlCommand(query, connection))
{
cmd.Parameters.AddWithValue("ip_address", ipAddress);
cmd.Parameters.AddWithValue("ssh_settings", sshSettings ?? (object)DBNull.Value);
cmd.Parameters.AddWithValue("name", name);
cmd.Parameters.AddWithValue("room_id", roomId);
cmd.Parameters.AddWithValue("id", id);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public DataRow GetEquipmentById(int id)
{
string query = $"SELECT * FROM Equipment WHERE id = {id}";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt.Rows.Count > 0 ? dt.Rows[0] : null;
}
}
}

@ -33,8 +33,10 @@
this.dataBtn = new System.Windows.Forms.Button();
this.raportBtn = new System.Windows.Forms.Button();
this.aboutBtn = new System.Windows.Forms.Button();
this.exitBtn = new System.Windows.Forms.Button();
this.dbConnectBtn = new System.Windows.Forms.Button();
this.exitBtn = new System.Windows.Forms.Button();
this.buildingButton = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
@ -47,6 +49,8 @@
this.flowLayoutPanel1.Controls.Add(this.aboutBtn);
this.flowLayoutPanel1.Controls.Add(this.dbConnectBtn);
this.flowLayoutPanel1.Controls.Add(this.exitBtn);
this.flowLayoutPanel1.Controls.Add(this.buildingButton);
this.flowLayoutPanel1.Controls.Add(this.button1);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
@ -93,16 +97,6 @@
this.aboutBtn.UseVisualStyleBackColor = true;
this.aboutBtn.Click += new System.EventHandler(this.aboutBtn_Click);
//
// exitBtn
//
this.exitBtn.Location = new System.Drawing.Point(528, 3);
this.exitBtn.Name = "exitBtn";
this.exitBtn.Size = new System.Drawing.Size(75, 23);
this.exitBtn.TabIndex = 4;
this.exitBtn.Text = "Выход";
this.exitBtn.UseVisualStyleBackColor = true;
this.exitBtn.Click += new System.EventHandler(this.exitBtn_Click);
//
// dbConnectBtn
//
this.dbConnectBtn.AutoSize = true;
@ -115,6 +109,36 @@
this.dbConnectBtn.UseVisualStyleBackColor = true;
this.dbConnectBtn.Click += new System.EventHandler(this.dbConnectBtn_Click);
//
// exitBtn
//
this.exitBtn.Location = new System.Drawing.Point(528, 3);
this.exitBtn.Name = "exitBtn";
this.exitBtn.Size = new System.Drawing.Size(75, 23);
this.exitBtn.TabIndex = 4;
this.exitBtn.Text = "Выход";
this.exitBtn.UseVisualStyleBackColor = true;
this.exitBtn.Click += new System.EventHandler(this.exitBtn_Click);
//
// buildingButton
//
this.buildingButton.Location = new System.Drawing.Point(609, 3);
this.buildingButton.Name = "buildingButton";
this.buildingButton.Size = new System.Drawing.Size(75, 23);
this.buildingButton.TabIndex = 6;
this.buildingButton.Text = "CRUD";
this.buildingButton.UseVisualStyleBackColor = true;
this.buildingButton.Click += new System.EventHandler(this.buildingButton_Click);
this.buildingButton.MouseClick += new System.Windows.Forms.MouseEventHandler(this.buildingButton_MouseClick);
//
// button1
//
this.button1.Location = new System.Drawing.Point(690, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 7;
this.button1.Text = "Экспорт";
this.button1.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -139,6 +163,8 @@
private System.Windows.Forms.Button aboutBtn;
private System.Windows.Forms.Button exitBtn;
private System.Windows.Forms.Button dbConnectBtn;
private System.Windows.Forms.Button buildingButton;
private System.Windows.Forms.Button button1;
}
}

@ -13,7 +13,7 @@ namespace db_lab
{
public partial class Form1 : Form
{
string connectionString = "Server=192.168.1.218;Port=5432;UserId=postgres;Password=postgres;Database=SQL_Servers;";
string connectionString = "Server=172.27.128.1;Port=5432;UserId=postgres;Password=postgres;Database=SQL_Servers;";
NpgsqlConnection connection;
public Form1()
@ -67,5 +67,17 @@ namespace db_lab
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();
}
}
}

@ -0,0 +1,137 @@
namespace db_lab
{
partial class RoomForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// dataGridView1
//
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.Size = new System.Drawing.Size(677, 431);
this.dataGridView1.TabIndex = 0;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.button1);
this.flowLayoutPanel1.Controls.Add(this.button2);
this.flowLayoutPanel1.Controls.Add(this.button3);
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(695, 12);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(93, 431);
this.flowLayoutPanel1.TabIndex = 1;
//
// button1
//
this.button1.Location = new System.Drawing.Point(3, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Next";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.btnNext_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(3, 32);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1;
this.button2.Text = "Prev";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.btnPrev_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(3, 61);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 2;
this.button3.Text = "Delete";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.btnDelete_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(3, 90);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 3;
this.button4.Text = "Add";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.btnAdd_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(3, 119);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 4;
this.button5.Text = "Edit";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.btnEdit_Click);
//
// RoomForm
//
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.flowLayoutPanel1);
this.Controls.Add(this.dataGridView1);
this.Name = "RoomForm";
this.Text = "RoomForm";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.flowLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
}
}

@ -0,0 +1,79 @@
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;
namespace db_lab
{
public partial class RoomForm : Form
{
private RoomRepository roomRepository;
private int pageSize = 10;
private int currentPage = 1;
public RoomForm(string connectionString)
{
InitializeComponent();
roomRepository = new RoomRepository(connectionString);
LoadData();
}
private void LoadData()
{
DataTable dt = roomRepository.ReadRooms(pageSize, currentPage);
dataGridView1.DataSource = dt;
}
private void btnNext_Click(object sender, EventArgs e)
{
currentPage++;
LoadData();
}
private void btnPrev_Click(object sender, EventArgs e)
{
if (currentPage > 1)
{
currentPage--;
LoadData();
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow row in dataGridView1.SelectedRows)
{
int id = Convert.ToInt32(row.Cells["id"].Value);
roomRepository.DeleteRoom(id);
}
LoadData();
}
private void btnAdd_Click(object sender, EventArgs e)
{
EditRoomForm editForm = new EditRoomForm(roomRepository);
editForm.ShowDialog();
LoadData();
}
private void btnEdit_Click(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count == 1)
{
int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["id"].Value);
EditRoomForm editForm = new EditRoomForm(roomRepository, id);
editForm.ShowDialog();
LoadData();
}
else
{
MessageBox.Show("Please select a single row to edit.");
}
}
}
}

@ -0,0 +1,120 @@
<?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>
</root>

@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Npgsql;
namespace db_lab
{
public class RoomRepository
{
private NpgsqlConnection connection;
public RoomRepository(string connectionString)
{
this.connection = new NpgsqlConnection(connectionString);
}
public DataTable ReadRooms(int pageSize, int pageNumber)
{
string query = $"SELECT * FROM Rooms ORDER BY id LIMIT {pageSize} OFFSET {(pageNumber - 1) * pageSize}";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
public void DeleteRoom(int id)
{
string query = $"DELETE FROM Rooms WHERE id = {id}";
using (var cmd = new NpgsqlCommand(query, connection))
{
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public void AddRoom(string roomType, int roomNumber, int floor, int creatingUserId, int buildingId, string roomName)
{
string query = "INSERT INTO Rooms (room_type, room_number, floor, creating_user_id, building_id, room_name) VALUES (@room_type, @room_number, @floor, @creating_user_id, @building_id, @room_name)";
using (var cmd = new NpgsqlCommand(query, connection))
{
cmd.Parameters.AddWithValue("room_type", roomType);
cmd.Parameters.AddWithValue("room_number", roomNumber);
cmd.Parameters.AddWithValue("floor", floor);
cmd.Parameters.AddWithValue("creating_user_id", creatingUserId);
cmd.Parameters.AddWithValue("building_id", buildingId);
cmd.Parameters.AddWithValue("room_name", roomName);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public void UpdateRoom(int id, string roomType, int roomNumber, int floor, int creatingUserId, int buildingId, string roomName)
{
string query = "UPDATE Rooms SET room_type = @room_type, room_number = @room_number, floor = @floor, creating_user_id = @creating_user_id, building_id = @building_id, room_name = @room_name WHERE id = @id";
using (var cmd = new NpgsqlCommand(query, connection))
{
cmd.Parameters.AddWithValue("room_type", roomType);
cmd.Parameters.AddWithValue("room_number", roomNumber);
cmd.Parameters.AddWithValue("floor", floor);
cmd.Parameters.AddWithValue("creating_user_id", creatingUserId);
cmd.Parameters.AddWithValue("building_id", buildingId);
cmd.Parameters.AddWithValue("room_name", roomName);
cmd.Parameters.AddWithValue("id", id);
connection.Open();
cmd.ExecuteNonQuery();
connection.Close();
}
}
public DataRow GetRoomById(int id)
{
string query = $"SELECT * FROM Rooms WHERE id = {id}";
NpgsqlDataAdapter da = new NpgsqlDataAdapter(query, connection);
DataTable dt = new DataTable();
da.Fill(dt);
return dt.Rows.Count > 0 ? dt.Rows[0] : null;
}
}
}

Binary file not shown.

Binary file not shown.

@ -95,12 +95,62 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BuildingRepository.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="BuildingRepository.Designer.cs">
<DependentUpon>BuildingRepository.cs</DependentUpon>
</Compile>
<Compile Include="CRUDForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CRUDForm.Designer.cs">
<DependentUpon>CRUDForm.cs</DependentUpon>
</Compile>
<Compile Include="DataForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DataForm.Designer.cs">
<DependentUpon>DataForm.cs</DependentUpon>
</Compile>
<Compile Include="DepartmentForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DepartmentForm.Designer.cs">
<DependentUpon>DepartmentForm.cs</DependentUpon>
</Compile>
<Compile Include="DepartmentRepository.cs" />
<Compile Include="EditDepartmentForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="EditDepartmentForm.Designer.cs">
<DependentUpon>EditDepartmentForm.cs</DependentUpon>
</Compile>
<Compile Include="EditEquipmentForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="EditEquipmentForm.Designer.cs">
<DependentUpon>EditEquipmentForm.cs</DependentUpon>
</Compile>
<Compile Include="EditFormBuilding.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="EditFormBuilding.Designer.cs">
<DependentUpon>EditFormBuilding.cs</DependentUpon>
</Compile>
<Compile Include="EditRoomForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="EditRoomForm.Designer.cs">
<DependentUpon>EditRoomForm.cs</DependentUpon>
</Compile>
<Compile Include="EquipmentForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="EquipmentForm.Designer.cs">
<DependentUpon>EquipmentForm.cs</DependentUpon>
</Compile>
<Compile Include="EquipmentRepository.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
@ -121,9 +171,37 @@
<Compile Include="RaportForm.Designer.cs">
<DependentUpon>RaportForm.cs</DependentUpon>
</Compile>
<Compile Include="RoomForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RoomForm.Designer.cs">
<DependentUpon>RoomForm.cs</DependentUpon>
</Compile>
<Compile Include="RoomRepository.cs" />
<EmbeddedResource Include="CRUDForm.resx">
<DependentUpon>CRUDForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DataForm.resx">
<DependentUpon>DataForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DepartmentForm.resx">
<DependentUpon>DepartmentForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="EditDepartmentForm.resx">
<DependentUpon>EditDepartmentForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="EditEquipmentForm.resx">
<DependentUpon>EditEquipmentForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="EditFormBuilding.resx">
<DependentUpon>EditFormBuilding.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="EditRoomForm.resx">
<DependentUpon>EditRoomForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="EquipmentForm.resx">
<DependentUpon>EquipmentForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
@ -139,6 +217,9 @@
<EmbeddedResource Include="RaportForm.resx">
<DependentUpon>RaportForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="RoomForm.resx">
<DependentUpon>RoomForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

@ -1 +1 @@
6cfe98626599e0585a6a4cbde9575a47698b081aa3748f1df4309e2ac8c0a680
944491e2b148661396206da4f57aa1e690b8d9c434e41ee7e94081a5ed9feabd

@ -43,3 +43,11 @@ C:\Users\mit3t\source\repos\db_lab\db_lab\bin\Debug\System.ValueTuple.xml
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.csproj.CopyComplete
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.DataForm.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.RaportForm.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.CRUDForm.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.EditFormBuilding.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.DepartmentForm.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.EditDepartmentForm.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.EditRoomForm.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.RoomForm.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.EditEquipmentForm.resources
C:\Users\mit3t\source\repos\db_lab\db_lab\obj\Debug\db_lab.EquipmentForm.resources

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save