| @ -0,0 +1,74 @@ | |||||
| | |||||
| Microsoft Visual Studio Solution File, Format Version 12.00 | |||||
| # Visual Studio 2012 | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CowOutputClient", "CowOutputClient\CowOutputClient.csproj", "{F216A33C-71D2-4E4A-926A-B315C2A8B0CE}" | |||||
| EndProject | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FireBirdUtil", "FireBirdUtil\FireBirdUtil.csproj", "{3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}" | |||||
| EndProject | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyPad", "KeyPad\KeyPad.csproj", "{3ADBFF38-915C-4115-9CDD-81C0CAD9733A}" | |||||
| EndProject | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{4768FDF9-DBC5-441F-AC59-5655146B8961}" | |||||
| EndProject | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "Utils\Utils.csproj", "{D123A086-C03A-4B8B-BEFB-124E102D3ADE}" | |||||
| EndProject | |||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeighBusiness", "WeighBusiness\WeighBusiness.csproj", "{35613A1C-A935-480D-9545-78BCF5279AC4}" | |||||
| EndProject | |||||
| Global | |||||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||||
| Debug|Any CPU = Debug|Any CPU | |||||
| Debug|x86 = Debug|x86 | |||||
| Release|Any CPU = Release|Any CPU | |||||
| Release|x86 = Release|x86 | |||||
| EndGlobalSection | |||||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||||
| {F216A33C-71D2-4E4A-926A-B315C2A8B0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {F216A33C-71D2-4E4A-926A-B315C2A8B0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {F216A33C-71D2-4E4A-926A-B315C2A8B0CE}.Debug|x86.ActiveCfg = Debug|Any CPU | |||||
| {F216A33C-71D2-4E4A-926A-B315C2A8B0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {F216A33C-71D2-4E4A-926A-B315C2A8B0CE}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {F216A33C-71D2-4E4A-926A-B315C2A8B0CE}.Release|x86.ActiveCfg = Release|Any CPU | |||||
| {3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}.Debug|x86.ActiveCfg = Debug|x86 | |||||
| {3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}.Debug|x86.Build.0 = Debug|x86 | |||||
| {3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}.Release|x86.ActiveCfg = Release|x86 | |||||
| {3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}.Release|x86.Build.0 = Release|x86 | |||||
| {3ADBFF38-915C-4115-9CDD-81C0CAD9733A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {3ADBFF38-915C-4115-9CDD-81C0CAD9733A}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {3ADBFF38-915C-4115-9CDD-81C0CAD9733A}.Debug|x86.ActiveCfg = Debug|x86 | |||||
| {3ADBFF38-915C-4115-9CDD-81C0CAD9733A}.Debug|x86.Build.0 = Debug|x86 | |||||
| {3ADBFF38-915C-4115-9CDD-81C0CAD9733A}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {3ADBFF38-915C-4115-9CDD-81C0CAD9733A}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {3ADBFF38-915C-4115-9CDD-81C0CAD9733A}.Release|x86.ActiveCfg = Release|x86 | |||||
| {3ADBFF38-915C-4115-9CDD-81C0CAD9733A}.Release|x86.Build.0 = Release|x86 | |||||
| {4768FDF9-DBC5-441F-AC59-5655146B8961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {4768FDF9-DBC5-441F-AC59-5655146B8961}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {4768FDF9-DBC5-441F-AC59-5655146B8961}.Debug|x86.ActiveCfg = Debug|x86 | |||||
| {4768FDF9-DBC5-441F-AC59-5655146B8961}.Debug|x86.Build.0 = Debug|x86 | |||||
| {4768FDF9-DBC5-441F-AC59-5655146B8961}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {4768FDF9-DBC5-441F-AC59-5655146B8961}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {4768FDF9-DBC5-441F-AC59-5655146B8961}.Release|x86.ActiveCfg = Release|x86 | |||||
| {4768FDF9-DBC5-441F-AC59-5655146B8961}.Release|x86.Build.0 = Release|x86 | |||||
| {D123A086-C03A-4B8B-BEFB-124E102D3ADE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {D123A086-C03A-4B8B-BEFB-124E102D3ADE}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {D123A086-C03A-4B8B-BEFB-124E102D3ADE}.Debug|x86.ActiveCfg = Debug|x86 | |||||
| {D123A086-C03A-4B8B-BEFB-124E102D3ADE}.Debug|x86.Build.0 = Debug|x86 | |||||
| {D123A086-C03A-4B8B-BEFB-124E102D3ADE}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {D123A086-C03A-4B8B-BEFB-124E102D3ADE}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {D123A086-C03A-4B8B-BEFB-124E102D3ADE}.Release|x86.ActiveCfg = Release|x86 | |||||
| {D123A086-C03A-4B8B-BEFB-124E102D3ADE}.Release|x86.Build.0 = Release|x86 | |||||
| {35613A1C-A935-480D-9545-78BCF5279AC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
| {35613A1C-A935-480D-9545-78BCF5279AC4}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
| {35613A1C-A935-480D-9545-78BCF5279AC4}.Debug|x86.ActiveCfg = Debug|x86 | |||||
| {35613A1C-A935-480D-9545-78BCF5279AC4}.Debug|x86.Build.0 = Debug|x86 | |||||
| {35613A1C-A935-480D-9545-78BCF5279AC4}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
| {35613A1C-A935-480D-9545-78BCF5279AC4}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
| {35613A1C-A935-480D-9545-78BCF5279AC4}.Release|x86.ActiveCfg = Release|x86 | |||||
| {35613A1C-A935-480D-9545-78BCF5279AC4}.Release|x86.Build.0 = Release|x86 | |||||
| EndGlobalSection | |||||
| GlobalSection(SolutionProperties) = preSolution | |||||
| HideSolutionNode = FALSE | |||||
| EndGlobalSection | |||||
| EndGlobal | |||||
| @ -0,0 +1,8 @@ | |||||
| <Application x:Class="CowOutputClient.App" | |||||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
| StartupUri="MainWindow.xaml"> | |||||
| <Application.Resources> | |||||
| </Application.Resources> | |||||
| </Application> | |||||
| @ -0,0 +1,58 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Configuration; | |||||
| using System.Data; | |||||
| using System.Diagnostics; | |||||
| using System.IO; | |||||
| using System.Linq; | |||||
| using System.Windows; | |||||
| using CowOutputClient.Utils; | |||||
| using Update.Utils; | |||||
| namespace CowOutputClient | |||||
| { | |||||
| /// <summary> | |||||
| /// Interaction logic for App.xaml | |||||
| /// </summary> | |||||
| public partial class App : Application | |||||
| { | |||||
| public App() | |||||
| { | |||||
| //处理程序中未捕获的异常 | |||||
| DispatcherUnhandledException += App_DispatcherUnhandledException; | |||||
| } | |||||
| private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) | |||||
| { | |||||
| WindowUtil.Err(e.Exception.Message.ToString()); | |||||
| e.Handled = true; | |||||
| } | |||||
| protected override void OnStartup(StartupEventArgs e) | |||||
| { | |||||
| base.OnStartup(e); | |||||
| init(); | |||||
| LoginUtil.InitRpc(); | |||||
| Application currApp = Application.Current; | |||||
| currApp.StartupUri = new Uri("MainWindow.xaml", UriKind.RelativeOrAbsolute); | |||||
| } | |||||
| private void init() | |||||
| { | |||||
| var exePath = Process.GetCurrentProcess().MainModule.FileName; | |||||
| var folder = new FileInfo(exePath).Directory.FullName; | |||||
| var logFolder = Path.Combine(folder, "logs"); | |||||
| if (!Directory.Exists(logFolder)) { | |||||
| Directory.CreateDirectory(logFolder); | |||||
| } | |||||
| var fileName = string.Format("{0:yyyyMMdd}.log", DateTime.Now); | |||||
| var log = Path.Combine(logFolder, fileName); | |||||
| Trace.Listeners.Clear(); | |||||
| Trace.Listeners.Add(new TextWriterTraceListener(log)); | |||||
| Trace.AutoFlush = true; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,79 @@ | |||||
| <UserControl x:Class="CowOutputClient.CaptionBarButton" | |||||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
| mc:Ignorable="d" | |||||
| DataContext="{Binding RelativeSource={RelativeSource Self}}" | |||||
| d:DesignHeight="30" d:DesignWidth="100" | |||||
| Loaded="UserControl_Loaded"> | |||||
| <Grid> | |||||
| <Button Name="btnMinimize" HorizontalAlignment="Right" VerticalAlignment="Top" | |||||
| Width="30" Height="25" Margin="0,0,60,0" Click="btnMinimize_Click" | |||||
| Focusable="False" ToolTip="最小化"> | |||||
| <Button.Template> | |||||
| <ControlTemplate TargetType="{x:Type Button}"> | |||||
| <Border Name="Border" Background="#00000000"> | |||||
| <Grid> | |||||
| <Path Stroke="Black" StrokeThickness="3" Data="M 10,15 l 10,0"/> | |||||
| </Grid> | |||||
| </Border> | |||||
| <ControlTemplate.Triggers> | |||||
| <Trigger Property="IsMouseOver" Value="True"> | |||||
| <Setter TargetName="Border" Property="Background" Value="#20000000"/> | |||||
| </Trigger> | |||||
| <Trigger Property="IsPressed" Value="True"> | |||||
| <Setter TargetName="Border" Property="Background" Value="#80000000"/> | |||||
| </Trigger> | |||||
| </ControlTemplate.Triggers> | |||||
| </ControlTemplate> | |||||
| </Button.Template> | |||||
| </Button> | |||||
| <Button Name="btnMaximize" HorizontalAlignment="Right" VerticalAlignment="Top" | |||||
| Width="30" Height="25" Margin="0,0,30,0" Click="btnMaximize_Click" | |||||
| Focusable="False" ToolTip="{Binding MaximizeToolTip}"> | |||||
| <Button.Template> | |||||
| <ControlTemplate TargetType="{x:Type Button}"> | |||||
| <Border Name="Border" Background="#00000000"> | |||||
| <Grid> | |||||
| <Path Name="pathMaximize" Visibility="{Binding PathMaximizeVisibility}" | |||||
| Stroke="Black" StrokeThickness="2" Data="M 10,17 l 9,0 l 0 -6 l -9 0 l 0 7 M 11,8 l 11,0 l 0,9"/> | |||||
| <Path Name="pathNormal" Visibility="{Binding PathNormalVisibility}" | |||||
| Stroke="Black" StrokeThickness="2" Data="M 10,17 l 9,0 l 0 -6 l -9 0 l 0 7"/> | |||||
| </Grid> | |||||
| </Border> | |||||
| <ControlTemplate.Triggers> | |||||
| <Trigger Property="IsMouseOver" Value="True"> | |||||
| <Setter TargetName="Border" Property="Background" Value="#20000000"/> | |||||
| </Trigger> | |||||
| <Trigger Property="IsPressed" Value="True"> | |||||
| <Setter TargetName="Border" Property="Background" Value="#80000000"/> | |||||
| </Trigger> | |||||
| </ControlTemplate.Triggers> | |||||
| </ControlTemplate> | |||||
| </Button.Template> | |||||
| </Button> | |||||
| <Button Name="btnClose" HorizontalAlignment="Right" VerticalAlignment="Top" | |||||
| Width="30" Height="25" Margin="0,0,0,0" Click="btnClose_Click" | |||||
| Focusable="False" ToolTip="关闭"> | |||||
| <Button.Template> | |||||
| <ControlTemplate TargetType="{x:Type Button}"> | |||||
| <Border Name="Border" Background="#00000000"> | |||||
| <Grid> | |||||
| <Path Stroke="Black" StrokeThickness="3" Data="m 10,7.5 l 10,10 m 0,-10 l -10,10"/> | |||||
| </Grid> | |||||
| </Border> | |||||
| <ControlTemplate.Triggers> | |||||
| <Trigger Property="IsMouseOver" Value="True"> | |||||
| <Setter TargetName="Border" Property="Background" Value="#80ff0000"/> | |||||
| </Trigger> | |||||
| <Trigger Property="IsPressed" Value="True"> | |||||
| <Setter TargetName="Border" Property="Background" Value="#FFff0000"/> | |||||
| </Trigger> | |||||
| </ControlTemplate.Triggers> | |||||
| </ControlTemplate> | |||||
| </Button.Template> | |||||
| </Button> | |||||
| </Grid> | |||||
| </UserControl> | |||||
| @ -0,0 +1,155 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| 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 CowOutputClient | |||||
| { | |||||
| /// <summary> | |||||
| /// CaptionBarButton.xaml 的交互逻辑 | |||||
| /// </summary> | |||||
| public partial class CaptionBarButton : UserControl, INotifyPropertyChanged | |||||
| { | |||||
| public event Predicate<object> PreCloseRequest; | |||||
| public CaptionBarButton() | |||||
| { | |||||
| InitializeComponent(); | |||||
| } | |||||
| private Window CurWindow { get { return Window.GetWindow(this); } } | |||||
| public event PropertyChangedEventHandler PropertyChanged; | |||||
| public void Notify(string prop) | |||||
| { | |||||
| if (PropertyChanged != null) | |||||
| PropertyChanged.Invoke(this, new PropertyChangedEventArgs(prop)); | |||||
| } | |||||
| #region 依赖属性 | |||||
| public static readonly DependencyProperty CanMaxinizeProperty; | |||||
| public bool CanMaxinize | |||||
| { | |||||
| set { SetValue(CanMaxinizeProperty, value); } | |||||
| get { return (bool)GetValue(CanMaxinizeProperty); } | |||||
| } | |||||
| static void OnCanMaxinizePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) | |||||
| { | |||||
| CaptionBarButton cbb = obj as CaptionBarButton; | |||||
| cbb.btnMaximize.Visibility = cbb.CanMaxinize ? Visibility.Visible : Visibility.Hidden; | |||||
| cbb.btnMinimize.Margin = cbb.CanMaxinize ? new Thickness(0, 0, 60, 0) : new Thickness(0, 0, 30, 0); | |||||
| } | |||||
| public static readonly DependencyProperty CanMinimizeProperty; | |||||
| public bool CanMinimize | |||||
| { | |||||
| set { SetValue(CanMinimizeProperty, value); } | |||||
| get { return (bool)GetValue(CanMinimizeProperty); } | |||||
| } | |||||
| static void OnCanMinimizePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) | |||||
| { | |||||
| CaptionBarButton cbb = obj as CaptionBarButton; | |||||
| cbb.btnMinimize.Visibility = cbb.CanMinimize ? Visibility.Visible : Visibility.Hidden; | |||||
| } | |||||
| static CaptionBarButton() | |||||
| { | |||||
| FrameworkPropertyMetadata metadata1 = new FrameworkPropertyMetadata(true, OnCanMaxinizePropertyChanged); | |||||
| CanMaxinizeProperty = DependencyProperty.Register( | |||||
| "CanMaxinize", typeof(bool), typeof(CaptionBarButton), metadata1, null); | |||||
| FrameworkPropertyMetadata metadata2 = new FrameworkPropertyMetadata(true, OnCanMinimizePropertyChanged); | |||||
| CanMinimizeProperty = DependencyProperty.Register( | |||||
| "CanMinimize", typeof(bool), typeof(CaptionBarButton), metadata2, null); | |||||
| } | |||||
| #endregion | |||||
| /// <summary> | |||||
| /// 是否是最大化状态 | |||||
| /// </summary> | |||||
| private bool IsMaximize | |||||
| { | |||||
| get | |||||
| { | |||||
| if (CurWindow != null) | |||||
| return Window.GetWindow(this).WindowState == WindowState.Maximized; | |||||
| else | |||||
| return false; | |||||
| } | |||||
| set | |||||
| { | |||||
| if (CurWindow != null) | |||||
| CurWindow.WindowState = value ? WindowState.Maximized : WindowState.Normal; | |||||
| Notify("MaximizeToolTip"); | |||||
| Notify("PathMaximizeVisibility"); | |||||
| Notify("PathNormalVisibility"); | |||||
| } | |||||
| } | |||||
| public string MaximizeToolTip | |||||
| { | |||||
| get | |||||
| { | |||||
| return IsMaximize ? "还原" : "最大化"; | |||||
| } | |||||
| } | |||||
| public Visibility PathMaximizeVisibility | |||||
| { | |||||
| get | |||||
| { | |||||
| return IsMaximize ? Visibility.Visible : Visibility.Hidden; | |||||
| } | |||||
| } | |||||
| public Visibility PathNormalVisibility | |||||
| { | |||||
| get | |||||
| { | |||||
| return IsMaximize ? Visibility.Hidden : Visibility.Visible; | |||||
| } | |||||
| } | |||||
| private void btnClose_Click(object sender, RoutedEventArgs e) | |||||
| { | |||||
| if (PreCloseRequest == null || PreCloseRequest(this)) | |||||
| CurWindow.Close(); | |||||
| } | |||||
| private void btnMinimize_Click(object sender, RoutedEventArgs e) | |||||
| { | |||||
| CurWindow.WindowState = WindowState.Minimized; | |||||
| } | |||||
| private void btnMaximize_Click(object sender, RoutedEventArgs e) | |||||
| { | |||||
| IsMaximize = !IsMaximize; | |||||
| } | |||||
| private void UserControl_Loaded(object sender, RoutedEventArgs e) | |||||
| { | |||||
| if (CurWindow != null) | |||||
| { | |||||
| IsMaximize = CurWindow.WindowState == WindowState.Maximized; | |||||
| CurWindow.StateChanged += (s, args) => | |||||
| { | |||||
| Notify("MaximizeToolTip"); | |||||
| Notify("PathMaximizeVisibility"); | |||||
| Notify("PathNormalVisibility"); | |||||
| }; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,160 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" 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>{F216A33C-71D2-4E4A-926A-B315C2A8B0CE}</ProjectGuid> | |||||
| <OutputType>WinExe</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>CowOutputClient</RootNamespace> | |||||
| <AssemblyName>CowOutputClient</AssemblyName> | |||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||||
| <PlatformTarget>x86</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="FirebirdSql.Data.FirebirdClient"> | |||||
| <HintPath>..\..\牛屠宰分割\B3CowButcherClient\FireBirdUtil\FirebirdSql.Data.FirebirdClient.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\..\牛屠宰分割\B3CowButcherClient\B3CowButcherClient\bin\Debug\Forks.JsonRpc.Client.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="System" /> | |||||
| <Reference Include="System.configuration" /> | |||||
| <Reference Include="System.Data" /> | |||||
| <Reference Include="System.Xml" /> | |||||
| <Reference Include="Microsoft.CSharp" /> | |||||
| <Reference Include="System.Core" /> | |||||
| <Reference Include="System.Xml.Linq" /> | |||||
| <Reference Include="System.Data.DataSetExtensions" /> | |||||
| <Reference Include="System.Xaml"> | |||||
| <RequiredTargetFramework>4.0</RequiredTargetFramework> | |||||
| </Reference> | |||||
| <Reference Include="WindowsBase" /> | |||||
| <Reference Include="PresentationCore" /> | |||||
| <Reference Include="PresentationFramework" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ApplicationDefinition Include="App.xaml"> | |||||
| <Generator>MSBuild:Compile</Generator> | |||||
| <SubType>Designer</SubType> | |||||
| </ApplicationDefinition> | |||||
| <Compile Include="OperateWindow.xaml.cs"> | |||||
| <DependentUpon>OperateWindow.xaml</DependentUpon> | |||||
| </Compile> | |||||
| <Compile Include="SelectedProductWindow.xaml.cs"> | |||||
| <DependentUpon>SelectedProductWindow.xaml</DependentUpon> | |||||
| </Compile> | |||||
| <Compile Include="Utils\WindowUtil.cs" /> | |||||
| <Page Include="Controls\CaptionBarButton.xaml"> | |||||
| <Generator>MSBuild:Compile</Generator> | |||||
| <SubType>Designer</SubType> | |||||
| </Page> | |||||
| <Page Include="MainWindow.xaml"> | |||||
| <Generator>MSBuild:Compile</Generator> | |||||
| <SubType>Designer</SubType> | |||||
| </Page> | |||||
| <Compile Include="App.xaml.cs"> | |||||
| <DependentUpon>App.xaml</DependentUpon> | |||||
| <SubType>Code</SubType> | |||||
| </Compile> | |||||
| <Compile Include="Controls\CaptionBarButton.xaml.cs"> | |||||
| <DependentUpon>CaptionBarButton.xaml</DependentUpon> | |||||
| </Compile> | |||||
| <Compile Include="MainWindow.xaml.cs"> | |||||
| <DependentUpon>MainWindow.xaml</DependentUpon> | |||||
| <SubType>Code</SubType> | |||||
| </Compile> | |||||
| <Page Include="OperateWindow.xaml"> | |||||
| <Generator>MSBuild:Compile</Generator> | |||||
| <SubType>Designer</SubType> | |||||
| </Page> | |||||
| <Page Include="SelectedProductWindow.xaml"> | |||||
| <SubType>Designer</SubType> | |||||
| <Generator>MSBuild:Compile</Generator> | |||||
| </Page> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="Properties\AssemblyInfo.cs"> | |||||
| <SubType>Code</SubType> | |||||
| </Compile> | |||||
| <Compile Include="Properties\Resources.Designer.cs"> | |||||
| <AutoGen>True</AutoGen> | |||||
| <DesignTime>True</DesignTime> | |||||
| <DependentUpon>Resources.resx</DependentUpon> | |||||
| </Compile> | |||||
| <Compile Include="Properties\Settings.Designer.cs"> | |||||
| <AutoGen>True</AutoGen> | |||||
| <DependentUpon>Settings.settings</DependentUpon> | |||||
| <DesignTimeSharedInput>True</DesignTimeSharedInput> | |||||
| </Compile> | |||||
| <EmbeddedResource Include="Properties\Resources.resx"> | |||||
| <Generator>ResXFileCodeGenerator</Generator> | |||||
| <LastGenOutput>Resources.Designer.cs</LastGenOutput> | |||||
| </EmbeddedResource> | |||||
| <None Include="app.config" /> | |||||
| <None Include="Properties\Settings.settings"> | |||||
| <Generator>SettingsSingleFileGenerator</Generator> | |||||
| <LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||||
| </None> | |||||
| <AppDesigner Include="Properties\" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Resource Include="Images\u15.png" /> | |||||
| <Resource Include="Images\u17.png" /> | |||||
| <Resource Include="Images\u19.png" /> | |||||
| <Resource Include="Images\u37.png" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\FireBirdUtil\FireBirdUtil.csproj"> | |||||
| <Project>{3b09e2b6-b649-47de-bf8d-2e233d47acfd}</Project> | |||||
| <Name>FireBirdUtil</Name> | |||||
| </ProjectReference> | |||||
| <ProjectReference Include="..\KeyPad\KeyPad.csproj"> | |||||
| <Project>{3adbff38-915c-4115-9cdd-81c0cad9733a}</Project> | |||||
| <Name>KeyPad</Name> | |||||
| </ProjectReference> | |||||
| <ProjectReference Include="..\Update\Update.csproj"> | |||||
| <Project>{4768fdf9-dbc5-441f-ac59-5655146b8961}</Project> | |||||
| <Name>Update</Name> | |||||
| </ProjectReference> | |||||
| <ProjectReference Include="..\Utils\Utils.csproj"> | |||||
| <Project>{d123a086-c03a-4b8b-befb-124e102d3ade}</Project> | |||||
| <Name>Utils</Name> | |||||
| </ProjectReference> | |||||
| <ProjectReference Include="..\WeighBusiness\WeighBusiness.csproj"> | |||||
| <Project>{35613a1c-a935-480d-9545-78bcf5279ac4}</Project> | |||||
| <Name>WeighBusiness</Name> | |||||
| </ProjectReference> | |||||
| </ItemGroup> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||||
| Other similar extension points exist, see Microsoft.Common.targets. | |||||
| <Target Name="BeforeBuild"> | |||||
| </Target> | |||||
| <Target Name="AfterBuild"> | |||||
| </Target> | |||||
| --> | |||||
| </Project> | |||||
| @ -0,0 +1,63 @@ | |||||
| <Window | |||||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
| xmlns:cc="clr-namespace:CowOutputClient" | |||||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
| mc:Ignorable="d" | |||||
| x:Class="CowOutputClient.MainWindow" | |||||
| Title="MainWindow" Height="500" Width="705" Loaded="Window_Loaded" WindowStyle="None" AllowsTransparency="True" Background="#0fff" WindowStartupLocation="CenterScreen" > | |||||
| <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown"> | |||||
| <Border CornerRadius="20" Background="#ccc"> | |||||
| <Border Margin="20" Background="White"> | |||||
| </Border> | |||||
| </Border> | |||||
| <Button x:Name="btnLogin" Content="登录" HorizontalAlignment="Center" Margin="15,300,0,0" VerticalAlignment="Center" Width="130" Height="40" RenderTransformOrigin="0.493,5.079" Click="btnLogin_Click"> | |||||
| <Button.Template> | |||||
| <ControlTemplate TargetType="{x:Type Button}"> | |||||
| <Grid> | |||||
| <Border Name="border"> | |||||
| <Border.Background> | |||||
| <ImageBrush Opacity="0.5" ImageSource="/CowOutputClient;component/Images/u15.png"/> | |||||
| </Border.Background> | |||||
| </Border> | |||||
| <TextBlock Text="登 录" Foreground="White" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" /> | |||||
| </Grid> | |||||
| <ControlTemplate.Triggers> | |||||
| <Trigger Property="IsMouseOver" Value="True"> | |||||
| <Setter TargetName="border" Property="Background"> | |||||
| <Setter.Value> | |||||
| <ImageBrush ImageSource="/CowOutputClient;component/Images/u15.png"/> | |||||
| </Setter.Value> | |||||
| </Setter> | |||||
| </Trigger> | |||||
| <Trigger Property="IsPressed" Value="True"> | |||||
| <Setter TargetName="border" Property="Background"> | |||||
| <Setter.Value> | |||||
| <ImageBrush ImageSource="/CowOutputClient;component/Images/u15.png"/> | |||||
| </Setter.Value> | |||||
| </Setter> | |||||
| </Trigger> | |||||
| </ControlTemplate.Triggers> | |||||
| </ControlTemplate> | |||||
| </Button.Template> | |||||
| <Button.Background> | |||||
| <ImageBrush ImageSource="/CowOutputClient;component/Images/u15.png" Stretch="Fill"/> | |||||
| </Button.Background> | |||||
| </Button> | |||||
| <!--<Label Content="地址" Foreground="#666" FontSize="20px" HorizontalAlignment="Center" Margin="-240,-100,0,0" VerticalAlignment="Center"/> | |||||
| <TextBox x:Name="txtUrlPath" VerticalContentAlignment="Center" Background="#f0f0f0" IsReadOnly="True" BorderBrush="#9a9a9a" HorizontalAlignment="Center" Height="26" Margin="40,-100,0,0" VerticalAlignment="Center" Width="220"/>--> | |||||
| <Label Content="用户名" Foreground="#666" FontSize="20px" HorizontalAlignment="Center" Margin="-260,90,0,0" VerticalAlignment="Center"/> | |||||
| <TextBox x:Name="txtUserName" PreviewMouseDown="txtUserName_PreviewMouseDown" VerticalContentAlignment="Center" BorderBrush="#9a9a9a" HorizontalAlignment="Center" Height="26" Margin="40,90,0,0" VerticalAlignment="Center" Width="220" /> | |||||
| <Label Content="密码" Foreground="#666" BorderBrush="#9a9a9a" FontSize="20px" HorizontalAlignment="Center" Margin="-240,170,0,0" VerticalAlignment="Center"/> | |||||
| <PasswordBox x:Name="txtPassWord" PreviewMouseDown="txtPassWord_PreviewMouseDown" VerticalContentAlignment="Center" BorderBrush="#9a9a9a" HorizontalAlignment="Center" Height="26" Margin="40,170,0,0" VerticalAlignment="Center" Width="220"/> | |||||
| <Image Source="/CowOutputClient;component/Images/u17.png" HorizontalAlignment="Center" Height="100" Margin="0,-224,0,0" VerticalAlignment="Center" Width="100"/> | |||||
| <cc:CaptionBarButton Margin="0,20,20,0" HorizontalAlignment="Right" VerticalAlignment="Top" Width="200" Height="50"/> | |||||
| <!--<Image Source="/CutupClient;component/Images/u19.png" HorizontalAlignment="Center" Height="25" Margin="300,-100,0,0" VerticalAlignment="Center" Width="25" MouseDown="Image_MouseDown"/>--> | |||||
| <!--<Button Content="Button" Click="Button_Click_1" HorizontalAlignment="Left" Margin="81,395,0,0" VerticalAlignment="Top" Width="75"/>--> | |||||
| </Grid> | |||||
| </Window> | |||||
| @ -0,0 +1,204 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| 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; | |||||
| using CowOutputClient.Utils; | |||||
| using Forks.JsonRpc.Client; | |||||
| using Forks.JsonRpc.Client.Data; | |||||
| using CowOutputClient.Utils; | |||||
| using KeyPad; | |||||
| using Update.Utils; | |||||
| using Utils; | |||||
| using WeighBusiness.BL; | |||||
| using WeighBusiness.BO; | |||||
| using WeighBusiness.Utils; | |||||
| namespace CowOutputClient | |||||
| { | |||||
| /// <summary> | |||||
| /// Interaction logic for MainWindow.xaml | |||||
| /// </summary> | |||||
| public partial class MainWindow : Window | |||||
| { | |||||
| public MainWindow() | |||||
| { | |||||
| InitializeComponent(); | |||||
| } | |||||
| private void btnLogin_Click(object sender, RoutedEventArgs e) | |||||
| { | |||||
| try { | |||||
| if (string.IsNullOrEmpty(txtUserName.Text)) { | |||||
| WindowUtil.Warn("用户名不能为空"); | |||||
| return; | |||||
| } | |||||
| string errorInfo; | |||||
| var isExist = UserBL.Exist(txtUserName.Text); | |||||
| var success = LoginUtil.Login(txtUserName.Text, txtPassWord.Password, out errorInfo); | |||||
| if (!success) { | |||||
| if (!string.IsNullOrEmpty(errorInfo)) { | |||||
| if (!isExist) { | |||||
| if (errorInfo == "无法连接到远程服务器" || errorInfo == "Unable to connect to the remote server") { | |||||
| WindowUtil.Warn("网络不通请联系管理员"); | |||||
| return; | |||||
| } | |||||
| WindowUtil.Warn(errorInfo); | |||||
| return; | |||||
| } | |||||
| if (errorInfo == "无法连接到远程服务器" || errorInfo.Contains("Unable to connect to the remote server")) { | |||||
| //"无法连接到远程服务器" 就登录客户端本地 | |||||
| LoginClient(); | |||||
| } else { | |||||
| WindowUtil.Warn(errorInfo); | |||||
| return; | |||||
| } | |||||
| } | |||||
| } else { | |||||
| UpdateERPUser(); | |||||
| } | |||||
| BusinessInfosSync(); | |||||
| ShowWinodw(); | |||||
| } catch (Exception exe) { | |||||
| LogUtil.LogError("登录报错:" + exe.Message); | |||||
| WindowUtil.Err(exe.ToString()); | |||||
| } | |||||
| } | |||||
| private void BusinessInfosSync() | |||||
| { | |||||
| WpfUserBL.SyncWpfUser(); | |||||
| ProductCatalogBL.SyncProductCatalog(); | |||||
| ProductPlanBL.SyncProductPlan(); | |||||
| ProductTeamBL.SyncProductTeam(); | |||||
| } | |||||
| private void ShowWinodw() | |||||
| { | |||||
| var window = new OperateWindow(); | |||||
| window.WindowState = System.Windows.WindowState.Maximized; | |||||
| window.Focus(); | |||||
| this.Visibility = System.Windows.Visibility.Hidden; | |||||
| App.Current.MainWindow = window; | |||||
| App.Current.MainWindow.Show(); | |||||
| this.Close(); | |||||
| } | |||||
| public void LoginClient() | |||||
| { | |||||
| try { | |||||
| var clientLogin = UserBL.LoginTerminal(txtUserName.Text, txtPassWord.Password); | |||||
| if (!clientLogin) { | |||||
| WindowUtil.Inf("无法连接到远程服务器,当前为离线登录模式,用户名或密码不正确"); | |||||
| } | |||||
| } catch (LoginError error) { | |||||
| WindowUtil.Err(error.Message); | |||||
| } | |||||
| } | |||||
| private void UpdateERPUser() | |||||
| { | |||||
| var clientUser = UserBL.Load(txtUserName.Text); | |||||
| if (clientUser == null) { | |||||
| clientUser = CreateERPUser(clientUser); | |||||
| SetUserIsAdmin(clientUser); | |||||
| UserBL.Save(clientUser, false); | |||||
| } else { | |||||
| clientUser.ERP_User_Password = txtPassWord.Password; | |||||
| SetUserIsAdmin(clientUser); | |||||
| UserBL.Save(clientUser, false); | |||||
| } | |||||
| UserBL.CurrentUser = clientUser; | |||||
| } | |||||
| private User CreateERPUser(User clientUser) | |||||
| { | |||||
| var wpfUser = RpcFacade.Call<RpcObject>("/MainSystem/B3_HaoYue/Rpcs/RpcFun/GetCurrentUser"); | |||||
| clientUser = new User() { | |||||
| ERP_User_Name = txtUserName.Text, | |||||
| ERP_User_Password = UserBL.EncodeUserPassword(txtPassWord.Password), | |||||
| ERP_User_ID = wpfUser == null ? 0 : wpfUser.Get<long>("ID"), | |||||
| IsDomainManager = false, | |||||
| }; | |||||
| return clientUser; | |||||
| } | |||||
| private void SetUserIsAdmin(User user) | |||||
| { | |||||
| string method = "/MainSystem/B3_HaoYue/Rpcs/RpcFun/CheckCurrentUserRole"; | |||||
| try { | |||||
| user.IsAdmin = RpcFacade.Call<bool>(method); | |||||
| } catch (Exception e) { | |||||
| } | |||||
| } | |||||
| private void Window_Loaded(object sender, RoutedEventArgs e) | |||||
| { | |||||
| CheckDataBase(); | |||||
| } | |||||
| private static void CheckDataBase() | |||||
| { | |||||
| var creatDatabaseOrTableError = CreateUtil.CreateDataBaseAndTable(); | |||||
| if (!string.IsNullOrEmpty(creatDatabaseOrTableError)) { | |||||
| WindowUtil.Warn(creatDatabaseOrTableError); | |||||
| } | |||||
| } | |||||
| private void txtPassWord_PreviewMouseDown(object sender, MouseButtonEventArgs e) | |||||
| { | |||||
| var keypadWindow = new Keypad(this); | |||||
| if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) { | |||||
| try { | |||||
| txtPassWord.Password = keypadWindow.Result; | |||||
| } catch (Exception ex) { | |||||
| LogUtil.LogError(ex); | |||||
| } | |||||
| } | |||||
| } | |||||
| private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||||
| { | |||||
| DragMove(); | |||||
| } | |||||
| private void txtUserName_PreviewMouseDown(object sender, MouseButtonEventArgs e) | |||||
| { | |||||
| var keypadWindow = new Keypad(this); | |||||
| if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) { | |||||
| try { | |||||
| txtUserName.Text = OnLineLoadNameByCode(keypadWindow.Result); | |||||
| } catch (Exception ex) { | |||||
| LogUtil.LogError(ex); | |||||
| var wpfUser = WpfUserBL.LoadByCode(keypadWindow.Result); | |||||
| if (wpfUser != null && !string.IsNullOrEmpty(wpfUser.WpfUser_Name)) { | |||||
| txtUserName.Text = wpfUser.WpfUser_Name; | |||||
| } else { | |||||
| WindowUtil.Err("您是第一次登录,网络不通无法进入系统,请联系管理员"); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| public static string OnLineLoadNameByCode(string code) | |||||
| { | |||||
| string wpfUserMethod = "/MainSystem/B3_HaoYue/Rpcs/RpcFun/GetWpfUserInfoByIds"; | |||||
| var wpfUsers = RpcFacade.Call<IList<RpcObject>>(wpfUserMethod, null, code); | |||||
| if (wpfUsers.Count() > 0) { | |||||
| return wpfUsers[0].Get<string>("Name"); | |||||
| } | |||||
| return string.Empty; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,142 @@ | |||||
| <Window x:Class="CowOutputClient.OperateWindow" | |||||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
| Title="OperateWindow" Height="768" Width="1064" WindowStyle="None" AllowsTransparency="True" Background="#0fff" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded_1" > | |||||
| <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown"> | |||||
| <Border CornerRadius="20" Background="#ccc"> | |||||
| <Border Margin="20" Background="White"> | |||||
| </Border> | |||||
| </Border> | |||||
| <TextBlock Text="" Name="ComWeight" HorizontalAlignment="Left" TextAlignment="Center" Background="Black" Foreground="Green" FontSize="35" VerticalAlignment="Top" Margin="30,30,0,0" Width="120" Height="50"/> | |||||
| <Button Focusable="False" Content="产品配置" Name="btnProductSet" Click="btnProductSet_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="280,30,0,0" VerticalAlignment="Top" Width="100" Height="40"/> | |||||
| <WrapPanel Name="ProductCatalogPanel" ItemHeight="45" ItemWidth="110" Width="350" Height="100" Margin="30,90,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"> | |||||
| <!--<Button Focusable="False" Content="鲜品" Name="btn4" Click="btnCreateBill_Click" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn3" Click="btnCreateBill_Click" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn2" Click="btnCreateBill_Click" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn5" Click="btnCreateBill_Click" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn6" Click="btnCreateBill_Click" FontSize="20" Margin="10,0,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn8" Click="btnCreateBill_Click" FontSize="20" Margin="10,0,0,0" />--> | |||||
| </WrapPanel> | |||||
| <!--<StackPanel Orientation="Horizontal" Height="90" Width="350" Margin="30,100,0,0" > | |||||
| </StackPanel>--> | |||||
| <Grid Name="Grid1" Margin="30,200,0,0" Width="350" Height="540" HorizontalAlignment="Left" VerticalAlignment="Top"> | |||||
| <Border BorderThickness="1" BorderBrush="Black"> | |||||
| </Border> | |||||
| <ScrollViewer x:Name="scrList" Margin="0" VerticalScrollBarVisibility="Auto"> | |||||
| <!--<WrapPanel Name="CatalogDetails" ItemHeight="45" ItemWidth="110" Width="350" Height="540" >--> | |||||
| <WrapPanel Name="CatalogDetails" ItemHeight="50" ItemWidth="160" Margin="0" Width="{Binding ElementName=scrList, Path=Width, Mode=OneWay}"> | |||||
| </WrapPanel> | |||||
| </ScrollViewer> | |||||
| </Grid> | |||||
| <!--<Label Content="生产班组:" FontSize="20px" HorizontalAlignment="Left" Margin="400,20,0,0" VerticalAlignment="Top" /> | |||||
| <Label Content="分割一线" FontSize="20px" HorizontalAlignment="Left" Margin="500,20,0,0" VerticalAlignment="Top" /> | |||||
| <Label Content="用户:" FontSize="20px" HorizontalAlignment="Left" Margin="650,20,0,0" VerticalAlignment="Top" /> | |||||
| <Label Content="张三" FontSize="20px" HorizontalAlignment="Left" Margin="710,20,0,0" VerticalAlignment="Top" />--> | |||||
| <Button Focusable="False" Content="注销" Name="btnLogOut" Click="btnLogOut_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="900,30,0,0" VerticalAlignment="Top" Width="100" Height="40"/> | |||||
| <Label Content="生产日期" FontSize="20px" HorizontalAlignment="Left" Margin="400,60,0,0" VerticalAlignment="Top" /> | |||||
| <!--<TextBox x:Name="txtProductDate" VerticalContentAlignment="Center" HorizontalAlignment="Left" Height="26" Margin="500,65,0,0" VerticalAlignment="Top" Width="220"/>--> | |||||
| <Grid Width="260" Height="35" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="500,65,0,0"> | |||||
| <TextBox x:Name="txtProduceYear" Text="" FontSize="18" PreviewMouseDown="txtProduceYear_PreviewMouseDown_1" IsReadOnly="True" HorizontalAlignment="Left" Height="26" Margin="10,5,0,0" VerticalAlignment="Top" Width="70" TextAlignment="Center"/> | |||||
| <TextBlock Text="年" FontSize="20" Margin="90,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/> | |||||
| <TextBox x:Name="txtProduceMonth" FontSize="18" PreviewMouseDown="txtProduceMonth_PreviewMouseDown_1" IsReadOnly="True" HorizontalAlignment="Left" Height="26" Margin="115,5,0,0" VerticalAlignment="Top" Width="40" TextAlignment="Center"/> | |||||
| <TextBlock Text="月" FontSize="20" Margin="160,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" TextAlignment="Center"/> | |||||
| <TextBox x:Name="txtProduceDay" FontSize="18" PreviewMouseDown="txtProduceDay_PreviewMouseDown_1" IsReadOnly="True" HorizontalAlignment="Left" Height="26" Margin="185,5,0,0" VerticalAlignment="Top" Width="40" /> | |||||
| <TextBlock Text="日" FontSize="20" Margin="230,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/> | |||||
| </Grid> | |||||
| <Label Content="生产批次" FontSize="20px" HorizontalAlignment="Left" Margin="400,100,0,0" VerticalAlignment="Top" /> | |||||
| <ComboBox Name="combProductBatch" FontSize="18" Height="30" Width="200" HorizontalAlignment="Left" Margin="500,110,0,0" VerticalAlignment="Top" /> | |||||
| <Button Focusable="False" Content="同步数据" Name="SyncData" Click="SyncData_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="750,100,0,0" VerticalAlignment="Top" Width="100" Height="40"/> | |||||
| <Button Focusable="False" Content="创建产出单" Name="CreateOutPut" Click="CreateOutPut_Click_1" FontSize="20" HorizontalAlignment="Left" Margin="900,100,0,0" VerticalAlignment="Top" Width="130" Height="40"/> | |||||
| <DataGrid HorizontalAlignment="Left" VerticalAlignment="Top" SelectionChanged="gridProductPlan_SelectionChanged_1" HeadersVisibility="Column" Name="gridProductPlan" EnableColumnVirtualization="True" EnableRowVirtualization="True" AutoGenerateColumns="False" CanUserAddRows="False" Width="640" Height="300" Margin="400,150,0,0" > | |||||
| <DataGrid.RowStyle> | |||||
| <Style TargetType="DataGridRow"> | |||||
| <Setter Property="Height" Value="40" /> | |||||
| <Setter Property="FontSize" Value="15"/> | |||||
| </Style> | |||||
| </DataGrid.RowStyle> | |||||
| <DataGrid.ColumnHeaderStyle> | |||||
| <Style | |||||
| TargetType="DataGridColumnHeader"> | |||||
| <Setter | |||||
| Property="HorizontalContentAlignment" Value="Center"> | |||||
| </Setter> | |||||
| <Setter Property="Height" Value="40" /> | |||||
| <Setter Property="FontSize" Value="15"/> | |||||
| </Style> | |||||
| </DataGrid.ColumnHeaderStyle> | |||||
| <DataGrid.Columns> | |||||
| <DataGridTextColumn Binding="{Binding Goods_Name}" IsReadOnly="True" Header="产品名称" Width="2*"/> | |||||
| <DataGridTextColumn Binding="{Binding Goods_Spec}" IsReadOnly="True" Header="规格" Width="2*"/> | |||||
| <DataGridTextColumn IsReadOnly="True" Binding="{Binding PlanNumber}" Header="计划数量" Width="2*"/> | |||||
| <DataGridTextColumn IsReadOnly="True" Binding="{Binding FinishNum}" Header="完工数量" Width="2*"/> | |||||
| <DataGridTextColumn IsReadOnly="True" Binding="{Binding SurplusNum}" Header="余数" Width="2*"/> | |||||
| <DataGridTemplateColumn Header="操作" Width="1.5*"> | |||||
| <DataGridTemplateColumn.CellTemplate> | |||||
| <DataTemplate> | |||||
| <Button Content="完毕" | |||||
| Click="Button_Click_1" | |||||
| Tag="{Binding}" | |||||
| FontSize="20" | |||||
| /> | |||||
| </DataTemplate> | |||||
| </DataGridTemplateColumn.CellTemplate> | |||||
| </DataGridTemplateColumn> | |||||
| </DataGrid.Columns> | |||||
| </DataGrid> | |||||
| <DataGrid HorizontalAlignment="Left" VerticalAlignment="Top" Margin="400,470,0,0" HeadersVisibility="Column" Name="gridWeightInfo" EnableColumnVirtualization="True" EnableRowVirtualization="True" AutoGenerateColumns="False" CanUserAddRows="False" Width="640" Height="270" > | |||||
| <DataGrid.RowStyle> | |||||
| <Style TargetType="DataGridRow"> | |||||
| <Setter Property="Height" Value="40" /> | |||||
| <Setter Property="FontSize" Value="15"/> | |||||
| </Style> | |||||
| </DataGrid.RowStyle> | |||||
| <DataGrid.ColumnHeaderStyle> | |||||
| <Style | |||||
| TargetType="DataGridColumnHeader"> | |||||
| <Setter | |||||
| Property="HorizontalContentAlignment" Value="Center"> | |||||
| </Setter> | |||||
| <Setter Property="Height" Value="40" /> | |||||
| <Setter Property="FontSize" Value="15"/> | |||||
| </Style> | |||||
| </DataGrid.ColumnHeaderStyle> | |||||
| <DataGrid.Columns> | |||||
| <DataGridTemplateColumn> | |||||
| <DataGridTemplateColumn.HeaderTemplate> | |||||
| <DataTemplate> | |||||
| <CheckBox x:Name="CheckAll" Click="CheckAll_Click_1"/> | |||||
| </DataTemplate> | |||||
| </DataGridTemplateColumn.HeaderTemplate> | |||||
| <DataGridTemplateColumn.CellTemplate> | |||||
| <DataTemplate> | |||||
| <CheckBox x:Name="cb" Click="cb_Click_1" IsChecked="{Binding IsSelected}" /> | |||||
| </DataTemplate> | |||||
| </DataGridTemplateColumn.CellTemplate> | |||||
| </DataGridTemplateColumn> | |||||
| <DataGridTextColumn Binding="{Binding Number}" IsReadOnly="True" Header="序号" Width="1*"/> | |||||
| <DataGridTextColumn Binding="{Binding Goods_Name}" IsReadOnly="True" Header="产品名称" Width="3*"/> | |||||
| <DataGridTextColumn Binding="{Binding Goods_Spec}" IsReadOnly="True" Header="规格" Width="2*"/> | |||||
| <DataGridTextColumn IsReadOnly="True" Binding="{Binding NetWeight}" Header="净重" Width="1*"/> | |||||
| <DataGridTextColumn IsReadOnly="True" Binding="{Binding Weight}" Header="毛重" Width="1*"/> | |||||
| <DataGridTextColumn IsReadOnly="True" Binding="{Binding SubWeight}" Header="皮重" Width="1*"/> | |||||
| <DataGridTextColumn IsReadOnly="True" Binding="{Binding Num}" Header="数量" Width="1*"/> | |||||
| <DataGridTemplateColumn Header="操作" Width="1.5*"> | |||||
| <DataGridTemplateColumn.CellTemplate> | |||||
| <DataTemplate> | |||||
| <Button Content="删除" | |||||
| Click="DeleteButton_Click_2" | |||||
| Tag="{Binding}" | |||||
| FontSize="20" | |||||
| /> | |||||
| </DataTemplate> | |||||
| </DataGridTemplateColumn.CellTemplate> | |||||
| </DataGridTemplateColumn> | |||||
| </DataGrid.Columns> | |||||
| </DataGrid> | |||||
| </Grid> | |||||
| </Window> | |||||
| @ -0,0 +1,428 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Configuration; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| 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.Shapes; | |||||
| using CowOutputClient.Utils; | |||||
| using Forks.JsonRpc.Client; | |||||
| using Forks.JsonRpc.Client.Data; | |||||
| using KeyPad; | |||||
| using SerialPortWebSocketAdapter; | |||||
| using WeighBusiness.BL; | |||||
| using WeighBusiness.BO; | |||||
| using WeighBusiness.Utils.SqlUtils; | |||||
| namespace CowOutputClient | |||||
| { | |||||
| /// <summary> | |||||
| /// Interaction logic for OperateWindow.xaml | |||||
| /// </summary> | |||||
| public partial class OperateWindow : Window | |||||
| { | |||||
| MyThread thread1; | |||||
| string param; | |||||
| WpfUser wpfUser; | |||||
| ProductTeam mTeam; | |||||
| DateTime mProduceDate; | |||||
| string accountingUnit_ID = ConfigurationManager.AppSettings["AccountingUnit_ID"]; | |||||
| string domain_ID = ConfigurationManager.AppSettings["Domain_ID"]; | |||||
| ButcherDetailData mButcherDetailData; | |||||
| public OperateWindow() | |||||
| { | |||||
| InitializeComponent(); | |||||
| } | |||||
| private void btnLogOut_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| thread1.CloseThread(); | |||||
| App.Current.MainWindow = new MainWindow(); | |||||
| App.Current.MainWindow.Show(); | |||||
| this.Close(); | |||||
| } | |||||
| private void SyncData_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| WpfUserBL.SyncWpfUser(); | |||||
| ProductCatalogBL.SyncProductCatalog(); | |||||
| ProductPlanBL.SyncProductPlan(); | |||||
| ProductTeamBL.SyncProductTeam(); | |||||
| BindCombProductBatch(); | |||||
| BindGridProductPlan(); | |||||
| WindowUtil.Inf("同步成功"); | |||||
| } | |||||
| private void CreateOutPut_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| if (combProductBatch.SelectedValue == null) | |||||
| throw new ApplicationException("请选择分割生产批次"); | |||||
| var weightInfos = gridWeightInfo.ItemsSource as List<WeightInfo>; | |||||
| var selectedItems = weightInfos.Where(x=>x.IsSelected); | |||||
| if (selectedItems.Count() <= 0) | |||||
| throw new ApplicationException("请先勾选称重记录"); | |||||
| var output = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output"); | |||||
| output.Set<long?>("AccountingUnit_ID", long.Parse(accountingUnit_ID)); | |||||
| output.Set<long?>("Department_ID", 0); | |||||
| output.Set<long?>("Domain_ID", long.Parse(domain_ID)); | |||||
| output.Set<long?>("Employee_ID", wpfUser.Employee_ID ?? 0); | |||||
| output.Set<long?>("ProductBatch_ID", (long)combProductBatch.SelectedValue); | |||||
| var details = new ManyList("/MainSystem/B3CowButcherManage/BO/Output_Detail"); | |||||
| foreach (var item in selectedItems) { | |||||
| var inputDetail = new RpcObject("/MainSystem/B3CowButcherManage/BO/Output_Detail"); | |||||
| inputDetail.Set<long?>("Goods_ID", item.Goods_ID); | |||||
| inputDetail.Set<decimal?>("Number", item.Weight); | |||||
| details.Add(inputDetail); | |||||
| } | |||||
| output.Set("Details", details); | |||||
| var outputId = RpcFacade.Call<long>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/CreateOutput", output); | |||||
| if (outputId > 0) { | |||||
| WeightInfoBL.UpdateOutputId(selectedItems.Select(x => x.ID).ToArray(), outputId); | |||||
| //BindGridInputInfo(); | |||||
| BindGridWeightInfo(); | |||||
| WindowUtil.Inf("生成产出单No." + outputId); | |||||
| } | |||||
| } | |||||
| List<ProCataGoods> catalogsDetails = new List<ProCataGoods>(); | |||||
| private void BindBaseData() | |||||
| { | |||||
| txtProduceYear.Text = DateTime.Now.ToString("yyyy"); | |||||
| txtProduceMonth.Text = DateTime.Now.ToString("MM"); | |||||
| txtProduceDay.Text = DateTime.Now.ToString("dd"); | |||||
| mProduceDate = DateTime.Now.Date; | |||||
| BindProductCatalogs(); | |||||
| BindCombProductBatch(); | |||||
| BindGridProductPlan(); | |||||
| BindGridWeightInfo(); | |||||
| } | |||||
| private void BindProductCatalogs() | |||||
| { | |||||
| ProductCatalogPanel.Children.Clear(); | |||||
| var catalogs = ProductCatalogBL.GetProductCatalogs(); | |||||
| catalogsDetails = ProductCatalogBL.GetProductCatalogDetails(true); | |||||
| if (catalogs.Count() > 0) { | |||||
| foreach (var catalog in catalogs) { | |||||
| var txtCatalog = new TextBlock() { Text = catalog.Name, FontSize = 20, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Center }; | |||||
| txtCatalog.Tag = catalog; | |||||
| txtCatalog.MouseDown += (object sende, MouseButtonEventArgs args) => { | |||||
| if (ProductCatalogPanel.Children != null && ProductCatalogPanel.Children.Count > 0) { | |||||
| foreach (var item in ProductCatalogPanel.Children) { | |||||
| var bor = item as Border; | |||||
| if (bor != null) { | |||||
| var block = bor.Child as TextBlock; | |||||
| if (block != null) { | |||||
| block.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| block.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#000")); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| txtCatalog.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3598fe")); | |||||
| txtCatalog.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| var result = (ProductCatalog)txtCatalog.Tag; | |||||
| BindProductCatalogsDetails(result.ProductCatalog_ID); | |||||
| }; | |||||
| var border = new Border(); | |||||
| border.BorderThickness = new Thickness(1, 1, 1, 1); | |||||
| border.BorderBrush = Brushes.Black; | |||||
| border.Child = txtCatalog; | |||||
| border.Margin = new Thickness(10, 10, 0, 0); | |||||
| ProductCatalogPanel.Children.Add(border); | |||||
| } | |||||
| } | |||||
| } | |||||
| private void BindProductCatalogsDetails(long productCatalog_ID) | |||||
| { | |||||
| CatalogDetails.Children.Clear(); | |||||
| if (catalogsDetails.Count() > 0) { | |||||
| var details = catalogsDetails.Where(x => x.ProductCatalog_ID == productCatalog_ID); | |||||
| foreach (var catalog in details) { | |||||
| var txtCatalog = new TextBlock() { Text = catalog.Goods_Name, FontSize = 15, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Center }; | |||||
| txtCatalog.Tag = catalog; | |||||
| txtCatalog.MouseDown += (object sende, MouseButtonEventArgs args) => { | |||||
| if (CatalogDetails.Children != null && CatalogDetails.Children.Count > 0) { | |||||
| foreach (var item in CatalogDetails.Children) { | |||||
| var bor = item as Border; | |||||
| if (bor != null) { | |||||
| var block = bor.Child as TextBlock; | |||||
| if (block != null) { | |||||
| block.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| block.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#000")); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| txtCatalog.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3598fe")); | |||||
| txtCatalog.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| ReadWeight((ProCataGoods)txtCatalog.Tag); | |||||
| }; | |||||
| var border = new Border(); | |||||
| border.BorderThickness = new Thickness(1, 1, 1, 1); | |||||
| border.BorderBrush = Brushes.Black; | |||||
| border.Child = txtCatalog; | |||||
| border.Margin = new Thickness(8, 8, 0, 0); | |||||
| CatalogDetails.Children.Add(border); | |||||
| } | |||||
| } | |||||
| } | |||||
| private void ReadWeight(ProCataGoods detail) | |||||
| { | |||||
| //if (string.IsNullOrEmpty(txtProductBatch.Text)) | |||||
| // throw new ApplicationException("请输入屠宰生产批次"); | |||||
| var w = ConfigurationManager.AppSettings["Weight"]; | |||||
| if (!string.IsNullOrEmpty(w)) { | |||||
| ComWeight.Text = w; | |||||
| } | |||||
| if (string.IsNullOrEmpty(ComWeight.Text)) | |||||
| WindowUtil.Err("没称重不能读入"); | |||||
| var weight = new WeightInfo(); | |||||
| weight.Goods_Name = detail.Goods_Name; | |||||
| weight.Goods_Spec = detail.Goods_Name; | |||||
| weight.Goods_ID = detail.Goods_ID; | |||||
| weight.Weight = decimal.Parse(ComWeight.Text); | |||||
| //decimal result = 0; | |||||
| //if (weight.LegType == LegType.前腿 && combForeLeg.SelectedValue != null && !string.IsNullOrEmpty(txtForeLegNum.Text)) { | |||||
| // result = ((decimal)combForeLeg.SelectedValue) * (int.Parse(txtForeLegNum.Text)); | |||||
| //} | |||||
| //if (weight.LegType == LegType.后腿 && combHindLeg.SelectedValue != null && !string.IsNullOrEmpty(txtForeHindNum.Text)) { | |||||
| // result = ((decimal)combHindLeg.SelectedValue) * (int.Parse(txtForeHindNum.Text)); | |||||
| //} | |||||
| //weight.SubWeight = result; | |||||
| //weight.NetWeight = weight.Weight - weight.SubWeight; | |||||
| //weight.ProductBatch = txtProductBatch.Text; | |||||
| weight.CreateTime = DateTime.Now; | |||||
| decimal? finishNum = null; | |||||
| using (var she = new SqlHelperEx()) { | |||||
| she.CreateTransaction(); | |||||
| if (mButcherDetailData != null) { | |||||
| if (detail.Goods_ID == mButcherDetailData.Goods_ID) { | |||||
| weight.ButcDetailID = mButcherDetailData.DetailID; | |||||
| finishNum = (mButcherDetailData.FinishNum ?? 0) + weight.Weight; | |||||
| ProductPlanBL.UpdateButhcerDetailFinishNum(finishNum, mButcherDetailData.DetailID, mButcherDetailData.Goods_ID, she); | |||||
| } | |||||
| } | |||||
| WeightInfoBL.Insert(weight,she); | |||||
| she.Commit(); | |||||
| } | |||||
| //待事务提交后再更新UI的值 | |||||
| if (mButcherDetailData != null) { | |||||
| mButcherDetailData.FinishNum = finishNum; | |||||
| mButcherDetailData.SurplusNum = (mButcherDetailData.PlanNumber ?? 0) - (mButcherDetailData.FinishNum ?? 0); | |||||
| } | |||||
| BindGridWeightInfo(); | |||||
| } | |||||
| private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||||
| { | |||||
| DragMove(); | |||||
| } | |||||
| private void Window_Loaded_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| thread1 = new MyThread(); | |||||
| thread1.ReadParam += this.OnRead; | |||||
| thread1.Start(); | |||||
| wpfUser = WpfUserBL.Load(UserBL.CurrentUser.ERP_User_ID); | |||||
| mTeam = ProductTeamBL.GetProductTeam(wpfUser.Employee_ID); | |||||
| BindBaseData(); | |||||
| } | |||||
| private void OnRead(string sParam) | |||||
| { | |||||
| param = sParam; | |||||
| Object[] list = { this, System.EventArgs.Empty }; | |||||
| ComWeight.Dispatcher.Invoke(new EventHandler(ComWeight_Loaded), list); | |||||
| } | |||||
| private void ComWeight_Loaded(object sender, EventArgs e) | |||||
| { | |||||
| ComWeight.Text = param; | |||||
| } | |||||
| private void BindCombProductBatch() | |||||
| { | |||||
| var batchs = ProductPlanBL.GetProductBatch(mProduceDate); | |||||
| combProductBatch.ItemsSource = batchs; | |||||
| combProductBatch.SelectedValuePath = "Batch_ID"; | |||||
| combProductBatch.DisplayMemberPath = "Batch"; | |||||
| } | |||||
| private void txtProduceYear_PreviewMouseDown_1(object sender, MouseButtonEventArgs e) | |||||
| { | |||||
| var keypadWindow = new Keypad(this); | |||||
| if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) { | |||||
| try { | |||||
| var year = int.Parse(keypadWindow.Result); | |||||
| if (year < 1990) { | |||||
| WindowUtil.Inf("年份格式不正确"); | |||||
| return; | |||||
| } | |||||
| txtProduceYear.Text = keypadWindow.Result; | |||||
| } catch (Exception ex) { | |||||
| WindowUtil.Inf("年份格式不正确"); | |||||
| } | |||||
| try { | |||||
| mProduceDate = new DateTime(int.Parse(txtProduceYear.Text), int.Parse(txtProduceMonth.Text), int.Parse(txtProduceDay.Text)); | |||||
| } catch (Exception exe) { | |||||
| WindowUtil.Inf("输入日期格式不正确"); | |||||
| } | |||||
| BindCombProductBatch(); | |||||
| BindGridProductPlan(); | |||||
| } | |||||
| } | |||||
| private void txtProduceMonth_PreviewMouseDown_1(object sender, MouseButtonEventArgs e) | |||||
| { | |||||
| var keypadWindow = new Keypad(this); | |||||
| if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) { | |||||
| try { | |||||
| var month = int.Parse(keypadWindow.Result); | |||||
| txtProduceMonth.Text = keypadWindow.Result; | |||||
| } catch (Exception ex) { | |||||
| WindowUtil.Inf("月份格式不正确"); | |||||
| } | |||||
| try { | |||||
| mProduceDate = new DateTime(int.Parse(txtProduceYear.Text), int.Parse(txtProduceMonth.Text), int.Parse(txtProduceDay.Text)); | |||||
| } catch (Exception exe) { | |||||
| WindowUtil.Inf("输入日期格式不正确"); | |||||
| } | |||||
| BindCombProductBatch(); | |||||
| BindGridProductPlan(); | |||||
| } | |||||
| } | |||||
| private void txtProduceDay_PreviewMouseDown_1(object sender, MouseButtonEventArgs e) | |||||
| { | |||||
| var keypadWindow = new Keypad(this); | |||||
| if (keypadWindow.ShowDialog() == true && !string.IsNullOrEmpty(keypadWindow.Result)) { | |||||
| try { | |||||
| var day = int.Parse(keypadWindow.Result); | |||||
| txtProduceDay.Text = keypadWindow.Result; | |||||
| } catch (Exception ex) { | |||||
| WindowUtil.Err("天数格式不正确"); | |||||
| } | |||||
| try { | |||||
| mProduceDate = new DateTime(int.Parse(txtProduceYear.Text), int.Parse(txtProduceMonth.Text), int.Parse(txtProduceDay.Text)); | |||||
| } catch (Exception exe) { | |||||
| WindowUtil.Inf("输入日期格式不正确"); | |||||
| } | |||||
| BindCombProductBatch(); | |||||
| BindGridProductPlan(); | |||||
| } | |||||
| } | |||||
| private void BindGridProductPlan() | |||||
| { | |||||
| if (mTeam != null) { | |||||
| var details = ProductPlanBL.GetButcherDetails(mProduceDate, mTeam.ProductTeam_ID); | |||||
| gridProductPlan.ItemsSource = details; | |||||
| } | |||||
| } | |||||
| private void BindGridWeightInfo() | |||||
| { | |||||
| var details = WeightInfoBL.GetWeightInfos(); | |||||
| gridWeightInfo.ItemsSource = details; | |||||
| } | |||||
| private void cb_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| var a = sender as CheckBox; | |||||
| var b = a.DataContext as WeightInfo; | |||||
| b.IsSelected = a.IsChecked ?? false; | |||||
| } | |||||
| private void CheckAll_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| var chbox = sender as CheckBox; | |||||
| var items = gridWeightInfo.ItemsSource as List<WeightInfo>; | |||||
| foreach (var item in items) { | |||||
| item.IsSelected = chbox.IsChecked ?? false; | |||||
| } | |||||
| } | |||||
| private void Button_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| var selectedItem = gridProductPlan.SelectedItem as ButcherDetailData; | |||||
| var num = RpcFacade.Call<int>("/MainSystem/B3_HaoYue/Rpcs/B3CowButcherManageRpc/FinishButcherDetail", selectedItem.DetailID); | |||||
| if (num == 1) { | |||||
| ProductPlanBL.UpdateButhcerDetailFinish(selectedItem.DetailID); | |||||
| BindGridProductPlan(); | |||||
| } | |||||
| } | |||||
| private void DeleteButton_Click_2(object sender, RoutedEventArgs e) | |||||
| { | |||||
| var detail = (sender as Button).Tag as WeightInfo; | |||||
| ButcherDetailData result = null; | |||||
| decimal? finishNum = null; | |||||
| using (var she = new SqlHelperEx()) { | |||||
| she.CreateTransaction(); | |||||
| WeightInfoBL.DeleteByID(detail.ID,she); | |||||
| //var weight = WeightInfoBL.GetButcDetailIDWeight(detail.ButcDetailID,she); | |||||
| var items = gridProductPlan.ItemsSource as List<ButcherDetailData>; | |||||
| var results = items.Where(x => x.DetailID == detail.ButcDetailID); | |||||
| if (results.Count() > 0) { | |||||
| result = results.First(); | |||||
| finishNum = result.FinishNum - detail.Weight; | |||||
| ProductPlanBL.UpdateButhcerDetailFinishNum(finishNum,result.DetailID,result.Goods_ID,she); | |||||
| } | |||||
| she.Commit(); | |||||
| } | |||||
| //待事务提交后再更新UI的值 | |||||
| if (result != null) { | |||||
| result.FinishNum = finishNum; | |||||
| result.SurplusNum = result.PlanNumber - result.FinishNum; | |||||
| } | |||||
| var details = gridWeightInfo.ItemsSource as List<WeightInfo>; | |||||
| details.Remove(detail); | |||||
| var list = new List<WeightInfo>(); | |||||
| int i = 1; | |||||
| foreach (var item in details) { | |||||
| item.Number = i; | |||||
| list.Add(item); | |||||
| i++; | |||||
| } | |||||
| gridWeightInfo.ItemsSource = null; | |||||
| gridWeightInfo.ItemsSource = list; | |||||
| } | |||||
| private void RemoveBindGridWeightInfo(WeightInfo weightInfo) | |||||
| { | |||||
| var details = gridWeightInfo.ItemsSource as List<WeightInfo>; | |||||
| details.Remove(weightInfo); | |||||
| } | |||||
| private void btnProductSet_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| if (new SelectedProductWindow().ShowDialog() == true) { | |||||
| BindProductCatalogs(); | |||||
| } | |||||
| } | |||||
| private void gridProductPlan_SelectionChanged_1(object sender, SelectionChangedEventArgs e) | |||||
| { | |||||
| if (gridProductPlan.SelectedIndex != -1) { | |||||
| mButcherDetailData = gridProductPlan.SelectedItem as ButcherDetailData; | |||||
| gridProductPlan.SelectedIndex = -1; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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("CowOutputClient")] | |||||
| [assembly: AssemblyDescription("")] | |||||
| [assembly: AssemblyConfiguration("")] | |||||
| [assembly: AssemblyCompany("Microsoft")] | |||||
| [assembly: AssemblyProduct("CowOutputClient")] | |||||
| [assembly: AssemblyCopyright("Copyright © Microsoft 2017")] | |||||
| [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 | |||||
| //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file | |||||
| //inside a <PropertyGroup>. For example, if you are using US english | |||||
| //in your source files, set the <UICulture> 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")] | |||||
| @ -0,0 +1,70 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // This code was generated by a tool. | |||||
| // Runtime Version:4.0.30319.18444 | |||||
| // | |||||
| // Changes to this file may cause incorrect behavior and will be lost if | |||||
| // the code is regenerated. | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace CowOutputClient.Properties | |||||
| { | |||||
| /// <summary> | |||||
| /// A strongly-typed resource class, for looking up localized strings, etc. | |||||
| /// </summary> | |||||
| // 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() | |||||
| { | |||||
| } | |||||
| /// <summary> | |||||
| /// Returns the cached ResourceManager instance used by this class. | |||||
| /// </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("CowOutputClient.Properties.Resources", typeof(Resources).Assembly); | |||||
| resourceMan = temp; | |||||
| } | |||||
| return resourceMan; | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// Overrides the current thread's CurrentUICulture property for all | |||||
| /// resource lookups using this strongly typed resource class. | |||||
| /// </summary> | |||||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||||
| internal static global::System.Globalization.CultureInfo Culture | |||||
| { | |||||
| get | |||||
| { | |||||
| return resourceCulture; | |||||
| } | |||||
| set | |||||
| { | |||||
| resourceCulture = value; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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> | |||||
| @ -0,0 +1,30 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // This code was generated by a tool. | |||||
| // Runtime Version:4.0.30319.18444 | |||||
| // | |||||
| // Changes to this file may cause incorrect behavior and will be lost if | |||||
| // the code is regenerated. | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace CowOutputClient.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; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,7 @@ | |||||
| <?xml version='1.0' encoding='utf-8'?> | |||||
| <SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> | |||||
| <Profiles> | |||||
| <Profile Name="(Default)" /> | |||||
| </Profiles> | |||||
| <Settings /> | |||||
| </SettingsFile> | |||||
| @ -0,0 +1,49 @@ | |||||
| <Window | |||||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
| xmlns:cc="clr-namespace:CowOutputClient" | |||||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
| mc:Ignorable="d" | |||||
| x:Class="CowOutputClient.SelectedProductWindow" | |||||
| Title="SelectedProductWindow" Height="500" Width="705" Loaded="Window_Loaded" WindowStyle="None" AllowsTransparency="True" Background="#0fff" WindowStartupLocation="CenterScreen" > | |||||
| <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown"> | |||||
| <Border CornerRadius="20" Background="#ccc"> | |||||
| <Border Margin="20" Background="White"> | |||||
| </Border> | |||||
| </Border> | |||||
| <Grid Name="Grid2" Margin="30,20,0,0" Width="470" Height="100" HorizontalAlignment="Left" VerticalAlignment="Top"> | |||||
| <ScrollViewer x:Name="scrList2" Margin="0" VerticalScrollBarVisibility="Auto"> | |||||
| <WrapPanel Name="ProductCatalogPanel" ItemHeight="45" ItemWidth="110" Width="{Binding ElementName=scrList, Path=Width, Mode=OneWay}" Margin="0,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"> | |||||
| <!--<Button Focusable="False" Content="鲜品" Name="btn4" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn3" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn2" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn5" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn6" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn8" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn9" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn10" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn11" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn12" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn13" FontSize="20" Margin="10,10,0,0" /> | |||||
| <Button Focusable="False" Content="鲜品" Name="btn14" FontSize="20" Margin="10,10,0,0" />--> | |||||
| </WrapPanel> | |||||
| </ScrollViewer> | |||||
| </Grid> | |||||
| <Button Focusable="False" Content="保存" Name="btnSave" Click="btnSave_Click_1" FontSize="20" Margin="0,40,120,0" Width="70" Height="50" HorizontalAlignment="Right" VerticalAlignment="Top"/> | |||||
| <Button Focusable="False" Content="关闭" Name="btnClose" Click="btnClose_Click_1" FontSize="20" Margin="0,40,30,0" Width="70" Height="50" HorizontalAlignment="Right" VerticalAlignment="Top"/> | |||||
| <Grid Name="Grid1" Margin="30,115,0,0" Width="650" Height="360" HorizontalAlignment="Left" VerticalAlignment="Top"> | |||||
| <Border BorderThickness="1" BorderBrush="Black"> | |||||
| </Border> | |||||
| <ScrollViewer x:Name="scrList" Margin="0" VerticalScrollBarVisibility="Auto"> | |||||
| <!--<WrapPanel Name="CatalogDetails" ItemHeight="45" ItemWidth="110" Width="350" Height="540" >--> | |||||
| <WrapPanel Name="CatalogDetails" ItemHeight="50" ItemWidth="160" Margin="0" Width="{Binding ElementName=scrList, Path=Width, Mode=OneWay}"> | |||||
| </WrapPanel> | |||||
| </ScrollViewer> | |||||
| </Grid> | |||||
| </Grid> | |||||
| </Window> | |||||
| @ -0,0 +1,126 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| 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.Shapes; | |||||
| using WeighBusiness.BL; | |||||
| using WeighBusiness.BO; | |||||
| namespace CowOutputClient | |||||
| { | |||||
| /// <summary> | |||||
| /// Interaction logic for SelectedProductWindow.xaml | |||||
| /// </summary> | |||||
| public partial class SelectedProductWindow : Window | |||||
| { | |||||
| private List<ProCataGoods> catalogsDetails = new List<ProCataGoods>(); | |||||
| List<long> detailIds = new List<long>(); | |||||
| public SelectedProductWindow() | |||||
| { | |||||
| InitializeComponent(); | |||||
| } | |||||
| private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||||
| { | |||||
| DragMove(); | |||||
| } | |||||
| private void Window_Loaded(object sender, RoutedEventArgs e) | |||||
| { | |||||
| BindProductCatalogs(); | |||||
| } | |||||
| private void BindProductCatalogs() | |||||
| { | |||||
| ProductCatalogPanel.Children.Clear(); | |||||
| var catalogs = ProductCatalogBL.GetProductCatalogs(); | |||||
| catalogsDetails = ProductCatalogBL.GetProductCatalogDetails(); | |||||
| if (catalogs.Count() > 0) { | |||||
| foreach (var catalog in catalogs) { | |||||
| var txtCatalog = new TextBlock() { Text = catalog.Name, FontSize = 20, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Center }; | |||||
| txtCatalog.Tag = catalog; | |||||
| txtCatalog.MouseDown += (object sende, MouseButtonEventArgs args) => { | |||||
| if (ProductCatalogPanel.Children != null && ProductCatalogPanel.Children.Count > 0) { | |||||
| foreach (var item in ProductCatalogPanel.Children) { | |||||
| var bor = item as Border; | |||||
| if (bor != null) { | |||||
| var block = bor.Child as TextBlock; | |||||
| if (block != null) { | |||||
| block.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| block.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#000")); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| txtCatalog.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3598fe")); | |||||
| txtCatalog.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| var result = (ProductCatalog)txtCatalog.Tag; | |||||
| BindProductCatalogsDetails(result.ProductCatalog_ID); | |||||
| }; | |||||
| var border = new Border(); | |||||
| border.BorderThickness = new Thickness(1, 1, 1, 1); | |||||
| border.BorderBrush = Brushes.Black; | |||||
| border.Child = txtCatalog; | |||||
| border.Margin = new Thickness(10, 10, 0, 0); | |||||
| ProductCatalogPanel.Children.Add(border); | |||||
| } | |||||
| } | |||||
| } | |||||
| private void BindProductCatalogsDetails(long productCatalog_ID) | |||||
| { | |||||
| CatalogDetails.Children.Clear(); | |||||
| if (catalogsDetails.Count() > 0) { | |||||
| var details = catalogsDetails.Where(x => x.ProductCatalog_ID == productCatalog_ID); | |||||
| foreach (var catalog in details) { | |||||
| var txtCatalog = new TextBlock() { Text = catalog.Goods_Name, FontSize = 15, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Center }; | |||||
| txtCatalog.Tag = catalog; | |||||
| if (catalog.IsSelected) { | |||||
| txtCatalog.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3598fe")); | |||||
| txtCatalog.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| } | |||||
| txtCatalog.MouseDown += (object sende, MouseButtonEventArgs args) => { | |||||
| var cata = txtCatalog.Tag as ProCataGoods; | |||||
| if (!cata.IsSelected) { | |||||
| txtCatalog.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3598fe")); | |||||
| txtCatalog.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| cata.IsSelected = true; | |||||
| } else { | |||||
| cata.IsSelected = false; | |||||
| txtCatalog.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#fff")); | |||||
| txtCatalog.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#000")); | |||||
| } | |||||
| }; | |||||
| var border = new Border(); | |||||
| border.BorderThickness = new Thickness(1, 1, 1, 1); | |||||
| border.BorderBrush = Brushes.Black; | |||||
| border.Child = txtCatalog; | |||||
| border.Margin = new Thickness(8, 8, 0, 0); | |||||
| CatalogDetails.Children.Add(border); | |||||
| } | |||||
| } | |||||
| } | |||||
| private void btnClose_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| this.DialogResult = false; | |||||
| } | |||||
| private void btnSave_Click_1(object sender, RoutedEventArgs e) | |||||
| { | |||||
| var selectedList = catalogsDetails.Where(x => x.IsSelected); | |||||
| if (selectedList.Count() > 0) | |||||
| ProductCatalogBL.UpdateProductCatalogDetails(selectedList.ToList()); | |||||
| this.DialogResult = true; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,57 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Windows; | |||||
| using System.Windows.Input; | |||||
| namespace CowOutputClient.Utils | |||||
| { | |||||
| public static class WindowUtil | |||||
| { | |||||
| public static Window ShowWindow(string title, string content) | |||||
| { | |||||
| Window window = new Window(); | |||||
| window.Title = title; | |||||
| window.Content = content; | |||||
| window.Show(); | |||||
| return window; | |||||
| } | |||||
| public static void Msg(string title, string content) | |||||
| { | |||||
| MessageBox.Show(content, title); | |||||
| } | |||||
| public static MessageBoxResult Inf(string content) | |||||
| { | |||||
| return MessageBox.Show(content, "提示信息"); | |||||
| } | |||||
| public static MessageBoxResult Err(string content) | |||||
| { | |||||
| return MessageBox.Show(content, "错误信息"); | |||||
| } | |||||
| public static MessageBoxResult Warn(string content) | |||||
| { | |||||
| return MessageBox.Show(content, "警告信息"); | |||||
| } | |||||
| /// <summary> | |||||
| /// 窗口可以通过鼠标移动(拖拽) | |||||
| /// </summary> | |||||
| /// <param name="window">要移动的窗口</param> | |||||
| public static void WindowDragMove(this Window window) | |||||
| { | |||||
| window.MouseMove += windowMove; | |||||
| } | |||||
| private static void windowMove(object sender, MouseEventArgs e) | |||||
| { | |||||
| if (e.LeftButton == MouseButtonState.Pressed) | |||||
| ((Window)sender).DragMove(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,44 @@ | |||||
| <?xml version="1.0"?> | |||||
| <configuration> | |||||
| <startup> | |||||
| <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /> | |||||
| </startup> | |||||
| <appSettings> | |||||
| <add key="UrlPath" value="http://localhost:2000/MainSystem/" /> | |||||
| <!-- 版块ID --> | |||||
| <add key="Domain_ID" value="4" /> | |||||
| <!-- 会计单位ID --> | |||||
| <add key="AccountingUnit_ID" value="11" /> | |||||
| <!-- 存货ID --> | |||||
| <add key="Goods_ID" value="2776" /> | |||||
| <!-- ************************* 电子秤1相关 ****************************--> | |||||
| <!--串口名称--> | |||||
| <add key="PortName" value="COM1" /> | |||||
| <!--波特率--> | |||||
| <add key="BaudRate" value="1200" /> | |||||
| <!--数据开始标志位,16进制表示--> | |||||
| <add key="BeginHexNumber" value="02" /> | |||||
| <!--数据长度--> | |||||
| <add key="DataLength" value="11" /> | |||||
| <!--数据位--> | |||||
| <add key="DataBits" value="7" /> | |||||
| <!--奇偶校验--> | |||||
| <add key="Parity" value="" /> | |||||
| <!--服务端口--> | |||||
| <add key="ServicePort" value="8181" /> | |||||
| <add key="ServiceType" value="Comet" /> | |||||
| <!--数据来源类型--> | |||||
| <add key="DataSource" value="XK3190-A1+" /> | |||||
| <!--数据类型--> | |||||
| <add key="DataType" value="Decimal" /> | |||||
| <!--返回消息的格式化,目使用.net中类型格式化的语法,例如{0}--> | |||||
| <add key="Format" value="{0:0.00}" /> | |||||
| <add key="Delay" value="4" /> | |||||
| <add key="NoBeginChar" value="false" /> | |||||
| <add key="Weight" value="2" /> | |||||
| <!--前腿勾重量配置--> | |||||
| <add key="ForeLeg" value="1.4,2.8" /> | |||||
| <!--后腿勾重量配置--> | |||||
| <add key="HindLeg" value="2.2,4.4" /> | |||||
| </appSettings> | |||||
| </configuration> | |||||
| @ -0,0 +1,79 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace FireBirdUtil.DataTypes | |||||
| { | |||||
| /// <summary> | |||||
| /// FireBird的数据库类型 | |||||
| /// </summary> | |||||
| public enum FBType | |||||
| { | |||||
| Integer = 1,//32位 从-2147483648到2147483647 整数 | |||||
| SmallInt = 2,//16位 从-32768到32767 短整数 | |||||
| Float = 4,//32位: 从1.175×10的-38次方到3.402×10的38次方 IEEE单精度浮点数,7位长度(指小数位数) | |||||
| Double = 8,//Double Precision//64位: 从2.225×10的-308次方到1.797×10的308次方 IEEE双精度浮点数,15位长度(指小数位数) | |||||
| Numeric = 16,// 变长(16、32或64位):Numeric(P,S) 精度p从1到18:指定数字的总长度;标度s从0到18:指定小数点后的位数。s<=p 定点小数。例如decimal(10,3)可以存储的数字形式为:ppppppp.sss | |||||
| Decimal = 32,//变长(16、32或64位): Decimal(P,S) 精度p从1到18:指定数字的总长度;标度s从0到18:指定小数点后的位数。s<=p 定点小数。例如decimal(5,3)可以存储的数字形式为:pp.sss | |||||
| Date = 64,//64位: 从公元后100年一月一日到32768年二月29日 日期类型。只有年月日,不带时间。如:2011-9-21 | |||||
| Time = 128,//64位: 从0:00 AM到23:59.9999 PM 时间类型 | |||||
| Timestamp = 256,//64位: 从公元后100年一月一日到32768年二月29日 带有时间的日期类型。如:2011-9-21 16:56:13.0000 | |||||
| Char = 512,//n个字符: 1到32767个字节。字符集决定了其能容纳的最大字符数 固定长度的字符或字符串【如果存入的长度不足定义的长度,则自动补空。因此,查询时,要去掉空字符】 | |||||
| Varchar = 1024,//n个字符: 1到32767个字节。字符集决定了其能容纳的最大字符数 变长字符或字符串类型 | |||||
| /// <summary> | |||||
| /// 暂时以Varchar(5)代替。当内容为字符串“true”时,代表值为true;false类似;为空时表示为null或false(根据该值是否允许为空来决定) | |||||
| /// </summary> | |||||
| Boolean = 2048,//16位:True False Unkown 代表了逻辑上的真、假或不确定。必须是ODS11或以上版本,与Dialect无关。 | |||||
| //TODO:blob如何使用? | |||||
| Blob = 4096,//变长: blob段大小限于64K 动态变长度二进制类型,可用于存放大量数据的情况,如图片、音乐、视频、多媒体等。其基本结构单位为段,它的子类型描述了存储数据的详细信息 | |||||
| } | |||||
| //超出数据范围时报错:FbException。内容为:arithmetic exception, numeric overflow, or string truncation\r\nnumeric value is out of range【测试Integer类型的数据,存入2147483648报的这个错】 | |||||
| public static class FBTypeUtil | |||||
| { | |||||
| public static string ToTypeString(this FBType fbType) | |||||
| { | |||||
| switch (fbType) { | |||||
| case FBType.Blob: | |||||
| return "Blob"; | |||||
| case FBType.Boolean: | |||||
| return "Varchar(5)";//TODO:由于没有bool类型,暂时以这个代替。详见FBType中的Boolean的说明 | |||||
| case FBType.Char: | |||||
| return "Char"; | |||||
| case FBType.Date: | |||||
| return "Date"; | |||||
| case FBType.Decimal: | |||||
| return "Decimal"; | |||||
| case FBType.Double: | |||||
| return "Double PRECISION"; | |||||
| case FBType.Float: | |||||
| return "Float"; | |||||
| case FBType.Integer: | |||||
| return "Integer"; | |||||
| case FBType.Numeric: | |||||
| return "Numeric"; | |||||
| case FBType.SmallInt: | |||||
| return "SmallInt"; | |||||
| case FBType.Time: | |||||
| return "Time"; | |||||
| case FBType.Timestamp: | |||||
| return "Timestamp"; | |||||
| case FBType.Varchar: | |||||
| return "Varchar"; | |||||
| default: | |||||
| #if DEBUG | |||||
| throw new ApplicationException("未处理的类型"); | |||||
| #else | |||||
| return "Varchar"; | |||||
| #endif | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,15 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace FireBirdUtil.DataTypes | |||||
| { | |||||
| public static class FBTypeDataUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// FB数据库中,Decimal(18,6)允许的最大的数字。实际为:9223372036854.775807 | |||||
| /// </summary> | |||||
| public const decimal DecimalMaxValue = 9223372036854; //最大的数为:9223372036854.775807 | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,89 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FireBirdUtil.SqlUtils; | |||||
| namespace FireBirdUtil.DataTypes | |||||
| { | |||||
| public class FieldInfo | |||||
| { | |||||
| private bool _IsKey = false; | |||||
| public bool IsKey { get { return _IsKey; } set { _IsKey = value; } } | |||||
| private bool _IsNotNull = false; | |||||
| public bool IsNotNull { get { return _IsNotNull; } set { _IsNotNull = value; } } | |||||
| private bool _IsAutoIncrease = false; | |||||
| public bool IsAutoIncrease { get { return _IsAutoIncrease; } set { _IsAutoIncrease = value; } } | |||||
| /// <summary> | |||||
| /// 字段名称 | |||||
| /// </summary> | |||||
| public string FieldName { get; set; } | |||||
| /// <summary> | |||||
| /// 字段类型 | |||||
| /// </summary>//TODO:学习FireBird的数据类型,然后重写该类相关方法或重新设计该类 | |||||
| public FBType FieldType { get; set; }//TODO:把类型改为与C#的类型对应起来.可用一个单独的类实现 | |||||
| /// <summary> | |||||
| /// 字段类型参数。如:“varchar(20)”中的“(20)” | |||||
| /// </summary> | |||||
| public string FieldTypeParams { get; set; }//TODO:是否可考虑将括号去掉,在本程序中实现? | |||||
| //TODO:是否考虑支持数组。firebird支持数组 | |||||
| /// <summary> | |||||
| /// 获取字段信息 | |||||
| /// </summary> | |||||
| public string GetSQL() | |||||
| { | |||||
| #if DEBUG | |||||
| if (string.IsNullOrEmpty(FieldName)) | |||||
| throw new ArgumentException("FieldName参数没有赋值"); | |||||
| if (FieldType == 0) | |||||
| throw new ArgumentException("FieldType参数没有赋值。该参数表示数据库中字段的类型"); | |||||
| #endif | |||||
| string sql = FieldName + " " + FieldType.ToTypeString(); | |||||
| if (!string.IsNullOrEmpty(FieldTypeParams)) | |||||
| sql += FieldTypeParams; | |||||
| if (_IsNotNull) | |||||
| sql += " not null"; | |||||
| if (_IsKey) | |||||
| sql += " primary key"; | |||||
| return sql; | |||||
| } | |||||
| /// <summary> | |||||
| /// 创建自增变量的SQL语句 | |||||
| /// </summary> | |||||
| public string GetSql_AddGenerator(string tableName) | |||||
| { | |||||
| return SqlUtil.GetSql_AddGenerator(tableName); | |||||
| } | |||||
| /// <summary> | |||||
| /// 查找指定自增变量的数量(用于判断是否存在指定自增变量) | |||||
| /// </summary> | |||||
| public string GetSql_SelectGeneratorCount(string tableName) | |||||
| { | |||||
| return SqlUtil.GetSql_SelectGeneratorCount(tableName); | |||||
| } | |||||
| /// <summary> | |||||
| /// 删除自增变量的SQL语句 | |||||
| /// </summary> | |||||
| public string GetSql_DropGenerator(string tableName) | |||||
| { | |||||
| return SqlUtil.GetSql_DropGenerator(tableName); | |||||
| } | |||||
| public string GetSql_AddAutoIncreaseTrigger(string tableName) | |||||
| { | |||||
| return GetSql_AddAutoIncreaseTrigger(tableName, null); | |||||
| } | |||||
| public string GetSql_AddAutoIncreaseTrigger(string tableName, string AutoIncreasedFieldTypeIfNotNum) | |||||
| {//TODO:未测试AutoIncreasedFieldTypeIfNotNum不为空的情况 | |||||
| return SqlUtil.GetSql_AddAutoIncreaseTrigger(tableName, FieldName, AutoIncreasedFieldTypeIfNotNum); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,115 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | |||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||||
| <ProductVersion>8.0.30703</ProductVersion> | |||||
| <SchemaVersion>2.0</SchemaVersion> | |||||
| <ProjectGuid>{3B09E2B6-B649-47DE-BF8D-2E233D47ACFD}</ProjectGuid> | |||||
| <OutputType>Library</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>FireBirdUtil</RootNamespace> | |||||
| <AssemblyName>FireBirdUtil</AssemblyName> | |||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| </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> | |||||
| <PlatformTarget>x86</PlatformTarget> | |||||
| </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> | |||||
| <PlatformTarget>x86</PlatformTarget> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | |||||
| <DebugSymbols>true</DebugSymbols> | |||||
| <OutputPath>bin\x86\Debug\</OutputPath> | |||||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||||
| <DebugType>full</DebugType> | |||||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | |||||
| <OutputPath>bin\x86\Release\</OutputPath> | |||||
| <DefineConstants>TRACE</DefineConstants> | |||||
| <Optimize>true</Optimize> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <PlatformTarget>x86</PlatformTarget> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <Reference Include="FirebirdSql.Data.FirebirdClient, Version=2.6.5.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>.\FirebirdSql.Data.FirebirdClient.dll</HintPath> | |||||
| </Reference> | |||||
| <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.Xml" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="DataTypes\FBType.cs" /> | |||||
| <Compile Include="DataTypes\FBTypeDataUtil.cs" /> | |||||
| <Compile Include="DataTypes\FieldInfo.cs" /> | |||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||||
| <Compile Include="SqlHelper\CreateTableHelper.cs" /> | |||||
| <Compile Include="SqlHelper\DeleteHelper.cs" /> | |||||
| <Compile Include="SqlHelper\InsertHelper.cs" /> | |||||
| <Compile Include="SqlHelper\SqlHelper.cs" /> | |||||
| <Compile Include="SqlHelper\UpdateHelper.cs" /> | |||||
| <Compile Include="SqlUtils\SqlExecuteBaseUtil.cs" /> | |||||
| <Compile Include="SqlUtils\SQLExecuteUtil.cs" /> | |||||
| <Compile Include="SqlUtils\SQLExecuteUtil_Transaction.cs" /> | |||||
| <Compile Include="SqlUtils\SqlUtil.cs" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Content Include="fbembed.dll"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
| </Content> | |||||
| <Content Include="FirebirdSql.Data.FirebirdClient.dll"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
| </Content> | |||||
| <Content Include="ib_util.dll"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
| </Content> | |||||
| <Content Include="icudt30.dll"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
| </Content> | |||||
| <Content Include="icuin30.dll"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
| </Content> | |||||
| <Content Include="icuuc30.dll"> | |||||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||||
| </Content> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\Utils\Utils.csproj"> | |||||
| <Project>{d123a086-c03a-4b8b-befb-124e102d3ade}</Project> | |||||
| <Name>Utils</Name> | |||||
| </ProjectReference> | |||||
| </ItemGroup> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||||
| Other similar extension points exist, see Microsoft.Common.targets. | |||||
| <Target Name="BeforeBuild"> | |||||
| </Target> | |||||
| <Target Name="AfterBuild"> | |||||
| </Target> | |||||
| --> | |||||
| </Project> | |||||
| @ -0,0 +1,36 @@ | |||||
| using System.Reflection; | |||||
| using System.Runtime.CompilerServices; | |||||
| using System.Runtime.InteropServices; | |||||
| // 有关程序集的常规信息通过以下 | |||||
| // 特性集控制。更改这些特性值可修改 | |||||
| // 与程序集关联的信息。 | |||||
| [assembly: AssemblyTitle("FireBirdUtil")] | |||||
| [assembly: AssemblyDescription("")] | |||||
| [assembly: AssemblyConfiguration("")] | |||||
| [assembly: AssemblyCompany("青花瓷软件")] | |||||
| [assembly: AssemblyProduct("FireBirdUtil")] | |||||
| [assembly: AssemblyCopyright("Copyright © 青花瓷软件 2011")] | |||||
| [assembly: AssemblyTrademark("")] | |||||
| [assembly: AssemblyCulture("")] | |||||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||||
| // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, | |||||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||||
| [assembly: ComVisible(false)] | |||||
| // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | |||||
| [assembly: Guid("461b7896-af41-469b-b1b8-6dbd08c2ba7d")] | |||||
| // 程序集的版本信息由下面四个值组成: | |||||
| // | |||||
| // 主版本 | |||||
| // 次版本 | |||||
| // 内部版本号 | |||||
| // 修订号 | |||||
| // | |||||
| // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, | |||||
| // 方法是按如下所示使用“*”: | |||||
| // [assembly: AssemblyVersion("1.0.*")] | |||||
| [assembly: AssemblyVersion("1.0.0.0")] | |||||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||||
| @ -0,0 +1,185 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FireBirdUtil.DataTypes; | |||||
| using FireBirdUtil.SqlUtils; | |||||
| using FirebirdSql.Data.FirebirdClient; | |||||
| namespace FireBirdUtil.SqlHelpers | |||||
| { | |||||
| /// <summary> | |||||
| /// 创建数据表的类。 | |||||
| /// <para>如果创建失败,则抛出异常(例如当数据库已经被其他程序使用时);如果已创建,则不创建</para> | |||||
| /// </summary> | |||||
| public class CreateTableHelper | |||||
| { | |||||
| string _database; | |||||
| string _tableName; | |||||
| List<FieldInfo> _fields; | |||||
| public CreateTableHelper(string database, string tableName) | |||||
| { | |||||
| #if DEBUG | |||||
| if (string.IsNullOrEmpty(database) || string.IsNullOrEmpty(tableName)) | |||||
| throw new ArgumentException("构造函数的参数不允许为空"); | |||||
| #endif | |||||
| _database = database; | |||||
| _tableName = tableName; | |||||
| _fields = new List<FieldInfo>(); | |||||
| } | |||||
| public void AddField(FieldInfo fieldInfo) | |||||
| { | |||||
| _fields.Add(fieldInfo); | |||||
| } | |||||
| private void AlterTable(string database,string tableName) | |||||
| { | |||||
| //if (tableName == "PSInfo") | |||||
| //{ | |||||
| // AddColumnToTable(database, "PSINFO", "BILLSET", "varchar(100)"); | |||||
| // AddColumnToTable(database, "PSINFO", "WINDOWSET", "varchar(100)"); | |||||
| // AddColumnToTable(database, "PSINFO", "GOODSINSTORE_ID", "Integer"); | |||||
| //} | |||||
| //else if (tableName == "ProduceBatch") | |||||
| //{ | |||||
| // AddColumnToTable(database, "PRODUCEBATCH", "MAINNUMBER", "decimal(18,6)"); | |||||
| // AddColumnToTable(database, "PRODUCEBATCH", "BILLID", "Integer"); | |||||
| //} | |||||
| //else if (tableName == "ProduceIntake") | |||||
| //{ | |||||
| // AddColumnToTable(database, "PRODUCEINTAKE", "OUTGOODS_ID", "Integer"); | |||||
| // AddColumnToTable(database, "PRODUCEINTAKE", "OUTGOODSNUM", "decimal(18,6)"); | |||||
| // AddColumnToTable(database, "PRODUCEINTAKE", "INPUTTYPE", "varchar(100)"); | |||||
| //} else if (tableName == "WeightInfo") { | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "PRODUCTDATE", "TIMESTAMP"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "BATCHNUMBER_ID", "Integer"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "PRODUCTLINK", "varchar(100)"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "ROUTING_ID", "Integer"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "PRODUCTSHIFT_ID", "Integer"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "STANDARDNUM", "decimal(18,6)"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "EMPLOYEE_ID", "Integer"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "DEPARTMENT_ID", "Integer"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "ISIMPORT", "varchar(5)"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "GOODSBATCHID", "Integer"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "GOODSBATCH_NAME", "varchar(100)"); | |||||
| // AddColumnToTable(database, "WEIGHTINFO", "OUTDETAILID", "Integer"); | |||||
| //} else if (tableName == "Intake_Detail") { | |||||
| // AddColumnToTable(database, "INTAKE_DETAIL", "PRODUCTDATE", "TIMESTAMP"); | |||||
| //} | |||||
| // else if (tableName == "WpfUser") | |||||
| //{ | |||||
| // AddColumnToTable(database, "WPFUSER", "ROWVERSION", "varchar(100)"); | |||||
| //} else if (tableName == "BSDetail") { | |||||
| // AddColumnToTable(database, "BSDETAIL", "FIXEDNUMBER", "decimal(18,6)"); | |||||
| //} | |||||
| } | |||||
| private static void AddColumnToTable(string dataBase,string tableName, string column,string columnType) | |||||
| { | |||||
| SqlHelper sh = new SqlHelper(dataBase); | |||||
| sh.CreateTransaction(); | |||||
| try | |||||
| { | |||||
| var table = | |||||
| sh.Query(string.Format( | |||||
| @"SELECT count(*) FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME='{0}' AND RDB$FIELD_NAME='{1}'", tableName, column)); | |||||
| if (table != null && table.Rows.Count > 0) | |||||
| { | |||||
| var count = (int) table.Rows[0][0]; | |||||
| if (count <= 0) | |||||
| { | |||||
| sh.ExecuteNonQuery(string.Format(@"alter table {0} add {1} {2}",tableName,column, columnType)); | |||||
| } | |||||
| } | |||||
| sh.Commit(); | |||||
| } | |||||
| catch (Exception ex) | |||||
| { | |||||
| sh.Rollback(); | |||||
| #if DEBUG | |||||
| throw new ApplicationException(ex.ToString()); | |||||
| #endif | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 数据表不存在,则创建 | |||||
| /// </summary> | |||||
| public void CreateTableIfNotExist(string sqlAfterCreateTable = null) | |||||
| { | |||||
| if (SQLExecuteUtil.IsTableExist(_database, _tableName)) | |||||
| { | |||||
| AlterTable(_database,_tableName); | |||||
| return; | |||||
| } | |||||
| string selectGeneratorCountSql; | |||||
| string dropGeneratorSql; | |||||
| string addGeneratorSql; | |||||
| string addTriggerSql; | |||||
| var fieldSqls = GetFieldSqls(_tableName, _fields, out selectGeneratorCountSql, out dropGeneratorSql, out addGeneratorSql, out addTriggerSql); | |||||
| SQLExecuteUtil.CreateTable(_database, _tableName, string.Join(",", fieldSqls)); | |||||
| //添加自增功能 | |||||
| AddAutoIncrease(_database, selectGeneratorCountSql, dropGeneratorSql, addGeneratorSql, addTriggerSql); | |||||
| if (!string.IsNullOrEmpty(sqlAfterCreateTable)) | |||||
| ExecuteSqlAfterCreateTable(_database, sqlAfterCreateTable); | |||||
| } | |||||
| private void AddAutoIncrease(string database, string selectGeneratorCountSql, string dropGeneratorSql, string addGeneratorSql, string addTriggerSql)//添加自增功能 | |||||
| { | |||||
| SqlHelper sh = new SqlHelper(database); | |||||
| sh.CreateTransaction(); | |||||
| try { | |||||
| var count = sh.Query<int>(selectGeneratorCountSql, obj => { return (int)obj; }); | |||||
| if (count > 0) | |||||
| sh.ExecuteNonQuery(dropGeneratorSql); | |||||
| sh.ExecuteNonQuery(addGeneratorSql); | |||||
| sh.ExecuteNonQuery(addTriggerSql); | |||||
| sh.Commit(); | |||||
| } catch (Exception ex) { | |||||
| sh.Rollback(); | |||||
| #if DEBUG | |||||
| throw new ApplicationException(ex.ToString()); | |||||
| #endif | |||||
| } | |||||
| } | |||||
| private static List<string> GetFieldSqls(string tableName, List<FieldInfo> fieldInfos, out string selectGeneratorCountSql, out string dropGeneratorSql, out string addGeneratorSql, out string addTriggerSql) | |||||
| { | |||||
| selectGeneratorCountSql = string.Empty; | |||||
| dropGeneratorSql = string.Empty; | |||||
| addGeneratorSql = string.Empty; | |||||
| addTriggerSql = string.Empty; | |||||
| List<string> fieldSqls = new List<string>(); | |||||
| foreach (var item in fieldInfos) { | |||||
| fieldSqls.Add(item.GetSQL()); | |||||
| if (item.IsAutoIncrease) { | |||||
| selectGeneratorCountSql = item.GetSql_SelectGeneratorCount(tableName); | |||||
| dropGeneratorSql = item.GetSql_DropGenerator(tableName); | |||||
| addGeneratorSql = item.GetSql_AddGenerator(tableName); | |||||
| addTriggerSql = item.GetSql_AddAutoIncreaseTrigger(tableName); | |||||
| } | |||||
| } | |||||
| return fieldSqls; | |||||
| } | |||||
| private void ExecuteSqlAfterCreateTable(string database, string sqlAfterCreateTable) | |||||
| { | |||||
| SqlHelper sh = new SqlHelper(database); | |||||
| sh.CreateTransaction(); | |||||
| try { | |||||
| sh.ExecuteNonQuery(sqlAfterCreateTable); | |||||
| sh.Commit(); | |||||
| } catch (Exception ex) { | |||||
| sh.Rollback(); | |||||
| #if DEBUG | |||||
| throw new ApplicationException(ex.ToString()); | |||||
| #endif | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,50 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FirebirdSql.Data.FirebirdClient; | |||||
| using FireBirdUtil.SqlUtils; | |||||
| namespace FireBirdUtil.SqlHelpers | |||||
| { | |||||
| public class DeleteHelper | |||||
| { | |||||
| private string _Database; | |||||
| private FbConnection _Connection; | |||||
| private FbTransaction _Transaction; | |||||
| /// <summary> | |||||
| /// 用于直接删除数据 | |||||
| /// </summary> | |||||
| public DeleteHelper(string database)//用于直接删除数据 | |||||
| { | |||||
| #if DEBUG | |||||
| if (string.IsNullOrEmpty(database)) | |||||
| throw new ArgumentException("构造函数参数不允许为空"); | |||||
| #endif | |||||
| _Database = database; | |||||
| } | |||||
| /// <summary> | |||||
| /// 既可用于在事务中,删除数据,也可用于直接删除数据.之所以加上database参数,是为了直接删除数据时使用 | |||||
| /// </summary> | |||||
| public DeleteHelper(string database, FbConnection connection, FbTransaction transaction)//既可用于在事务中,删除数据,也可用于直接删除数据.之所以加上database参数,是为了直接删除数据时使用 | |||||
| : this(database) | |||||
| { | |||||
| #if DEBUG | |||||
| if (connection == null || transaction == null) | |||||
| throw new ArgumentException("构造函数的参数不允许为空"); | |||||
| #endif | |||||
| _Connection = connection; | |||||
| _Transaction = transaction; | |||||
| } | |||||
| public void Delete(string tableName, string conditions) | |||||
| { | |||||
| if (_Connection == null || _Transaction == null) | |||||
| SQLExecuteUtil.Delete(_Database, tableName, conditions); | |||||
| else | |||||
| SQLExecuteUtil_Transaction.Delete(_Connection, _Transaction, tableName, conditions); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,50 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FirebirdSql.Data.FirebirdClient; | |||||
| using FireBirdUtil.SqlUtils; | |||||
| namespace FireBirdUtil.SqlHelpers | |||||
| { | |||||
| public class InsertHelper | |||||
| { | |||||
| private string _Database; | |||||
| private FbConnection _Connection; | |||||
| private FbTransaction _Transaction; | |||||
| /// <summary> | |||||
| /// 用于直接插入数据 | |||||
| /// </summary> | |||||
| public InsertHelper(string database)//用于直接插入数据 | |||||
| { | |||||
| #if DEBUG | |||||
| if (string.IsNullOrEmpty(database)) | |||||
| throw new ArgumentException("构造函数参数不允许为空"); | |||||
| #endif | |||||
| _Database = database; | |||||
| } | |||||
| /// <summary> | |||||
| /// 既可用于在事务中,插入数据,也可用于直接插入数据.之所以加上database参数,是为了直接插入数据时使用 | |||||
| /// </summary> | |||||
| public InsertHelper(string database, FbConnection connection, FbTransaction transaction)//既可用于在事务中,插入数据,也可用于直接插入数据.之所以加上database参数,是为了直接插入数据时使用 | |||||
| : this(database) | |||||
| { | |||||
| #if DEBUG | |||||
| if (connection == null || transaction == null) | |||||
| throw new ArgumentException("构造函数的参数不允许为空"); | |||||
| #endif | |||||
| _Connection = connection; | |||||
| _Transaction = transaction; | |||||
| } | |||||
| public void Insert(string tableName, IDictionary<string, object> fieldsValues) | |||||
| { | |||||
| if (_Connection == null || _Transaction == null) | |||||
| SQLExecuteUtil.Insert(_Database, tableName, fieldsValues); | |||||
| else | |||||
| SQLExecuteUtil_Transaction.Insert(_Connection, _Transaction, tableName, fieldsValues); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,123 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FirebirdSql.Data.FirebirdClient; | |||||
| using FireBirdUtil.SqlUtils; | |||||
| using System.Diagnostics; | |||||
| using System.Data; | |||||
| namespace FireBirdUtil.SqlHelpers | |||||
| { | |||||
| public class SqlHelper : IDisposable | |||||
| { | |||||
| private string _Database; | |||||
| private FbConnection _Connection; | |||||
| private FbTransaction _Transaction; | |||||
| public SqlHelper(string database) | |||||
| { | |||||
| #if DEBUG | |||||
| if (string.IsNullOrEmpty(database)) | |||||
| throw new ArgumentException("构造函数参数不允许为空"); | |||||
| #endif | |||||
| _Database = database; | |||||
| CreateConnection(); | |||||
| } | |||||
| ~SqlHelper() | |||||
| { | |||||
| Dispose(); | |||||
| } | |||||
| private FbConnection CreateConnection() | |||||
| { | |||||
| _Connection = new FbConnection(SQLExecuteUtil.GetConnectionString(_Database)); | |||||
| _Connection.Open(); | |||||
| return _Connection; | |||||
| } | |||||
| public FbTransaction CreateTransaction() | |||||
| { | |||||
| _Transaction = _Connection.BeginTransaction(); | |||||
| return _Transaction; | |||||
| } | |||||
| /// <summary> | |||||
| /// 提交事务。注意:提交之后,事务就为空了 | |||||
| /// </summary> | |||||
| public void Commit() | |||||
| { | |||||
| _Transaction.Commit(); | |||||
| } | |||||
| /// <summary> | |||||
| /// Rollback | |||||
| /// </summary> | |||||
| public void Rollback() | |||||
| { | |||||
| _Transaction.Rollback(); | |||||
| } | |||||
| public void Insert(string tableName, IDictionary<string, object> fieldsValues) | |||||
| { | |||||
| new InsertHelper(_Database, _Connection, _Transaction).Insert(tableName, fieldsValues); | |||||
| } | |||||
| public void Delete(string tableName, string conditions) | |||||
| { | |||||
| new DeleteHelper(_Database, _Connection, _Transaction).Delete(tableName, conditions); | |||||
| } | |||||
| public void Update(string tableName, Dictionary<string, object> newValues, string conditions) | |||||
| { | |||||
| new UpdateHelper(_Database, _Connection, _Transaction).Update(tableName, newValues, conditions); | |||||
| } | |||||
| public TResult Query<TResult>(string sql, Func<object, TResult> DealResult) | |||||
| { | |||||
| return SqlExecuteBaseUtil.ExecuteScalar<TResult>(_Connection, _Transaction, sql, DealResult); | |||||
| } | |||||
| /// <summary> | |||||
| /// 查询当前id。主要用于事务中 | |||||
| /// </summary> | |||||
| /// <param name="idVar">要查询的表的表名</param> | |||||
| public long GetCurrentID(string tableName) | |||||
| { | |||||
| return Query<long>("SELECT GEN_ID(" + SqlUtil.GetGeneratorName(tableName) + ", 0) FROM RDB$DATABASE;", idStr => { return (long)idStr; }); | |||||
| } | |||||
| public DataTable Query(string sql) | |||||
| { | |||||
| return SqlExecuteBaseUtil.ExecuteReader(_Connection, _Transaction, sql); | |||||
| } | |||||
| public void ExecuteNonQuery(string sql) | |||||
| { | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(_Connection, _Transaction, sql); | |||||
| } | |||||
| public void ExecuteNonQuery(string sql, out bool success) | |||||
| { | |||||
| string errorMessage; | |||||
| ExecuteNonQuery(sql, out success, out errorMessage); | |||||
| } | |||||
| public void ExecuteNonQuery(string sql, out bool success, out string errorMessage) | |||||
| { | |||||
| success = false; | |||||
| errorMessage = string.Empty; | |||||
| try { | |||||
| ExecuteNonQuery(sql); | |||||
| success = true; | |||||
| } catch (Exception ex) { | |||||
| success = false; | |||||
| errorMessage = ex.ToString(); | |||||
| } | |||||
| } | |||||
| public void Dispose() | |||||
| { | |||||
| if (_Connection != null && _Connection.State == ConnectionState.Open) | |||||
| _Connection.Close(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,50 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FirebirdSql.Data.FirebirdClient; | |||||
| using FireBirdUtil.SqlUtils; | |||||
| namespace FireBirdUtil.SqlHelpers | |||||
| { | |||||
| public class UpdateHelper | |||||
| { | |||||
| private string _Database; | |||||
| private FbConnection _Connection; | |||||
| private FbTransaction _Transaction; | |||||
| /// <summary> | |||||
| /// 用于直接更新数据 | |||||
| /// </summary> | |||||
| public UpdateHelper(string database)//用于直接更新数据 | |||||
| { | |||||
| #if DEBUG | |||||
| if (string.IsNullOrEmpty(database)) | |||||
| throw new ArgumentException("构造函数参数不允许为空"); | |||||
| #endif | |||||
| _Database = database; | |||||
| } | |||||
| /// <summary> | |||||
| /// 既可用于在事务中,更新数据,也可用于直接更新数据.之所以加上database参数,是为了直接更新数据时使用 | |||||
| /// </summary> | |||||
| public UpdateHelper(string database, FbConnection connection, FbTransaction transaction)//既可用于在事务中,更新数据,也可用于直接更新数据.之所以加上database参数,是为了直接更新数据时使用 | |||||
| : this(database) | |||||
| { | |||||
| #if DEBUG | |||||
| if (connection == null || transaction == null) | |||||
| throw new ArgumentException("构造函数的参数不允许为空"); | |||||
| #endif | |||||
| _Connection = connection; | |||||
| _Transaction = transaction; | |||||
| } | |||||
| public void Update(string tableName, Dictionary<string, object> newValues, string conditions) | |||||
| { | |||||
| if (_Connection == null || _Transaction == null) | |||||
| SQLExecuteUtil.Update(_Database, tableName, newValues, conditions); | |||||
| else | |||||
| SQLExecuteUtil_Transaction.Update(_Connection, _Transaction, tableName, newValues, conditions); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,234 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FirebirdSql.Data.FirebirdClient; | |||||
| using System.IO; | |||||
| using System.Runtime.InteropServices; | |||||
| namespace FireBirdUtil.SqlUtils | |||||
| { | |||||
| public static class SQLExecuteUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 向指定数据库的指定表中,插入一条数据。 | |||||
| /// <para>数据的Key为字段,Value为字段对应的值</para> | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="fieldsValues">一条数据的信息</param> | |||||
| public static void Insert(string database, string tableName, IDictionary<string, object> fieldsValues) | |||||
| { | |||||
| var insertSql = SqlUtil.GetInsertSql(tableName, fieldsValues); | |||||
| using (FbConnection conn = new FbConnection(GetConnectionString(database))) { | |||||
| conn.Open(); | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(conn, null, insertSql); | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 删除符合条件的数据 | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="conditions">以where打头的条件</param> | |||||
| public static void Delete(string database, string tableName, string conditions) | |||||
| { | |||||
| var deleteSql = SqlUtil.GetDeleteSql(tableName, conditions); | |||||
| using (FbConnection conn = new FbConnection(GetConnectionString(database))) { | |||||
| conn.Open(); | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(conn, null, deleteSql); | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 更新符合条件的数据 | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="newValues">新值:Key为字段名,Value为新值</param> | |||||
| /// <param name="conditions">以where打头的条件</param> | |||||
| public static void Update(string database, string tableName, Dictionary<string, object> newValues, string conditions) | |||||
| { | |||||
| var updateSql = SqlUtil.GetUpdateSql(tableName, newValues, conditions); | |||||
| using (FbConnection conn = new FbConnection(GetConnectionString(database))) { | |||||
| conn.Open(); | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(conn, null, updateSql); | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 数据库是否存在 | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| public static bool IsDatabaseExist(string database) | |||||
| { | |||||
| return File.Exists(database); | |||||
| } | |||||
| /// <summary> | |||||
| /// 如果指定数据库中,不存在指定的表,则根据创建表的参数,创建之 | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="tableParams">创建表的字段的相关参数信息</param> | |||||
| public static void CreateTableIfNotExist(string database, string tableName, string tableParams) | |||||
| { | |||||
| if (IsTableExist(database, tableName)) | |||||
| return; | |||||
| CreateTable(database, tableName, tableParams); | |||||
| } | |||||
| /// <summary> | |||||
| /// 在指定数据库中,判断表是否存在 | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| public static bool IsTableExist(string database, string tableName) | |||||
| { | |||||
| bool exist = false; | |||||
| using (FbConnection conn = new FbConnection(GetConnectionString(database))) { | |||||
| conn.Open(); | |||||
| exist = SqlExecuteBaseUtil.ExecuteScalar<bool>(conn, null, SqlUtil.GetJudgeTableExistSql(tableName), obj => { | |||||
| int count = 0; | |||||
| if (obj.Equals(null) || obj.Equals(System.DBNull.Value)) { | |||||
| count = -1; | |||||
| } else { | |||||
| count = (int)obj; | |||||
| } | |||||
| return count > 0; | |||||
| }); | |||||
| } | |||||
| return exist; | |||||
| } | |||||
| /// <summary> | |||||
| /// 在指定数据库中,创建数据表 | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="tableParams">创建表的字段的相关参数信息</param> | |||||
| public static void CreateTable(string database, string tableName, string tableParams) | |||||
| { | |||||
| FbConnection cn = new FbConnection(GetConnectionString(database)); | |||||
| cn.Open(); | |||||
| string strSQL = SqlUtil.GetCreateTableSql(tableName, tableParams); | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(cn, null, strSQL); | |||||
| cn.Close(); | |||||
| } | |||||
| /// <summary> | |||||
| /// 如果数据库不存在,则创建数据库 | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| public static void CreateDataBaseIfNotExist(string database) | |||||
| { | |||||
| if (!File.Exists(database)) | |||||
| FbConnection.CreateDatabase(GetConnectionString(database)); | |||||
| } | |||||
| /// <summary> | |||||
| /// 获取连接字符串 | |||||
| /// </summary> | |||||
| /// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| public static string GetConnectionString(string database) | |||||
| { | |||||
| FbConnectionStringBuilder cs = new FbConnectionStringBuilder(); | |||||
| cs.Database = database; | |||||
| cs.UserID = "SYSDBA"; | |||||
| cs.Password = "masterkey"; | |||||
| cs.Charset = "UTF8"; | |||||
| cs.ServerType = FbServerType.Embedded; | |||||
| return cs.ToString(); | |||||
| } | |||||
| #region 注销的代码:插入数据。注销原因:要求数据的顺序与数据表的顺序一致 | |||||
| ///// <summary> | |||||
| ///// 向指定数据库的指定表中,插入一条数据。 | |||||
| ///// <para>fields为字段,values为与字段对应的值</para> | |||||
| ///// </summary> | |||||
| ///// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| ///// <param name="tableName">表名</param> | |||||
| ///// <param name="fields">一条数据的字段信息,与值信息一一对应</param> | |||||
| ///// <param name="values">一条数据的值信息,与字段信息一一对应</param> | |||||
| //public static void Insert(string database, string tableName, IList<string> fields, IList<object> values) | |||||
| //{ | |||||
| // var preparedParams = PrepareInsertSQLParams(fields, values); | |||||
| // InsertPrepared(database, tableName, preparedParams); | |||||
| //} | |||||
| ///// <summary> | |||||
| ///// 向指定数据库的指定表中,插入一条数据。 | |||||
| ///// <para>数据的Key为字段,Value为字段对应的值</para> | |||||
| ///// </summary> | |||||
| ///// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| ///// <param name="tableName">表名</param> | |||||
| ///// <param name="fieldsValues">一条数据的信息</param> | |||||
| //public static void Insert(string database, string tableName, IDictionary<string, object> fieldsValues) | |||||
| //{ | |||||
| // var preparedParams = PrepareInsertSQLParams(fieldsValues); | |||||
| // InsertPrepared(database, tableName, preparedParams); | |||||
| //} | |||||
| ///// <summary> | |||||
| ///// 向指定数据库的指定表中,插入一条数据。 | |||||
| ///// <para>数据的Key为字段对应的变量名(字段前加@),Value为字段对应的值</para> | |||||
| ///// </summary> | |||||
| ///// <param name="database">数据库名(在fbembed.dll所在目录;或者是绝对路径+数据库名)</param> | |||||
| ///// <param name="tableName">表名</param> | |||||
| ///// <param name="fieldsValues">一条数据的信息,是经过处理的</param> | |||||
| //private static void InsertPrepared(string database, string tableName, IDictionary<string, object> fieldsValues) | |||||
| //{ | |||||
| // string insertString = "insert into {0} values ({1})";//"insert into tb_user values (@id, @word)" | |||||
| // insertString = string.Format(insertString, tableName, string.Join(", ", fieldsValues.Keys)); | |||||
| // using (FbConnection conn = new FbConnection(GetConnectionString(database))) { | |||||
| // conn.Open(); | |||||
| // using (FbCommand insertData = conn.CreateCommand()) { | |||||
| // insertData.CommandText = insertString; | |||||
| // insertData.Parameters.Clear(); | |||||
| // foreach (var item in fieldsValues) { | |||||
| // insertData.Parameters.AddWithValue(item.Key, item.Value); | |||||
| // } | |||||
| // insertData.ExecuteNonQuery(); | |||||
| // } | |||||
| // } | |||||
| //} | |||||
| // /// <summary> | |||||
| // /// 获取插入数据参数,key为变量名,value为值。 | |||||
| // /// <para>在字段名前加@,使其成为变量名</para> | |||||
| // /// </summary> | |||||
| // private static IDictionary<string, object> PrepareInsertSQLParams(IList<string> fields, IList<object> values) | |||||
| // { | |||||
| //#if DEBUG | |||||
| // if (fields == null || values == null) | |||||
| // throw new ApplicationException("没有初始化参数"); | |||||
| // if (fields.Count != values.Count) | |||||
| // throw new ApplicationException("字段与值的数量不匹配"); | |||||
| //#endif | |||||
| // Dictionary<string, object> paramS = new Dictionary<string, object>(); | |||||
| // for (int i = 0; i < fields.Count; i++) | |||||
| // paramS.Add("@" + fields[i], values[i]); | |||||
| // return paramS; | |||||
| // } | |||||
| // /// <summary> | |||||
| // /// 获取插入数据参数,key为变量名,value为值。 | |||||
| // /// <para>在字段名前加@,使其成为变量名</para> | |||||
| // /// </summary> | |||||
| // private static IDictionary<string, object> PrepareInsertSQLParams(IDictionary<string, object> fieldsValues) | |||||
| // { | |||||
| //#if DEBUG | |||||
| // if (fieldsValues == null || fieldsValues.Count == 0)//TODO:为0时,是否要特殊处理?即不执行插入操作 | |||||
| // throw new ApplicationException("没有初始化参数"); | |||||
| //#endif | |||||
| // Dictionary<string, object> paramS = new Dictionary<string, object>(); | |||||
| // foreach (var item in fieldsValues) | |||||
| // paramS.Add("@" + item.Key, item.Value); | |||||
| // return paramS; | |||||
| // } | |||||
| #endregion | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,98 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FirebirdSql.Data.FirebirdClient; | |||||
| namespace FireBirdUtil.SqlUtils | |||||
| { | |||||
| public static class SQLExecuteUtil_Transaction | |||||
| {//TODO:是否增加方法:用FbCommand参数,替代FbConnection参数的方法 | |||||
| /// <summary> | |||||
| /// 在事务中:插入数据 | |||||
| /// </summary> | |||||
| /// <param name="conn">连接.在调用该方法之前,应该已打开</param> | |||||
| /// <param name="tr">事务</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="fieldsValues">一条数据的信息</param> | |||||
| public static void Insert(FbConnection conn, FbTransaction tr, string tableName, IDictionary<string, object> fieldsValues) | |||||
| { | |||||
| var insertSql = SqlUtil.GetInsertSql(tableName, fieldsValues); | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(conn, tr, insertSql); | |||||
| } | |||||
| /// <summary> | |||||
| /// 在事务中:删除符合条件的数据 | |||||
| /// </summary> | |||||
| /// <param name="conn">连接.在调用该方法之前,应该已打开</param> | |||||
| /// <param name="tr">事务</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="conditions">以where打头的条件</param> | |||||
| public static void Delete(FbConnection conn, FbTransaction tr, string tableName, string conditions) | |||||
| { | |||||
| var deleteSql = SqlUtil.GetDeleteSql(tableName, conditions); | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(conn, tr, deleteSql); | |||||
| } | |||||
| /// <summary> | |||||
| /// 在事务中:更新符合条件的数据 | |||||
| /// </summary> | |||||
| /// <param name="conn">连接.在调用该方法之前,应该已打开</param> | |||||
| /// <param name="tr">事务</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="newValues">新值:Key为字段名,Value为新值</param> | |||||
| /// <param name="conditions">以where打头的条件</param> | |||||
| public static void Update(FbConnection conn, FbTransaction tr, string tableName, Dictionary<string, object> newValues, string conditions) | |||||
| { | |||||
| var updateSql = SqlUtil.GetUpdateSql(tableName, newValues, conditions); | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(conn, tr, updateSql); | |||||
| } | |||||
| /// <summary> | |||||
| /// 在事务中:如果指定数据库中,不存在指定的表,则根据创建表的参数,创建之 | |||||
| /// </summary> | |||||
| /// <param name="conn">连接.在调用该方法之前,应该已打开</param> | |||||
| /// <param name="tr">事务</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="tableParams">创建表的字段的相关参数信息</param> | |||||
| public static void CreateTableIfNotExist(FbConnection conn, FbTransaction tr, string tableName, string tableParams) | |||||
| { | |||||
| if (IsTableExist(conn, tr, tableName)) | |||||
| return; | |||||
| CreateTable(conn, tr, tableName, tableParams); | |||||
| } | |||||
| /// <summary> | |||||
| /// 在事务中:在指定数据库中,判断表是否存在 | |||||
| /// </summary> | |||||
| /// <param name="conn">连接.在调用该方法之前,应该已打开</param> | |||||
| /// <param name="tr">事务</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| public static bool IsTableExist(FbConnection conn, FbTransaction tr, string tableName) | |||||
| { | |||||
| return SqlExecuteBaseUtil.ExecuteScalar<bool>(conn, tr, SqlUtil.GetJudgeTableExistSql(tableName), obj => { | |||||
| int count = 0; | |||||
| if (obj.Equals(null) || obj.Equals(System.DBNull.Value)) { | |||||
| count = -1; | |||||
| } else { | |||||
| count = (int)obj; | |||||
| } | |||||
| return count > 0; | |||||
| }); | |||||
| } | |||||
| /// <summary> | |||||
| /// 在事务中:在指定数据库中,创建数据表 | |||||
| /// </summary> | |||||
| /// <param name="conn">连接.在调用该方法之前,应该已打开</param> | |||||
| /// <param name="tr">事务</param> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="tableParams">创建表的字段的相关参数信息</param> | |||||
| public static void CreateTable(FbConnection conn, FbTransaction tr, string tableName, string tableParams) | |||||
| { | |||||
| string strSQL = SqlUtil.GetCreateTableSql(tableName, tableParams); | |||||
| SqlExecuteBaseUtil.ExecuteNonQuery(conn, tr, strSQL); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,90 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using FireBirdUtil.DataTypes; | |||||
| using FirebirdSql.Data.FirebirdClient; | |||||
| using System.Data; | |||||
| namespace FireBirdUtil.SqlUtils | |||||
| { | |||||
| public class SqlExecuteBaseUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 执行非查询命令(如果事务参数不为null,则在事务中执行) | |||||
| /// </summary> | |||||
| public static void ExecuteNonQuery(FbConnection connection, FbTransaction transaction, string commandText) | |||||
| { | |||||
| using (FbCommand fbCmd = connection.CreateCommand()) { | |||||
| if (transaction != null) | |||||
| fbCmd.Transaction = transaction; | |||||
| fbCmd.CommandText = GetReplaceNullSql(commandText); | |||||
| fbCmd.ExecuteNonQuery(); | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 执行查询命令【根据返回的单个值处理后的值】(如果事务参数不为null,则在事务中执行) | |||||
| /// </summary> | |||||
| /// <typeparam name="TResult">处理后的结果类型</typeparam> | |||||
| public static TResult ExecuteScalar<TResult>(FbConnection connection, FbTransaction transaction, string commandText, Func<object, TResult> DealResult) | |||||
| { | |||||
| #if DEBUG | |||||
| if (DealResult == null) | |||||
| throw new ArgumentException("DealResult参数不允许为null"); | |||||
| #endif | |||||
| TResult result; | |||||
| using (FbCommand fbCmd = connection.CreateCommand()) { | |||||
| if (transaction != null) | |||||
| fbCmd.Transaction = transaction; | |||||
| fbCmd.CommandText = GetReplaceNullSql(commandText); | |||||
| var obj = fbCmd.ExecuteScalar(); | |||||
| result = DealResult(obj); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| /// <summary> | |||||
| /// 执行查询命令(如果事务参数不为null,则在事务中执行) | |||||
| /// </summary> | |||||
| public static DataTable ExecuteReader(FbConnection connection, FbTransaction transaction, string commandText) | |||||
| { | |||||
| DataTable table; | |||||
| using (FbCommand fbCmd = connection.CreateCommand()) { | |||||
| if (transaction != null) | |||||
| fbCmd.Transaction = transaction; | |||||
| fbCmd.CommandText = GetReplaceNullSql(commandText); | |||||
| var reader = fbCmd.ExecuteReader(); | |||||
| table = CreateDataTable(reader); | |||||
| } | |||||
| return table; | |||||
| } | |||||
| /// <summary> | |||||
| /// 如果null由引号包括,则去掉null前后的引号。即:用null代替'null' | |||||
| /// </summary> | |||||
| private static string GetReplaceNullSql(string sql) | |||||
| { | |||||
| var tmp = sql.ToLower(); | |||||
| var index = tmp.IndexOf("'null'"); | |||||
| if (index < 0) | |||||
| return sql; | |||||
| string old = sql.Substring(index, 6); | |||||
| sql = sql.Replace(old, "null"); | |||||
| sql = GetReplaceNullSql(sql); | |||||
| return sql; | |||||
| } | |||||
| private static DataTable CreateDataTable(FbDataReader reader) | |||||
| { | |||||
| if (reader.IsClosed) | |||||
| throw new ApplicationException("查询命令已结束"); | |||||
| var dataTable = new DataTable(); | |||||
| dataTable.Load(reader); | |||||
| return dataTable; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,156 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace FireBirdUtil.SqlUtils | |||||
| { | |||||
| public class SqlUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 判断表是否存在的SQL语句 | |||||
| /// <para>执行该sql语句后,结果为1时,表示表存在;否则不存在(小于1)</para> | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| public static string GetJudgeTableExistSql(string tableName)//查询结果为1时,表示表存在;否则不存在(小于1) | |||||
| { | |||||
| return "select count(*) from rdb$relations where rdb$relation_name='" + tableName.ToUpper() + "' AND RDB$VIEW_SOURCE IS NULL"; | |||||
| } | |||||
| /// <summary> | |||||
| /// 创建表的SQL语句 | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="tableParams">所有字段的参数。如:uid int,uname varchar(20)</param> | |||||
| public static string GetCreateTableSql(string tableName, string tableParams) | |||||
| { | |||||
| return "create table " + tableName + " (" + tableParams + ")";//tableParams如:“uid int,uname varchar(20)” | |||||
| } | |||||
| /// <summary> | |||||
| /// 插入一条数据的SQL语句 | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="fieldsValues">一条数据的信息:Key为字段,Value为字段对应的值</param> | |||||
| public static string GetInsertSql(string tableName, IDictionary<string, object> fieldsValues) | |||||
| { | |||||
| string insertSql = "insert into {0} ({1}) values ({2})"; | |||||
| insertSql = string.Format(insertSql, tableName, string.Join(", ", fieldsValues.Keys), "'" + string.Join("', '", fieldsValues.Values) + "'"); | |||||
| return insertSql; | |||||
| } | |||||
| /// <summary> | |||||
| /// 删除表 | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| public static string GetDropSql(string tableName)//TODO:未测试 | |||||
| { | |||||
| return "drop table " + tableName; | |||||
| } | |||||
| /// <summary> | |||||
| /// 删除表的所有数据 | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| public static string GetDeleteSql(string tableName) | |||||
| { | |||||
| return "delete from " + tableName; | |||||
| } | |||||
| /// <summary> | |||||
| /// 删除符合条件的数据 | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="conditions">以where打头的条件</param> | |||||
| public static string GetDeleteSql(string tableName, string conditions) | |||||
| { | |||||
| return "delete from " + tableName + " " + conditions; | |||||
| } | |||||
| //delete from table1 where id=1 or id=2 | |||||
| //delete from table1 where id in (3,4,5) | |||||
| //delete from table1 where age is null | |||||
| //delete from table1 where age is null and id<10 | |||||
| /// <summary> | |||||
| /// 将符合条件的数据行的指定字段的值更新//不能处理将一个字段的值赋给另一个字段 | |||||
| /// </summary> | |||||
| /// <param name="newValues">新值:Key为字段名,Value为新值</param> | |||||
| /// <param name="conditions">以where打头的条件</param> | |||||
| public static string GetUpdateSql(string tableName, Dictionary<string, object> newValues, string conditions) | |||||
| { | |||||
| List<string> setValueString = new List<string>(); | |||||
| foreach (var item in newValues) { | |||||
| setValueString.Add(item.Key + "=" + UpdateValueToString(item.Value)); | |||||
| } | |||||
| return "update " + tableName + " set " + string.Join(", ", setValueString) + " " + conditions; | |||||
| } | |||||
| private static string UpdateValueToString(object obj) | |||||
| { | |||||
| return "'" + obj.ToString() + "'"; | |||||
| } | |||||
| /// <summary> | |||||
| /// 获取自增变量名。说明:长度是有限制的,好像最长是31个字符 | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| internal static string GetGeneratorName(string tableName) | |||||
| { | |||||
| return tableName + "_gen"; | |||||
| } | |||||
| /// <summary> | |||||
| /// 创建自增变量的SQL语句 | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| public static string GetSql_AddGenerator(string tableName) | |||||
| { | |||||
| return "create generator " + GetGeneratorName(tableName); | |||||
| } | |||||
| /// <summary> | |||||
| /// 删除自增变量 | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| public static string GetSql_DropGenerator(string tableName) | |||||
| { | |||||
| return "drop generator " + GetGeneratorName(tableName); | |||||
| } | |||||
| /// <summary> | |||||
| /// 查找指定自增变量的数量(用于判断是否存在指定自增变量) | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| public static string GetSql_SelectGeneratorCount(string tableName) | |||||
| { | |||||
| return string.Format("select count(*) from rdb$generators where rdb$generator_name='{0}'", GetGeneratorName(tableName).ToUpper()); | |||||
| } | |||||
| /// <summary> | |||||
| /// 创建字段自增功能的SQL语句(通过添加触发器实现) | |||||
| /// <para>字段类型不是数字类型时,还有强制转换类型</para> | |||||
| /// </summary> | |||||
| /// <param name="tableName">表名</param> | |||||
| /// <param name="fieldName">字段名</param> | |||||
| /// <param name="AutoIncreasedFieldTypeIfNotNum">强制转换后的类型。为空则不转换</param> | |||||
| public static string GetSql_AddAutoIncreaseTrigger(string tableName, string fieldName, string AutoIncreasedFieldTypeIfNotNum) | |||||
| {//TODO:未测试AutoIncreasedFieldTypeIfNotNum不为空的情况 | |||||
| string generatorName = GetGeneratorName(tableName); | |||||
| string triggerName = tableName + "_increaseID"; | |||||
| string newValue = string.Format("gen_id({0}, 1)", generatorName); | |||||
| if (!string.IsNullOrEmpty(AutoIncreasedFieldTypeIfNotNum)) | |||||
| newValue = string.Format("cast({0} as {1})", newValue, AutoIncreasedFieldTypeIfNotNum); | |||||
| string sql = @" | |||||
| create trigger {1} for {2} active before insert | |||||
| as | |||||
| begin | |||||
| if ((new.{3} is null) or (new.{3} = 0)) then | |||||
| begin | |||||
| new.{3} = {4}; | |||||
| end | |||||
| end | |||||
| ";//TODO:需不需要判读是否为0? | |||||
| return string.Format(sql, generatorName, triggerName, tableName, fieldName, newValue); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,27 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Windows.Data; | |||||
| namespace KeyPad.Converter | |||||
| { | |||||
| class BoolToVisibilityConverter : IValueConverter | |||||
| { | |||||
| public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |||||
| { | |||||
| if ((bool?)value == true) | |||||
| return System.Windows.Visibility.Visible; | |||||
| else | |||||
| return System.Windows.Visibility.Collapsed; | |||||
| } | |||||
| public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | |||||
| { | |||||
| throw new NotImplementedException(); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,125 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | |||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||||
| <Platform Condition=" '$(Platform)' == '' ">x86</Platform> | |||||
| <ProductVersion>8.0.30703</ProductVersion> | |||||
| <SchemaVersion>2.0</SchemaVersion> | |||||
| <ProjectGuid>{3ADBFF38-915C-4115-9CDD-81C0CAD9733A}</ProjectGuid> | |||||
| <OutputType>Library</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>KeyPad</RootNamespace> | |||||
| <AssemblyName>KeyPad</AssemblyName> | |||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <TargetFrameworkProfile>Client</TargetFrameworkProfile> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | |||||
| <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|x86' "> | |||||
| <PlatformTarget>x86</PlatformTarget> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <Optimize>true</Optimize> | |||||
| <OutputPath>bin\Release\</OutputPath> | |||||
| <DefineConstants>TRACE</DefineConstants> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <WarningLevel>4</WarningLevel> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup> | |||||
| <StartupObject /> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> | |||||
| <DebugSymbols>true</DebugSymbols> | |||||
| <OutputPath>bin\Debug\</OutputPath> | |||||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||||
| <DebugType>full</DebugType> | |||||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> | |||||
| <OutputPath>bin\Release\</OutputPath> | |||||
| <DefineConstants>TRACE</DefineConstants> | |||||
| <Optimize>true</Optimize> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <Reference Include="System" /> | |||||
| <Reference Include="System.Data" /> | |||||
| <Reference Include="System.Xml" /> | |||||
| <Reference Include="Microsoft.CSharp" /> | |||||
| <Reference Include="System.Core" /> | |||||
| <Reference Include="System.Xml.Linq" /> | |||||
| <Reference Include="System.Data.DataSetExtensions" /> | |||||
| <Reference Include="System.Xaml"> | |||||
| <RequiredTargetFramework>4.0</RequiredTargetFramework> | |||||
| </Reference> | |||||
| <Reference Include="WindowsBase" /> | |||||
| <Reference Include="PresentationCore" /> | |||||
| <Reference Include="PresentationFramework" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="Converter\BoolToVisibilityConverter.cs" /> | |||||
| <Compile Include="VirtualKeyboard.xaml.cs"> | |||||
| <DependentUpon>VirtualKeyboard.xaml</DependentUpon> | |||||
| </Compile> | |||||
| <Page Include="Keypad.xaml"> | |||||
| <Generator>MSBuild:Compile</Generator> | |||||
| <SubType>Designer</SubType> | |||||
| </Page> | |||||
| <Compile Include="Keypad.xaml.cs"> | |||||
| <DependentUpon>Keypad.xaml</DependentUpon> | |||||
| <SubType>Code</SubType> | |||||
| </Compile> | |||||
| <Page Include="VirtualKeyboard.xaml"> | |||||
| <SubType>Designer</SubType> | |||||
| <Generator>MSBuild:Compile</Generator> | |||||
| </Page> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="Properties\AssemblyInfo.cs"> | |||||
| <SubType>Code</SubType> | |||||
| </Compile> | |||||
| <Compile Include="Properties\Resources.Designer.cs"> | |||||
| <AutoGen>True</AutoGen> | |||||
| <DesignTime>True</DesignTime> | |||||
| <DependentUpon>Resources.resx</DependentUpon> | |||||
| </Compile> | |||||
| <Compile Include="Properties\Settings.Designer.cs"> | |||||
| <AutoGen>True</AutoGen> | |||||
| <DependentUpon>Settings.settings</DependentUpon> | |||||
| <DesignTimeSharedInput>True</DesignTimeSharedInput> | |||||
| </Compile> | |||||
| <EmbeddedResource Include="Properties\Resources.resx"> | |||||
| <Generator>ResXFileCodeGenerator</Generator> | |||||
| <LastGenOutput>Resources.Designer.cs</LastGenOutput> | |||||
| </EmbeddedResource> | |||||
| <None Include="app.config" /> | |||||
| <None Include="Properties\Settings.settings"> | |||||
| <Generator>SettingsSingleFileGenerator</Generator> | |||||
| <LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||||
| </None> | |||||
| <AppDesigner Include="Properties\" /> | |||||
| </ItemGroup> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||||
| Other similar extension points exist, see Microsoft.Common.targets. | |||||
| <Target Name="BeforeBuild"> | |||||
| </Target> | |||||
| <Target Name="AfterBuild"> | |||||
| </Target> | |||||
| --> | |||||
| </Project> | |||||
| @ -0,0 +1,61 @@ | |||||
| <Window x:Class="KeyPad.Keypad" | |||||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
| Title="MainWindow" Height="313" Width="299" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" > | |||||
| <Window.Resources> | |||||
| <DropShadowEffect x:Key="DropShadowEffect" ShadowDepth="1" Direction="-90" BlurRadius="3" /> | |||||
| <Style TargetType="Label"> | |||||
| <Setter Property="FontSize" Value="22"/> | |||||
| <Setter Property="Label.Effect" Value="{StaticResource DropShadowEffect}"/> | |||||
| </Style> | |||||
| <LinearGradientBrush x:Key="IPhoneSteelBackground" EndPoint="0.5,1.272" StartPoint="0.5,0"> | |||||
| <GradientStop Color="#FF9097A3" Offset="0"/> | |||||
| <GradientStop Color="#FF444D5B" Offset="1"/> | |||||
| </LinearGradientBrush> | |||||
| <Style TargetType="Button"> | |||||
| <EventSetter Event="Click" Handler="button_Click" /> | |||||
| <Setter Property="Margin" Value="4"/> | |||||
| <Setter Property="Button.Effect" Value="{StaticResource DropShadowEffect}"/> | |||||
| <Setter Property="FontSize" Value="22"/> | |||||
| <Setter Property="Background" Value="WhiteSmoke"/> | |||||
| <Setter Property="RenderTransform"> | |||||
| <Setter.Value> | |||||
| <!-- Workaround for ATI video cards that don't render good with dropshadoweffect--> | |||||
| <RotateTransform Angle="0.00000000001"/> | |||||
| </Setter.Value> | |||||
| </Setter> | |||||
| </Style> | |||||
| </Window.Resources> | |||||
| <Grid Background="{DynamicResource IPhoneSteelBackground}"> | |||||
| <Grid.RowDefinitions> | |||||
| <RowDefinition /> | |||||
| <RowDefinition /> | |||||
| <RowDefinition /> | |||||
| <RowDefinition /> | |||||
| <RowDefinition /> | |||||
| </Grid.RowDefinitions> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Row="1" Grid.Column="0" BorderThickness="1" BorderBrush="Gray" CommandParameter="NUMPAD7" >7</Button> | |||||
| <Button Grid.Row="1" Grid.Column="1" CommandParameter="NUMPAD8" BorderThickness="1" Content="8" /> | |||||
| <Button Grid.Row="1" Grid.Column="2" CommandParameter="NUMPAD9" Content="9" /> | |||||
| <Button Grid.Row="1" Grid.Column="3" CommandParameter="BACK" > | |||||
| <Path Stretch="Fill" Width="36" Height="24" Data="F1M555.0371,274.4893L552.7871,276.7383L549.9861,273.9373L547.1991,276.7243L545.1131,274.6393L547.9001,271.8523L545.0101,268.9603L547.2601,266.7113L550.1501,269.6023L552.8921,266.8613L554.9761,268.9463L552.2361,271.6883z M555.3751,264.0003L544.8751,264.0003C543.1251,264.1253,535.0001,270.7503,535.0001,272.2503C535.0001,273.7503,543.1251,279.3753,544.8751,279.5003L555.3751,279.5003C558.8751,279.5003,559.3751,277.7093,559.3751,275.5003L559.3751,268.0003C559.3751,265.7913,558.7501,264.0003,555.3751,264.0003" Fill="#FF333333"/> | |||||
| </Button> | |||||
| <Button Grid.Row="2" Grid.Column="0" x:Name="button9" CommandParameter="NUMPAD4" Content="4"/> | |||||
| <Button Grid.Row="2" Grid.Column="1" CommandParameter="NUMPAD5" Content="5" /> | |||||
| <Button Grid.Row="2" Grid.Column="2" CommandParameter="NUMPAD6" Content="6" /> | |||||
| <Button Grid.Row="3" Grid.Column="0" CommandParameter="NUMPAD1" Content="1"/> | |||||
| <Button Grid.Row="3" Grid.Column="1" CommandParameter="NUMPAD2" Content="2"/> | |||||
| <Button Grid.Row="3" Grid.Column="2" CommandParameter="NUMPAD3" Content="3" /> | |||||
| <Button Grid.Row="2" Grid.Column="3" Grid.RowSpan="3" CommandParameter="RETURN" Content="确认"/> | |||||
| <Button Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" CommandParameter="NUMPAD0" Content="0" /> | |||||
| <Button Grid.Row="4" Grid.Column="2" CommandParameter="DECIMAL" Content="." /> | |||||
| <Label Grid.Column="0" Grid.ColumnSpan="4" Content="{Binding Result}" HorizontalContentAlignment="Right" Background="WhiteSmoke" Margin="4"/> | |||||
| </Grid> | |||||
| </Window> | |||||
| @ -0,0 +1,97 @@ | |||||
| | |||||
| /* | |||||
| * Copyright (c) 2008, Andrzej Rusztowicz (ekus.net) | |||||
| * All rights reserved. | |||||
| * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |||||
| * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |||||
| * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |||||
| * Neither the name of ekus.net nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |||||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| */ | |||||
| /* | |||||
| * Added by Michele Cattafesta (mesta-automation.com) 29/2/2011 | |||||
| * The code has been totally rewritten to create a control that can be modified more easy even without knowing the MVVM pattern. | |||||
| * If you need to check the original source code you can download it here: http://wosk.codeplex.com/ | |||||
| */ | |||||
| using System; | |||||
| using System.Windows; | |||||
| using System.Windows.Controls; | |||||
| using System.ComponentModel; | |||||
| namespace KeyPad | |||||
| { | |||||
| /// <summary> | |||||
| /// Logica di interazione per MainWindow.xaml | |||||
| /// </summary> | |||||
| public partial class Keypad : Window,INotifyPropertyChanged | |||||
| { | |||||
| #region Public Properties | |||||
| private string _result; | |||||
| public string Result | |||||
| { | |||||
| get { return _result; } | |||||
| private set { _result = value; this.OnPropertyChanged("Result"); } | |||||
| } | |||||
| #endregion | |||||
| public Keypad(Window wndOwner) | |||||
| { | |||||
| InitializeComponent(); | |||||
| this.Owner = wndOwner; | |||||
| this.DataContext = this; | |||||
| Result = ""; | |||||
| } | |||||
| private void button_Click(object sender, RoutedEventArgs e) | |||||
| { | |||||
| Button button = sender as Button; | |||||
| switch (button.CommandParameter.ToString()) | |||||
| { | |||||
| case "ESC": | |||||
| //this.DialogResult = false; | |||||
| this.Close(); | |||||
| break; | |||||
| case "RETURN": | |||||
| this.DialogResult = true; | |||||
| break; | |||||
| case "BACK": | |||||
| if (Result.Length > 0) | |||||
| Result = Result.Remove(Result.Length - 1); | |||||
| break; | |||||
| default: | |||||
| Result += button.Content.ToString(); | |||||
| break; | |||||
| } | |||||
| } | |||||
| #region INotifyPropertyChanged members | |||||
| public event PropertyChangedEventHandler PropertyChanged; | |||||
| private void OnPropertyChanged(String info) | |||||
| { | |||||
| if (PropertyChanged != null) | |||||
| { | |||||
| PropertyChanged(this, new PropertyChangedEventArgs(info)); | |||||
| } | |||||
| } | |||||
| #endregion | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,55 @@ | |||||
| using System.Reflection; | |||||
| using System.Resources; | |||||
| using System.Runtime.CompilerServices; | |||||
| using System.Runtime.InteropServices; | |||||
| using System.Windows; | |||||
| // Le informazioni generali relative a un assembly sono controllate dal seguente | |||||
| // set di attributi. Per modificare le informazioni associate a un assembly | |||||
| // occorre quindi modificare i valori di questi attributi. | |||||
| [assembly: AssemblyTitle("KeyPad")] | |||||
| [assembly: AssemblyDescription("")] | |||||
| [assembly: AssemblyConfiguration("")] | |||||
| [assembly: AssemblyCompany("")] | |||||
| [assembly: AssemblyProduct("KeyPad")] | |||||
| [assembly: AssemblyCopyright("Copyright © 2012")] | |||||
| [assembly: AssemblyTrademark("")] | |||||
| [assembly: AssemblyCulture("")] | |||||
| // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili | |||||
| // ai componenti COM. Se è necessario accedere a un tipo in questo assembly da | |||||
| // COM, impostare su true l'attributo ComVisible per tale tipo. | |||||
| [assembly: ComVisible(false)] | |||||
| //Per iniziare la compilazione delle applicazioni localizzabili, impostare | |||||
| //<UICulture>CultureYouAreCodingWith</UICulture> nel file .csproj | |||||
| //all'interno di un <PropertyGroup>. Ad esempio, se si utilizza l'inglese (Stati Uniti) | |||||
| //nei file di origine, impostare <UICulture> su en-US. Rimuovere quindi il commento dall'attributo | |||||
| //NeutralResourceLanguage riportato di seguito. Aggiornare "en-US" nella | |||||
| //riga sottostante in modo che corrisponda all'impostazione UICulture nel file di progetto. | |||||
| //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] | |||||
| [assembly: ThemeInfo( | |||||
| ResourceDictionaryLocation.None, //dove si trovano i dizionari delle risorse specifiche del tema | |||||
| //(in uso se non è possibile trovare una risorsa nella pagina | |||||
| // oppure nei dizionari delle risorse dell'applicazione) | |||||
| ResourceDictionaryLocation.SourceAssembly //dove si trova il dizionario delle risorse generiche | |||||
| //(in uso se non è possibile trovare una risorsa nella pagina, | |||||
| // nell'applicazione o nei dizionari delle risorse specifiche del tema) | |||||
| )] | |||||
| // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: | |||||
| // | |||||
| // Numero di versione principale | |||||
| // Numero di versione secondario | |||||
| // Numero build | |||||
| // Revisione | |||||
| // | |||||
| // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build | |||||
| // utilizzando l'asterisco (*) come descritto di seguito: | |||||
| // [assembly: AssemblyVersion("1.0.*")] | |||||
| [assembly: AssemblyVersion("1.0.0.0")] | |||||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||||
| @ -0,0 +1,71 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // Codice generato da uno strumento. | |||||
| // Versione runtime:4.0.30319.239 | |||||
| // | |||||
| // Le modifiche a questo file possono causare un comportamento non corretto e verranno perse | |||||
| // se il codice viene rigenerato. | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace KeyPad.Properties | |||||
| { | |||||
| /// <summary> | |||||
| /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via. | |||||
| /// </summary> | |||||
| // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder | |||||
| // tramite uno strumento quale ResGen o Visual Studio. | |||||
| // Per aggiungere o rimuovere un membro, modificare il file con estensione .ResX, quindi eseguire di nuovo ResGen | |||||
| // con l'opzione /str oppure ricompilare il progetto 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> | |||||
| /// Restituisce l'istanza di ResourceManager nella cache utilizzata da questa classe. | |||||
| /// </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("KeyPad.Properties.Resources", typeof(Resources).Assembly); | |||||
| resourceMan = temp; | |||||
| } | |||||
| return resourceMan; | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte | |||||
| /// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata. | |||||
| /// </summary> | |||||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||||
| internal static global::System.Globalization.CultureInfo Culture | |||||
| { | |||||
| get | |||||
| { | |||||
| return resourceCulture; | |||||
| } | |||||
| set | |||||
| { | |||||
| resourceCulture = value; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -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> | |||||
| @ -0,0 +1,30 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // This code was generated by a tool. | |||||
| // Runtime Version:4.0.30319.239 | |||||
| // | |||||
| // Changes to this file may cause incorrect behavior and will be lost if | |||||
| // the code is regenerated. | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace KeyPad.Properties | |||||
| { | |||||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,7 @@ | |||||
| <?xml version='1.0' encoding='utf-8'?> | |||||
| <SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> | |||||
| <Profiles> | |||||
| <Profile Name="(Default)" /> | |||||
| </Profiles> | |||||
| <Settings /> | |||||
| </SettingsFile> | |||||
| @ -0,0 +1,353 @@ | |||||
| <Window x:Class="KeyPad.VirtualKeyboard" | |||||
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||||
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||||
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||||
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||||
| xmlns:converter="clr-namespace:KeyPad.Converter" | |||||
| Height="350" Width="1000" x:Name="Keyboard" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" Title="Virtual Keyboard"> | |||||
| <Window.Resources> | |||||
| <converter:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/> | |||||
| <LinearGradientBrush x:Key="IPhoneSteelBackground" EndPoint="0.5,1.272" StartPoint="0.5,0"> | |||||
| <GradientStop Color="#FF9097A3" Offset="0"/> | |||||
| <GradientStop Color="#FF444D5B" Offset="1"/> | |||||
| </LinearGradientBrush> | |||||
| <DropShadowEffect x:Key="DropShadowEffect" ShadowDepth="1" Direction="-90" BlurRadius="3" /> | |||||
| <Style TargetType="Button"> | |||||
| <EventSetter Event="Click" Handler="button_Click" /> | |||||
| <Setter Property="Margin" Value="4"/> | |||||
| <Setter Property="Button.Effect" Value="{StaticResource DropShadowEffect}"/> | |||||
| <Setter Property="FontSize" Value="22"/> | |||||
| <Setter Property="Background" Value="WhiteSmoke"/> | |||||
| <Setter Property="RenderTransform"> | |||||
| <Setter.Value> | |||||
| <!-- Workaround for ATI video cards that don't render good with dropshadoweffect--> | |||||
| <RotateTransform Angle="0.00000000001"/> | |||||
| </Setter.Value> | |||||
| </Setter> | |||||
| </Style> | |||||
| <Style TargetType="ToggleButton"> | |||||
| <Setter Property="ClickMode" Value="Press"/> | |||||
| <Setter Property="Margin" Value="4"/> | |||||
| <Setter Property="Background" Value="WhiteSmoke"/> | |||||
| <Setter Property="Button.Effect" Value="{StaticResource DropShadowEffect}"/> | |||||
| <Setter Property="FontSize" Value="22"/> | |||||
| <Setter Property="RenderTransform"> | |||||
| <Setter.Value> | |||||
| <!-- Workaround for ATI video cards that don't render good with dropshadoweffect--> | |||||
| <RotateTransform Angle="0.00000000001"/> | |||||
| </Setter.Value> | |||||
| </Setter> | |||||
| </Style> | |||||
| <Style TargetType="Label"> | |||||
| <Setter Property="Label.Effect" Value="{StaticResource DropShadowEffect}"/> | |||||
| <Setter Property="FontSize" Value="22"/> | |||||
| <Setter Property="VerticalContentAlignment" Value="Center"/> | |||||
| <Setter Property="RenderTransform"> | |||||
| <Setter.Value> | |||||
| <!-- Workaround for ATI video cards that don't render good with dropshadoweffect--> | |||||
| <RotateTransform Angle="0.00000000001"/> | |||||
| </Setter.Value> | |||||
| </Setter> | |||||
| </Style> | |||||
| </Window.Resources> | |||||
| <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{DynamicResource IPhoneSteelBackground}" > | |||||
| <Grid.RowDefinitions> | |||||
| <RowDefinition Height="auto"/> | |||||
| <RowDefinition/> | |||||
| </Grid.RowDefinitions> | |||||
| <Grid HorizontalAlignment="Stretch"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition Width="auto"/> | |||||
| <ColumnDefinition/> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="0" CommandParameter="ESC" Content="Esc" Height="50" Width="80" IsCancel="True"/> | |||||
| <Label Content="{Binding Result, ElementName=Keyboard }" Background="WhiteSmoke" BorderBrush="Gray" BorderThickness="1" Grid.Column="1" Margin="5,5,5,5" FontSize="18" HorizontalAlignment="Stretch"/> | |||||
| </Grid> | |||||
| <Grid Grid.Row="1" VerticalAlignment="Stretch" x:Name="AlfaKeyboard" Background="{DynamicResource IPhoneSteelBackground}" > | |||||
| <Grid.RowDefinitions> | |||||
| <RowDefinition Height="0" /> | |||||
| <RowDefinition x:Name="NumberKeys" Height="0"/> | |||||
| <RowDefinition/> | |||||
| <RowDefinition/> | |||||
| <RowDefinition/> | |||||
| <RowDefinition/> | |||||
| </Grid.RowDefinitions> | |||||
| <Grid Grid.Row="2"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition /> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="1" CommandParameter="Q" Content="Q"/> | |||||
| <Button Grid.Column="2" CommandParameter="W" Content="W"/> | |||||
| <Button Grid.Column="3" CommandParameter="E" Content="E"/> | |||||
| <Button Grid.Column="4" CommandParameter="R" Content="R"/> | |||||
| <Button Grid.Column="5" CommandParameter="T" Content="T"/> | |||||
| <Button Grid.Column="6" CommandParameter="Y" Content="Y"/> | |||||
| <Button Grid.Column="7" CommandParameter="U" Content="U"/> | |||||
| <Button Grid.Column="8" CommandParameter="I" Content="I"/> | |||||
| <Button Grid.Column="9" CommandParameter="O" Content="O"/> | |||||
| <Button Grid.Column="10" CommandParameter="P" Content="P"/> | |||||
| <Button Grid.Column="13" CommandParameter="BACK"> | |||||
| <Path Stretch="Fill" Width="36" Height="24" Data="F1M555.0371,274.4893L552.7871,276.7383L549.9861,273.9373L547.1991,276.7243L545.1131,274.6393L547.9001,271.8523L545.0101,268.9603L547.2601,266.7113L550.1501,269.6023L552.8921,266.8613L554.9761,268.9463L552.2361,271.6883z M555.3751,264.0003L544.8751,264.0003C543.1251,264.1253,535.0001,270.7503,535.0001,272.2503C535.0001,273.7503,543.1251,279.3753,544.8751,279.5003L555.3751,279.5003C558.8751,279.5003,559.3751,277.7093,559.3751,275.5003L559.3751,268.0003C559.3751,265.7913,558.7501,264.0003,555.3751,264.0003" Fill="#FF333333"></Path> | |||||
| </Button> | |||||
| </Grid> | |||||
| <Grid Grid.Row="3"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition Width="0.3*"/> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="1.55*"/> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="1" CommandParameter="A" Content="A"/> | |||||
| <Button Grid.Column="2" CommandParameter="S" Content="S"/> | |||||
| <Button Grid.Column="3" CommandParameter="D" Content="D"/> | |||||
| <Button Grid.Column="4" CommandParameter="F" Content="F"/> | |||||
| <Button Grid.Column="5" CommandParameter="G" Content="G"/> | |||||
| <Button Grid.Column="6" CommandParameter="H" Content="H"/> | |||||
| <Button Grid.Column="7" CommandParameter="J" Content="J"/> | |||||
| <Button Grid.Column="8" CommandParameter="K" Content="K"/> | |||||
| <Button Grid.Column="9" CommandParameter="L" Content="L"/> | |||||
| <Button Grid.Column="12" CommandParameter="RETURN" HorizontalContentAlignment="Right" Padding="10"> | |||||
| <StackPanel Orientation="Horizontal"> | |||||
| <TextBlock Text="Return "/> | |||||
| <TextBlock Text="8 " FontFamily="Wingdings 3" TextAlignment="Center" /> | |||||
| </StackPanel> | |||||
| </Button> | |||||
| </Grid> | |||||
| <Grid Grid.Row="4"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition Width="1*"/> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition Width="*"/> | |||||
| <ColumnDefinition Width="*"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="1.1*"/> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="0" CommandParameter="LSHIFT"> | |||||
| <Path Fill="#FF333333" Stretch="Fill" Width="28" Height="24" Data="F1M269.5,262C269.026,262,268.552,262.168,268.171,262.505L259.671,270.505C259.05,271.057,258.835,271.935,259.131,272.71C259.425,273.487,260.169,274,261,274L265,274L265,278C265,279.104,265.896,280,267,280L272,280C273.104,280,274,279.104,274,278L274,274L278,274C278.81,274,279.538,273.513,279.849,272.766C280.157,272.018,279.986,271.158,279.415,270.585L270.914,262.586C270.524,262.197,270.013,262,269.5,262 M269.5,264L278,272L272,272L272,278L267,278L267,272L261,272L269.5,264"/> | |||||
| </Button> | |||||
| <Button Grid.Column="1" CommandParameter="Z" Content="Z"/> | |||||
| <Button Grid.Column="2" CommandParameter="X" Content="X"/> | |||||
| <Button Grid.Column="3" CommandParameter="C" Content="C"/> | |||||
| <Button Grid.Column="4" CommandParameter="V" Content="V"/> | |||||
| <Button Grid.Column="5" CommandParameter="B" Content="B"/> | |||||
| <Button Grid.Column="6" CommandParameter="N" Content="N"/> | |||||
| <Button Grid.Column="7" CommandParameter="M" Content="M"/> | |||||
| <Button Grid.Column="8" CommandParameter="," Content=","/> | |||||
| <Button Grid.Column="9" CommandParameter="." Content="."/> | |||||
| <Button Grid.Column="11" CommandParameter="-" Content="-"/> | |||||
| </Grid> | |||||
| <Grid Grid.Row="5"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition Width="5*" /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| </Grid.ColumnDefinitions> | |||||
| <ToggleButton IsChecked="{Binding ShowNumericKeyboard, ElementName=Keyboard}" Grid.Column="0" Grid.ColumnSpan="2" ClickMode="Press" Content=".?123" /> | |||||
| <Button Grid.Column="2" CommandParameter="CTRL" Content="Ctrl" /> | |||||
| <!-- wingdings Windows Logo: ÿ --> | |||||
| <!-- wingdings apple cmd key: z --> | |||||
| <Button Grid.Column="3" CommandParameter="SPACE" Content=" "/> | |||||
| <Button Grid.Column="4" CommandParameter="ALT" Content="Alt" /> | |||||
| <ToggleButton IsChecked="{Binding ShowNumericKeyboard, ElementName=Keyboard}" Grid.Column="5" Grid.ColumnSpan="2" Command="{Binding Path=PressAndHold}" CommandParameter="IGNORE" Content=".?123" /> | |||||
| </Grid> | |||||
| </Grid> | |||||
| <!--<Grid Grid.Row="1" x:Name="NumKeyboard" Background="{DynamicResource IPhoneSteelBackground}" Margin="0,0,0,0" Visibility="Collapsed" >--> | |||||
| <Grid Grid.Row="1" x:Name="NumKeyboard" Background="{DynamicResource IPhoneSteelBackground}" Margin="0,0,0,0" Visibility="{Binding ShowNumericKeyboard, ElementName=Keyboard, Converter={StaticResource BoolToVisibilityConverter}}" > | |||||
| <Grid.RowDefinitions> | |||||
| <RowDefinition Height="0"/> | |||||
| <RowDefinition /> | |||||
| <RowDefinition/> | |||||
| <RowDefinition Height="0"/> | |||||
| <RowDefinition/> | |||||
| <RowDefinition Height="*"/> | |||||
| </Grid.RowDefinitions> | |||||
| <Grid Grid.Row="1"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition /> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="0" CommandParameter="_1" Content="1"/> | |||||
| <Button Grid.Column="1" CommandParameter="_2" Content="2"/> | |||||
| <Button Grid.Column="2" CommandParameter="_3" Content="3"/> | |||||
| <Button Grid.Column="3" CommandParameter="_4" Content="4"/> | |||||
| <Button Grid.Column="4" CommandParameter="_5" Content="5"/> | |||||
| <Button Grid.Column="5" CommandParameter="_6" Content="6"/> | |||||
| <Button Grid.Column="6" CommandParameter="_7" Content="7"/> | |||||
| <Button Grid.Column="7" CommandParameter="_8" Content="8" /> | |||||
| <Button Grid.Column="8" CommandParameter="_9" Content="9"/> | |||||
| <Button Grid.Column="9" CommandParameter="_0" Content="0"/> | |||||
| <Button Grid.Column="13" CommandParameter="BACK" > | |||||
| <Path Stretch="Fill" Width="36" Height="24" Data="F1M555.0371,274.4893L552.7871,276.7383L549.9861,273.9373L547.1991,276.7243L545.1131,274.6393L547.9001,271.8523L545.0101,268.9603L547.2601,266.7113L550.1501,269.6023L552.8921,266.8613L554.9761,268.9463L552.2361,271.6883z M555.3751,264.0003L544.8751,264.0003C543.1251,264.1253,535.0001,270.7503,535.0001,272.2503C535.0001,273.7503,543.1251,279.3753,544.8751,279.5003L555.3751,279.5003C558.8751,279.5003,559.3751,277.7093,559.3751,275.5003L559.3751,268.0003C559.3751,265.7913,558.7501,264.0003,555.3751,264.0003" Fill="#FF333333"/> | |||||
| </Button> | |||||
| </Grid> | |||||
| <Grid Grid.Row="2"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition Width="0.3*"/> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="1.55*"/> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="1" CommandParameter="Q" Content="-"/> | |||||
| <Button Grid.Column="2" CommandParameter="W" Content="/"/> | |||||
| <Button Grid.Column="3" CommandParameter="E" Content=":"/> | |||||
| <Button Grid.Column="4" CommandParameter="R" Content=";"/> | |||||
| <Button Grid.Column="5" CommandParameter="T" Content="(" /> | |||||
| <Button Grid.Column="6" CommandParameter="Y" Content=")"/> | |||||
| <Button Grid.Column="7" CommandParameter="U" Content="$"/> | |||||
| <Button Grid.Column="8" CommandParameter="I" Content="&"/> | |||||
| <Button Grid.Column="9" CommandParameter="O" Content="@"/> | |||||
| <Button Grid.Column="10" CommandParameter="P" Content="""/> | |||||
| <Button Grid.Column="12" CommandParameter="RETURN" HorizontalContentAlignment="Right" Padding="10"> | |||||
| <StackPanel Orientation="Horizontal"> | |||||
| <TextBlock Text="Return "/> | |||||
| <TextBlock Text="8 " FontFamily="Wingdings 3" TextAlignment="Center" /> | |||||
| </StackPanel> | |||||
| </Button> | |||||
| </Grid> | |||||
| <!--<Grid Grid.Row="3"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition Width="0.3*"/> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="1.55*"/> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="1" CommandParameter="A" Content="A"/> | |||||
| <Button Grid.Column="2" CommandParameter="S" Content="S"/> | |||||
| <Button Grid.Column="3" CommandParameter="D" Content="D"/> | |||||
| <Button Grid.Column="4" CommandParameter="F" Content="F"/> | |||||
| <Button Grid.Column="5" CommandParameter="G" Content="G"/> | |||||
| <Button Grid.Column="6" CommandParameter="H" Content="H"/> | |||||
| <Button Grid.Column="7" CommandParameter="J" Content="J"/> | |||||
| <Button Grid.Column="8" CommandParameter="K" Content="K"/> | |||||
| <Button Grid.Column="9" CommandParameter="L" Content="L"/> | |||||
| <Button Grid.Column="12" CommandParameter="RETURN" Content="return" HorizontalContentAlignment="Right" Padding="10"/>--> | |||||
| <!--</Grid>--> | |||||
| <Grid Grid.Row="4"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition Width="1*"/> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition /> | |||||
| <ColumnDefinition Width="*"/> | |||||
| <ColumnDefinition Width="*"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="1.1*"/> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="0" Command="{Binding Path=PressAndHold}" CommandParameter="LSHIFT"> | |||||
| <Path Fill="#FF333333" Stretch="Fill" Width="28" Height="24" Data="F1M269.5,262C269.026,262,268.552,262.168,268.171,262.505L259.671,270.505C259.05,271.057,258.835,271.935,259.131,272.71C259.425,273.487,260.169,274,261,274L265,274L265,278C265,279.104,265.896,280,267,280L272,280C273.104,280,274,279.104,274,278L274,274L278,274C278.81,274,279.538,273.513,279.849,272.766C280.157,272.018,279.986,271.158,279.415,270.585L270.914,262.586C270.524,262.197,270.013,262,269.5,262 M269.5,264L278,272L272,272L272,278L267,278L267,272L261,272L269.5,264"/> | |||||
| </Button> | |||||
| <Button Grid.Column="1" CommandParameter="Z" Content="."/> | |||||
| <Button Grid.Column="2" CommandParameter="X" Content=","/> | |||||
| <Button Grid.Column="3" CommandParameter="C" Content="?"/> | |||||
| <Button Grid.Column="4" CommandParameter="B" Content="'"/> | |||||
| <Button Grid.Column="5" CommandParameter="N" Content="="/> | |||||
| <Button Grid.Column="6" CommandParameter="M" Content="+"/> | |||||
| <Button Grid.Column="7" CommandParameter="OEM_COMMA" >*</Button> | |||||
| <Button Grid.Column="8" CommandParameter="OEM_PERIOD" >\</Button> | |||||
| <Button Grid.Column="9" CommandParameter="OEM_PERIOD" >[</Button> | |||||
| <Button Grid.Column="11" CommandParameter="OEM_PERIOD" >]</Button> | |||||
| </Grid> | |||||
| <Grid Grid.Row="5"> | |||||
| <Grid.ColumnDefinitions> | |||||
| <ColumnDefinition Width="2*"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="5*" /> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="0"/> | |||||
| <ColumnDefinition Width="2*"/> | |||||
| </Grid.ColumnDefinitions> | |||||
| <Button Grid.Column="0" CommandParameter="RSHIFT" Content=".?123" /> | |||||
| <Button Grid.Column="1" CommandParameter="LCONTROL" Content="Ctrl" /> | |||||
| <Button Grid.Column="2" CommandParameter="LWIN" FontFamily="WingDings"> | |||||
| z</Button> | |||||
| <!-- wingdings Windows Logo: ÿ --> | |||||
| <!-- wingdings apple cmd key: z --> | |||||
| <ToggleButton IsChecked="{Binding ShowNumericKeyboard, ElementName=Keyboard}" CommandParameter="IGNORE" Grid.Column="0" ClickMode="Press" Content="ABC" /> | |||||
| <Button Grid.Column="3" CommandParameter="SPACE" Content=" "/> | |||||
| <Button Grid.Column="4" CommandParameter="MENU" Content="Alt" /> | |||||
| <Button Grid.Column="5" CommandParameter="LMENU" Content="Menu" /> | |||||
| <ToggleButton IsChecked="{Binding ShowNumericKeyboard, ElementName=Keyboard}" CommandParameter="IGNORE" Grid.Column="6" ClickMode="Press" Content="ABC" /> | |||||
| </Grid> | |||||
| </Grid> | |||||
| <!--<Image HorizontalAlignment="Left" Margin="-450,0,0,-377" Width="163" Stretch="Fill" VerticalAlignment="Bottom" Height="342" Grid.Row="1"/>--> | |||||
| </Grid> | |||||
| <!--<CheckBox Canvas.Left="894.223" Canvas.Top="17.02" Height="16.665" Name="checkBox1" Width="17.845" IsChecked="{Binding Source={DynamicResource virtualKeyboard}, Path=Shift, Mode=TwoWay, NotifyOnTargetUpdated=True}"></CheckBox>--> | |||||
| </Window> | |||||
| @ -0,0 +1,144 @@ | |||||
| /* | |||||
| * Copyright (c) 2008, Andrzej Rusztowicz (ekus.net) | |||||
| * All rights reserved. | |||||
| * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |||||
| * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |||||
| * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |||||
| * Neither the name of ekus.net nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | |||||
| * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||
| */ | |||||
| /* | |||||
| * Added by Michele Cattafesta (mesta-automation.com) 29/2/2011 | |||||
| * The code has been totally rewritten to create a control that can be modified more easy even without knowing the MVVM pattern. | |||||
| * If you need to check the original source code you can download it here: http://wosk.codeplex.com/ | |||||
| */ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| 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; | |||||
| using System.ComponentModel; | |||||
| using System.Text.RegularExpressions; | |||||
| namespace KeyPad | |||||
| { | |||||
| /// <summary> | |||||
| /// Logica di interazione per VirtualKeyboard.xaml | |||||
| /// </summary> | |||||
| public partial class VirtualKeyboard : Window, INotifyPropertyChanged | |||||
| { | |||||
| #region Public Properties | |||||
| private bool _showNumericKeyboard; | |||||
| public bool ShowNumericKeyboard | |||||
| { | |||||
| get { return _showNumericKeyboard; } | |||||
| set { _showNumericKeyboard = value; this.OnPropertyChanged("ShowNumericKeyboard"); } | |||||
| } | |||||
| private string _result; | |||||
| public string Result | |||||
| { | |||||
| get { return _result; } | |||||
| private set { _result = value; this.OnPropertyChanged("Result"); } | |||||
| } | |||||
| #endregion | |||||
| #region Constructor | |||||
| public VirtualKeyboard(TextBox owner, Window wndOwner) | |||||
| { | |||||
| InitializeComponent(); | |||||
| this.Owner = wndOwner; | |||||
| this.DataContext = this; | |||||
| Result = ""; | |||||
| } | |||||
| #endregion | |||||
| #region Callbacks | |||||
| private void button_Click(object sender, RoutedEventArgs e) | |||||
| { | |||||
| Button button = sender as Button; | |||||
| if (button != null) | |||||
| { | |||||
| switch (button.CommandParameter.ToString()) | |||||
| { | |||||
| case "LSHIFT": | |||||
| Regex upperCaseRegex = new Regex("[A-Z]"); | |||||
| Regex lowerCaseRegex = new Regex("[a-z]"); | |||||
| Button btn; | |||||
| foreach (UIElement elem in AlfaKeyboard.Children) //iterate the main grid | |||||
| { | |||||
| Grid grid = elem as Grid; | |||||
| if (grid != null) | |||||
| { | |||||
| foreach (UIElement uiElement in grid.Children) //iterate the single rows | |||||
| { | |||||
| btn = uiElement as Button; | |||||
| if (btn != null) // if button contains only 1 character | |||||
| { | |||||
| if (btn.Content.ToString().Length == 1) | |||||
| { | |||||
| if (upperCaseRegex.Match(btn.Content.ToString()).Success) // if the char is a letter and uppercase | |||||
| btn.Content = btn.Content.ToString().ToLower(); | |||||
| else if (lowerCaseRegex.Match(button.Content.ToString()).Success) // if the char is a letter and lower case | |||||
| btn.Content = btn.Content.ToString().ToUpper(); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| break; | |||||
| case "ALT": | |||||
| case "CTRL": | |||||
| break; | |||||
| case "RETURN": | |||||
| this.DialogResult = true; | |||||
| break; | |||||
| case "BACK": | |||||
| if (Result.Length > 0) | |||||
| Result = Result.Remove(Result.Length - 1); | |||||
| break; | |||||
| default: | |||||
| Result += button.Content.ToString(); | |||||
| break; | |||||
| } | |||||
| } | |||||
| } | |||||
| #endregion | |||||
| #region INotifyPropertyChanged members | |||||
| public event PropertyChangedEventHandler PropertyChanged; | |||||
| protected void OnPropertyChanged(string propertyName) | |||||
| { | |||||
| if (PropertyChanged != null) | |||||
| this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); | |||||
| } | |||||
| #endregion | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,3 @@ | |||||
| <?xml version="1.0" encoding="utf-8" ?> | |||||
| <configuration> | |||||
| </configuration> | |||||
| @ -0,0 +1,36 @@ | |||||
| using System.Reflection; | |||||
| using System.Runtime.CompilerServices; | |||||
| using System.Runtime.InteropServices; | |||||
| // 有关程序集的常规信息通过以下 | |||||
| // 特性集控制。更改这些特性值可修改 | |||||
| // 与程序集关联的信息。 | |||||
| [assembly: AssemblyTitle("Update")] | |||||
| [assembly: AssemblyDescription("")] | |||||
| [assembly: AssemblyConfiguration("")] | |||||
| [assembly: AssemblyCompany("青花瓷")] | |||||
| [assembly: AssemblyProduct("Update")] | |||||
| [assembly: AssemblyCopyright("Copyright © 青花瓷 2014")] | |||||
| [assembly: AssemblyTrademark("")] | |||||
| [assembly: AssemblyCulture("")] | |||||
| // 将 ComVisible 设置为 false 使此程序集中的类型 | |||||
| // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, | |||||
| // 则将该类型上的 ComVisible 特性设置为 true。 | |||||
| [assembly: ComVisible(false)] | |||||
| // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID | |||||
| [assembly: Guid("e8fcc1a1-95fa-4858-9108-0f3d912c1ce7")] | |||||
| // 程序集的版本信息由下面四个值组成: | |||||
| // | |||||
| // 主版本 | |||||
| // 次版本 | |||||
| // 内部版本号 | |||||
| // 修订号 | |||||
| // | |||||
| // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, | |||||
| // 方法是按如下所示使用“*”: | |||||
| // [assembly: AssemblyVersion("1.0.*")] | |||||
| [assembly: AssemblyVersion("1.0.0.0")] | |||||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||||
| @ -0,0 +1,4 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/"> | |||||
| <contractRef ref="http://nserver/B2/LoginService.svc?wsdl" docRef="http://nserver/B2/LoginService.svc" xmlns="http://schemas.xmlsoap.org/disco/scl/" /> | |||||
| </discovery> | |||||
| @ -0,0 +1,58 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="LoginService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> | |||||
| <wsdl:types> | |||||
| <xsd:schema targetNamespace="http://tempuri.org/Imports"> | |||||
| <xsd:import schemaLocation="http://nserver/B2/LoginService.svc?xsd=xsd0" namespace="http://tempuri.org/" /> | |||||
| <xsd:import schemaLocation="http://nserver/B2/LoginService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> | |||||
| <xsd:import schemaLocation="http://nserver/B2/LoginService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Bwp.Web.Pages.WCFs" /> | |||||
| </xsd:schema> | |||||
| </wsdl:types> | |||||
| <wsdl:message name="ILoginService_Login_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:Login" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="ILoginService_Login_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:LoginResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="ILoginService_KeepLogin_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:KeepLogin" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="ILoginService_KeepLogin_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:KeepLoginResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:portType name="ILoginService"> | |||||
| <wsdl:operation name="Login"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/ILoginService/Login" message="tns:ILoginService_Login_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/ILoginService/LoginResponse" message="tns:ILoginService_Login_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="KeepLogin"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/ILoginService/KeepLogin" message="tns:ILoginService_KeepLogin_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/ILoginService/KeepLoginResponse" message="tns:ILoginService_KeepLogin_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| </wsdl:portType> | |||||
| <wsdl:binding name="BasicHttpBinding_ILoginService" type="tns:ILoginService"> | |||||
| <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> | |||||
| <wsdl:operation name="Login"> | |||||
| <soap:operation soapAction="http://tempuri.org/ILoginService/Login" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="KeepLogin"> | |||||
| <soap:operation soapAction="http://tempuri.org/ILoginService/KeepLogin" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| </wsdl:binding> | |||||
| <wsdl:service name="LoginService"> | |||||
| <wsdl:port name="BasicHttpBinding_ILoginService" binding="tns:BasicHttpBinding_ILoginService"> | |||||
| <soap:address location="http://nserver/B2/LoginService.svc" /> | |||||
| </wsdl:port> | |||||
| </wsdl:service> | |||||
| </wsdl:definitions> | |||||
| @ -0,0 +1,10 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/Bwp.Web.Pages.WCFs" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/Bwp.Web.Pages.WCFs" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||||
| <xs:complexType name="WcfLoginResponseMessage"> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="Message" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="Success" type="xs:boolean" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| <xs:element name="WcfLoginResponseMessage" nillable="true" type="tns:WcfLoginResponseMessage" /> | |||||
| </xs:schema> | |||||
| @ -0,0 +1,33 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||||
| <xs:import schemaLocation="http://nserver/B2/LoginService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Bwp.Web.Pages.WCFs" /> | |||||
| <xs:element name="Login"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="username" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="password" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="LoginResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/Bwp.Web.Pages.WCFs" minOccurs="0" name="LoginResult" nillable="true" type="q1:WcfLoginResponseMessage" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="KeepLogin"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="KeepLoginResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="KeepLoginResult" type="xs:boolean" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| </xs:schema> | |||||
| @ -0,0 +1,42 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||||
| <xs:element name="anyType" nillable="true" type="xs:anyType" /> | |||||
| <xs:element name="anyURI" nillable="true" type="xs:anyURI" /> | |||||
| <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" /> | |||||
| <xs:element name="boolean" nillable="true" type="xs:boolean" /> | |||||
| <xs:element name="byte" nillable="true" type="xs:byte" /> | |||||
| <xs:element name="dateTime" nillable="true" type="xs:dateTime" /> | |||||
| <xs:element name="decimal" nillable="true" type="xs:decimal" /> | |||||
| <xs:element name="double" nillable="true" type="xs:double" /> | |||||
| <xs:element name="float" nillable="true" type="xs:float" /> | |||||
| <xs:element name="int" nillable="true" type="xs:int" /> | |||||
| <xs:element name="long" nillable="true" type="xs:long" /> | |||||
| <xs:element name="QName" nillable="true" type="xs:QName" /> | |||||
| <xs:element name="short" nillable="true" type="xs:short" /> | |||||
| <xs:element name="string" nillable="true" type="xs:string" /> | |||||
| <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" /> | |||||
| <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" /> | |||||
| <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" /> | |||||
| <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" /> | |||||
| <xs:element name="char" nillable="true" type="tns:char" /> | |||||
| <xs:simpleType name="char"> | |||||
| <xs:restriction base="xs:int" /> | |||||
| </xs:simpleType> | |||||
| <xs:element name="duration" nillable="true" type="tns:duration" /> | |||||
| <xs:simpleType name="duration"> | |||||
| <xs:restriction base="xs:duration"> | |||||
| <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" /> | |||||
| <xs:minInclusive value="-P10675199DT2H48M5.4775808S" /> | |||||
| <xs:maxInclusive value="P10675199DT2H48M5.4775807S" /> | |||||
| </xs:restriction> | |||||
| </xs:simpleType> | |||||
| <xs:element name="guid" nillable="true" type="tns:guid" /> | |||||
| <xs:simpleType name="guid"> | |||||
| <xs:restriction base="xs:string"> | |||||
| <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" /> | |||||
| </xs:restriction> | |||||
| </xs:simpleType> | |||||
| <xs:attribute name="FactoryType" type="xs:QName" /> | |||||
| <xs:attribute name="Id" type="xs:ID" /> | |||||
| <xs:attribute name="Ref" type="xs:IDREF" /> | |||||
| </xs:schema> | |||||
| @ -0,0 +1,123 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // 此代码由工具生成。 | |||||
| // 运行时版本:4.0.30319.34011 | |||||
| // | |||||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||||
| // 重新生成代码,这些更改将会丢失。 | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace Update.LoginService { | |||||
| using System.Runtime.Serialization; | |||||
| using System; | |||||
| [System.Diagnostics.DebuggerStepThroughAttribute()] | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] | |||||
| [System.Runtime.Serialization.DataContractAttribute(Name="WcfLoginResponseMessage", Namespace="http://schemas.datacontract.org/2004/07/Bwp.Web.Pages.WCFs")] | |||||
| [System.SerializableAttribute()] | |||||
| public partial class WcfLoginResponseMessage : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { | |||||
| [System.NonSerializedAttribute()] | |||||
| private System.Runtime.Serialization.ExtensionDataObject extensionDataField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private string MessageField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private bool SuccessField; | |||||
| [global::System.ComponentModel.BrowsableAttribute(false)] | |||||
| public System.Runtime.Serialization.ExtensionDataObject ExtensionData { | |||||
| get { | |||||
| return this.extensionDataField; | |||||
| } | |||||
| set { | |||||
| this.extensionDataField = value; | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public string Message { | |||||
| get { | |||||
| return this.MessageField; | |||||
| } | |||||
| set { | |||||
| if ((object.ReferenceEquals(this.MessageField, value) != true)) { | |||||
| this.MessageField = value; | |||||
| this.RaisePropertyChanged("Message"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public bool Success { | |||||
| get { | |||||
| return this.SuccessField; | |||||
| } | |||||
| set { | |||||
| if ((this.SuccessField.Equals(value) != true)) { | |||||
| this.SuccessField = value; | |||||
| this.RaisePropertyChanged("Success"); | |||||
| } | |||||
| } | |||||
| } | |||||
| public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; | |||||
| protected void RaisePropertyChanged(string propertyName) { | |||||
| System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; | |||||
| if ((propertyChanged != null)) { | |||||
| propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] | |||||
| [System.ServiceModel.ServiceContractAttribute(ConfigurationName="LoginService.ILoginService")] | |||||
| public interface ILoginService { | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILoginService/Login", ReplyAction="http://tempuri.org/ILoginService/LoginResponse")] | |||||
| Update.LoginService.WcfLoginResponseMessage Login(string username, string password); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/ILoginService/KeepLogin", ReplyAction="http://tempuri.org/ILoginService/KeepLoginResponse")] | |||||
| bool KeepLogin(string ticket); | |||||
| } | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] | |||||
| public interface ILoginServiceChannel : Update.LoginService.ILoginService, System.ServiceModel.IClientChannel { | |||||
| } | |||||
| [System.Diagnostics.DebuggerStepThroughAttribute()] | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] | |||||
| public partial class LoginServiceClient : System.ServiceModel.ClientBase<Update.LoginService.ILoginService>, Update.LoginService.ILoginService { | |||||
| public LoginServiceClient() { | |||||
| } | |||||
| public LoginServiceClient(string endpointConfigurationName) : | |||||
| base(endpointConfigurationName) { | |||||
| } | |||||
| public LoginServiceClient(string endpointConfigurationName, string remoteAddress) : | |||||
| base(endpointConfigurationName, remoteAddress) { | |||||
| } | |||||
| public LoginServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : | |||||
| base(endpointConfigurationName, remoteAddress) { | |||||
| } | |||||
| public LoginServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : | |||||
| base(binding, remoteAddress) { | |||||
| } | |||||
| public Update.LoginService.WcfLoginResponseMessage Login(string username, string password) { | |||||
| return base.Channel.Login(username, password); | |||||
| } | |||||
| public bool KeepLogin(string ticket) { | |||||
| return base.Channel.KeepLogin(ticket); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,34 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="5f0bf755-14a0-4350-9bc2-6b317514867f" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap"> | |||||
| <ClientOptions> | |||||
| <GenerateAsynchronousMethods>false</GenerateAsynchronousMethods> | |||||
| <EnableDataBinding>true</EnableDataBinding> | |||||
| <ExcludedTypes /> | |||||
| <ImportXmlTypes>false</ImportXmlTypes> | |||||
| <GenerateInternalTypes>false</GenerateInternalTypes> | |||||
| <GenerateMessageContracts>false</GenerateMessageContracts> | |||||
| <NamespaceMappings /> | |||||
| <CollectionMappings /> | |||||
| <GenerateSerializableTypes>true</GenerateSerializableTypes> | |||||
| <Serializer>Auto</Serializer> | |||||
| <UseSerializerForFaults>true</UseSerializerForFaults> | |||||
| <ReferenceAllAssemblies>true</ReferenceAllAssemblies> | |||||
| <ReferencedAssemblies /> | |||||
| <ReferencedDataContractTypes /> | |||||
| <ServiceContractMappings /> | |||||
| </ClientOptions> | |||||
| <MetadataSources> | |||||
| <MetadataSource Address="http://nserver/B2/LoginService.svc" Protocol="http" SourceId="1" /> | |||||
| </MetadataSources> | |||||
| <Metadata> | |||||
| <MetadataFile FileName="LoginService1.xsd" MetadataType="Schema" ID="d482bb41-1e0d-4493-a858-bcce7eb2e7ef" SourceId="1" SourceUrl="http://nserver/B2/LoginService.svc?xsd=xsd0" /> | |||||
| <MetadataFile FileName="LoginService.disco" MetadataType="Disco" ID="33890be0-bd23-487f-b38f-1b5536417a2e" SourceId="1" SourceUrl="http://nserver/B2/LoginService.svc?disco" /> | |||||
| <MetadataFile FileName="LoginService.xsd" MetadataType="Schema" ID="b62b933d-a104-4341-a1aa-bdb2a2398044" SourceId="1" SourceUrl="http://nserver/B2/LoginService.svc?xsd=xsd2" /> | |||||
| <MetadataFile FileName="LoginService2.xsd" MetadataType="Schema" ID="cd354730-57ad-4643-89a1-6dfa3b450e40" SourceId="1" SourceUrl="http://nserver/B2/LoginService.svc?xsd=xsd1" /> | |||||
| <MetadataFile FileName="LoginService.wsdl" MetadataType="Wsdl" ID="60cfd59f-1a2e-483d-88da-13c176aee3d1" SourceId="1" SourceUrl="http://nserver/B2/LoginService.svc?wsdl" /> | |||||
| </Metadata> | |||||
| <Extensions> | |||||
| <ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" /> | |||||
| <ExtensionFile FileName="configuration.svcinfo" Name="configuration.svcinfo" /> | |||||
| </Extensions> | |||||
| </ReferenceGroup> | |||||
| @ -0,0 +1,10 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <!-- | |||||
| This file is automatically generated by Visual Studio .Net. It is | |||||
| used to store generic object data source configuration information. | |||||
| Renaming the file extension or editing the content of this file may | |||||
| cause the file to be unrecognizable by the program. | |||||
| --> | |||||
| <GenericObjectDataSource DisplayName="WcfLoginResponseMessage" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||||
| <TypeInfo>Update.LoginService.WcfLoginResponseMessage, Service References.LoginService.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||||
| </GenericObjectDataSource> | |||||
| @ -0,0 +1,10 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot"> | |||||
| <behaviors /> | |||||
| <bindings> | |||||
| <binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="BasicHttpBinding_ILoginService" />" bindingType="basicHttpBinding" name="BasicHttpBinding_ILoginService" /> | |||||
| </bindings> | |||||
| <endpoints> | |||||
| <endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://nserver/B2/LoginService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILoginService" contract="LoginService.ILoginService" name="BasicHttpBinding_ILoginService" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://nserver/B2/LoginService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILoginService" contract="LoginService.ILoginService" name="BasicHttpBinding_ILoginService" />" contractName="LoginService.ILoginService" name="BasicHttpBinding_ILoginService" /> | |||||
| </endpoints> | |||||
| </configurationSnapshot> | |||||
| @ -0,0 +1,201 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="++t2uMgn4as1QbhUVUSg5kWMAHU="> | |||||
| <bindingConfigurations> | |||||
| <bindingConfiguration bindingType="basicHttpBinding" name="BasicHttpBinding_ILoginService"> | |||||
| <properties> | |||||
| <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>BasicHttpBinding_ILoginService</serializedValue> | |||||
| </property> | |||||
| <property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>StrongWildcard</serializedValue> | |||||
| </property> | |||||
| <property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/maxBufferSize" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>65536</serializedValue> | |||||
| </property> | |||||
| <property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/textEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.Text.Encoding, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.Text.UTF8Encoding</serializedValue> | |||||
| </property> | |||||
| <property path="/transferMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.TransferMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>Buffered</serializedValue> | |||||
| </property> | |||||
| <property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>Text</serializedValue> | |||||
| </property> | |||||
| <property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.BasicHttpSecurityElement</serializedValue> | |||||
| </property> | |||||
| <property path="/security/mode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpSecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>None</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.HttpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.HttpTransportSecurityElement</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>None</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>None</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>Never</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>TransportSelected</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>(集合)</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpMessageSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.BasicHttpMessageSecurityElement</serializedValue> | |||||
| </property> | |||||
| <property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpMessageCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>UserName</serializedValue> | |||||
| </property> | |||||
| <property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>Default</serializedValue> | |||||
| </property> | |||||
| </properties> | |||||
| </bindingConfiguration> | |||||
| </bindingConfigurations> | |||||
| <endpoints> | |||||
| <endpoint name="BasicHttpBinding_ILoginService" contract="LoginService.ILoginService" bindingType="basicHttpBinding" address="http://nserver/B2/LoginService.svc" bindingConfiguration="BasicHttpBinding_ILoginService"> | |||||
| <properties> | |||||
| <property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>http://nserver/B2/LoginService.svc</serializedValue> | |||||
| </property> | |||||
| <property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>basicHttpBinding</serializedValue> | |||||
| </property> | |||||
| <property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>BasicHttpBinding_ILoginService</serializedValue> | |||||
| </property> | |||||
| <property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>LoginService.ILoginService</serializedValue> | |||||
| </property> | |||||
| <property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue> | |||||
| </property> | |||||
| <property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue><Header /></serializedValue> | |||||
| </property> | |||||
| <property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>My</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>LocalMachine</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>FindBySubjectDistinguishedName</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>False</serializedValue> | |||||
| </property> | |||||
| <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>BasicHttpBinding_ILoginService</serializedValue> | |||||
| </property> | |||||
| <property path="/kind" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/endpointConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| </properties> | |||||
| </endpoint> | |||||
| </endpoints> | |||||
| </SavedWcfConfigurationInformation> | |||||
| @ -0,0 +1,450 @@ | |||||
| //------------------------------------------------------------------------------ | |||||
| // <auto-generated> | |||||
| // 此代码由工具生成。 | |||||
| // 运行时版本:4.0.30319.34011 | |||||
| // | |||||
| // 对此文件的更改可能会导致不正确的行为,并且如果 | |||||
| // 重新生成代码,这些更改将会丢失。 | |||||
| // </auto-generated> | |||||
| //------------------------------------------------------------------------------ | |||||
| namespace Update.WeighTerminalService { | |||||
| using System.Runtime.Serialization; | |||||
| using System; | |||||
| [System.Diagnostics.DebuggerStepThroughAttribute()] | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] | |||||
| [System.Runtime.Serialization.DataContractAttribute(Name="ClientCar", Namespace="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_")] | |||||
| [System.SerializableAttribute()] | |||||
| public partial class ClientCar : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { | |||||
| [System.NonSerializedAttribute()] | |||||
| private System.Runtime.Serialization.ExtensionDataObject extensionDataField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private long Car_IDField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private string Car_NameField; | |||||
| [global::System.ComponentModel.BrowsableAttribute(false)] | |||||
| public System.Runtime.Serialization.ExtensionDataObject ExtensionData { | |||||
| get { | |||||
| return this.extensionDataField; | |||||
| } | |||||
| set { | |||||
| this.extensionDataField = value; | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public long Car_ID { | |||||
| get { | |||||
| return this.Car_IDField; | |||||
| } | |||||
| set { | |||||
| if ((this.Car_IDField.Equals(value) != true)) { | |||||
| this.Car_IDField = value; | |||||
| this.RaisePropertyChanged("Car_ID"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public string Car_Name { | |||||
| get { | |||||
| return this.Car_NameField; | |||||
| } | |||||
| set { | |||||
| if ((object.ReferenceEquals(this.Car_NameField, value) != true)) { | |||||
| this.Car_NameField = value; | |||||
| this.RaisePropertyChanged("Car_Name"); | |||||
| } | |||||
| } | |||||
| } | |||||
| public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; | |||||
| protected void RaisePropertyChanged(string propertyName) { | |||||
| System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; | |||||
| if ((propertyChanged != null)) { | |||||
| propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Diagnostics.DebuggerStepThroughAttribute()] | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] | |||||
| [System.Runtime.Serialization.DataContractAttribute(Name="ClientAccountingUnit", Namespace="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_")] | |||||
| [System.SerializableAttribute()] | |||||
| public partial class ClientAccountingUnit : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { | |||||
| [System.NonSerializedAttribute()] | |||||
| private System.Runtime.Serialization.ExtensionDataObject extensionDataField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private long AccountingUnit_IDField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private string AccountingUnit_NameField; | |||||
| [global::System.ComponentModel.BrowsableAttribute(false)] | |||||
| public System.Runtime.Serialization.ExtensionDataObject ExtensionData { | |||||
| get { | |||||
| return this.extensionDataField; | |||||
| } | |||||
| set { | |||||
| this.extensionDataField = value; | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public long AccountingUnit_ID { | |||||
| get { | |||||
| return this.AccountingUnit_IDField; | |||||
| } | |||||
| set { | |||||
| if ((this.AccountingUnit_IDField.Equals(value) != true)) { | |||||
| this.AccountingUnit_IDField = value; | |||||
| this.RaisePropertyChanged("AccountingUnit_ID"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public string AccountingUnit_Name { | |||||
| get { | |||||
| return this.AccountingUnit_NameField; | |||||
| } | |||||
| set { | |||||
| if ((object.ReferenceEquals(this.AccountingUnit_NameField, value) != true)) { | |||||
| this.AccountingUnit_NameField = value; | |||||
| this.RaisePropertyChanged("AccountingUnit_Name"); | |||||
| } | |||||
| } | |||||
| } | |||||
| public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; | |||||
| protected void RaisePropertyChanged(string propertyName) { | |||||
| System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; | |||||
| if ((propertyChanged != null)) { | |||||
| propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Diagnostics.DebuggerStepThroughAttribute()] | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] | |||||
| [System.Runtime.Serialization.DataContractAttribute(Name="ClientWeigh", Namespace="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_")] | |||||
| [System.SerializableAttribute()] | |||||
| public partial class ClientWeigh : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { | |||||
| [System.NonSerializedAttribute()] | |||||
| private System.Runtime.Serialization.ExtensionDataObject extensionDataField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private long AccountingUnit_IDField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private System.Nullable<int> CarNumberField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private long Car_IDField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private System.Nullable<int> NumberField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private string TerminalUser_NameField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private long TerminalWeigh_IDField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private long Terminal_IDField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private System.Nullable<System.DateTime> WeighTimeField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private System.Nullable<decimal> WeightField; | |||||
| [System.Runtime.Serialization.OptionalFieldAttribute()] | |||||
| private string WorkshopField; | |||||
| [global::System.ComponentModel.BrowsableAttribute(false)] | |||||
| public System.Runtime.Serialization.ExtensionDataObject ExtensionData { | |||||
| get { | |||||
| return this.extensionDataField; | |||||
| } | |||||
| set { | |||||
| this.extensionDataField = value; | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public long AccountingUnit_ID { | |||||
| get { | |||||
| return this.AccountingUnit_IDField; | |||||
| } | |||||
| set { | |||||
| if ((this.AccountingUnit_IDField.Equals(value) != true)) { | |||||
| this.AccountingUnit_IDField = value; | |||||
| this.RaisePropertyChanged("AccountingUnit_ID"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public System.Nullable<int> CarNumber { | |||||
| get { | |||||
| return this.CarNumberField; | |||||
| } | |||||
| set { | |||||
| if ((this.CarNumberField.Equals(value) != true)) { | |||||
| this.CarNumberField = value; | |||||
| this.RaisePropertyChanged("CarNumber"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public long Car_ID { | |||||
| get { | |||||
| return this.Car_IDField; | |||||
| } | |||||
| set { | |||||
| if ((this.Car_IDField.Equals(value) != true)) { | |||||
| this.Car_IDField = value; | |||||
| this.RaisePropertyChanged("Car_ID"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public System.Nullable<int> Number { | |||||
| get { | |||||
| return this.NumberField; | |||||
| } | |||||
| set { | |||||
| if ((this.NumberField.Equals(value) != true)) { | |||||
| this.NumberField = value; | |||||
| this.RaisePropertyChanged("Number"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public string TerminalUser_Name { | |||||
| get { | |||||
| return this.TerminalUser_NameField; | |||||
| } | |||||
| set { | |||||
| if ((object.ReferenceEquals(this.TerminalUser_NameField, value) != true)) { | |||||
| this.TerminalUser_NameField = value; | |||||
| this.RaisePropertyChanged("TerminalUser_Name"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public long TerminalWeigh_ID { | |||||
| get { | |||||
| return this.TerminalWeigh_IDField; | |||||
| } | |||||
| set { | |||||
| if ((this.TerminalWeigh_IDField.Equals(value) != true)) { | |||||
| this.TerminalWeigh_IDField = value; | |||||
| this.RaisePropertyChanged("TerminalWeigh_ID"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public long Terminal_ID { | |||||
| get { | |||||
| return this.Terminal_IDField; | |||||
| } | |||||
| set { | |||||
| if ((this.Terminal_IDField.Equals(value) != true)) { | |||||
| this.Terminal_IDField = value; | |||||
| this.RaisePropertyChanged("Terminal_ID"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public System.Nullable<System.DateTime> WeighTime { | |||||
| get { | |||||
| return this.WeighTimeField; | |||||
| } | |||||
| set { | |||||
| if ((this.WeighTimeField.Equals(value) != true)) { | |||||
| this.WeighTimeField = value; | |||||
| this.RaisePropertyChanged("WeighTime"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public System.Nullable<decimal> Weight { | |||||
| get { | |||||
| return this.WeightField; | |||||
| } | |||||
| set { | |||||
| if ((this.WeightField.Equals(value) != true)) { | |||||
| this.WeightField = value; | |||||
| this.RaisePropertyChanged("Weight"); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.Runtime.Serialization.DataMemberAttribute()] | |||||
| public string Workshop { | |||||
| get { | |||||
| return this.WorkshopField; | |||||
| } | |||||
| set { | |||||
| if ((object.ReferenceEquals(this.WorkshopField, value) != true)) { | |||||
| this.WorkshopField = value; | |||||
| this.RaisePropertyChanged("Workshop"); | |||||
| } | |||||
| } | |||||
| } | |||||
| public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; | |||||
| protected void RaisePropertyChanged(string propertyName) { | |||||
| System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; | |||||
| if ((propertyChanged != null)) { | |||||
| propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); | |||||
| } | |||||
| } | |||||
| } | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] | |||||
| [System.ServiceModel.ServiceContractAttribute(ConfigurationName="WeighTerminalService.IWeighTerminalService")] | |||||
| public interface IWeighTerminalService { | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/GetTerminalID", ReplyAction="http://tempuri.org/IWeighTerminalService/GetTerminalIDResponse")] | |||||
| long GetTerminalID(string ticket, string terminalMessage); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/StartQueryCar", ReplyAction="http://tempuri.org/IWeighTerminalService/StartQueryCarResponse")] | |||||
| void StartQueryCar(string ticket); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/GetCarPageCount", ReplyAction="http://tempuri.org/IWeighTerminalService/GetCarPageCountResponse")] | |||||
| int GetCarPageCount(string ticket); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/GetCarList", ReplyAction="http://tempuri.org/IWeighTerminalService/GetCarListResponse")] | |||||
| Update.WeighTerminalService.ClientCar[] GetCarList(string ticket, int pageIndex); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/FinishCar", ReplyAction="http://tempuri.org/IWeighTerminalService/FinishCarResponse")] | |||||
| void FinishCar(string ticket); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/StartQueryAccountingUnit", ReplyAction="http://tempuri.org/IWeighTerminalService/StartQueryAccountingUnitResponse")] | |||||
| void StartQueryAccountingUnit(string ticket); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/GetAccountingUnitPageCount", ReplyAction="http://tempuri.org/IWeighTerminalService/GetAccountingUnitPageCountResponse")] | |||||
| int GetAccountingUnitPageCount(string ticket); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/GetAccountingUnitList", ReplyAction="http://tempuri.org/IWeighTerminalService/GetAccountingUnitListResponse")] | |||||
| Update.WeighTerminalService.ClientAccountingUnit[] GetAccountingUnitList(string ticket, int pageIndex); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/FinishAccountingUnit", ReplyAction="http://tempuri.org/IWeighTerminalService/FinishAccountingUnitResponse")] | |||||
| void FinishAccountingUnit(string ticket); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/InsertWeigh", ReplyAction="http://tempuri.org/IWeighTerminalService/InsertWeighResponse")] | |||||
| long InsertWeigh(string ticket, Update.WeighTerminalService.ClientWeigh clientWeigh); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/GetSystemWeighID", ReplyAction="http://tempuri.org/IWeighTerminalService/GetSystemWeighIDResponse")] | |||||
| long GetSystemWeighID(string ticket, long terminalID, long terminalWeighID, System.DateTime weighTime); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/DeleteWeigh", ReplyAction="http://tempuri.org/IWeighTerminalService/DeleteWeighResponse")] | |||||
| int DeleteWeigh(string ticket, long weighID); | |||||
| [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IWeighTerminalService/CheckTerminalUser", ReplyAction="http://tempuri.org/IWeighTerminalService/CheckTerminalUserResponse")] | |||||
| bool CheckTerminalUser(string ticket, string terminalUserName); | |||||
| } | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] | |||||
| public interface IWeighTerminalServiceChannel : Update.WeighTerminalService.IWeighTerminalService, System.ServiceModel.IClientChannel { | |||||
| } | |||||
| [System.Diagnostics.DebuggerStepThroughAttribute()] | |||||
| [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] | |||||
| public partial class WeighTerminalServiceClient : System.ServiceModel.ClientBase<Update.WeighTerminalService.IWeighTerminalService>, Update.WeighTerminalService.IWeighTerminalService { | |||||
| public WeighTerminalServiceClient() { | |||||
| } | |||||
| public WeighTerminalServiceClient(string endpointConfigurationName) : | |||||
| base(endpointConfigurationName) { | |||||
| } | |||||
| public WeighTerminalServiceClient(string endpointConfigurationName, string remoteAddress) : | |||||
| base(endpointConfigurationName, remoteAddress) { | |||||
| } | |||||
| public WeighTerminalServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : | |||||
| base(endpointConfigurationName, remoteAddress) { | |||||
| } | |||||
| public WeighTerminalServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : | |||||
| base(binding, remoteAddress) { | |||||
| } | |||||
| public long GetTerminalID(string ticket, string terminalMessage) { | |||||
| return base.Channel.GetTerminalID(ticket, terminalMessage); | |||||
| } | |||||
| public void StartQueryCar(string ticket) { | |||||
| base.Channel.StartQueryCar(ticket); | |||||
| } | |||||
| public int GetCarPageCount(string ticket) { | |||||
| return base.Channel.GetCarPageCount(ticket); | |||||
| } | |||||
| public Update.WeighTerminalService.ClientCar[] GetCarList(string ticket, int pageIndex) { | |||||
| return base.Channel.GetCarList(ticket, pageIndex); | |||||
| } | |||||
| public void FinishCar(string ticket) { | |||||
| base.Channel.FinishCar(ticket); | |||||
| } | |||||
| public void StartQueryAccountingUnit(string ticket) { | |||||
| base.Channel.StartQueryAccountingUnit(ticket); | |||||
| } | |||||
| public int GetAccountingUnitPageCount(string ticket) { | |||||
| return base.Channel.GetAccountingUnitPageCount(ticket); | |||||
| } | |||||
| public Update.WeighTerminalService.ClientAccountingUnit[] GetAccountingUnitList(string ticket, int pageIndex) { | |||||
| return base.Channel.GetAccountingUnitList(ticket, pageIndex); | |||||
| } | |||||
| public void FinishAccountingUnit(string ticket) { | |||||
| base.Channel.FinishAccountingUnit(ticket); | |||||
| } | |||||
| public long InsertWeigh(string ticket, Update.WeighTerminalService.ClientWeigh clientWeigh) { | |||||
| return base.Channel.InsertWeigh(ticket, clientWeigh); | |||||
| } | |||||
| public long GetSystemWeighID(string ticket, long terminalID, long terminalWeighID, System.DateTime weighTime) { | |||||
| return base.Channel.GetSystemWeighID(ticket, terminalID, terminalWeighID, weighTime); | |||||
| } | |||||
| public int DeleteWeigh(string ticket, long weighID) { | |||||
| return base.Channel.DeleteWeigh(ticket, weighID); | |||||
| } | |||||
| public bool CheckTerminalUser(string ticket, string terminalUserName) { | |||||
| return base.Channel.CheckTerminalUser(ticket, terminalUserName); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,34 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="95289dc3-6dd8-4efe-bc55-0ef3edc17a27" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap"> | |||||
| <ClientOptions> | |||||
| <GenerateAsynchronousMethods>false</GenerateAsynchronousMethods> | |||||
| <EnableDataBinding>true</EnableDataBinding> | |||||
| <ExcludedTypes /> | |||||
| <ImportXmlTypes>false</ImportXmlTypes> | |||||
| <GenerateInternalTypes>false</GenerateInternalTypes> | |||||
| <GenerateMessageContracts>false</GenerateMessageContracts> | |||||
| <NamespaceMappings /> | |||||
| <CollectionMappings /> | |||||
| <GenerateSerializableTypes>true</GenerateSerializableTypes> | |||||
| <Serializer>Auto</Serializer> | |||||
| <UseSerializerForFaults>true</UseSerializerForFaults> | |||||
| <ReferenceAllAssemblies>true</ReferenceAllAssemblies> | |||||
| <ReferencedAssemblies /> | |||||
| <ReferencedDataContractTypes /> | |||||
| <ServiceContractMappings /> | |||||
| </ClientOptions> | |||||
| <MetadataSources> | |||||
| <MetadataSource Address="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc" Protocol="http" SourceId="1" /> | |||||
| </MetadataSources> | |||||
| <Metadata> | |||||
| <MetadataFile FileName="WeighTerminalService1.disco" MetadataType="Disco" ID="a9c7fc14-5ddf-41f8-ae0c-f0baedfd9607" SourceId="1" SourceUrl="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?disco" /> | |||||
| <MetadataFile FileName="WeighTerminalService3.xsd" MetadataType="Schema" ID="22f06af9-a23c-4c8a-8c1e-7fe1d1f056b4" SourceId="1" SourceUrl="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?xsd=xsd1" /> | |||||
| <MetadataFile FileName="WeighTerminalService1.wsdl" MetadataType="Wsdl" ID="b4da3188-4987-49f2-8ba9-fa1870f0c401" SourceId="1" SourceUrl="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?wsdl" /> | |||||
| <MetadataFile FileName="WeighTerminalService31.xsd" MetadataType="Schema" ID="4cf72e9f-f699-4d12-82bd-5b3f568d1977" SourceId="1" SourceUrl="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?xsd=xsd2" /> | |||||
| <MetadataFile FileName="WeighTerminalService32.xsd" MetadataType="Schema" ID="2522bc45-6d05-4471-b6ed-b2e442a9fea9" SourceId="1" SourceUrl="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?xsd=xsd0" /> | |||||
| </Metadata> | |||||
| <Extensions> | |||||
| <ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" /> | |||||
| <ExtensionFile FileName="configuration.svcinfo" Name="configuration.svcinfo" /> | |||||
| </Extensions> | |||||
| </ReferenceGroup> | |||||
| @ -0,0 +1,10 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <!-- | |||||
| This file is automatically generated by Visual Studio .Net. It is | |||||
| used to store generic object data source configuration information. | |||||
| Renaming the file extension or editing the content of this file may | |||||
| cause the file to be unrecognizable by the program. | |||||
| --> | |||||
| <GenericObjectDataSource DisplayName="ClientAccountingUnit" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||||
| <TypeInfo>Update.WeighTerminalService.ClientAccountingUnit, Service References.WeighTerminalService.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||||
| </GenericObjectDataSource> | |||||
| @ -0,0 +1,10 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <!-- | |||||
| This file is automatically generated by Visual Studio .Net. It is | |||||
| used to store generic object data source configuration information. | |||||
| Renaming the file extension or editing the content of this file may | |||||
| cause the file to be unrecognizable by the program. | |||||
| --> | |||||
| <GenericObjectDataSource DisplayName="ClientCar" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource"> | |||||
| <TypeInfo>Update.WeighTerminalService.ClientCar, Service References.WeighTerminalService.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo> | |||||
| </GenericObjectDataSource> | |||||
| @ -0,0 +1,4 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/"> | |||||
| <contractRef ref="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?wsdl" docRef="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc" xmlns="http://schemas.xmlsoap.org/disco/scl/" /> | |||||
| </discovery> | |||||
| @ -0,0 +1,267 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="WeighTerminalService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> | |||||
| <wsdl:types> | |||||
| <xsd:schema targetNamespace="http://tempuri.org/Imports"> | |||||
| <xsd:import schemaLocation="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?xsd=xsd0" namespace="http://tempuri.org/" /> | |||||
| <xsd:import schemaLocation="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> | |||||
| <xsd:import schemaLocation="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_" /> | |||||
| </xsd:schema> | |||||
| </wsdl:types> | |||||
| <wsdl:message name="IWeighTerminalService_GetTerminalID_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetTerminalID" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetTerminalID_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetTerminalIDResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_StartQueryCar_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:StartQueryCar" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_StartQueryCar_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:StartQueryCarResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetCarPageCount_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetCarPageCount" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetCarPageCount_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetCarPageCountResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetCarList_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetCarList" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetCarList_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetCarListResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_FinishCar_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:FinishCar" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_FinishCar_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:FinishCarResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_StartQueryAccountingUnit_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:StartQueryAccountingUnit" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_StartQueryAccountingUnit_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:StartQueryAccountingUnitResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetAccountingUnitPageCount_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetAccountingUnitPageCount" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetAccountingUnitPageCount_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetAccountingUnitPageCountResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetAccountingUnitList_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetAccountingUnitList" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetAccountingUnitList_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetAccountingUnitListResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_FinishAccountingUnit_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:FinishAccountingUnit" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_FinishAccountingUnit_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:FinishAccountingUnitResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_InsertWeigh_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:InsertWeigh" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_InsertWeigh_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:InsertWeighResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetSystemWeighID_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetSystemWeighID" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_GetSystemWeighID_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:GetSystemWeighIDResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_DeleteWeigh_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:DeleteWeigh" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_DeleteWeigh_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:DeleteWeighResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_CheckTerminalUser_InputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:CheckTerminalUser" /> | |||||
| </wsdl:message> | |||||
| <wsdl:message name="IWeighTerminalService_CheckTerminalUser_OutputMessage"> | |||||
| <wsdl:part name="parameters" element="tns:CheckTerminalUserResponse" /> | |||||
| </wsdl:message> | |||||
| <wsdl:portType name="IWeighTerminalService"> | |||||
| <wsdl:operation name="GetTerminalID"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/GetTerminalID" message="tns:IWeighTerminalService_GetTerminalID_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/GetTerminalIDResponse" message="tns:IWeighTerminalService_GetTerminalID_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="StartQueryCar"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/StartQueryCar" message="tns:IWeighTerminalService_StartQueryCar_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/StartQueryCarResponse" message="tns:IWeighTerminalService_StartQueryCar_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetCarPageCount"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/GetCarPageCount" message="tns:IWeighTerminalService_GetCarPageCount_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/GetCarPageCountResponse" message="tns:IWeighTerminalService_GetCarPageCount_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetCarList"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/GetCarList" message="tns:IWeighTerminalService_GetCarList_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/GetCarListResponse" message="tns:IWeighTerminalService_GetCarList_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="FinishCar"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/FinishCar" message="tns:IWeighTerminalService_FinishCar_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/FinishCarResponse" message="tns:IWeighTerminalService_FinishCar_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="StartQueryAccountingUnit"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/StartQueryAccountingUnit" message="tns:IWeighTerminalService_StartQueryAccountingUnit_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/StartQueryAccountingUnitResponse" message="tns:IWeighTerminalService_StartQueryAccountingUnit_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetAccountingUnitPageCount"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/GetAccountingUnitPageCount" message="tns:IWeighTerminalService_GetAccountingUnitPageCount_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/GetAccountingUnitPageCountResponse" message="tns:IWeighTerminalService_GetAccountingUnitPageCount_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetAccountingUnitList"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/GetAccountingUnitList" message="tns:IWeighTerminalService_GetAccountingUnitList_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/GetAccountingUnitListResponse" message="tns:IWeighTerminalService_GetAccountingUnitList_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="FinishAccountingUnit"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/FinishAccountingUnit" message="tns:IWeighTerminalService_FinishAccountingUnit_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/FinishAccountingUnitResponse" message="tns:IWeighTerminalService_FinishAccountingUnit_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="InsertWeigh"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/InsertWeigh" message="tns:IWeighTerminalService_InsertWeigh_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/InsertWeighResponse" message="tns:IWeighTerminalService_InsertWeigh_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetSystemWeighID"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/GetSystemWeighID" message="tns:IWeighTerminalService_GetSystemWeighID_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/GetSystemWeighIDResponse" message="tns:IWeighTerminalService_GetSystemWeighID_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="DeleteWeigh"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/DeleteWeigh" message="tns:IWeighTerminalService_DeleteWeigh_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/DeleteWeighResponse" message="tns:IWeighTerminalService_DeleteWeigh_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="CheckTerminalUser"> | |||||
| <wsdl:input wsaw:Action="http://tempuri.org/IWeighTerminalService/CheckTerminalUser" message="tns:IWeighTerminalService_CheckTerminalUser_InputMessage" /> | |||||
| <wsdl:output wsaw:Action="http://tempuri.org/IWeighTerminalService/CheckTerminalUserResponse" message="tns:IWeighTerminalService_CheckTerminalUser_OutputMessage" /> | |||||
| </wsdl:operation> | |||||
| </wsdl:portType> | |||||
| <wsdl:binding name="BasicHttpBinding_IWeighTerminalService" type="tns:IWeighTerminalService"> | |||||
| <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> | |||||
| <wsdl:operation name="GetTerminalID"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/GetTerminalID" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="StartQueryCar"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/StartQueryCar" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetCarPageCount"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/GetCarPageCount" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetCarList"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/GetCarList" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="FinishCar"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/FinishCar" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="StartQueryAccountingUnit"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/StartQueryAccountingUnit" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetAccountingUnitPageCount"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/GetAccountingUnitPageCount" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetAccountingUnitList"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/GetAccountingUnitList" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="FinishAccountingUnit"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/FinishAccountingUnit" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="InsertWeigh"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/InsertWeigh" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="GetSystemWeighID"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/GetSystemWeighID" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="DeleteWeigh"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/DeleteWeigh" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| <wsdl:operation name="CheckTerminalUser"> | |||||
| <soap:operation soapAction="http://tempuri.org/IWeighTerminalService/CheckTerminalUser" style="document" /> | |||||
| <wsdl:input> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:input> | |||||
| <wsdl:output> | |||||
| <soap:body use="literal" /> | |||||
| </wsdl:output> | |||||
| </wsdl:operation> | |||||
| </wsdl:binding> | |||||
| <wsdl:service name="WeighTerminalService"> | |||||
| <wsdl:port name="BasicHttpBinding_IWeighTerminalService" binding="tns:BasicHttpBinding_IWeighTerminalService"> | |||||
| <soap:address location="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc" /> | |||||
| </wsdl:port> | |||||
| </wsdl:service> | |||||
| </wsdl:definitions> | |||||
| @ -0,0 +1,42 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <xs:schema xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||||
| <xs:element name="anyType" nillable="true" type="xs:anyType" /> | |||||
| <xs:element name="anyURI" nillable="true" type="xs:anyURI" /> | |||||
| <xs:element name="base64Binary" nillable="true" type="xs:base64Binary" /> | |||||
| <xs:element name="boolean" nillable="true" type="xs:boolean" /> | |||||
| <xs:element name="byte" nillable="true" type="xs:byte" /> | |||||
| <xs:element name="dateTime" nillable="true" type="xs:dateTime" /> | |||||
| <xs:element name="decimal" nillable="true" type="xs:decimal" /> | |||||
| <xs:element name="double" nillable="true" type="xs:double" /> | |||||
| <xs:element name="float" nillable="true" type="xs:float" /> | |||||
| <xs:element name="int" nillable="true" type="xs:int" /> | |||||
| <xs:element name="long" nillable="true" type="xs:long" /> | |||||
| <xs:element name="QName" nillable="true" type="xs:QName" /> | |||||
| <xs:element name="short" nillable="true" type="xs:short" /> | |||||
| <xs:element name="string" nillable="true" type="xs:string" /> | |||||
| <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" /> | |||||
| <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" /> | |||||
| <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" /> | |||||
| <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" /> | |||||
| <xs:element name="char" nillable="true" type="tns:char" /> | |||||
| <xs:simpleType name="char"> | |||||
| <xs:restriction base="xs:int" /> | |||||
| </xs:simpleType> | |||||
| <xs:element name="duration" nillable="true" type="tns:duration" /> | |||||
| <xs:simpleType name="duration"> | |||||
| <xs:restriction base="xs:duration"> | |||||
| <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" /> | |||||
| <xs:minInclusive value="-P10675199DT2H48M5.4775808S" /> | |||||
| <xs:maxInclusive value="P10675199DT2H48M5.4775807S" /> | |||||
| </xs:restriction> | |||||
| </xs:simpleType> | |||||
| <xs:element name="guid" nillable="true" type="tns:guid" /> | |||||
| <xs:simpleType name="guid"> | |||||
| <xs:restriction base="xs:string"> | |||||
| <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" /> | |||||
| </xs:restriction> | |||||
| </xs:simpleType> | |||||
| <xs:attribute name="FactoryType" type="xs:QName" /> | |||||
| <xs:attribute name="Id" type="xs:ID" /> | |||||
| <xs:attribute name="Ref" type="xs:IDREF" /> | |||||
| </xs:schema> | |||||
| @ -0,0 +1,44 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <xs:schema xmlns:tns="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||||
| <xs:complexType name="ArrayOfClientCar"> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" maxOccurs="unbounded" name="ClientCar" nillable="true" type="tns:ClientCar" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| <xs:element name="ArrayOfClientCar" nillable="true" type="tns:ArrayOfClientCar" /> | |||||
| <xs:complexType name="ClientCar"> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="Car_ID" type="xs:long" /> | |||||
| <xs:element minOccurs="0" name="Car_Name" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| <xs:element name="ClientCar" nillable="true" type="tns:ClientCar" /> | |||||
| <xs:complexType name="ArrayOfClientAccountingUnit"> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" maxOccurs="unbounded" name="ClientAccountingUnit" nillable="true" type="tns:ClientAccountingUnit" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| <xs:element name="ArrayOfClientAccountingUnit" nillable="true" type="tns:ArrayOfClientAccountingUnit" /> | |||||
| <xs:complexType name="ClientAccountingUnit"> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="AccountingUnit_ID" type="xs:long" /> | |||||
| <xs:element minOccurs="0" name="AccountingUnit_Name" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| <xs:element name="ClientAccountingUnit" nillable="true" type="tns:ClientAccountingUnit" /> | |||||
| <xs:complexType name="ClientWeigh"> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="AccountingUnit_ID" type="xs:long" /> | |||||
| <xs:element minOccurs="0" name="CarNumber" nillable="true" type="xs:int" /> | |||||
| <xs:element minOccurs="0" name="Car_ID" type="xs:long" /> | |||||
| <xs:element minOccurs="0" name="Number" nillable="true" type="xs:int" /> | |||||
| <xs:element minOccurs="0" name="TerminalUser_Name" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="TerminalWeigh_ID" type="xs:long" /> | |||||
| <xs:element minOccurs="0" name="Terminal_ID" type="xs:long" /> | |||||
| <xs:element minOccurs="0" name="WeighTime" nillable="true" type="xs:dateTime" /> | |||||
| <xs:element minOccurs="0" name="Weight" nillable="true" type="xs:decimal" /> | |||||
| <xs:element minOccurs="0" name="Workshop" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| <xs:element name="ClientWeigh" nillable="true" type="tns:ClientWeigh" /> | |||||
| </xs:schema> | |||||
| @ -0,0 +1,187 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <xs:schema xmlns:tns="http://tempuri.org/" elementFormDefault="qualified" targetNamespace="http://tempuri.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |||||
| <xs:import schemaLocation="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_" /> | |||||
| <xs:element name="GetTerminalID"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="terminalMessage" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetTerminalIDResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="GetTerminalIDResult" type="xs:long" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="StartQueryCar"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="StartQueryCarResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence /> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetCarPageCount"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetCarPageCountResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="GetCarPageCountResult" type="xs:int" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetCarList"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="pageIndex" type="xs:int" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetCarListResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_" minOccurs="0" name="GetCarListResult" nillable="true" type="q1:ArrayOfClientCar" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="FinishCar"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="FinishCarResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence /> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="StartQueryAccountingUnit"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="StartQueryAccountingUnitResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence /> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetAccountingUnitPageCount"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetAccountingUnitPageCountResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="GetAccountingUnitPageCountResult" type="xs:int" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetAccountingUnitList"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="pageIndex" type="xs:int" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetAccountingUnitListResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element xmlns:q2="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_" minOccurs="0" name="GetAccountingUnitListResult" nillable="true" type="q2:ArrayOfClientAccountingUnit" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="FinishAccountingUnit"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="FinishAccountingUnitResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence /> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="InsertWeigh"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| <xs:element xmlns:q3="http://schemas.datacontract.org/2004/07/TSingSoft.ChickFeed2.Breed.WCF_" minOccurs="0" name="clientWeigh" nillable="true" type="q3:ClientWeigh" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="InsertWeighResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="InsertWeighResult" type="xs:long" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetSystemWeighID"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="terminalID" type="xs:long" /> | |||||
| <xs:element minOccurs="0" name="terminalWeighID" type="xs:long" /> | |||||
| <xs:element minOccurs="0" name="weighTime" type="xs:dateTime" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="GetSystemWeighIDResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="GetSystemWeighIDResult" type="xs:long" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="DeleteWeigh"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="weighID" type="xs:long" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="DeleteWeighResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="DeleteWeighResult" type="xs:int" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="CheckTerminalUser"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="ticket" nillable="true" type="xs:string" /> | |||||
| <xs:element minOccurs="0" name="terminalUserName" nillable="true" type="xs:string" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| <xs:element name="CheckTerminalUserResponse"> | |||||
| <xs:complexType> | |||||
| <xs:sequence> | |||||
| <xs:element minOccurs="0" name="CheckTerminalUserResult" type="xs:boolean" /> | |||||
| </xs:sequence> | |||||
| </xs:complexType> | |||||
| </xs:element> | |||||
| </xs:schema> | |||||
| @ -0,0 +1,10 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot"> | |||||
| <behaviors /> | |||||
| <bindings> | |||||
| <binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="BasicHttpBinding_IWeighTerminalService" />" bindingType="basicHttpBinding" name="BasicHttpBinding_IWeighTerminalService" /> | |||||
| </bindings> | |||||
| <endpoints> | |||||
| <endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWeighTerminalService" contract="WeighTerminalService.IWeighTerminalService" name="BasicHttpBinding_IWeighTerminalService" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWeighTerminalService" contract="WeighTerminalService.IWeighTerminalService" name="BasicHttpBinding_IWeighTerminalService" />" contractName="WeighTerminalService.IWeighTerminalService" name="BasicHttpBinding_IWeighTerminalService" /> | |||||
| </endpoints> | |||||
| </configurationSnapshot> | |||||
| @ -0,0 +1,201 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="f4bOrfs31LhKk/jocJIsUF9gixk="> | |||||
| <bindingConfigurations> | |||||
| <bindingConfiguration bindingType="basicHttpBinding" name="BasicHttpBinding_IWeighTerminalService"> | |||||
| <properties> | |||||
| <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>BasicHttpBinding_IWeighTerminalService</serializedValue> | |||||
| </property> | |||||
| <property path="/closeTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/openTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/receiveTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/sendTimeout" isComplexType="false" isExplicitlyDefined="true" clrType="System.TimeSpan, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/allowCookies" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/bypassProxyOnLocal" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/hostNameComparisonMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HostNameComparisonMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>StrongWildcard</serializedValue> | |||||
| </property> | |||||
| <property path="/maxBufferPoolSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/maxBufferSize" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>65536</serializedValue> | |||||
| </property> | |||||
| <property path="/maxReceivedMessageSize" isComplexType="false" isExplicitlyDefined="true" clrType="System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/proxyAddress" isComplexType="false" isExplicitlyDefined="false" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/readerQuotas" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxDepth" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxStringContentLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxArrayLength" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxBytesPerRead" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/readerQuotas/maxNameTableCharCount" isComplexType="false" isExplicitlyDefined="false" clrType="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>0</serializedValue> | |||||
| </property> | |||||
| <property path="/textEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.Text.Encoding, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.Text.UTF8Encoding</serializedValue> | |||||
| </property> | |||||
| <property path="/transferMode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.TransferMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>Buffered</serializedValue> | |||||
| </property> | |||||
| <property path="/useDefaultWebProxy" isComplexType="false" isExplicitlyDefined="true" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/messageEncoding" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.WSMessageEncoding, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>Text</serializedValue> | |||||
| </property> | |||||
| <property path="/security" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.BasicHttpSecurityElement</serializedValue> | |||||
| </property> | |||||
| <property path="/security/mode" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpSecurityMode, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>None</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.HttpTransportSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.HttpTransportSecurityElement</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpClientCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>None</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/proxyCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.HttpProxyCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>None</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/extendedProtectionPolicy" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/extendedProtectionPolicy/policyEnforcement" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.PolicyEnforcement, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>Never</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/extendedProtectionPolicy/protectionScenario" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.ProtectionScenario, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>TransportSelected</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/extendedProtectionPolicy/customServiceNames" isComplexType="true" isExplicitlyDefined="false" clrType="System.Security.Authentication.ExtendedProtection.Configuration.ServiceNameElementCollection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>(集合)</serializedValue> | |||||
| </property> | |||||
| <property path="/security/transport/realm" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/security/message" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.BasicHttpMessageSecurityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.BasicHttpMessageSecurityElement</serializedValue> | |||||
| </property> | |||||
| <property path="/security/message/clientCredentialType" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.BasicHttpMessageCredentialType, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>UserName</serializedValue> | |||||
| </property> | |||||
| <property path="/security/message/algorithmSuite" isComplexType="false" isExplicitlyDefined="false" clrType="System.ServiceModel.Security.SecurityAlgorithmSuite, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>Default</serializedValue> | |||||
| </property> | |||||
| </properties> | |||||
| </bindingConfiguration> | |||||
| </bindingConfigurations> | |||||
| <endpoints> | |||||
| <endpoint name="BasicHttpBinding_IWeighTerminalService" contract="WeighTerminalService.IWeighTerminalService" bindingType="basicHttpBinding" address="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc" bindingConfiguration="BasicHttpBinding_IWeighTerminalService"> | |||||
| <properties> | |||||
| <property path="/address" isComplexType="false" isExplicitlyDefined="true" clrType="System.Uri, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc</serializedValue> | |||||
| </property> | |||||
| <property path="/behaviorConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/binding" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>basicHttpBinding</serializedValue> | |||||
| </property> | |||||
| <property path="/bindingConfiguration" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>BasicHttpBinding_IWeighTerminalService</serializedValue> | |||||
| </property> | |||||
| <property path="/contract" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>WeighTerminalService.IWeighTerminalService</serializedValue> | |||||
| </property> | |||||
| <property path="/headers" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.AddressHeaderCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.AddressHeaderCollectionElement</serializedValue> | |||||
| </property> | |||||
| <property path="/headers/headers" isComplexType="false" isExplicitlyDefined="true" clrType="System.ServiceModel.Channels.AddressHeaderCollection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue><Header /></serializedValue> | |||||
| </property> | |||||
| <property path="/identity" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.IdentityElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.IdentityElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/userPrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.UserPrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.UserPrincipalNameElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/userPrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/servicePrincipalName" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.ServicePrincipalNameElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.ServicePrincipalNameElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/servicePrincipalName/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/dns" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.DnsElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.DnsElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/dns/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/rsa" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.RsaElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.RsaElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/rsa/value" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/certificate" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.CertificateElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificate/encodedValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/certificateReference" isComplexType="true" isExplicitlyDefined="false" clrType="System.ServiceModel.Configuration.CertificateReferenceElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>System.ServiceModel.Configuration.CertificateReferenceElement</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/storeName" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreName, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>My</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/storeLocation" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.StoreLocation, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>LocalMachine</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/x509FindType" isComplexType="false" isExplicitlyDefined="false" clrType="System.Security.Cryptography.X509Certificates.X509FindType, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>FindBySubjectDistinguishedName</serializedValue> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/findValue" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/identity/certificateReference/isChainIncluded" isComplexType="false" isExplicitlyDefined="false" clrType="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>False</serializedValue> | |||||
| </property> | |||||
| <property path="/name" isComplexType="false" isExplicitlyDefined="true" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue>BasicHttpBinding_IWeighTerminalService</serializedValue> | |||||
| </property> | |||||
| <property path="/kind" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| <property path="/endpointConfiguration" isComplexType="false" isExplicitlyDefined="false" clrType="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
| <serializedValue /> | |||||
| </property> | |||||
| </properties> | |||||
| </endpoint> | |||||
| </endpoints> | |||||
| </SavedWcfConfigurationInformation> | |||||
| @ -0,0 +1,179 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <PropertyGroup> | |||||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||||
| <ProductVersion>8.0.30703</ProductVersion> | |||||
| <SchemaVersion>2.0</SchemaVersion> | |||||
| <ProjectGuid>{4768FDF9-DBC5-441F-AC59-5655146B8961}</ProjectGuid> | |||||
| <OutputType>Library</OutputType> | |||||
| <AppDesignerFolder>Properties</AppDesignerFolder> | |||||
| <RootNamespace>Update</RootNamespace> | |||||
| <AssemblyName>Update</AssemblyName> | |||||
| <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |||||
| <FileAlignment>512</FileAlignment> | |||||
| </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> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | |||||
| <DebugSymbols>true</DebugSymbols> | |||||
| <OutputPath>bin\x86\Debug\</OutputPath> | |||||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||||
| <DebugType>full</DebugType> | |||||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> | |||||
| <OutputPath>bin\x86\Release\</OutputPath> | |||||
| <DefineConstants>TRACE</DefineConstants> | |||||
| <Optimize>true</Optimize> | |||||
| <DebugType>pdbonly</DebugType> | |||||
| <PlatformTarget>x86</PlatformTarget> | |||||
| <ErrorReport>prompt</ErrorReport> | |||||
| <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | |||||
| </PropertyGroup> | |||||
| <ItemGroup> | |||||
| <Reference Include="Forks.JsonRpc.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7254430f49d10aae, processorArchitecture=MSIL"> | |||||
| <SpecificVersion>False</SpecificVersion> | |||||
| <HintPath>..\CutupClient\bin\Debug\Forks.JsonRpc.Client.dll</HintPath> | |||||
| </Reference> | |||||
| <Reference Include="System" /> | |||||
| <Reference Include="System.configuration" /> | |||||
| <Reference Include="System.Core" /> | |||||
| <Reference Include="System.Runtime.Serialization" /> | |||||
| <Reference Include="System.ServiceModel" /> | |||||
| <Reference Include="System.Xml.Linq" /> | |||||
| <Reference Include="System.Data.DataSetExtensions" /> | |||||
| <Reference Include="Microsoft.CSharp" /> | |||||
| <Reference Include="System.Data" /> | |||||
| <Reference Include="System.Xml" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||||
| <Compile Include="Service References\LoginService\Reference.cs"> | |||||
| <AutoGen>True</AutoGen> | |||||
| <DesignTime>True</DesignTime> | |||||
| <DependentUpon>Reference.svcmap</DependentUpon> | |||||
| </Compile> | |||||
| <Compile Include="Service References\WeighTerminalService\Reference.cs"> | |||||
| <AutoGen>True</AutoGen> | |||||
| <DesignTime>True</DesignTime> | |||||
| <DependentUpon>Reference.svcmap</DependentUpon> | |||||
| </Compile> | |||||
| <Compile Include="Utils\DatabaseUtil.cs" /> | |||||
| <Compile Include="Utils\Config.cs" /> | |||||
| <Compile Include="Utils\Extentions\WeighExtension.cs" /> | |||||
| <Compile Include="Utils\LoginUtil.cs" /> | |||||
| <Compile Include="Utils\RemoteQueryUtil.cs" /> | |||||
| <Compile Include="Utils\RemoteSenderUtil.cs" /> | |||||
| <Compile Include="WCF_\LoginClient.cs" /> | |||||
| <Compile Include="WCF_\WeighTerminalClient.cs" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <WCFMetadata Include="Service References\" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="app.config" /> | |||||
| <None Include="Service References\LoginService\LoginService.wsdl" /> | |||||
| <None Include="Service References\LoginService\LoginService.xsd"> | |||||
| <SubType>Designer</SubType> | |||||
| </None> | |||||
| <None Include="Service References\LoginService\LoginService1.xsd"> | |||||
| <SubType>Designer</SubType> | |||||
| </None> | |||||
| <None Include="Service References\LoginService\LoginService2.xsd"> | |||||
| <SubType>Designer</SubType> | |||||
| </None> | |||||
| <None Include="Service References\LoginService\Update.LoginService.WcfLoginResponseMessage.datasource"> | |||||
| <DependentUpon>Reference.svcmap</DependentUpon> | |||||
| </None> | |||||
| <None Include="Service References\WeighTerminalService\Update.WeighTerminalService.ClientAccountingUnit.datasource"> | |||||
| <DependentUpon>Reference.svcmap</DependentUpon> | |||||
| </None> | |||||
| <None Include="Service References\WeighTerminalService\Update.WeighTerminalService.ClientCar.datasource"> | |||||
| <DependentUpon>Reference.svcmap</DependentUpon> | |||||
| </None> | |||||
| <None Include="Service References\WeighTerminalService\WeighTerminalService1.wsdl" /> | |||||
| <None Include="Service References\WeighTerminalService\WeighTerminalService3.xsd"> | |||||
| <SubType>Designer</SubType> | |||||
| </None> | |||||
| <None Include="Service References\WeighTerminalService\WeighTerminalService31.xsd"> | |||||
| <SubType>Designer</SubType> | |||||
| </None> | |||||
| <None Include="Service References\WeighTerminalService\WeighTerminalService32.xsd"> | |||||
| <SubType>Designer</SubType> | |||||
| </None> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <WCFMetadataStorage Include="Service References\LoginService\" /> | |||||
| <WCFMetadataStorage Include="Service References\WeighTerminalService\" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="Service References\LoginService\LoginService.disco" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="Service References\LoginService\configuration91.svcinfo" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="Service References\LoginService\configuration.svcinfo" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="Service References\LoginService\Reference.svcmap"> | |||||
| <Generator>WCF Proxy Generator</Generator> | |||||
| <LastGenOutput>Reference.cs</LastGenOutput> | |||||
| </None> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="Service References\WeighTerminalService\configuration91.svcinfo" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="Service References\WeighTerminalService\configuration.svcinfo" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="Service References\WeighTerminalService\Reference.svcmap"> | |||||
| <Generator>WCF Proxy Generator</Generator> | |||||
| <LastGenOutput>Reference.cs</LastGenOutput> | |||||
| </None> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <None Include="Service References\WeighTerminalService\WeighTerminalService1.disco" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ProjectReference Include="..\FireBirdUtil\FireBirdUtil.csproj"> | |||||
| <Project>{3b09e2b6-b649-47de-bf8d-2e233d47acfd}</Project> | |||||
| <Name>FireBirdUtil</Name> | |||||
| </ProjectReference> | |||||
| <ProjectReference Include="..\Utils\Utils.csproj"> | |||||
| <Project>{d123a086-c03a-4b8b-befb-124e102d3ade}</Project> | |||||
| <Name>Utils</Name> | |||||
| </ProjectReference> | |||||
| <ProjectReference Include="..\WeighBusiness\WeighBusiness.csproj"> | |||||
| <Project>{35613a1c-a935-480d-9545-78bcf5279ac4}</Project> | |||||
| <Name>WeighBusiness</Name> | |||||
| </ProjectReference> | |||||
| </ItemGroup> | |||||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||||
| <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |||||
| Other similar extension points exist, see Microsoft.Common.targets. | |||||
| <Target Name="BeforeBuild"> | |||||
| </Target> | |||||
| <Target Name="AfterBuild"> | |||||
| </Target> | |||||
| --> | |||||
| </Project> | |||||
| @ -0,0 +1,144 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using WeighBusiness.BL; | |||||
| using WeighBusiness.BO; | |||||
| namespace Update.Utils | |||||
| { | |||||
| /* | |||||
| 添加新配置的操作: | |||||
| 1.添加属性(如果set为private,则还要添加对应的设置方法); | |||||
| 2.在GetSetting方法中,参照方法里的格式(最后几行代码),添加新属性的语句(用于保存); | |||||
| 3.在InitConfig方法中,参照方法里的格式,添加新属性的语句(用于从数据库中,查询出相应的配置)。 | |||||
| * */ | |||||
| /// <summary> | |||||
| /// 配置(保存在数据库中)。 | |||||
| /// <para>登录后,更新上次登录的用户为当前用户</para> | |||||
| /// </summary> | |||||
| public static class Config | |||||
| { | |||||
| static Config() | |||||
| { | |||||
| SetTerminalID(0);//TODO:未完成,用0做测试 | |||||
| var configFromDatabase = SettingBL.Load(); | |||||
| ID = configFromDatabase.ID; | |||||
| SetRecentUser(configFromDatabase.RecentUserID, configFromDatabase.RecentUserName); | |||||
| InitConfig(configFromDatabase.Setting); | |||||
| } | |||||
| #if DEBUG | |||||
| public static readonly string LoginAddress = "http://localhost:2000/MainSystem/LoginService.svc"; | |||||
| public static readonly string WeighAddress = "http://localhost:2000/MainSystem/O/Breed/WeighTerminalService.svc"; | |||||
| #endif | |||||
| private static long ID;//用于保存配置 | |||||
| /// <summary> | |||||
| /// 终端ID。用于指明是哪个终端 | |||||
| /// </summary> | |||||
| public static long TerminalID { get; private set; }//TODO:未完成,用0做测试 | |||||
| /// <summary> | |||||
| /// 终端管理员 | |||||
| /// </summary> | |||||
| public const string TerminalSystemUserName = "system";//终端管理员 | |||||
| /// <summary> | |||||
| /// 上次登录的用户ID。登录后,设置为当前用户 | |||||
| /// </summary> | |||||
| public static long RecentUserID { get; private set; }//参见登录按钮 | |||||
| /// <summary> | |||||
| /// 上次登录的用户Name。登录后,设置为当前用户 | |||||
| /// </summary> | |||||
| public static string RecentUserName { get; private set; }//参见登录按钮 | |||||
| /// <summary> | |||||
| /// 系统IP。用于同步数据 | |||||
| /// </summary> | |||||
| public static string SystemIP { get; private set; } | |||||
| /// <summary> | |||||
| /// 默认会计单位ID。 | |||||
| /// </summary> | |||||
| public static long AccountingUnit_ID { get; private set; } | |||||
| /// <summary> | |||||
| /// 默认会计单位Name。 | |||||
| /// </summary> | |||||
| public static string AccountingUnit_Name { get; private set; } | |||||
| /// <summary> | |||||
| /// 车间 | |||||
| /// </summary> | |||||
| public static string Workshop { get; private set; } | |||||
| /// <summary> | |||||
| /// 登陆信息 | |||||
| /// </summary> | |||||
| public static string Ticket { get; set; }//登陆信息,不保存到数据库中 | |||||
| private static void SetRecentUser(long recentUserID, string recentUserName) | |||||
| { | |||||
| RecentUserID = recentUserID; | |||||
| RecentUserName = recentUserName; | |||||
| } | |||||
| public static void SetSystemIP(string ip) | |||||
| { | |||||
| SystemIP = ip; | |||||
| } | |||||
| public static void SetAccountingUnit(long accountingUnitID, string accountingUnitName) | |||||
| { | |||||
| AccountingUnit_ID = accountingUnitID; | |||||
| AccountingUnit_Name = accountingUnitName; | |||||
| } | |||||
| public static void SetTerminalID(long terminalID) | |||||
| { | |||||
| TerminalID = terminalID; | |||||
| } | |||||
| public static void SetWorkshop(string workshop) | |||||
| { | |||||
| Workshop = workshop; | |||||
| } | |||||
| /// <summary> | |||||
| /// 保存当前配置 | |||||
| /// </summary> | |||||
| public static void Save()//保存当前配置 | |||||
| { | |||||
| var setting = GetSetting(); | |||||
| SettingBL.Save(setting, true); | |||||
| } | |||||
| private static SettingData GetSetting() | |||||
| { | |||||
| var saveSetting = new SettingData(); | |||||
| saveSetting.ID = ID; | |||||
| saveSetting.RecentUserID = RecentUserID; | |||||
| saveSetting.RecentUserName = RecentUserName; | |||||
| saveSetting.Setting = new Dictionary<string, string>(); | |||||
| saveSetting.Setting.Add("1", SystemIP); | |||||
| saveSetting.Setting.Add("2", AccountingUnit_ID.ToString()); | |||||
| saveSetting.Setting.Add("3", AccountingUnit_Name); | |||||
| saveSetting.Setting.Add("4", TerminalID.ToString()); | |||||
| saveSetting.Setting.Add("5", Workshop); | |||||
| return saveSetting; | |||||
| } | |||||
| private static void InitConfig(Dictionary<string, string> setting) | |||||
| { | |||||
| if (setting.Keys.Contains("1")) | |||||
| SystemIP = setting["1"]; | |||||
| if (setting.Keys.Contains("2")) | |||||
| AccountingUnit_ID = long.Parse(setting["2"]); | |||||
| if (setting.Keys.Contains("3")) | |||||
| AccountingUnit_Name = setting["3"]; | |||||
| if (setting.Keys.Contains("4")) | |||||
| TerminalID = long.Parse(setting["4"]); | |||||
| if (setting.Keys.Contains("5")) | |||||
| Workshop = setting["5"]; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,64 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using Update.WeighTerminalService; | |||||
| using WeighBusiness.Utils; | |||||
| using WeighBusiness.Utils.SqlUtils; | |||||
| namespace Update.Utils | |||||
| { | |||||
| public class DatabaseUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 插入车辆到数据库中。 | |||||
| /// 全部成功,返回true;只要有一个失败,则返回false | |||||
| /// </summary> | |||||
| public static bool InsertCar(IList<ClientCar> allNeedInsert, out Dictionary<long, string> faileds) | |||||
| { | |||||
| faileds = new Dictionary<long, string>(); | |||||
| bool successResult = true; | |||||
| using (var she = new SqlHelperEx()) { | |||||
| foreach (var needInsertItem in allNeedInsert) { | |||||
| string insertSql = InsertUtil.GetInsertSql(TableNames.车辆表, new string[] { "Car_ID", "Car_Name" }, new string[] { needInsertItem.Car_ID.ToString(), needInsertItem.Car_Name }); | |||||
| if (string.IsNullOrEmpty(insertSql)) | |||||
| continue; | |||||
| bool success; | |||||
| she.ExecuteNonQuery(insertSql, out success); | |||||
| if (!success) { | |||||
| faileds.Add(needInsertItem.Car_ID, needInsertItem.Car_Name); | |||||
| successResult = false; | |||||
| continue; | |||||
| } | |||||
| } | |||||
| } | |||||
| return successResult; | |||||
| } | |||||
| /// <summary> | |||||
| /// 插入会计单位到数据库中。 | |||||
| /// 全部成功,返回true;只要有一个失败,则返回false | |||||
| /// </summary> | |||||
| public static bool InsertAccountingUnit(IList<ClientAccountingUnit> allNeedInsert, out Dictionary<long, string> faileds) | |||||
| { | |||||
| faileds = new Dictionary<long, string>(); | |||||
| bool successResult = true; | |||||
| using (var she = new SqlHelperEx()) { | |||||
| foreach (var needInsertItem in allNeedInsert) { | |||||
| string insertSql = InsertUtil.GetInsertSql(TableNames.会计单位表, new string[] { "AccountingUnit_ID", "AccountingUnit_Name" }, new string[] { needInsertItem.AccountingUnit_ID.ToString(), needInsertItem.AccountingUnit_Name }); | |||||
| if (string.IsNullOrEmpty(insertSql)) | |||||
| continue; | |||||
| bool success; | |||||
| she.ExecuteNonQuery(insertSql, out success); | |||||
| if (!success) { | |||||
| faileds.Add(needInsertItem.AccountingUnit_ID, needInsertItem.AccountingUnit_Name); | |||||
| successResult = false; | |||||
| continue; | |||||
| } | |||||
| } | |||||
| } | |||||
| return successResult; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,34 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using Update.Utils; | |||||
| using Update.WeighTerminalService; | |||||
| using WeighBusiness.BL; | |||||
| namespace WeighBusiness.BO | |||||
| { | |||||
| public static class WeighExtension | |||||
| { | |||||
| public static ClientWeigh ToClientWeigh(this Weigh weigh) | |||||
| { | |||||
| var weight = weigh.Details.Sum(x => x.Weight ?? 0); | |||||
| var weighTime = weigh.Details.Count > 0 ? weigh.Details.ElementAt(0).WeighTime : weigh.CreateDateTime; | |||||
| var client = new ClientWeigh() { | |||||
| Terminal_ID = Config.TerminalID, | |||||
| TerminalWeigh_ID = weigh.ID, | |||||
| TerminalUser_Name = UserBL.CurrentUser.ERP_User_Name, | |||||
| AccountingUnit_ID = Config.AccountingUnit_ID, | |||||
| Workshop = Config.Workshop, | |||||
| WeighTime = weighTime, | |||||
| Car_ID = weigh.Car_ID, | |||||
| CarNumber = weigh.CarNumber, | |||||
| Number = weigh.Number, | |||||
| Weight = weight, | |||||
| }; | |||||
| return client; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,85 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using Forks.JsonRpc.Client; | |||||
| using Update.LoginService; | |||||
| using Update.WCF_; | |||||
| using Utils.Security; | |||||
| using WeighBusiness; | |||||
| using WeighBusiness.BL; | |||||
| using System.Configuration; | |||||
| namespace Update.Utils | |||||
| { | |||||
| public class LoginUtil | |||||
| { | |||||
| private static bool IsInitRpc = false; | |||||
| private static string urlPath; | |||||
| public static void InitRpc() | |||||
| { | |||||
| var path = ConfigurationManager.AppSettings["UrlPath"]; | |||||
| if (!IsInitRpc) { | |||||
| RpcFacade.Init(path, "CutupClient"); | |||||
| IsInitRpc = true; | |||||
| urlPath = path; | |||||
| } else { | |||||
| if (urlPath != path) { | |||||
| RpcFacade.ReInit(path); | |||||
| } | |||||
| } | |||||
| urlPath = path; | |||||
| } | |||||
| /// <summary> | |||||
| /// 验证远程登陆。如果没有登陆远程系统,则重新登陆 | |||||
| /// </summary> | |||||
| public static void CheckLogin()//验证远程登陆。如果没有登陆远程系统,则重新登陆 | |||||
| { | |||||
| CheckLogin(UserBL.CurrentUser.ERP_User_Name, () => SecurityUtil.ChangeBack(UserBL.CurrentUser.ERP_User_Password, UserBL.a)); | |||||
| } | |||||
| /// <summary> | |||||
| /// 验证远程登陆。如果没有登陆远程系统,则重新登陆 | |||||
| /// </summary> | |||||
| public static void CheckLogin(string name, Func<string> GetPassword)//验证远程登陆。如果没有登陆远程系统,则重新登陆 | |||||
| { | |||||
| if (string.IsNullOrEmpty(Config.Ticket) || !new LoginClient().KeepLogin(Config.Ticket)) { | |||||
| //var login = LoginSystem(name, GetPassword); | |||||
| var login = LoginSystem(name, GetPassword); | |||||
| if (!login.Success) | |||||
| throw new LoginError("登陆系统失败!"); | |||||
| Config.Ticket = login.Message; | |||||
| new LoginClient().KeepLogin(Config.Ticket); | |||||
| } | |||||
| } | |||||
| public static bool Login(string name, string password, out string error) | |||||
| { | |||||
| error = string.Empty; | |||||
| //if (UserBL.CurrentUser == null) { | |||||
| try { | |||||
| RpcFacade.Login(name, password); | |||||
| } catch (Exception e) { | |||||
| error = e.Message; | |||||
| return false; | |||||
| } | |||||
| //} | |||||
| return true; | |||||
| } | |||||
| public static bool CheckSystemPassword(string name, string secretPassword) | |||||
| { | |||||
| var originalPassword = SecurityUtil.ChangeBack(secretPassword, UserBL.a); | |||||
| var login = new LoginClient().Login(name, originalPassword); | |||||
| return login.Success; | |||||
| } | |||||
| private static WcfLoginResponseMessage LoginSystem(string name, Func<string> GetPassword) | |||||
| { | |||||
| var password = GetPassword(); | |||||
| return new LoginClient().Login(name, password); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,74 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using Update.WCF_; | |||||
| using Update.WeighTerminalService; | |||||
| using WeighBusiness; | |||||
| namespace Update.Utils | |||||
| { | |||||
| public class RemoteQueryUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 获取系统中的车辆。(操作者权限树对应的【车辆信息】) | |||||
| /// </summary> | |||||
| /// <returns>系统中的车辆</returns> | |||||
| public static IList<ClientCar> GetAllRemoteCars() | |||||
| { | |||||
| LoginUtil.CheckLogin(); | |||||
| var result = new List<ClientCar>(); | |||||
| var existIDs = new List<long>(); | |||||
| var client = new WeighTerminalClient(); | |||||
| client.StartQueryCar(Config.Ticket); | |||||
| var pageCount = client.GetCarPageCount(Config.Ticket); | |||||
| for (int i = 0; i < pageCount; i++) { | |||||
| var list = client.GetCarList(Config.Ticket, i); | |||||
| foreach (var item in list) { | |||||
| if (existIDs.Contains(item.Car_ID)) | |||||
| continue; | |||||
| result.Add(item); | |||||
| existIDs.Add(item.Car_ID); | |||||
| } | |||||
| } | |||||
| client.FinishCar(Config.Ticket); | |||||
| return result; | |||||
| } | |||||
| /// <summary> | |||||
| /// 获取系统中的会计单位表。(操作者权限树对应的【会计单位表】) | |||||
| /// </summary> | |||||
| /// <returns>系统中的会计单位表</returns> | |||||
| public static IList<ClientAccountingUnit> GetAllRemoteAccountingUnits() | |||||
| { | |||||
| LoginUtil.CheckLogin(); | |||||
| var result = new List<ClientAccountingUnit>(); | |||||
| var existIDs = new List<long>(); | |||||
| var client = new WeighTerminalClient(); | |||||
| client.StartQueryAccountingUnit(Config.Ticket); | |||||
| var pageCount = client.GetAccountingUnitPageCount(Config.Ticket); | |||||
| for (int i = 0; i < pageCount; i++) { | |||||
| var list = client.GetAccountingUnitList(Config.Ticket, i); | |||||
| foreach (var item in list) { | |||||
| if (existIDs.Contains(item.AccountingUnit_ID)) | |||||
| continue; | |||||
| result.Add(item); | |||||
| existIDs.Add(item.AccountingUnit_ID); | |||||
| } | |||||
| } | |||||
| client.FinishAccountingUnit(Config.Ticket); | |||||
| return result; | |||||
| } | |||||
| public static bool CheckUser(string terminalUserName) | |||||
| { | |||||
| LoginUtil.CheckLogin(); | |||||
| var client = new WeighTerminalClient(); | |||||
| return client.CheckTerminalUser(Config.Ticket, terminalUserName); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,53 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using Update.WCF_; | |||||
| using Update.WeighTerminalService; | |||||
| using WeighBusiness; | |||||
| namespace Update.Utils | |||||
| { | |||||
| public class RemoteSenderUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 返回值为0时,表示插入失败.貌似没有机会返回0,就报错了 | |||||
| /// </summary> | |||||
| /// <param name="client"></param> | |||||
| /// <returns></returns> | |||||
| public static long InsertWeigh(ClientWeigh client) | |||||
| { | |||||
| LoginUtil.CheckLogin(); | |||||
| return new WeighTerminalClient().InsertWeigh(Config.Ticket, client); | |||||
| } | |||||
| //public static long UpdateOrder(ClientOrder clientOrder) | |||||
| //{ | |||||
| // LoginUtil.CheckLogin(); | |||||
| // return new SaleTerminalClient().UpdateOrder(ConfigUtil.Ticket, clientOrder, ConfigUtil.TerminalUser); | |||||
| //} | |||||
| public static long GetSystemWeighID(long terminalWeighID, DateTime createDate)//取表头日期当天的该终端、指定称重单号的系统端单号。 | |||||
| { | |||||
| LoginUtil.CheckLogin(); | |||||
| return new WeighTerminalClient().GetSystemWeighID(Config.Ticket, Config.TerminalID, terminalWeighID, createDate); | |||||
| } | |||||
| /// <summary> | |||||
| /// 删除服务器端的称重单。 | |||||
| /// <para>返回值含义:0:单据不存在;1:已作废;2:删除成功;3:已审核;4:已完毕;5:删除报错</para> | |||||
| /// </summary> | |||||
| /// <param name="remoteWeighID">服务器端称重单单号</param> | |||||
| /// <returns>返回值含义:0:单据不存在;1:已作废;2:删除成功;3:已审核;4:已完毕;5:删除报错</returns> | |||||
| public static int DeleteWeigh(long remoteWeighID)//0:单据不存在;1:已作废;2:删除成功;3:已审核;4:已完毕;5:删除报错 | |||||
| { | |||||
| LoginUtil.CheckLogin(); | |||||
| return new WeighTerminalClient().DeleteWeigh(Config.Ticket, remoteWeighID); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,34 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using Update.LoginService; | |||||
| using System.ServiceModel; | |||||
| using Update.Utils; | |||||
| using WeighBusiness; | |||||
| namespace Update.WCF_ | |||||
| { | |||||
| public class LoginClient : LoginServiceClient | |||||
| { | |||||
| public LoginClient() | |||||
| : base(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(Url)) | |||||
| { | |||||
| } | |||||
| static string Url | |||||
| { | |||||
| get | |||||
| { | |||||
| #if DEBUG | |||||
| return Config.LoginAddress; | |||||
| #else | |||||
| string head = Config.SystemIP; | |||||
| if (!head.EndsWith("/")) | |||||
| head += "/"; | |||||
| return head + "B2/LoginService.svc"; | |||||
| #endif | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,37 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using Update.WeighTerminalService; | |||||
| using System.ServiceModel; | |||||
| using Update.Utils; | |||||
| using WeighBusiness; | |||||
| namespace Update.WCF_ | |||||
| { | |||||
| public class WeighTerminalClient : WeighTerminalServiceClient | |||||
| { | |||||
| public WeighTerminalClient() | |||||
| : base(new BasicHttpBinding(BasicHttpSecurityMode.None) { | |||||
| MaxReceivedMessageSize = 655350, | |||||
| MaxBufferSize = 655350 | |||||
| }, new EndpointAddress(Url)) | |||||
| { | |||||
| } | |||||
| static string Url | |||||
| { | |||||
| get | |||||
| { | |||||
| #if DEBUG | |||||
| return Config.WeighAddress; | |||||
| #else | |||||
| string head = Config.SystemIP; | |||||
| if (!head.EndsWith("/")) | |||||
| head += "/"; | |||||
| return head + "B2/O/Breed/WeighTerminalService.svc"; | |||||
| #endif | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| <?xml version="1.0" encoding="utf-8" ?> | |||||
| <configuration> | |||||
| <system.serviceModel> | |||||
| <bindings> | |||||
| <basicHttpBinding> | |||||
| <binding name="BasicHttpBinding_ILoginService" /> | |||||
| <binding name="BasicHttpBinding_IWeighTerminalService" /> | |||||
| </basicHttpBinding> | |||||
| </bindings> | |||||
| <client> | |||||
| <endpoint address="http://192.168.1.2/B2/O/Breed/WeighTerminalService.svc" | |||||
| binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWeighTerminalService" | |||||
| contract="WeighTerminalService.IWeighTerminalService" name="BasicHttpBinding_IWeighTerminalService" /> | |||||
| <endpoint address="http://nserver/B2/LoginService.svc" binding="basicHttpBinding" | |||||
| bindingConfiguration="BasicHttpBinding_ILoginService" contract="LoginService.ILoginService" | |||||
| name="BasicHttpBinding_ILoginService" /> | |||||
| </client> | |||||
| </system.serviceModel> | |||||
| </configuration> | |||||
| @ -0,0 +1,24 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace Utils.Attributes | |||||
| { | |||||
| public class AttributesUtil | |||||
| { | |||||
| public static void SetReferenceValue<TClass>(TClass obj, string referenceProperty, string connectionStr) | |||||
| { | |||||
| var dmoType = obj.GetType(); | |||||
| var propertyInfo = dmoType.GetProperty(referenceProperty); | |||||
| if (!propertyInfo.IsDefined(typeof(DataReferenceAttribute), false)) | |||||
| return; | |||||
| var attrs = propertyInfo.GetCustomAttributes(typeof(DataReferenceAttribute), false); | |||||
| DataReferenceAttribute rAttribute = (DataReferenceAttribute)attrs[0]; | |||||
| var joinProperty = rAttribute.ThisTableJoinProperty; | |||||
| var joinValue = dmoType.GetProperty(joinProperty).GetValue(obj, null).ToString(); | |||||
| var propertyValue = rAttribute.GetValue(joinValue, connectionStr); | |||||
| dmoType.GetProperty(referenceProperty).SetValue(obj, propertyValue, null); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,27 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace Utils.Attributes | |||||
| { | |||||
| [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, Inherited = true)] | |||||
| public sealed class DataClassAttribute : Attribute | |||||
| { | |||||
| public DataClassAttribute(string name) | |||||
| { | |||||
| _Name = name; | |||||
| } | |||||
| public DataClassAttribute() | |||||
| { | |||||
| } | |||||
| private string _Name; | |||||
| public string Name { get { return _Name; } set { _Name = value; } } | |||||
| public string Get() | |||||
| { | |||||
| return _Name; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,51 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Data.SqlClient; | |||||
| using System.Data; | |||||
| namespace Utils.Attributes | |||||
| { | |||||
| [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | |||||
| public sealed class DataReferenceAttribute : Attribute | |||||
| { | |||||
| public DataReferenceAttribute(string thisTableJoinProperty, Type otherTableType, string needPropert) | |||||
| { | |||||
| _ThisTableJoinProperty = thisTableJoinProperty; | |||||
| _OtherTableType = otherTableType; | |||||
| _OtherTableJoinProperty = "ID"; | |||||
| _NeedPropert = needPropert; | |||||
| } | |||||
| public DataReferenceAttribute(string thisTableJoinProperty, Type otherTableType, string otherTableJoinProperty, string needPropert) | |||||
| : this(thisTableJoinProperty, otherTableType, needPropert) | |||||
| { | |||||
| _OtherTableJoinProperty = otherTableJoinProperty; | |||||
| } | |||||
| private string _ThisTableJoinProperty; | |||||
| public string ThisTableJoinProperty { get { return _ThisTableJoinProperty; } private set { _ThisTableJoinProperty = value; } } | |||||
| private Type _OtherTableType; | |||||
| private string _OtherTableJoinProperty; | |||||
| private string _NeedPropert; | |||||
| public object GetValue(string thisTablePropertyValue, string connectionStr) | |||||
| { | |||||
| if (thisTablePropertyValue.IsNullOrEmpty() || thisTablePropertyValue == "0") | |||||
| return string.Empty; | |||||
| var tableName = _OtherTableType.Name; | |||||
| string sql = "select {0} from {1} where {2} = '{3}'"; | |||||
| sql = string.Format(sql, _NeedPropert, tableName, _OtherTableJoinProperty, thisTablePropertyValue); | |||||
| SqlDataAdapter da = new SqlDataAdapter(sql, connectionStr); | |||||
| DataSet ds = new DataSet(); | |||||
| da.Fill(ds); | |||||
| var table = ds.Tables[0]; | |||||
| if (table.Rows.Count == 0) | |||||
| return ""; | |||||
| return table.Rows[0][0];//table.Rows[0][_NeedPropert] | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace Utils.Attributes | |||||
| { | |||||
| [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | |||||
| public sealed class DetailInfoAttribute : Attribute | |||||
| { | |||||
| public DetailInfoAttribute(Type detailType) | |||||
| { | |||||
| _DetailType = detailType; | |||||
| } | |||||
| private Type _DetailType; | |||||
| public Type DetailType { get { return _DetailType; } } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,81 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Text.RegularExpressions; | |||||
| namespace Utils.Datas | |||||
| { | |||||
| public class CharacterUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 得到每个汉字的字首拼音码字母(大写) | |||||
| /// </summary> | |||||
| /// <param name="chrStr">输入字符串</param> | |||||
| /// <returns>返回结果</returns> | |||||
| public static string GetHeadCharacter(string chrStr) | |||||
| { | |||||
| string strHeadString = string.Empty; | |||||
| Encoding gb = System.Text.Encoding.GetEncoding("gb2312"); | |||||
| for (int i = 0; i < chrStr.Length; i++) { | |||||
| //检测该字符是否为汉字 | |||||
| if (!IsChineseCharacters(chrStr.Substring(i, 1))) { | |||||
| strHeadString += chrStr.Substring(i, 1); | |||||
| continue; | |||||
| } | |||||
| byte[] bytes = gb.GetBytes(chrStr.Substring(i, 1)); | |||||
| string lowCode = System.Convert.ToString(bytes[0] - 0xA0, 16); | |||||
| string hightCode = System.Convert.ToString(bytes[1] - 0xA0, 16); | |||||
| int nCode = Convert.ToUInt16(lowCode, 16) * 100 + Convert.ToUInt16(hightCode, 16);//得到区位码 | |||||
| strHeadString += FirstLetter(nCode); | |||||
| } | |||||
| return strHeadString; | |||||
| } | |||||
| /// <summary> | |||||
| /// 判断是否为汉字 | |||||
| /// </summary> | |||||
| /// <param name="chrStr">待检测字符串</param> | |||||
| /// <returns>是汉字返回true</returns> | |||||
| private static bool IsChineseCharacters(string chrStr) | |||||
| { | |||||
| Regex CheckStr = new Regex("[\u4e00-\u9fa5]"); | |||||
| return CheckStr.IsMatch(chrStr); | |||||
| } | |||||
| /// <summary> | |||||
| /// 通过汉字区位码得到其首字母(大写) | |||||
| /// </summary> | |||||
| /// <param name="nCode">汉字编码</param> | |||||
| /// <returns></returns> | |||||
| private static string FirstLetter(int nCode) | |||||
| { | |||||
| if (nCode >= 1601 && nCode < 1637) return "A"; | |||||
| if (nCode >= 1637 && nCode < 1833) return "B"; | |||||
| if (nCode >= 1833 && nCode < 2078) return "C"; | |||||
| if (nCode >= 2078 && nCode < 2274) return "D"; | |||||
| if (nCode >= 2274 && nCode < 2302) return "E"; | |||||
| if (nCode >= 2302 && nCode < 2433) return "F"; | |||||
| if (nCode >= 2433 && nCode < 2594) return "G"; | |||||
| if (nCode >= 2594 && nCode < 2787) return "H"; | |||||
| if (nCode >= 2787 && nCode < 3106) return "J"; | |||||
| if (nCode >= 3106 && nCode < 3212) return "K"; | |||||
| if (nCode >= 3212 && nCode < 3472) return "L"; | |||||
| if (nCode >= 3472 && nCode < 3635) return "M"; | |||||
| if (nCode >= 3635 && nCode < 3722) return "N"; | |||||
| if (nCode >= 3722 && nCode < 3730) return "O"; | |||||
| if (nCode >= 3730 && nCode < 3858) return "P"; | |||||
| if (nCode >= 3858 && nCode < 4027) return "Q"; | |||||
| if (nCode >= 4027 && nCode < 4086) return "R"; | |||||
| if (nCode >= 4086 && nCode < 4390) return "S"; | |||||
| if (nCode >= 4390 && nCode < 4558) return "T"; | |||||
| if (nCode >= 4558 && nCode < 4684) return "W"; | |||||
| if (nCode >= 4684 && nCode < 4925) return "X"; | |||||
| if (nCode >= 4925 && nCode < 5249) return "Y"; | |||||
| if (nCode >= 5249 && nCode < 5590) return "Z"; | |||||
| return ""; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,233 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Security.Cryptography; | |||||
| using System.Text; | |||||
| namespace Utils.Datas | |||||
| { | |||||
| public static class DataTypeUtil | |||||
| { | |||||
| public static int GetIntNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return 0; | |||||
| return int.Parse(obj.ToString()); | |||||
| } | |||||
| public static int? GetIntNullNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return null; | |||||
| return int.Parse(obj.ToString()); | |||||
| } | |||||
| public static double GetDoubleNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return 0; | |||||
| return double.Parse(obj.ToString()); | |||||
| } | |||||
| public static double? GetDoubleNullNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return null; | |||||
| return double.Parse(obj.ToString()); | |||||
| } | |||||
| public static decimal GetDecimalNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return 0; | |||||
| return decimal.Parse(obj.ToString()); | |||||
| } | |||||
| public static decimal? GetDecimalNullNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return null; | |||||
| return decimal.Parse(obj.ToString()); | |||||
| } | |||||
| public static long GetLongNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return 0; | |||||
| return long.Parse(obj.ToString()); | |||||
| } | |||||
| public static long? GetLongNullNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return null; | |||||
| return long.Parse(obj.ToString()); | |||||
| } | |||||
| public static DateTime? GetDateTimeNullData(object obj) | |||||
| { | |||||
| if (obj == null || string.IsNullOrEmpty(obj.ToString())) | |||||
| return null; | |||||
| return DateTime.Parse(obj.ToString()); | |||||
| } | |||||
| public static bool GetBoolData(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return false; | |||||
| return bool.Parse(obj.ToString());//只能转换字符串:“true”、“false” | |||||
| } | |||||
| ///// <summary> | |||||
| ///// 用于FireBird的数据类型 | |||||
| ///// </summary> | |||||
| ///// <param name="booleanNum">存储在数据库中的值(数据库中的类型为Smallint)</param> | |||||
| //public static bool? GetBoolNullFromSmallInt(int booleanNum) | |||||
| //{ | |||||
| // if (booleanNum > 0) | |||||
| // return true; | |||||
| // if (booleanNum == 0) | |||||
| // return false; | |||||
| // return null;//booleanNum < 0 | |||||
| //} | |||||
| ///// <summary> | |||||
| ///// 用于FireBird的数据类型 | |||||
| ///// </summary> | |||||
| ///// <param name="booleanNum">存储在数据库中的值(数据库中的类型为Smallint)</param> | |||||
| //public static bool GetBoolDataFromSmallInt(int booleanNum) | |||||
| //{ | |||||
| // return booleanNum > 0; | |||||
| //} | |||||
| ///// <summary> | |||||
| ///// 将bool类型值,转换为存储在Firebird数据库中的值 | |||||
| ///// </summary> | |||||
| ///// <param name="booleanData"></param> | |||||
| ///// <returns></returns> | |||||
| //public static int GetDatabaseDataFromBool(bool booleanData) | |||||
| //{ | |||||
| // return booleanData ? 1 : 0; | |||||
| //} | |||||
| public static bool? GetBoolNullData(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return null; | |||||
| return bool.Parse(obj.ToString());//只能转换字符串:“true”、“false” | |||||
| } | |||||
| public static short GetShortNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return 0; | |||||
| return short.Parse(obj.ToString()); | |||||
| } | |||||
| public static short? GetShortNullNum(object obj) | |||||
| { | |||||
| if (obj == null || obj.ToString() == string.Empty) | |||||
| return null; | |||||
| return short.Parse(obj.ToString()); | |||||
| } | |||||
| public static string ToStringEmptyIfNull(object obj) | |||||
| { | |||||
| return obj == null ? string.Empty : obj.ToString(); | |||||
| } | |||||
| /// <summary> | |||||
| /// 空数据会被转换为"null" | |||||
| /// </summary> | |||||
| public static string ToStringNullIfNull(decimal? num) | |||||
| { | |||||
| return num == null ? "null" : num.ToString(); | |||||
| } | |||||
| /// <summary> | |||||
| /// 空数据会被转换为"null" | |||||
| /// </summary> | |||||
| public static string ToStringNullIfNull(int? num) | |||||
| { | |||||
| return num == null ? "null" : num.ToString(); | |||||
| } | |||||
| /// <summary> | |||||
| /// 空数据会被转换为"null" | |||||
| /// </summary> | |||||
| public static string ToStringNullIfNull(DateTime? num) | |||||
| { | |||||
| return num == null ? "null" : num.ToString(); | |||||
| } | |||||
| /// <summary> | |||||
| /// 将以指定字符串分隔的数据转换成List数据。 | |||||
| /// <para>如果有为空或不合法的数据,则去除之,只保留合法的数据。</para> | |||||
| /// </summary> | |||||
| public static List<double> GetListDouble(object obj, string separator) | |||||
| { | |||||
| bool hasFailedItem; | |||||
| return GetListDouble(obj, separator, out hasFailedItem); | |||||
| } | |||||
| /// <summary> | |||||
| /// 将以指定字符串分隔的数据转换成List数据。有转换失败的信息,则out的值为true;否则为false | |||||
| /// <para>如果有为空或不合法的数据,则去除之,只保留合法的数据。</para> | |||||
| /// </summary> | |||||
| /// <param name="hasFailedItem">有转换失败的信息,则out的值为true;否则为false</param> | |||||
| public static List<double> GetListDouble(object obj, string separator, out bool hasFailedItem) | |||||
| { | |||||
| hasFailedItem = false; | |||||
| List<double> result = new List<double>(); | |||||
| var splitResult = obj.ToString().Split(new string[] { separator }, StringSplitOptions.RemoveEmptyEntries); | |||||
| foreach (var item in splitResult) { | |||||
| double num; | |||||
| if (double.TryParse(item, out num)) | |||||
| result.Add(num); | |||||
| else | |||||
| hasFailedItem = true; | |||||
| } | |||||
| return result; | |||||
| } | |||||
| /// <summary> | |||||
| /// 将以指定字符串分隔的数据转换成List数据。 | |||||
| /// <para>如果有为空或不合法的数据,则去除之,只保留合法的数据。</para> | |||||
| /// </summary> | |||||
| public static List<int> GetListInt(object obj, string separator) | |||||
| { | |||||
| bool hasFailedItem; | |||||
| return GetListInt(obj, separator, out hasFailedItem); | |||||
| } | |||||
| /// <summary> | |||||
| /// 将以指定字符串分隔的数据转换成List数据。有转换失败的信息,则out的值为true;否则为false | |||||
| /// <para>如果有为空或不合法的数据,则去除之,只保留合法的数据。</para> | |||||
| /// </summary> | |||||
| /// <param name="hasFailedItem">有转换失败的信息,则out的值为true;否则为false</param> | |||||
| public static List<int> GetListInt(object obj, string separator, out bool hasFailedItem) | |||||
| { | |||||
| hasFailedItem = false; | |||||
| List<int> result = new List<int>(); | |||||
| var splitResult = obj.ToString().Split(new string[] { separator }, StringSplitOptions.RemoveEmptyEntries); | |||||
| foreach (var item in splitResult) { | |||||
| int num; | |||||
| if (int.TryParse(item, out num)) | |||||
| result.Add(num); | |||||
| else | |||||
| hasFailedItem = true; | |||||
| } | |||||
| return result; | |||||
| } | |||||
| /// <summary> | |||||
| /// 将以指定字符串分隔的数据转换成List数据。 | |||||
| /// <para>如果有为空或不合法的数据,则去除之,只保留合法的数据。</para> | |||||
| /// </summary> | |||||
| public static IList<string> GetListString(object obj, string separator) | |||||
| { | |||||
| return obj.ToString().Split(new string[] { separator }, StringSplitOptions.RemoveEmptyEntries); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,64 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| //namespace Utils.Datas | |||||
| namespace System.Collections.Generic | |||||
| { | |||||
| public static class DictionaryUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 将第二个参数中的数据合并到第一个参数中。【通过Key判断。如果已存在,则忽略】 | |||||
| /// <para>Key不能为类</para> | |||||
| /// </summary> | |||||
| public static void Combine<T1, T2>(this IDictionary<T1, T2> a, IDictionary<T1, T2> b) | |||||
| { | |||||
| if (a == null) | |||||
| a = new Dictionary<T1, T2>(); | |||||
| if (b == null || b.Count == 0) | |||||
| return; | |||||
| foreach (var item in b) { | |||||
| if (!a.Keys.Contains(item.Key)) | |||||
| a.Add(item.Key, item.Value); | |||||
| } | |||||
| } | |||||
| /// <summary> | |||||
| /// 找出两个参数中,Key相同的项的Key | |||||
| /// <para>Key不能为类</para> | |||||
| /// </summary> | |||||
| public static List<T1> FindSameKey<T1, T2>(this IDictionary<T1, T2> a, IDictionary<T1, T2> b) | |||||
| { | |||||
| List<T1> result = new List<T1>(); | |||||
| foreach (var item in a) { | |||||
| if (b.Keys.Contains(item.Key)) | |||||
| result.Add(item.Key); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| /// <summary> | |||||
| /// 从第一个参数中去掉第二个参数中的所有项后,剩余项的Key。只比较Key | |||||
| /// <para>Key不能为类</para> | |||||
| /// </summary> | |||||
| public static List<T1> SubKey<T1, T2>(this IDictionary<T1, T2> a, IDictionary<T1, T2> b) | |||||
| { | |||||
| List<T1> result = new List<T1>(); | |||||
| foreach (var item in a) { | |||||
| if (!b.Keys.Contains(item.Key)) | |||||
| result.Add(item.Key); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| public static Dictionary<T1, string> ChangeValueToString<T1>(this IDictionary<T1, object> dic) | |||||
| {//TODO:添加测试 | |||||
| Dictionary<T1, string> result = new Dictionary<T1, string>(); | |||||
| foreach (var detail in dic) { | |||||
| result.Add(detail.Key, detail.Value == null ? string.Empty : detail.Value.ToString()); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,132 @@ | |||||
| using Aspose.Cells; | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.ComponentModel; | |||||
| using System.Data; | |||||
| using System.IO; | |||||
| using System.Linq; | |||||
| using System.Reflection; | |||||
| using System.Runtime.Serialization; | |||||
| using System.Runtime.Serialization.Formatters.Binary; | |||||
| using System.Text; | |||||
| using System.Web; | |||||
| namespace Utils.Datas | |||||
| { | |||||
| /// <summary> | |||||
| /// Excel操作帮助类 (引用程序集Aspose.Cells.dll) | |||||
| /// </summary> | |||||
| public class ExcelHelper | |||||
| { | |||||
| /// <summary> | |||||
| /// 读取指定路径的Excel文件为DataTable | |||||
| /// </summary> | |||||
| /// <param name="fileName">文件全路径</param> | |||||
| /// <param name="firstRow">要开始读取的第一行在Excel中的行索引(默认会以此行各列数据作为DataTable的列名)</param> | |||||
| /// <param name="firstColumn">要开始读取的第一列在Excel中的列索引</param> | |||||
| /// <param name="invalidEndRowNumber">文件尾部无效行数目(该部分所有行数据将不会被读取)</param> | |||||
| /// <returns>返回DataSet</returns> | |||||
| public static DataSet ReadExcel(string fileName, int firstRow = 0, int firstColumn = 0, int invalidEndRowNumber = 0) | |||||
| { | |||||
| DataSet ds = new DataSet(); | |||||
| try { | |||||
| if (string.IsNullOrEmpty(fileName) || !System.IO.File.Exists(fileName)) { | |||||
| return null; | |||||
| } | |||||
| //new Aspose.Cells.License().SetLicense(AsposeHelper.LStream); | |||||
| Cells cells; | |||||
| Workbook workbook = new Workbook(fileName); | |||||
| foreach (Worksheet worksheet in workbook.Worksheets) { | |||||
| cells = worksheet.Cells;//取Sheet读取 | |||||
| if (cells == null) { | |||||
| return null; | |||||
| } | |||||
| try { | |||||
| DataTable dt = cells.ExportDataTable(firstRow, firstColumn, cells.MaxDataRow + 1, cells.MaxDataColumn + 1, true); | |||||
| dt.TableName = worksheet.Name;//取Sheet的名字作为表名 | |||||
| if (dt != null && dt.Rows.Count > 0) { | |||||
| ds.Tables.Add(dt); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| LogUtil.LogError("读取Excel内容失败:worksheet.Name" + worksheet.Name + " " + e.Message); | |||||
| } | |||||
| } | |||||
| } catch (Exception ex) { | |||||
| LogUtil.LogError("读取Excel内容失败:" + ex.Message); | |||||
| } | |||||
| return ds; | |||||
| } | |||||
| /// <summary> | |||||
| /// 将DataTable导出指定路径的Excel文件 | |||||
| /// </summary> | |||||
| /// <param name="dt">DataTable</param> | |||||
| /// <param name="tableName">Excel文件的表头内容</param> | |||||
| /// <param name="path">文件保存的全路径</param> | |||||
| public static void ExportExcel(DataTable dt, string headerText, string path) | |||||
| { | |||||
| Workbook workbook = new Workbook(); //工作簿 | |||||
| Worksheet sheet = workbook.Worksheets[0]; //工作表 | |||||
| Cells cells = sheet.Cells;//单元格 | |||||
| //为标题设置样式 | |||||
| Style styleTitle = workbook.Styles[workbook.Styles.Add()];//新增样式 | |||||
| styleTitle.HorizontalAlignment = TextAlignmentType.Center;//文字居中 | |||||
| styleTitle.Font.Name = "宋体";//文字字体 | |||||
| styleTitle.Font.Size = 18;//文字大小 | |||||
| styleTitle.Font.IsBold = true;//粗体 | |||||
| //样式2 | |||||
| Style style2 = workbook.Styles[workbook.Styles.Add()];//新增样式 | |||||
| style2.HorizontalAlignment = TextAlignmentType.Center;//文字居中 | |||||
| style2.Font.Name = "宋体";//文字字体 | |||||
| style2.Font.Size = 14;//文字大小 | |||||
| style2.Font.IsBold = true;//粗体 | |||||
| style2.IsTextWrapped = true;//单元格内容自动换行 | |||||
| style2.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin; | |||||
| style2.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin; | |||||
| style2.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin; | |||||
| style2.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin; | |||||
| //样式3 | |||||
| Style style3 = workbook.Styles[workbook.Styles.Add()];//新增样式 | |||||
| style3.HorizontalAlignment = TextAlignmentType.Center;//文字居中 | |||||
| style3.Font.Name = "宋体";//文字字体 | |||||
| style3.Font.Size = 12;//文字大小 | |||||
| style3.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin; | |||||
| style3.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin; | |||||
| style3.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin; | |||||
| style3.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin; | |||||
| int Colnum = dt.Columns.Count;//表格列数 | |||||
| int Rownum = dt.Rows.Count;//表格行数 | |||||
| //生成行1 标题行 | |||||
| cells.Merge(0, 0, 1, Colnum);//合并单元格 | |||||
| cells[0, 0].PutValue(headerText);//填写内容 | |||||
| cells[0, 0].SetStyle(styleTitle); | |||||
| cells.SetRowHeight(0, 38); | |||||
| //生成行2 列名行 | |||||
| for (int i = 0; i < Colnum; i++) { | |||||
| cells[1, i].PutValue(dt.Columns[i].ColumnName); | |||||
| cells[1, i].SetStyle(style2); | |||||
| cells.SetRowHeight(1, 25); | |||||
| } | |||||
| //生成数据行 | |||||
| for (int i = 0; i < Rownum; i++) { | |||||
| for (int k = 0; k < Colnum; k++) { | |||||
| cells[2 + i, k].PutValue(dt.Rows[i][k].ToString()); | |||||
| cells[2 + i, k].SetStyle(style3); | |||||
| } | |||||
| cells.SetRowHeight(2 + i, 24); | |||||
| } | |||||
| workbook.Save(path); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,39 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace Utils.Datas | |||||
| { | |||||
| public class NumToStringUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 小数位最多N位 | |||||
| /// </summary> | |||||
| public static string GetPointAtMost(decimal num, int places = 2) | |||||
| { | |||||
| var s = GetStandardPoint(num, places); | |||||
| if (!s.EndsWith("0")) | |||||
| return s; | |||||
| int zeroLength = 1; | |||||
| for (int i = 1; i < places; i++) { | |||||
| if (s.ElementAt(s.Length - zeroLength - 1) != '0') | |||||
| break; | |||||
| zeroLength++; | |||||
| } | |||||
| if (zeroLength == places) | |||||
| return s.Substring(0, s.Length - zeroLength - 1); | |||||
| return s.Substring(0, s.Length - zeroLength); | |||||
| } | |||||
| /// <summary> | |||||
| /// N位小数 | |||||
| /// </summary> | |||||
| public static string GetStandardPoint(decimal num, int places = 2) | |||||
| { | |||||
| if (places < 1) | |||||
| places = 2; | |||||
| return num.ToString("F" + places); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,28 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace Utils.Datas | |||||
| { | |||||
| public class PageNumUtil | |||||
| { | |||||
| /// <summary> | |||||
| /// 根据总数量和每页允许的最大数量,得到总页数 | |||||
| /// </summary> | |||||
| /// <param name="count">总数量</param> | |||||
| /// <param name="maxCountPerPage">每页允许的最大数量</param> | |||||
| /// <returns>总页数</returns> | |||||
| public static int GetTotalPageCount(long count, long maxCountPerPage) | |||||
| { | |||||
| #if DEBUG | |||||
| if (maxCountPerPage == 0) | |||||
| throw new ApplicationException("maxCountPerPage参数不允许为0"); | |||||
| #endif | |||||
| int pageCount = (int)(count / maxCountPerPage); | |||||
| if (count % maxCountPerPage > 0) | |||||
| pageCount++; | |||||
| return pageCount; | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,107 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Security.Cryptography; | |||||
| using System.Text; | |||||
| using System.Text.RegularExpressions; | |||||
| namespace System | |||||
| { | |||||
| public static class StringExtensions | |||||
| { | |||||
| /// <summary> | |||||
| /// 将字符串作为新List的第一个元素 | |||||
| /// </summary> | |||||
| public static IList<string> AsFirstValueOfList(this string source) | |||||
| { | |||||
| var list = new List<string>(); | |||||
| list.Add(source); | |||||
| return list; | |||||
| } | |||||
| public static bool IsNullOrEmpty(this string s) | |||||
| { | |||||
| return string.IsNullOrEmpty(s); | |||||
| } | |||||
| #region FormatWith:string.Format。后面三个方法,是为了提高效率而加的:比第一种方法效率高 | |||||
| public static string FormatWith(this string format, params object[] args) | |||||
| { | |||||
| return string.Format(format, args); | |||||
| } | |||||
| public static string FormatWith(this string format, object arg0) | |||||
| { | |||||
| return string.Format(format, arg0); | |||||
| } | |||||
| public static string FormatWith(this string format, object arg0, object arg1) | |||||
| { | |||||
| return string.Format(format, arg0, arg1); | |||||
| } | |||||
| public static string FormatWith(this string format, object arg0, object arg1, object arg2) | |||||
| { | |||||
| return string.Format(format, arg0, arg1, arg2); | |||||
| } | |||||
| #endregion | |||||
| public static bool IsMatch(this string s, string pattern) | |||||
| { | |||||
| if (s == null) | |||||
| return false; | |||||
| else | |||||
| return Regex.IsMatch(s, pattern); | |||||
| } | |||||
| public static string Match(this string s, string pattern) | |||||
| { | |||||
| if (s == null) | |||||
| return ""; | |||||
| return Regex.Match(s, pattern).Value; | |||||
| } | |||||
| public static bool IsInt(this string s) | |||||
| { | |||||
| int i; | |||||
| return int.TryParse(s, out i); | |||||
| } | |||||
| public static int ToInt(this string s) | |||||
| { | |||||
| return int.Parse(s); | |||||
| } | |||||
| /// <summary> | |||||
| /// 首字母转换成小写 | |||||
| /// </summary> | |||||
| public static string ToCamel(this string s) | |||||
| { | |||||
| if (s.IsNullOrEmpty()) | |||||
| return s; | |||||
| return s[0].ToString().ToLower() + s.Substring(1); | |||||
| } | |||||
| /// <summary> | |||||
| /// 首字母转换成大写 | |||||
| /// </summary> | |||||
| public static string ToPascal(this string s) | |||||
| { | |||||
| if (s.IsNullOrEmpty()) | |||||
| return s; | |||||
| return s[0].ToString().ToUpper() + s.Substring(1); | |||||
| } | |||||
| public static string ToUnicodeString(this byte[] arr) | |||||
| { | |||||
| return System.Text.Encoding.Unicode.GetString(arr); | |||||
| } | |||||
| public static byte[] EncodeUnicodePwd(this string password) | |||||
| { | |||||
| using (var md5 = MD5.Create()) | |||||
| return md5.ComputeHash(Encoding.Unicode.GetBytes(password)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,12 @@ | |||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| namespace System | |||||
| { | |||||
| public class DebugError: Exception | |||||
| { | |||||
| public DebugError(string message) : base(message) { } | |||||
| } | |||||
| } | |||||