From 7c8b19562f795e1c46d699fe526dd8266fe0543b Mon Sep 17 00:00:00 2001 From: tanya Date: Tue, 3 Jul 2018 20:52:20 +0300 Subject: [PATCH 1/2] test --- .gitattributes | 63 +++++ .gitignore | 245 ++++++++++++++++++ converter/converter.sln | 22 ++ converter/converter/App.config | 6 + converter/converter/App.xaml | 9 + converter/converter/App.xaml.cs | 17 ++ converter/converter/MainWindow.xaml | 12 + converter/converter/MainWindow.xaml.cs | 28 ++ .../converter/Properties/AssemblyInfo.cs | 55 ++++ .../Properties/Resources.Designer.cs | 71 +++++ converter/converter/Properties/Resources.resx | 117 +++++++++ .../converter/Properties/Settings.Designer.cs | 30 +++ .../converter/Properties/Settings.settings | 7 + converter/converter/converter.csproj | 106 ++++++++ 14 files changed, 788 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 converter/converter.sln create mode 100644 converter/converter/App.config create mode 100644 converter/converter/App.xaml create mode 100644 converter/converter/App.xaml.cs create mode 100644 converter/converter/MainWindow.xaml create mode 100644 converter/converter/MainWindow.xaml.cs create mode 100644 converter/converter/Properties/AssemblyInfo.cs create mode 100644 converter/converter/Properties/Resources.Designer.cs create mode 100644 converter/converter/Properties/Resources.resx create mode 100644 converter/converter/Properties/Settings.Designer.cs create mode 100644 converter/converter/Properties/Settings.settings create mode 100644 converter/converter/converter.csproj diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a2238d --- /dev/null +++ b/.gitignore @@ -0,0 +1,245 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +[Xx]64/ +[Xx]86/ +[Bb]uild/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# 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 + +# TODO: Un-comment the next line if you do not want to checkin +# your web deploy settings because they may include unencrypted +# passwords +#*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Microsoft Azure ApplicationInsights config file +ApplicationInsights.config + +# Windows Store app package directory +AppPackages/ +BundleArtifacts/ + +# 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/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# 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 + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# LightSwitch generated files +GeneratedArtifacts/ +ModelManifest.xml + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ \ No newline at end of file diff --git a/converter/converter.sln b/converter/converter.sln new file mode 100644 index 0000000..17a7ffc --- /dev/null +++ b/converter/converter.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "converter", "converter\converter.csproj", "{332FE3F6-1355-4CCE-B4AA-C18EACB7C00F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {332FE3F6-1355-4CCE-B4AA-C18EACB7C00F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {332FE3F6-1355-4CCE-B4AA-C18EACB7C00F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {332FE3F6-1355-4CCE-B4AA-C18EACB7C00F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {332FE3F6-1355-4CCE-B4AA-C18EACB7C00F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/converter/converter/App.config b/converter/converter/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/converter/converter/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/converter/converter/App.xaml b/converter/converter/App.xaml new file mode 100644 index 0000000..ae2c9fb --- /dev/null +++ b/converter/converter/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/converter/converter/App.xaml.cs b/converter/converter/App.xaml.cs new file mode 100644 index 0000000..10c79e1 --- /dev/null +++ b/converter/converter/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace converter +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/converter/converter/MainWindow.xaml b/converter/converter/MainWindow.xaml new file mode 100644 index 0000000..13de9cc --- /dev/null +++ b/converter/converter/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/converter/converter/MainWindow.xaml.cs b/converter/converter/MainWindow.xaml.cs new file mode 100644 index 0000000..e133d28 --- /dev/null +++ b/converter/converter/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace converter +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/converter/converter/Properties/AssemblyInfo.cs b/converter/converter/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..68f9765 --- /dev/null +++ b/converter/converter/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("converter")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("converter")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[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)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// 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")] diff --git a/converter/converter/Properties/Resources.Designer.cs b/converter/converter/Properties/Resources.Designer.cs new file mode 100644 index 0000000..c2bcc03 --- /dev/null +++ b/converter/converter/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace converter.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [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() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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("converter.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/converter/converter/Properties/Resources.resx b/converter/converter/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/converter/converter/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/converter/converter/Properties/Settings.Designer.cs b/converter/converter/Properties/Settings.Designer.cs new file mode 100644 index 0000000..335516a --- /dev/null +++ b/converter/converter/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace converter.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; + } + } + } +} diff --git a/converter/converter/Properties/Settings.settings b/converter/converter/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/converter/converter/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/converter/converter/converter.csproj b/converter/converter/converter.csproj new file mode 100644 index 0000000..96432cc --- /dev/null +++ b/converter/converter/converter.csproj @@ -0,0 +1,106 @@ + + + + + Debug + AnyCPU + {332FE3F6-1355-4CCE-B4AA-C18EACB7C00F} + WinExe + Properties + converter + converter + v4.5.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + \ No newline at end of file From 7eba636b8c9098d930f974f9bd31c51d4e731873 Mon Sep 17 00:00:00 2001 From: tanya Date: Tue, 3 Jul 2018 21:05:55 +0300 Subject: [PATCH 2/2] last --- converter/converter/App.xaml | 4 +- converter/converter/MainWindow.xaml | 12 - converter/converter/Model/DataRate.cs | 115 ++++ .../converter/SqlDataBase/SqlDataBase.cs | 476 +++++++++++++++ converter/converter/View/MainWindow.xaml | 65 ++ .../converter/{ => View}/MainWindow.xaml.cs | 18 +- .../converter/ViewModel/DataRateViewModel.cs | 40 ++ .../ViewModel/MainWindowViewModel.cs | 308 ++++++++++ converter/converter/converter.csproj | 17 +- ...Microsoft.Practices.Prism.Mvvm.Desktop.dll | Bin 0 -> 14496 bytes .../Microsoft.Practices.Prism.Mvvm.Store.dll | Bin 0 -> 12448 bytes windows8/Microsoft.Practices.Prism.Mvvm.dll | Bin 0 -> 31376 bytes windows8/Microsoft.Practices.Prism.Mvvm.xml | 577 ++++++++++++++++++ ...osoft.Practices.Prism.SharedInterfaces.dll | Bin 0 -> 12432 bytes ...osoft.Practices.Prism.SharedInterfaces.xml | 25 + 15 files changed, 1640 insertions(+), 17 deletions(-) delete mode 100644 converter/converter/MainWindow.xaml create mode 100644 converter/converter/Model/DataRate.cs create mode 100644 converter/converter/SqlDataBase/SqlDataBase.cs create mode 100644 converter/converter/View/MainWindow.xaml rename converter/converter/{ => View}/MainWindow.xaml.cs (57%) create mode 100644 converter/converter/ViewModel/DataRateViewModel.cs create mode 100644 converter/converter/ViewModel/MainWindowViewModel.cs create mode 100644 windows8/Microsoft.Practices.Prism.Mvvm.Desktop.dll create mode 100644 windows8/Microsoft.Practices.Prism.Mvvm.Store.dll create mode 100644 windows8/Microsoft.Practices.Prism.Mvvm.dll create mode 100644 windows8/Microsoft.Practices.Prism.Mvvm.xml create mode 100644 windows8/Microsoft.Practices.Prism.SharedInterfaces.dll create mode 100644 windows8/Microsoft.Practices.Prism.SharedInterfaces.xml diff --git a/converter/converter/App.xaml b/converter/converter/App.xaml index ae2c9fb..382bbbe 100644 --- a/converter/converter/App.xaml +++ b/converter/converter/App.xaml @@ -1,8 +1,8 @@ - + StartupUri="View\MainWindow.xaml"> diff --git a/converter/converter/MainWindow.xaml b/converter/converter/MainWindow.xaml deleted file mode 100644 index 13de9cc..0000000 --- a/converter/converter/MainWindow.xaml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - diff --git a/converter/converter/Model/DataRate.cs b/converter/converter/Model/DataRate.cs new file mode 100644 index 0000000..ab92318 --- /dev/null +++ b/converter/converter/Model/DataRate.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Practices.Prism.Commands; +using Microsoft.Practices.Prism.Mvvm; +using System.Runtime.CompilerServices; + +namespace converter.Model +{ + class DataRate : BindableBase + { + private string rubtorub; + private string rubtoeur; + private string rubtousd; + private string usdtousd; + private string usdtoeur; + private string usdtorub; + private string eurtoeur; + private string eurtousd; + private string eurtorub; + private string currentday; + public string RUBtoRUB + { + get + { return rubtorub; } + set + { + SetProperty(ref rubtorub, value); ; + } + } + public string RUBtoEUR + { + get + { return rubtoeur; } + set + { + SetProperty(ref rubtoeur, value); ; + } + } + public string RUBtoUSD + { + get + { return rubtousd; } + set + { + SetProperty(ref rubtousd, value); ; + } + } + public string USDtoUSD + { + get + { return usdtousd; } + set + { + SetProperty(ref usdtousd, value); ; + } + } + public string USDtoEUR + { + get + { return usdtoeur; } + set + { + SetProperty(ref usdtoeur, value); ; + } + } + public string USDtoRUB + { + get + { return usdtorub; } + set + { + SetProperty(ref usdtorub, value); ; + } + } + public string EURtoEUR + { + get + { return eurtoeur; } + set + { + SetProperty(ref eurtoeur, value); ; + } + } + public string EURtoUSD + { + get + { return eurtousd; } + set + { + SetProperty(ref eurtousd, value); ; + } + } + public string EURtoRUB + { + get + { return eurtorub; } + set + { + SetProperty(ref eurtorub, value); + } + } + public string CurrentDay + { + get + { return currentday; } + set + { + SetProperty(ref currentday, value); + } + } + } +} diff --git a/converter/converter/SqlDataBase/SqlDataBase.cs b/converter/converter/SqlDataBase/SqlDataBase.cs new file mode 100644 index 0000000..7617ba0 --- /dev/null +++ b/converter/converter/SqlDataBase/SqlDataBase.cs @@ -0,0 +1,476 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Data; +using System.Windows; +using System.Threading; +using System.Windows.Data; +using System.Data.SqlClient; + + +namespace converter.SqlDataBase +{ + public class DataBase + { + private string _ConStr; + + public DataBase(string ConStr) + { + _ConStr = ConStr; + } + public bool IsDataBaseExist() + { + + using (SqlConnection conn = new SqlConnection(_ConStr)) + { + try + { + conn.Open(); + + } + catch (SqlException se) + { + if (se.Number == 4060) + return false; + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database connect error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + return false; + } + return true; + } + } + + + public bool CreateDataBase(string createdbname) + { + if (!IsDataBaseExist()) + { + using (SqlConnection conn = new SqlConnection(@"Data Source=(local)\SQLEXPRESS; + Integrated Security=True")) + using (SqlCommand cmdSQLCommand = new SqlCommand(string.Format(string.Concat("CREATE DATABASE ", createdbname)), conn)) + { + conn.Open(); + + try + { + cmdSQLCommand.ExecuteNonQuery(); + System.Windows.MessageBox.Show("DataBase is Created Successfully", "Ok", MessageBoxButton.OK, MessageBoxImage.Information); + Thread.Sleep(5000); + return true; + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + + } + + } + return false; + } + + public bool DropDataBase(string dropdbname) + { + if (IsDataBaseExist()) + { + using (SqlConnection conn = new SqlConnection(@"Data Source=(local)\SQLEXPRESS; + Integrated Security=True")) + using (SqlCommand cmdSQLCommand = new SqlCommand(string.Format(string.Concat("ALTER DATABASE ", dropdbname, " SET SINGLE_USER WITH ROLLBACK IMMEDIATE;", "DROP DATABASE ", dropdbname)), conn)) + { + conn.Open(); + + try + { + //conn.ChangeDatabase(dropdbname); + cmdSQLCommand.ExecuteNonQuery(); + System.Windows.MessageBox.Show("DataBase drop Successfully", "Ok", MessageBoxButton.OK, MessageBoxImage.Information); + Thread.Sleep(5000); + return true; + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database drop error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + } + return false; + } + + public bool CreateTableIsNotExist(string dbname, string tablename, string column1, string column2) + { + string SQLstring = "IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + tablename + "')" + + " CREATE TABLE " + tablename + "(" + column1 + column2 + ")"; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Fill DataBase Error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + return false; + } + + public bool CreateTableIsNotExist(string dbname, string tablename, string column1, string column2, string column3) + { + string SQLstring = "IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + tablename + "')" + + " CREATE TABLE " + tablename + "(" + column1 + column2 + column3 + ")"; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + //System.Environment.Exit(0); + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Fill DataBase Error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + return false; + } + + public bool CreateTableIsNotExist(string dbname, string tablename, string column1, string column2, string column3, string column4) + { + string SQLstring = "IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + tablename + "')" + + " CREATE TABLE " + tablename + "(" + column1 + column2 + column3 + column4 + ")"; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + //System.Environment.Exit(0); + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Fill DataBase Error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + return false; + } + + public bool CreateTableIsNotExist(string dbname, string tablename, string column1, string column2, string column3, string column4, string column5, string column6) + { + string SQLstring = "IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + tablename + "')" + + " CREATE TABLE " + tablename + "(" + column1 + ", " + column2 + ", " + column3 + ", " + column4 + ", " + column5 + ", " + column6 + ", " + ")"; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + catch (System.Exception ex) + + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + return false; + } + public bool CreateTableIsNotExist(string dbname, string tablename, string column1, string column2, string column3, string column4, string column5, string column6, string column7) + { + string SQLstring = "IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + tablename + "')" + + " CREATE TABLE " + tablename + "(" + column1 + "," + column2 + "," + column3 + "," + column4 + "," + column5 + "," + column6 + "," + column7 + ")"; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + //System.Environment.Exit(0); + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + return false; + } + + public bool CreateTableIsNotExist(string dbname, string tablename, string column1, string column2, string column3, string column4, string column5, string column6, string column7, string column8) + { + string SQLstring = "IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + tablename + "')" + + " CREATE TABLE " + tablename + "(" + column1 + "," + column2 + "," + column3 + "," + column4 + "," + column5 + "," + column6 + "," + column7 + "," + column8 + ")"; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + //System.Environment.Exit(0); + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + return false; + } + public bool CreateTableIsNotExist(string dbname, string tablename, string column1, string column2, string column3, string column4, string column5, string column6, string column7, string column8, string column9) + { + string SQLstring = "IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + tablename + "')" + + " CREATE TABLE " + tablename + "(" + column1 + "," + column2 + "," + column3 + "," + column4 + "," + column5 + "," + column6 + "," + column7 + "," + column8 + "," + column9 + ")"; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + //System.Environment.Exit(0); + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + return false; + } + + + public bool CreateTableIsNotExist(string dbname, string tablename, string column1, string column2, string column3, string column4, string column5, string column6, string column7, string column8, string column9, string column10, string column11) + { + string SQLstring = "IF NOT EXISTS( SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + tablename + "')" + + " CREATE TABLE " + tablename + "(" + column1 + "," + column2 + "," + column3 + "," + column4 + "," + column5 + "," + column6 + "," + column7 + "," + column8 + "," + column9 + "," + column10 + "," + column11 + ")"; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + //System.Environment.Exit(0); + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database table create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + + + return false; + } + + public bool InsertRowDataBase(string DataBaseTableName, string CommandString) + { + + string SQLstring = "Insert Into " + DataBaseTableName + CommandString; + + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlCommand cmdSQLCommand = new SqlCommand(SQLstring, conn)) + { + try + { + conn.Open(); + cmdSQLCommand.ExecuteNonQuery(); + return true; + } + catch (SqlException ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Database create error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Fill DataBase Error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + + return false; + } + + public bool FillDataTableDataBase(DataSet myDataSet, string DataBaseTableName, string DataSetTableName) + { + int iResult; + Object thisLock = new Object(); + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlDataAdapter dAdapt = new SqlDataAdapter("Select * From " + DataBaseTableName, _ConStr)) + using (SqlCommandBuilder builder = new SqlCommandBuilder(dAdapt)) + { + try + { + conn.Open(); + Task FillDT = new Task(() => { lock (thisLock) { iResult = dAdapt.Fill(myDataSet, DataSetTableName); } }); + + FillDT.Start(); + FillDT.Wait(); + FillDT.Dispose(); + return true; + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Fill DataBase Error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + return false; + } + public bool FillDataTableDataBaseSelect(DataSet myDataSet, string DataBaseTableName, string DataSetTableName, string selectstring) + { + int iResult; + Object thisLock = new Object(); + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlDataAdapter dAdapt = new SqlDataAdapter("Select * From " + DataBaseTableName, _ConStr)) + using (SqlCommandBuilder builder = new SqlCommandBuilder(dAdapt)) + { + try + { + conn.Open(); + dAdapt.SelectCommand = new SqlCommand(selectstring, conn); + Task FillDT = new Task(() => { lock (thisLock) { iResult = dAdapt.Fill(myDataSet, DataSetTableName); } }); + + FillDT.Start(); + FillDT.Wait(); + FillDT.Dispose(); + return true; + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Fill DataBase Error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + return false; + } + + public bool UpdateDataTableDataBase(DataSet myDataSet, string DataBaseTableName, string DataSetTableName) + { + int iResult; + Object thisLock = new Object(); + using (SqlConnection conn = new SqlConnection(_ConStr)) + using (SqlDataAdapter dAdapt = new SqlDataAdapter("Select * From " + DataBaseTableName, _ConStr)) + using (SqlCommandBuilder builder = new SqlCommandBuilder(dAdapt)) + { + try + { + conn.Open(); + Task FillDT = new Task(() => { lock (thisLock) { iResult = dAdapt.Update(myDataSet, DataSetTableName); } }); + + FillDT.Start(); + FillDT.Wait(); + FillDT.Dispose(); + return true; + } + catch (System.Exception ex) + { + if (ex.Source != null) + System.Windows.MessageBox.Show(ex.ToString(), "Update DataBase Error!Try again!", MessageBoxButton.OK, MessageBoxImage.Information); + } + } + return false; + } + + //public SqlDbType GetSQLType(Type CLRType) + //{ + // if (CLRType.Equals(typeof(string))) + // return SqlDbType.Char; + // else if (CLRType.Equals(typeof(Int32))) + // return SqlDbType.Int; + // else return SqlDbType.Variant; + //} + + //public bool TestGetSQLType() + //{ + // int test = 10; + // System.Windows.Forms.MessageBox.Show(GetSQLType(test.GetType()).ToString()); + // return true; + + //} + + } +} diff --git a/converter/converter/View/MainWindow.xaml b/converter/converter/View/MainWindow.xaml new file mode 100644 index 0000000..d781692 --- /dev/null +++ b/converter/converter/View/MainWindow.xaml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + +