Selaa lähdekoodia

Полный проект зоопарк: Docker + приложение + установщик

ky9to 1 viikko sitten
sitoutus
5d3bcd5032

+ 0 - 0
README.md


+ 25 - 0
app/Zoo.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.13.35818.85 d17.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zoo", "Zoo\Zoo.csproj", "{06B9AE79-2B2F-4EFC-A516-F2865E59E322}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{06B9AE79-2B2F-4EFC-A516-F2865E59E322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{06B9AE79-2B2F-4EFC-A516-F2865E59E322}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{06B9AE79-2B2F-4EFC-A516-F2865E59E322}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{06B9AE79-2B2F-4EFC-A516-F2865E59E322}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {307323AD-F211-4D80-A020-B7DC4CF781BA}
+	EndGlobalSection
+EndGlobal

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
app/Zoo/.vs/Zoo.csproj.dtbcache.json


+ 6 - 0
app/Zoo/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+    </startup>
+</configuration>

+ 117 - 0
app/Zoo/FormEdit.cs

@@ -0,0 +1,117 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace Zoo
+{
+    public class FormEdit : Form
+    {
+        TextBox txtName;
+        TextBox txtPhone;
+        TextBox txtEmail;
+        TextBox txtComment;
+
+        Button btnSave;
+        Button btnCancel;
+
+        public FormEdit()
+        {
+            InitializeComponent();
+        }
+
+        private void InitializeComponent()
+        {
+            Text = "Редактирование записи";
+            StartPosition = FormStartPosition.CenterParent;
+            Size = new Size(420, 370);
+            FormBorderStyle = FormBorderStyle.FixedSingle;
+            MaximizeBox = false;
+            BackColor = Color.WhiteSmoke;
+            Font = new Font("Segoe UI", 10);
+
+            Label lblTitle = new Label();
+            lblTitle.Text = "Данные пользователя";
+            lblTitle.Font = new Font("Segoe UI", 15, FontStyle.Bold);
+            lblTitle.AutoSize = true;
+            lblTitle.Location = new Point(90, 20);
+
+            Label lblName = new Label();
+            lblName.Text = "ФИО";
+            lblName.Location = new Point(30, 70);
+            lblName.AutoSize = true;
+
+            txtName = new TextBox();
+            txtName.Location = new Point(130, 66);
+            txtName.Size = new Size(230, 30);
+
+            Label lblPhone = new Label();
+            lblPhone.Text = "Телефон";
+            lblPhone.Location = new Point(30, 115);
+            lblPhone.AutoSize = true;
+
+            txtPhone = new TextBox();
+            txtPhone.Location = new Point(130, 111);
+            txtPhone.Size = new Size(230, 30);
+
+            Label lblEmail = new Label();
+            lblEmail.Text = "Email";
+            lblEmail.Location = new Point(30, 160);
+            lblEmail.AutoSize = true;
+
+            txtEmail = new TextBox();
+            txtEmail.Location = new Point(130, 156);
+            txtEmail.Size = new Size(230, 30);
+
+            Label lblComment = new Label();
+            lblComment.Text = "Комментарий";
+            lblComment.Location = new Point(30, 205);
+            lblComment.AutoSize = true;
+
+            txtComment = new TextBox();
+            txtComment.Location = new Point(130, 201);
+            txtComment.Size = new Size(230, 60);
+            txtComment.Multiline = true;
+
+            btnSave = new Button();
+            btnSave.Text = "Сохранить";
+            btnSave.Location = new Point(60, 285);
+            btnSave.Size = new Size(120, 40);
+            btnSave.BackColor = Color.DodgerBlue;
+            btnSave.ForeColor = Color.White;
+            btnSave.FlatStyle = FlatStyle.Flat;
+            btnSave.Click += BtnSave_Click;
+
+            btnCancel = new Button();
+            btnCancel.Text = "Отмена";
+            btnCancel.Location = new Point(220, 285);
+            btnCancel.Size = new Size(120, 40);
+            btnCancel.BackColor = Color.Gray;
+            btnCancel.ForeColor = Color.White;
+            btnCancel.FlatStyle = FlatStyle.Flat;
+            btnCancel.Click += (s, e) => Close();
+
+            Controls.Add(lblTitle);
+            Controls.Add(lblName);
+            Controls.Add(txtName);
+            Controls.Add(lblPhone);
+            Controls.Add(txtPhone);
+            Controls.Add(lblEmail);
+            Controls.Add(txtEmail);
+            Controls.Add(lblComment);
+            Controls.Add(txtComment);
+            Controls.Add(btnSave);
+            Controls.Add(btnCancel);
+        }
+
+        private void BtnSave_Click(object sender, EventArgs e)
+        {
+            MessageBox.Show(
+                "Данные успешно сохранены!",
+                "Информация",
+                MessageBoxButtons.OK,
+                MessageBoxIcon.Information);
+
+            Close();
+        }
+    }
+}

+ 92 - 0
app/Zoo/FormLogin.cs

@@ -0,0 +1,92 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using Zoo;
+
+namespace Zoo
+
+{
+    public class FormLogin : Form
+    {
+        TextBox txtLogin;
+        TextBox txtPassword;
+        Button btnLogin;
+        Button btnExit;
+
+        public FormLogin()
+        {
+            InitializeComponent();
+        }
+
+        private void InitializeComponent()
+        {
+            Text = "Авторизация";
+            StartPosition = FormStartPosition.CenterScreen;
+            Size = new Size(400, 280);
+            FormBorderStyle = FormBorderStyle.FixedSingle;
+            MaximizeBox = false;
+            BackColor = Color.WhiteSmoke;
+            Font = new Font("Segoe UI", 10);
+
+            Label title = new Label();
+            title.Text = "Вход в систему";
+            title.Font = new Font("Segoe UI", 18, FontStyle.Bold);
+            title.AutoSize = true;
+            title.Location = new Point(90, 20);
+
+            Label lblLogin = new Label();
+            lblLogin.Text = "Логин";
+            lblLogin.Location = new Point(40, 80);
+            lblLogin.AutoSize = true;
+
+            txtLogin = new TextBox();
+            txtLogin.Location = new Point(120, 76);
+            txtLogin.Size = new Size(200, 30);
+            txtLogin.Text = "admin";
+
+            Label lblPassword = new Label();
+            lblPassword.Text = "Пароль";
+            lblPassword.Location = new Point(40, 125);
+            lblPassword.AutoSize = true;
+
+            txtPassword = new TextBox();
+            txtPassword.Location = new Point(120, 121);
+            txtPassword.Size = new Size(200, 30);
+            txtPassword.UseSystemPasswordChar = true;
+            txtPassword.Text = "12345";
+
+            btnLogin = new Button();
+            btnLogin.Text = "Войти";
+            btnLogin.Location = new Point(40, 180);
+            btnLogin.Size = new Size(130, 40);
+            btnLogin.BackColor = Color.DodgerBlue;
+            btnLogin.ForeColor = Color.White;
+            btnLogin.FlatStyle = FlatStyle.Flat;
+            btnLogin.Click += BtnLogin_Click;
+
+            btnExit = new Button();
+            btnExit.Text = "Выход";
+            btnExit.Location = new Point(190, 180);
+            btnExit.Size = new Size(130, 40);
+            btnExit.BackColor = Color.IndianRed;
+            btnExit.ForeColor = Color.White;
+            btnExit.FlatStyle = FlatStyle.Flat;
+            btnExit.Click += (s, e) => Application.Exit();
+
+            Controls.Add(title);
+            Controls.Add(lblLogin);
+            Controls.Add(txtLogin);
+            Controls.Add(lblPassword);
+            Controls.Add(txtPassword);
+            Controls.Add(btnLogin);
+            Controls.Add(btnExit);
+        }
+
+        private void BtnLogin_Click(object sender, EventArgs e)
+        {
+            FormMain main = new FormMain();
+            main.Show();
+            Hide();
+        }
+    }
+}

+ 142 - 0
app/Zoo/FormMain.cs

@@ -0,0 +1,142 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using Zoo;
+
+namespace Zoo
+
+{
+    public class FormMain : Form
+    {
+        DataGridView dgv;
+        TextBox txtSearch;
+        Button btnSearch;
+        Button btnAdd;
+        Button btnEdit;
+        Button btnDelete;
+
+        public FormMain()
+        {
+            InitializeComponent();
+            LoadData();
+        }
+
+        private void InitializeComponent()
+        {
+            Text = "Информационная система";
+            StartPosition = FormStartPosition.CenterScreen;
+            Size = new Size(900, 550);
+            BackColor = Color.WhiteSmoke;
+            Font = new Font("Segoe UI", 10);
+
+            Label lblSearch = new Label();
+            lblSearch.Text = "Поиск:";
+            lblSearch.Location = new Point(20, 20);
+            lblSearch.AutoSize = true;
+
+            txtSearch = new TextBox();
+            txtSearch.Location = new Point(80, 17);
+            txtSearch.Size = new Size(220, 30);
+
+            btnSearch = new Button();
+            btnSearch.Text = "Поиск";
+            btnSearch.Location = new Point(320, 15);
+            btnSearch.Size = new Size(100, 35);
+            btnSearch.BackColor = Color.DodgerBlue;
+            btnSearch.ForeColor = Color.White;
+            btnSearch.FlatStyle = FlatStyle.Flat;
+            btnSearch.Click += BtnSearch_Click;
+
+            dgv = new DataGridView();
+            dgv.Location = new Point(20, 70);
+            dgv.Size = new Size(620, 400);
+            dgv.AllowUserToAddRows = false;
+            dgv.ReadOnly = true;
+            dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+            dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+
+            dgv.Columns.Add("id", "ID");
+            dgv.Columns.Add("name", "ФИО");
+            dgv.Columns.Add("phone", "Телефон");
+            dgv.Columns.Add("email", "Email");
+
+            btnAdd = new Button();
+            btnAdd.Text = "Добавить";
+            btnAdd.Location = new Point(680, 90);
+            btnAdd.Size = new Size(170, 45);
+            btnAdd.BackColor = Color.ForestGreen;
+            btnAdd.ForeColor = Color.White;
+            btnAdd.FlatStyle = FlatStyle.Flat;
+            btnAdd.Click += BtnAdd_Click;
+
+            btnEdit = new Button();
+            btnEdit.Text = "Редактировать";
+            btnEdit.Location = new Point(680, 160);
+            btnEdit.Size = new Size(170, 45);
+            btnEdit.BackColor = Color.Goldenrod;
+            btnEdit.ForeColor = Color.White;
+            btnEdit.FlatStyle = FlatStyle.Flat;
+            btnEdit.Click += BtnEdit_Click;
+
+            btnDelete = new Button();
+            btnDelete.Text = "Удалить";
+            btnDelete.Location = new Point(680, 230);
+            btnDelete.Size = new Size(170, 45);
+            btnDelete.BackColor = Color.IndianRed;
+            btnDelete.ForeColor = Color.White;
+            btnDelete.FlatStyle = FlatStyle.Flat;
+            btnDelete.Click += BtnDelete_Click;
+
+            Controls.Add(lblSearch);
+            Controls.Add(txtSearch);
+            Controls.Add(btnSearch);
+            Controls.Add(dgv);
+            Controls.Add(btnAdd);
+            Controls.Add(btnEdit);
+            Controls.Add(btnDelete);
+        }
+
+        private void LoadData()
+        {
+            dgv.Rows.Add("1", "Иванов Иван", "89001234567", "ivan@mail.ru");
+            dgv.Rows.Add("2", "Петров Петр", "89112223344", "petr@mail.ru");
+            dgv.Rows.Add("3", "Сидоров Алексей", "89223334455", "alex@mail.ru");
+            dgv.Rows.Add("4", "Кузнецов Сергей", "89334445566", "sergey@mail.ru");
+        }
+
+        private void BtnSearch_Click(object sender, EventArgs e)
+        {
+            MessageBox.Show("Поиск: " + txtSearch.Text);
+        }
+
+        private void BtnAdd_Click(object sender, EventArgs e)
+        {
+            FormEdit f = new FormEdit();
+            f.ShowDialog();
+        }
+
+        private void BtnEdit_Click(object sender, EventArgs e)
+        {
+            if (dgv.CurrentRow == null)
+            {
+                MessageBox.Show("Выберите запись.");
+                return;
+            }
+
+            FormEdit f = new FormEdit();
+            f.ShowDialog();
+        }
+
+        private void BtnDelete_Click(object sender, EventArgs e)
+        {
+            if (dgv.CurrentRow == null)
+            {
+                MessageBox.Show("Выберите запись.");
+                return;
+            }
+
+            dgv.Rows.Remove(dgv.CurrentRow);
+            MessageBox.Show("Запись удалена.");
+        }
+    }
+}

+ 16 - 0
app/Zoo/Program.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Windows.Forms;
+
+namespace Zoo
+{
+    internal static class Program
+    {
+        [STAThread]
+        static void Main()
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+            Application.Run(new FormLogin());
+        }
+    }
+}

