Changed to newer framework in tracker project
This commit is contained in:
@ -1,7 +1,16 @@
|
||||
using System;
|
||||
using Dapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
|
||||
|
||||
//@PlaceNumber int,
|
||||
//@PlaceName nvarchar(50),
|
||||
//@PrizeAmount money,
|
||||
// @PrizePercentage float,
|
||||
//@id int = 0 output
|
||||
|
||||
namespace TrackerLibrary.DataAccess
|
||||
{
|
||||
public class SqlConnector : IDataConnection
|
||||
@ -14,8 +23,21 @@ namespace TrackerLibrary.DataAccess
|
||||
/// <returns>The prize information, including the unique identifier.</returns>
|
||||
public Models.PrizeModel CreatePrize(Models.PrizeModel model)
|
||||
{
|
||||
model.Id = 1;
|
||||
using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString("Tournaments")))
|
||||
{
|
||||
var p = new DynamicParameters();
|
||||
p.Add("@PlaceNumber", model.PlaceNumber);
|
||||
p.Add("@PlaceName", model.PlaceName);
|
||||
p.Add("@PrizeAmount", model.PrizeAmount);
|
||||
p.Add("@PrizePercentage", model.PrizePercentage);
|
||||
p.Add("@Id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output);
|
||||
|
||||
connection.Execute("dbo.spPrizes_Insert", p, commandType: CommandType.StoredProcedure);
|
||||
|
||||
model.Id = p.Get<int>("@Id");
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using TrackerLibrary.DataAccess;
|
||||
using System.Configuration;
|
||||
|
||||
namespace TrackerLibrary
|
||||
{
|
||||
@ -23,6 +24,12 @@ namespace TrackerLibrary
|
||||
TextConnector text = new TextConnector();
|
||||
Connections.Add(text);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static string CnnString(string name)
|
||||
{
|
||||
return ConfigurationManager.ConnectionStrings[name].ConnectionString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
TrackerLibrary/Properties/AssemblyInfo.cs
Normal file
36
TrackerLibrary/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TrackerLibrary")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TrackerLibrary")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("27ba8b4b-4ef6-4ca2-8e43-7c930552ecd9")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@ -1,7 +1,64 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<?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>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{27BA8B4B-4EF6-4CA2-8E43-7C930552ECD9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TrackerLibrary</RootNamespace>
|
||||
<AssemblyName>TrackerLibrary</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<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' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Dapper, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Dapper.2.0.30\lib\net461\Dapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<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.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DataAccess\IDataConnection.cs" />
|
||||
<Compile Include="DataAccess\SqlConnector.cs" />
|
||||
<Compile Include="DataAccess\TextConnector.cs" />
|
||||
<Compile Include="GlobalConfig.cs" />
|
||||
<Compile Include="Models\MatchupEntryModel.cs" />
|
||||
<Compile Include="Models\MatchupModel.cs" />
|
||||
<Compile Include="Models\PersonModel.cs" />
|
||||
<Compile Include="Models\PrizeModel.cs" />
|
||||
<Compile Include="Models\TeamModel.cs" />
|
||||
<Compile Include="Models\TournamentModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
4
TrackerLibrary/packages.config
Normal file
4
TrackerLibrary/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Dapper" version="2.0.30" targetFramework="net472" />
|
||||
</packages>
|
||||
@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<connectionStrings>
|
||||
<add name="Tournaments" connectionString="Server=.\SQLEXPR2017;Database=Tournaments;Trusted_Connection=True;" providerName="System.Data.SqlClient"/>
|
||||
</connectionStrings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
|
||||
@ -71,7 +71,7 @@ namespace TrackerUI
|
||||
int prizePercentage = 0;
|
||||
|
||||
bool prizeAmountValid = decimal.TryParse(prizeAmountValue.Text, out prizeAmount);
|
||||
bool prizePercentageValid = int.TryParse(prizeAmountValue.Text, out prizePercentage);
|
||||
bool prizePercentageValid = int.TryParse(prizePercentageValue.Text, out prizePercentage);
|
||||
|
||||
if (prizePercentageValid == false || prizeAmountValid == false)
|
||||
{
|
||||
|
||||
@ -117,7 +117,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TrackerLibrary\TrackerLibrary.csproj">
|
||||
<Project>{b4ffd708-5d53-4d58-b5a6-5691020ef6dc}</Project>
|
||||
<Project>{27ba8b4b-4ef6-4ca2-8e43-7c930552ecd9}</Project>
|
||||
<Name>TrackerLibrary</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user