浏览代码

Сделана работа 18

Вадим Королёв 1 年之前
当前提交
529accae14
共有 10 个文件被更改,包括 908 次插入0 次删除
  1. 398 0
      .gitignore
  2. 47 0
      Lab18/Lab18.csproj
  3. 34 0
      Lab18/Models/GSLink.cs
  4. 121 0
      Lab18/Models/GSRecords.cs
  5. 32 0
      Lab18/Models/Goods.cs
  6. 36 0
      Lab18/Models/Supplier.cs
  7. 47 0
      Lab18/Program.cs
  8. 26 0
      Lab18/Properties/AssemblyInfo.cs
  9. 144 0
      Lab18/Recorder.cs
  10. 23 0
      MDKlabs.sln

+ 398 - 0
.gitignore

@@ -0,0 +1,398 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml

+ 47 - 0
Lab18/Lab18.csproj

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProjectGuid>{2E68FC5F-19D6-4A85-B7E3-0455CE576063}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>Lab18</RootNamespace>
+    <AssemblyName>Lab18</AssemblyName>
+    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ExternalConsole>true</ExternalConsole>
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ExternalConsole>true</ExternalConsole>
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Models\Supplier.cs" />
+    <Compile Include="Models\Goods.cs" />
+    <Compile Include="Models\GSLink.cs" />
+    <Compile Include="Models\GSRecords.cs" />
+    <Compile Include="Recorder.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Models\" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>

+ 34 - 0
Lab18/Models/GSLink.cs

@@ -0,0 +1,34 @@
+using System;
+namespace Lab18.Models
+{
+    public class GSLink
+    {
+        int s_id;
+        int g_id;
+        int quantity = 0;
+        public int S_id
+        {
+            get { return s_id; }
+        }
+        public int G_id
+        {
+            get { return g_id; }
+        }
+        public int Quantity
+        {
+            get { return quantity; }
+            set { quantity = value; }
+        }
+        public GSLink(int s_id, int g_id)
+        {
+            this.s_id = s_id;
+            this.g_id = g_id;
+        }
+        //проверка двух объектов на совпадение номеров поставщиков и товаров
+        public override bool Equals(object obj)
+        {
+            GSLink p = obj as GSLink;
+            return ((s_id == p.s_id) && (g_id == p.g_id));
+        }
+    }
+}

+ 121 - 0
Lab18/Models/GSRecords.cs

@@ -0,0 +1,121 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Collections;
+
+namespace Lab18.Models
+{
+    public class GSRecords
+    {
+        /// <summary>
+        /// Массив объектов для связи
+        /// </summary>
+        GSLink[] gs_Links;
+
+        /// <summary>
+        /// Максимальное количество регистраций
+        /// </summary>
+        int max_counts;
+
+        /// <summary>
+        /// текущее количество регистраций
+        /// </summary>
+        int cur_counts;
+
+        public GSLink[] Gs_Links
+        {
+            get { return gs_Links; }
+        }
+
+        //констурктор
+        public GSRecords(int max_counts)
+        {
+            this.max_counts = max_counts;
+            cur_counts = 0;
+            //выделение памяти под массив ссылок
+            gs_Links = new GSLink[max_counts];
+            //память под объекты будет выделяться при регистрации поставщиков
+        }
+
+        //проверка, существует ли регистрация поставщика
+        public bool GS_Find(int num_sp, int num_goods)
+        {
+            GSLink temp = new GSLink(num_sp, num_goods);
+            int i = 0;
+            while ((i < cur_counts) && !temp.Equals(gs_Links[i])) i++;
+            return i != cur_counts;
+        }
+
+        /// <summary>
+        /// Регистрация желания поставщика продавать товар
+        /// </summary>
+        /// <returns><c>true</c>, if record was added, <c>false</c> otherwise.</returns>
+        /// <param name="num_sp">ID поставщика</param>
+        /// <param name="num_gsr">ID товара</param>
+        public bool AddRecord(int num_sp, int num_gsr)
+        {
+            if (GS_Find(num_sp, num_gsr) || (cur_counts == max_counts))
+            {
+                // Добавить поставщика нельзя - либо он уже есть, либо 
+                // нет памяти
+                return false;
+            }
+            gs_Links[cur_counts] = new GSLink(num_sp, num_gsr);
+            cur_counts++;
+            return true;
+        }
+
+        /// <summary>
+        /// Печать информации обо всех регистрациях поставщиков
+        /// </summary>
+        public void Display()
+        {
+            Console.WriteLine("Поставщик " + "товар " + "количество ");
+            for (int i = 0; i < cur_counts; i++)
+            {
+                Console.WriteLine(
+                    "{0,4:d}{1,10:d}{2,9:d}",
+                    gs_Links[i].S_id,
+                    gs_Links[i].G_id,
+                    gs_Links[i].Quantity);
+            }
+        }
+
+        /// <summary>
+        /// Добавляет количество товару поставщика
+        /// </summary>
+        /// <returns><c>true</c>, if supply was added, <c>false</c> otherwise.</returns>
+        /// <param name="goodID">Good identifier.</param>
+        /// <param name="count">Count.</param>
+        /// <param name="supplierID">Supplier identifier.</param>
+        public bool AddSupply(int goodID, int count, int supplierID)
+        {
+            GSLink compareObj = new GSLink(supplierID, goodID);
+            for (int i = 0; i < cur_counts; i++)
+            {
+                if (gs_Links[i].Equals(compareObj))
+                {
+                    // Найден объект связи поставщика с товаром
+                    gs_Links[i].Quantity += count;
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// Возвращает информацию о товарах и их количествах
+        /// </summary>
+        /// <returns>The max data.</returns>
+        public void GetGoodCountsData(out int goodID, out int goodCount)
+        {
+            var data = gs_Links.Where(l => l != null).GroupBy(l => l.G_id).Select(cl => new
+            {
+                GoodID = cl.Key,
+                GoodCount = cl.Sum(i => i.Quantity)
+            }).OrderByDescending(i => i.GoodCount).First();
+            goodID = data.GoodID;
+            goodCount = data.GoodCount;
+        }
+    }
+}

+ 32 - 0
Lab18/Models/Goods.cs

@@ -0,0 +1,32 @@
+using System;
+namespace Lab18.Models
+{
+    public class Goods
+    {
+        string g_name;
+        int g_id;
+        public string G_name
+        {
+            get { return g_name; }
+        }
+        public int G_id
+        {
+            get { return g_id; }
+        }
+        public Goods(string g_name, int g_id)
+        {
+            this.g_name = g_name;
+            this.g_id = g_id;
+        }
+        public void Display()
+        {
+            Console.WriteLine("Goods: g_name={0} g_id={1}", g_name, g_id);
+        }
+        //сравнение двух объектов класса Goods на равенство
+        public override bool Equals(object obj)
+        {
+            Goods p = obj as Goods;
+            return ((g_name == p.g_name) && (g_id == p.g_id));
+        }
+    }
+}

+ 36 - 0
Lab18/Models/Supplier.cs

@@ -0,0 +1,36 @@
+using System;
+namespace Lab18
+{
+    public class Supplier
+    {
+        string s_name;
+        int s_id;
+
+        public string S_name
+        {
+            get { return s_name; }
+        }
+
+        public int S_id
+        {
+            get { return s_id; }
+        }
+
+        public Supplier(string s_name, int s_id)
+        {
+            this.s_name = s_name;
+            this.s_id = s_id;
+        }
+
+        public void Display()
+        {
+            Console.WriteLine("Supplier: s_name={0} s_id={1},s_name,s_id");
+        }
+        
+        public override bool Equals(object obj)
+        {
+            Supplier p = obj as Supplier;
+            return ((s_name == p.s_name) && (s_id == p.s_id));
+        }
+    }
+}

+ 47 - 0
Lab18/Program.cs

@@ -0,0 +1,47 @@
+using System;
+
+namespace Lab18
+{
+    class Program
+    {
+        public static void Main(string[] args)
+        {
+            Recorder my = new Recorder(3, 3, 5);
+
+            //Добавляем данные в массив поставщиков
+            my.AddSupplier("Ivanov",5);
+            my.AddSupplier("Petrov",6);
+            my.AddSupplier("Sidorov",51);
+            my.AddSupplier("Kovalev",61);
+
+            //Добавляем данные в массив товаров
+            my.AddGoods("Apple",50);
+            my.AddGoods("Grushi",60);
+            my.AddGoods("Ananasi",70);
+            my.AddGoods("Banana",80);
+
+            //регистрируем поставщиков (поставщик/товар);
+            my.Recording (5,50);
+            //my.Recording(5, 70); позволить иванову поставлять товар
+
+            my.Recording (6,60);
+            my.Recording (3,30);
+            my.Recording (51,60);
+            my.Recording (5,50);
+
+            // Задание лабораторной
+            // Иванов поставил 42 яблока
+            my.AddSupply(50, 42, 5);
+            // Петров поставил 256 груш
+            my.AddSupply(60, 256, 6);
+            // Иванов не поставляет ананасы - провал
+            my.AddSupply(70, 999, 5);
+            // /Задание лабораторной
+
+            my.Gsr_GSRecords.Display();
+            my.DisplayGoodsSuppliersCount();
+            my.DisplayMaxGood();
+            Console.ReadLine();
+        }
+    }
+}

+ 26 - 0
Lab18/Properties/AssemblyInfo.cs

@@ -0,0 +1,26 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes. 
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("Lab18")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("${AuthorCopyright}")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly, 
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]

+ 144 - 0
Lab18/Recorder.cs

@@ -0,0 +1,144 @@
+using System;
+using Lab18.Models;
+
+namespace Lab18
+{
+    public class Recorder
+    {
+        Goods[] list_Goods; //ссылка на массив товаров
+        Supplier[] list_Supplier; //ссылка на массив поставщиков
+        GSRecords gsr_GSRecords; //ссылка на объект класса GSRecords
+        int cur_sp; //текущее количество поставщиков
+        int cur_gd; //текущее количество товаров
+        int max_sp; //максимальное количество поставщиков
+        int max_gd; //максимальное количество товаров
+
+        /// <summary>
+        /// Массив подсчёта количества поставщиков для товаров. Индексы этого
+        /// массива совпадают с индексами в list_Goods
+        /// </summary>
+        private int[] goodsSupplierCount;
+
+        //Описаниесвойств
+        public Goods[] List_Goods
+        {
+            get { return list_Goods; }
+        }
+
+        public Supplier[] List_Supplier
+        {
+            get { return list_Supplier; }
+        }
+
+        public GSRecords Gsr_GSRecords
+        {
+            get { return gsr_GSRecords; }
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="T:Lab18.Recorder"/> class.
+        /// </summary>
+        /// <param name="max_gd">Максимум товаров</param>
+        /// <param name="max_sp">Максимум поставщиков</param>
+        /// <param name="max_records">Максимум связей поставщиков с товарами</param>
+        public Recorder(int max_gd, int max_sp, int max_records)
+        {
+            list_Goods = new Goods[max_gd];
+            list_Supplier = new Supplier[max_sp];
+            cur_sp = 0;
+            this.max_sp = max_sp;
+            cur_gd = 0;
+            this.max_gd = max_gd;
+            gsr_GSRecords = new GSRecords(max_records);
+            goodsSupplierCount = new int[max_records];
+        }
+
+        //добавляем поставщика в массив поставщиков
+        public bool AddSupplier(string name, int num_sp)
+        {
+            Supplier temp = new Supplier(name, num_sp); //проверяем, есть ли такой поставщика
+            int i = 0;
+            while ((i < cur_sp) && !temp.Equals(list_Supplier[i])) i++;
+            if ((i != cur_sp) || (cur_sp == max_sp))
+            {
+                // Уже есть либо слишком много
+                return false;
+            }
+            list_Supplier[cur_sp++] = temp;
+            return true;
+        }
+
+        //выводспискапоставщиков
+        public void St_Display()
+        {
+            for (int i = 0; i < cur_sp; i++)
+            {
+                Console.WriteLine(list_Supplier[i].S_name + " " + list_Supplier[i].S_id);
+            }
+        }
+
+        //добавляемтоварвмассивтоваров
+        public bool AddGoods(string name, int num_gd)
+        {
+            Goods temp = new Goods(name, num_gd); //проверяем, есть ли такой товар
+            int i = 0;
+            while ((i < cur_gd) && !temp.Equals(list_Goods[i])) i++;
+            if ((i != cur_gd) /*нашли*/ || (cur_gd == max_gd) /*слишкоммноготоваров*/) return false;
+
+            list_Goods[cur_gd] = temp;
+            goodsSupplierCount[cur_gd] = 0;
+            cur_gd++;
+            return true;
+        }
+
+        //выводспискатоваров 
+        public void Cs_Display()
+        {
+            Console.WriteLine("Списоктоваров:");
+            for (int i = 0; i < cur_gd; i++)
+            {
+                Console.WriteLine("Goods: " + list_Goods[i].G_name + " " + list_Goods[i].G_id);
+            }
+        }
+
+        //регистрация поставщика
+        public bool Recording(int SupplierID, int GoodsID)
+        {
+            int i = 0, j = 0;
+
+            //естьлитакойпоставщик
+            while ((i < cur_sp) && (SupplierID != list_Supplier[i].S_id)) i++;
+            if (i == cur_sp) return false;
+
+            //есть ли такой товар
+            while ((j < cur_gd) && (GoodsID != list_Goods[j].G_id)) j++;
+            if (j == cur_gd) return false;
+
+            //нашли поставщика и товар в соотвествующих массивах, регистрируем поставщика товара
+            goodsSupplierCount[j]++;
+            return gsr_GSRecords.AddRecord(SupplierID, GoodsID);
+        }
+
+        public bool AddSupply(int goodID, int count, int supplierID)
+        {
+            return gsr_GSRecords.AddSupply(goodID, count, supplierID);
+        }
+
+        public void DisplayGoodsSuppliersCount()
+        {
+            Console.WriteLine("Количества поставщиков для товаров:");
+            for (int i = 0; i < cur_gd; i++)
+            {
+                Console.WriteLine($"Для товара {list_Goods[i].G_name} количество поставщиков = {goodsSupplierCount[i]}");
+            }
+        }
+
+        public void DisplayMaxGood()
+        {
+            int goodID;
+            int goodCount;
+            gsr_GSRecords.GetGoodCountsData(out goodID, out goodCount);
+            Console.WriteLine($"Товар с максимумом количества - {goodID}. Количество - {goodCount}");
+        }
+    }
+}

+ 23 - 0
MDKlabs.sln

@@ -0,0 +1,23 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab18", "Lab18\Lab18.csproj", "{2E68FC5F-19D6-4A85-B7E3-0455CE576063}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2E68FC5F-19D6-4A85-B7E3-0455CE576063}.Debug|x86.ActiveCfg = Debug|x86
+		{2E68FC5F-19D6-4A85-B7E3-0455CE576063}.Debug|x86.Build.0 = Debug|x86
+		{2E68FC5F-19D6-4A85-B7E3-0455CE576063}.Release|x86.ActiveCfg = Release|x86
+		{2E68FC5F-19D6-4A85-B7E3-0455CE576063}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(MonoDevelopProperties) = preSolution
+		Policies = $0
+		$0.DotNetNamingPolicy = $1
+		$1.DirectoryNamespaceAssociation = PrefixedHierarchical
+		$0.StandardHeader = $2
+	EndGlobalSection
+EndGlobal