Browse Source

first commit

Щукин Григорий Алексеевич 4 years ago
parent
commit
7e532cef8b

+ 25 - 0
ConsoleApp1/ConsoleApp1.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30523.141
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{B51908DA-5E4D-447B-A6FA-E7786A9B7A68}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{B51908DA-5E4D-447B-A6FA-E7786A9B7A68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B51908DA-5E4D-447B-A6FA-E7786A9B7A68}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B51908DA-5E4D-447B-A6FA-E7786A9B7A68}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B51908DA-5E4D-447B-A6FA-E7786A9B7A68}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {583B4568-7416-4AFA-8C58-C68471123373}
+	EndGlobalSection
+EndGlobal

+ 12 - 0
ConsoleApp1/ConsoleApp1/App.config

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
+  </startup>
+  <appSettings>
+    <!-- Pay -->
+    <add key="provider" value="System.Data.SqlClient"/>
+    <!-- Users -->
+    <add key="conStr" value="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Payment;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"/>
+  </appSettings>
+</configuration>

+ 74 - 0
ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj

@@ -0,0 +1,74 @@
+<?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>{B51908DA-5E4D-447B-A6FA-E7786A9B7A68}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>ConsoleApp1</RootNamespace>
+    <AssemblyName>ConsoleApp1</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.Configuration" />
+    <Reference Include="System.Configuration.ConfigurationManager, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Configuration.ConfigurationManager.5.0.0\lib\net461\System.Configuration.ConfigurationManager.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data.OracleClient" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Net" />
+    <Reference Include="System.Security" />
+    <Reference Include="System.Security.AccessControl, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.AccessControl.5.0.0\lib\net461\System.Security.AccessControl.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Permissions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Permissions.5.0.0\lib\net461\System.Security.Permissions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Security.Principal.Windows, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ServiceProcess" />
+    <Reference Include="System.Transactions" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+    <Reference Include="WindowsBase" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 55 - 0
ConsoleApp1/ConsoleApp1/Program.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Configuration;
+using System.Data.Common;
+
+namespace Платежи
+{
+    class Program
+    {
+        static void Main(string[] args)
+        {
+            string dp = ConfigurationManager.AppSettings["provider"];
+            string cnStr = ConfigurationManager.AppSettings["conStr"];
+
+            DbProviderFactory df = DbProviderFactories.GetFactory(dp);
+
+            using (DbConnection cn = df.CreateConnection())
+            {
+                Console.WriteLine("Объект подключения: " + cn.GetType().Name);
+                cn.ConnectionString = cnStr;
+                cn.Open();
+
+                DbCommand cmd = df.CreateCommand();
+                Console.WriteLine("Объект команды: " + cmd.GetType().Name);
+                cmd.Connection = cn;
+
+                string strSQL = "Select * From ";
+
+                cmd.CommandText = strSQL + "Users";
+                using (DbDataReader dr = cmd.ExecuteReader())
+                {
+                    Console.WriteLine("Объект чтения данных: " + dr.GetType().Name);
+                    Console.WriteLine("\n Cписок пользователей");
+                    while (dr.Read())
+                        Console.WriteLine("-> ID - {0} | FIO -{1} | Login - {2} | Password - {3} | Pincode - {4} ",
+                        dr[0], dr[1], dr[2], dr[3], dr[4]);
+                }
+                cmd.CommandText = strSQL + "Pay";
+                using (DbDataReader dr = cmd.ExecuteReader())
+                {
+                    Console.WriteLine("Объект чтения данных: " + dr.GetType().Name);
+                    Console.WriteLine("\n Cписок платежей");
+                    while (dr.Read())
+                        Console.WriteLine("-> ID - {0} | Дата -{1} | Категория - {2} | Наиминование платежа - {3} | Количество - {4} | Цена - {5} | Стоимость - {6} ",
+                        dr[0], dr[1], dr[2], dr[3], dr[4], dr[5], dr[6]);
+                }
+            }
+
+            Console.ReadKey();
+        }
+    }
+}

+ 36 - 0
ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Общие сведения об этой сборке предоставляются следующим набором
+// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
+// связанные с этой сборкой.
+[assembly: AssemblyTitle("ConsoleApp1")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ConsoleApp1")]
+[assembly: AssemblyCopyright("Copyright ©  2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
+// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
+// из модели COM задайте для атрибута ComVisible этого типа значение true.
+[assembly: ComVisible(false)]
+
+// Следующий GUID представляет идентификатор typelib, если этот проект доступен из модели COM
+[assembly: Guid("b51908da-5e4d-447b-a6fa-e7786a9b7a68")]
+
+// Сведения о версии сборки состоят из указанных ниже четырех значений:
+//
+//      Основной номер версии
+//      Дополнительный номер версии
+//      Номер сборки
+//      Номер редакции
+//
+// Можно задать все значения или принять номера сборки и редакции по умолчанию 
+// используя "*", как показано ниже:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 7 - 0
ConsoleApp1/ConsoleApp1/packages.config

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="System.Configuration.ConfigurationManager" version="5.0.0" targetFramework="net472" />
+  <package id="System.Security.AccessControl" version="5.0.0" targetFramework="net472" />
+  <package id="System.Security.Permissions" version="5.0.0" targetFramework="net472" />
+  <package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net472" />
+</packages>