+ 33 - 0
app/Zoo/Properties/AssemblyInfo.cs

@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
+// связанных со сборкой.
+[assembly: AssemblyTitle("Zoo")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Zoo")]
+[assembly: AssemblyCopyright("Copyright ©  2026")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// COM, следует установить атрибут ComVisible в TRUE для этого типа.
+[assembly: ComVisible(false)]
+
+// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
+[assembly: Guid("06b9ae79-2b2f-4efc-a516-f2865e59e322")]
+
+// Сведения о версии сборки состоят из указанных ниже четырех значений:
+//
+//      Основной номер версии
+//      Дополнительный номер версии
+//      Номер сборки
+//      Редакция
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71 - 0
app/Zoo/Properties/Resources.Designer.cs

@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан программным средством.
+//     Версия среды выполнения: 4.0.30319.42000
+//
+//     Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
+//     код создан повторно.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Zoo.Properties
+{
+
+
+    /// <summary>
+    ///   Класс ресурсов со строгим типом для поиска локализованных строк и пр.
+    /// </summary>
+    // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
+    // класс с помощью таких средств, как ResGen или Visual Studio.
+    // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
+    // с параметром /str или заново постройте свой VS-проект.
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources
+    {
+
+        private static global::System.Resources.ResourceManager resourceMan;
+
+        private static global::System.Globalization.CultureInfo resourceCulture;
+
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources()
+        {
+        }
+
+        /// <summary>
+        ///   Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager
+        {
+            get
+            {
+                if ((resourceMan == null))
+                {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Zoo.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+
+        /// <summary>
+        ///   Переопределяет свойство CurrentUICulture текущего потока для всех
+        ///   подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture
+        {
+            get
+            {
+                return resourceCulture;
+            }
+            set
+            {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
app/Zoo/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?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.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: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" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </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" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 30 - 0
app/Zoo/Properties/Settings.Designer.cs

@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Zoo.Properties
+{
+
+
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+    {
+
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+        public static Settings Default
+        {
+            get
+            {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
app/Zoo/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 83 - 0
app/Zoo/Zoo.csproj

@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{06B9AE79-2B2F-4EFC-A516-F2865E59E322}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>Zoo</RootNamespace>
+    <AssemblyName>Zoo</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Deployment" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="FormEdit.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FormMain.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FormLogin.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

BIN
app/Zoo/bin/Debug/Zoo.exe


+ 6 - 0
app/Zoo/bin/Debug/Zoo.exe.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+    </startup>
+</configuration>

BIN
app/Zoo/bin/Debug/Zoo.pdb


+ 4 - 0
app/Zoo/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs

@@ -0,0 +1,4 @@
+// <autogenerated />
+using System;
+using System.Reflection;
+[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

BIN
app/Zoo/obj/Debug/DesignTimeResolveAssemblyReferences.cache


BIN
app/Zoo/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


BIN
app/Zoo/obj/Debug/Zoo.Properties.Resources.resources


BIN
app/Zoo/obj/Debug/Zoo.csproj.AssemblyReference.cache


+ 1 - 0
app/Zoo/obj/Debug/Zoo.csproj.CoreCompileInputs.cache

@@ -0,0 +1 @@
+82e024272136590bf6e98b13d79bc8deac6717b069cd3d25d5b1e01927ff75c5

+ 9 - 0
app/Zoo/obj/Debug/Zoo.csproj.FileListAbsolute.txt

@@ -0,0 +1,9 @@
+C:\Zoo\Zoo\Zoo\obj\Debug\Zoo.csproj.AssemblyReference.cache
+C:\Zoo\Zoo\Zoo\obj\Debug\Zoo.Properties.Resources.resources
+C:\Zoo\Zoo\Zoo\obj\Debug\Zoo.csproj.GenerateResource.cache
+C:\Zoo\Zoo\Zoo\obj\Debug\Zoo.csproj.CoreCompileInputs.cache
+C:\Zoo\Zoo\Zoo\bin\Debug\Zoo.exe.config
+C:\Zoo\Zoo\Zoo\bin\Debug\Zoo.exe
+C:\Zoo\Zoo\Zoo\bin\Debug\Zoo.pdb
+C:\Zoo\Zoo\Zoo\obj\Debug\Zoo.exe
+C:\Zoo\Zoo\Zoo\obj\Debug\Zoo.pdb

BIN
app/Zoo/obj/Debug/Zoo.csproj.GenerateResource.cache


BIN
app/Zoo/obj/Debug/Zoo.exe


BIN
app/Zoo/obj/Debug/Zoo.pdb


+ 29 - 0
docker-compose.yml

@@ -0,0 +1,29 @@
+services:
+  postgres:
+    image: postgres:15
+    container_name: zoo-database
+    environment:
+      POSTGRES_DB: zoo_db
+      POSTGRES_USER: postgres
+      POSTGRES_PASSWORD: postgres
+    ports:
+      - "5432:5432"
+    volumes:
+      - ./sql:/docker-entrypoint-initdb.d
+      - postgres_data:/var/lib/postgresql/data
+    restart: unless-stopped
+
+  pgadmin:
+    image: dpage/pgadmin4
+    container_name: zoo-pgadmin
+    environment:
+      PGADMIN_DEFAULT_EMAIL: admin@admin.com
+      PGADMIN_DEFAULT_PASSWORD: admin
+    ports:
+      - "8080:80"
+    depends_on:
+      - postgres
+    restart: unless-stopped
+
+volumes:
+  postgres_data:

BIN
installer/ZooSystem_Setup.exe


+ 24 - 0
setup.iss

@@ -0,0 +1,24 @@
+[Setup]
+AppName=Зоопарк Система
+AppVersion=1.0
+AppPublisher=НовГУ
+DefaultDirName={pf}\ZooSystem
+DefaultGroupName=Зоопарк
+UninstallDisplayIcon={app}\Zoo.exe
+Compression=lzma2
+SolidCompression=yes
+OutputDir=installer
+OutputBaseFilename=ZooSystem_Setup
+
+[Files]
+; ТОЛЬКО .EXE ФАЙЛ (без dll)
+Source: "C:\Users\ky9to\Documents\zoo-project\app\Zoo\bin\Debug\Zoo.exe"; DestDir: "{app}"
+; Если есть .config файл - раскомментируйте строку ниже
+; Source: "C:\Users\ky9to\Documents\zoo-project\app\Zoo\bin\Debug\*.config"; DestDir: "{app}"
+
+[Icons]
+Name: "{group}\Зоопарк"; Filename: "{app}\Zoo.exe"
+Name: "{commondesktop}\Зоопарк"; Filename: "{app}\Zoo.exe"
+
+[Run]
+Filename: "{app}\Zoo.exe"; Description: "Запустить Зоопарк"; Flags: postinstall nowait skipifsilent

+ 165 - 0
sql/init.sql

@@ -0,0 +1,165 @@
+-- Создание таблицы поставщиков
+CREATE TABLE IF NOT EXISTS suppliers (
+    supplier_id SERIAL PRIMARY KEY,
+    organization_name VARCHAR(150) NOT NULL,
+    address VARCHAR(255),
+    contacts VARCHAR(100),
+    rating INTEGER CHECK (rating BETWEEN 1 AND 10),
+    products VARCHAR(150)
+);
+
+-- Создание таблицы кормов
+CREATE TABLE IF NOT EXISTS feed (
+    feed_id SERIAL PRIMARY KEY,
+    feed_type VARCHAR(100) NOT NULL,
+    quantity NUMERIC(10,2) CHECK (quantity >= 0)
+);
+
+-- Создание таблицы поставок кормов
+CREATE TABLE IF NOT EXISTS feed_supply (
+    supply_id SERIAL PRIMARY KEY,
+    supplier_id INTEGER NOT NULL,
+    feed_id INTEGER NOT NULL,
+    supply_date DATE NOT NULL,
+    CONSTRAINT fk_feed_supply_supplier
+        FOREIGN KEY (supplier_id)
+        REFERENCES suppliers(supplier_id)
+        ON DELETE CASCADE,
+    CONSTRAINT fk_feed_supply_feed
+        FOREIGN KEY (feed_id)
+        REFERENCES feed(feed_id)
+        ON DELETE CASCADE
+);
+
+-- Создание таблицы закупок
+CREATE TABLE IF NOT EXISTS purchase_list (
+    purchase_id SERIAL PRIMARY KEY,
+    number VARCHAR(50) NOT NULL,
+    purchase_date DATE NOT NULL,
+    product_name VARCHAR(150) NOT NULL,
+    quantity NUMERIC(10,2) CHECK (quantity > 0),
+    supplier_id INTEGER NOT NULL,
+    CONSTRAINT fk_purchase_supplier
+        FOREIGN KEY (supplier_id)
+        REFERENCES suppliers(supplier_id)
+        ON DELETE CASCADE
+);
+
+-- Создание таблицы должностей
+CREATE TABLE IF NOT EXISTS positions (
+    position_id SERIAL PRIMARY KEY,
+    position_name VARCHAR(100) NOT NULL,
+    salary NUMERIC(10,2) CHECK (salary > 0)
+);
+
+-- Создание таблицы сотрудников
+CREATE TABLE IF NOT EXISTS employees (
+    employee_id SERIAL PRIMARY KEY,
+    full_name VARCHAR(150) NOT NULL,
+    birth_date DATE,
+    gender VARCHAR(10),
+    passport_data VARCHAR(50),
+    inn VARCHAR(12) UNIQUE,
+    phone VARCHAR(20),
+    address VARCHAR(255),
+    position_id INTEGER NOT NULL,
+    CONSTRAINT fk_employee_position
+        FOREIGN KEY (position_id)
+        REFERENCES positions(position_id)
+        ON DELETE RESTRICT
+);
+
+-- Создание таблицы вольеров
+CREATE TABLE IF NOT EXISTS enclosures (
+    enclosure_id SERIAL PRIMARY KEY,
+    enclosure_number VARCHAR(50) NOT NULL,
+    enclosure_type VARCHAR(100) NOT NULL
+);
+
+-- Создание таблицы животных
+CREATE TABLE IF NOT EXISTS animals (
+    animal_id SERIAL PRIMARY KEY,
+    name VARCHAR(100) NOT NULL,
+    species VARCHAR(100) NOT NULL,
+    birth_date DATE,
+    enclosure_id INTEGER NOT NULL,
+    CONSTRAINT fk_animal_enclosure
+        FOREIGN KEY (enclosure_id)
+        REFERENCES enclosures(enclosure_id)
+        ON DELETE RESTRICT
+);
+
+-- Создание таблицы клиентов
+CREATE TABLE IF NOT EXISTS clients (
+    client_id SERIAL PRIMARY KEY,
+    full_name VARCHAR(150) NOT NULL,
+    address VARCHAR(255),
+    phone VARCHAR(20)
+);
+
+-- Создание таблицы услуг
+CREATE TABLE IF NOT EXISTS services (
+    service_id SERIAL PRIMARY KEY,
+    service_type VARCHAR(150) NOT NULL,
+    price NUMERIC(10,2) CHECK (price > 0)
+);
+
+-- Создание таблицы заказов услуг
+CREATE TABLE IF NOT EXISTS service_orders (
+    order_id SERIAL PRIMARY KEY,
+    client_id INTEGER NOT NULL,
+    service_id INTEGER NOT NULL,
+    employee_id INTEGER NOT NULL,
+    order_date DATE NOT NULL,
+    quantity INTEGER CHECK (quantity > 0),
+    total_cost NUMERIC(12,2),
+    CONSTRAINT fk_order_client
+        FOREIGN KEY (client_id)
+        REFERENCES clients(client_id)
+        ON DELETE CASCADE,
+    CONSTRAINT fk_order_service
+        FOREIGN KEY (service_id)
+        REFERENCES services(service_id)
+        ON DELETE RESTRICT,
+    CONSTRAINT fk_order_employee
+        FOREIGN KEY (employee_id)
+        REFERENCES employees(employee_id)
+        ON DELETE RESTRICT
+);
+
+-- Создание таблицы наблюдений
+CREATE TABLE IF NOT EXISTS observations (
+    observation_id SERIAL PRIMARY KEY,
+    employee_id INTEGER NOT NULL,
+    animal_id INTEGER NOT NULL,
+    observation_date DATE NOT NULL,
+    comment TEXT,
+    CONSTRAINT fk_observation_employee
+        FOREIGN KEY (employee_id)
+        REFERENCES employees(employee_id)
+        ON DELETE CASCADE,
+    CONSTRAINT fk_observation_animal
+        FOREIGN KEY (animal_id)
+        REFERENCES animals(animal_id)
+        ON DELETE CASCADE
+);
+
+-- Создание функции для автоматического расчета итоговой стоимости услуги
+CREATE OR REPLACE FUNCTION calculate_total_cost()
+RETURNS TRIGGER AS
+$$
+BEGIN
+    SELECT NEW.quantity * price
+    INTO NEW.total_cost
+    FROM services
+    WHERE service_id = NEW.service_id;
+
+    RETURN NEW;
+END;
+$$ LANGUAGE plpgsql;
+
+-- Создание триггера для автоматического вызова функции расчета стоимости
+CREATE TRIGGER trg_calculate_total_cost
+BEFORE INSERT OR UPDATE ON service_orders
+FOR EACH ROW
+EXECUTE FUNCTION calculate_total_cost();

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä