| | |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bro.UI.Model.Winform", "src\Bro.UI.Model.Winform\Bro.UI.Model.Winform.csproj", "{741F6491-57C7-479A-B391-09BBA9FBA9DC}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bro.Device.GTSCard", "src\Bro.Device.GTSCard\Bro.Device.GTSCard.csproj", "{B536003E-70BA-4701-B8FD-BAFA303AB4E2}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bro.M071.Process.DBManager", "src\Bro.M071.Process.DBManager\Bro.M071.Process.DBManager.csproj", "{230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bro.M071.Process.Model", "src\Bro.M071.Process.Model\Bro.M071.Process.Model.csproj", "{AD645C48-5811-4B1E-B81F-D35D5E6B577F}" |
| | | EndProject |
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bro.Process.DBManager", "src\Bro.Process.DBManager\Bro.Process.DBManager.csproj", "{65302D6E-9918-4E4C-92B4-75C8830C6BA7}" |
| | | EndProject |
| | | Global |
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
| | | Debug|Any CPU = Debug|Any CPU |
| | |
| | | {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Release|x64.Build.0 = Release|Any CPU |
| | | {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {741F6491-57C7-479A-B391-09BBA9FBA9DC}.Release|x86.Build.0 = Release|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Debug|x64.ActiveCfg = Debug|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Debug|x64.Build.0 = Debug|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Debug|x86.ActiveCfg = Debug|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Debug|x86.Build.0 = Debug|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Release|x64.ActiveCfg = Release|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Release|x64.Build.0 = Release|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {B536003E-70BA-4701-B8FD-BAFA303AB4E2}.Release|x86.Build.0 = Release|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Debug|x64.ActiveCfg = Debug|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Debug|x64.Build.0 = Debug|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Debug|x86.ActiveCfg = Debug|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Debug|x86.Build.0 = Debug|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|x64.ActiveCfg = Release|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|x64.Build.0 = Release|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}.Release|x86.Build.0 = Release|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Debug|x64.ActiveCfg = Debug|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Debug|x64.Build.0 = Debug|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Debug|x86.ActiveCfg = Debug|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Debug|x86.Build.0 = Debug|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Release|x64.ActiveCfg = Release|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Release|x64.Build.0 = Release|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {AD645C48-5811-4B1E-B81F-D35D5E6B577F}.Release|x86.Build.0 = Release|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Debug|Any CPU.Build.0 = Debug|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Debug|x64.ActiveCfg = Debug|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Debug|x64.Build.0 = Debug|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Debug|x86.ActiveCfg = Debug|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Debug|x86.Build.0 = Debug|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Release|Any CPU.ActiveCfg = Release|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Release|Any CPU.Build.0 = Release|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Release|x64.ActiveCfg = Release|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Release|x64.Build.0 = Release|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Release|x86.ActiveCfg = Release|Any CPU |
| | | {65302D6E-9918-4E4C-92B4-75C8830C6BA7}.Release|x86.Build.0 = Release|Any CPU |
| | | EndGlobalSection |
| | | GlobalSection(SolutionProperties) = preSolution |
| | | HideSolutionNode = FALSE |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
| | | <PropertyGroup> |
| | | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
| | | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
| | | <ProjectGuid>{B536003E-70BA-4701-B8FD-BAFA303AB4E2}</ProjectGuid> |
| | | <OutputType>Library</OutputType> |
| | | <AppDesignerFolder>Properties</AppDesignerFolder> |
| | | <RootNamespace>Bro.Device.GTSCard</RootNamespace> |
| | | <AssemblyName>Bro.Device.GTSCard</AssemblyName> |
| | | <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
| | | <FileAlignment>512</FileAlignment> |
| | | <Deterministic>true</Deterministic> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
| | | <DebugSymbols>true</DebugSymbols> |
| | | <DebugType>full</DebugType> |
| | | <Optimize>false</Optimize> |
| | | <OutputPath>..\Debug\</OutputPath> |
| | | <DefineConstants>DEBUG;TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
| | | <DebugType>pdbonly</DebugType> |
| | | <Optimize>true</Optimize> |
| | | <OutputPath>bin\Release\</OutputPath> |
| | | <DefineConstants>TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | | <Reference Include="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.Net.Http" /> |
| | | <Reference Include="System.Xml" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Compile Include="Class1.cs" /> |
| | | <Compile Include="Properties\AssemblyInfo.cs" /> |
| | | </ItemGroup> |
| | | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
| | | </Project> |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace Bro.Device.GTSCard |
| | | { |
| | | public class Class1 |
| | | { |
| | | } |
| | | } |
New file |
| | |
| | | using System.Reflection; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Runtime.InteropServices; |
| | | |
| | | // 有关程序集的一般信息由以下 |
| | | // 控制。更改这些特性值可修改 |
| | | // 与程序集关联的信息。 |
| | | [assembly: AssemblyTitle("Bro.Device.GTSCard")] |
| | | [assembly: AssemblyDescription("")] |
| | | [assembly: AssemblyConfiguration("")] |
| | | [assembly: AssemblyCompany("")] |
| | | [assembly: AssemblyProduct("Bro.Device.GTSCard")] |
| | | [assembly: AssemblyCopyright("Copyright © 2020")] |
| | | [assembly: AssemblyTrademark("")] |
| | | [assembly: AssemblyCulture("")] |
| | | |
| | | // 将 ComVisible 设置为 false 会使此程序集中的类型 |
| | | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 |
| | | //请将此类型的 ComVisible 特性设置为 true。 |
| | | [assembly: ComVisible(false)] |
| | | |
| | | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID |
| | | [assembly: Guid("b536003e-70ba-4701-b8fd-bafa303ab4e2")] |
| | | |
| | | // 程序集的版本信息由下列四个值组成: |
| | | // |
| | | // 主版本 |
| | | // 次版本 |
| | | // 生成号 |
| | | // 修订号 |
| | | // |
| | | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 |
| | | //通过使用 "*",如下所示: |
| | | // [assembly: AssemblyVersion("1.0.*")] |
| | | [assembly: AssemblyVersion("1.0.0.0")] |
| | | [assembly: AssemblyFileVersion("1.0.0.0")] |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <configuration> |
| | | <configSections> |
| | | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
| | | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
| | | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
| | | <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
| | | </configSections> |
| | | <system.data> |
| | | <DbProviderFactories> |
| | | <remove invariant="System.Data.SQLite.EF6" /> |
| | | <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" /> |
| | | <remove invariant="System.Data.SQLite" /> |
| | | <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> |
| | | </DbProviderFactories> |
| | | </system.data> |
| | | <entityFramework> |
| | | <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> |
| | | <providers> |
| | | <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> |
| | | <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> |
| | | </providers> |
| | | </entityFramework> |
| | | <runtime> |
| | | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
| | | <dependentAssembly> |
| | | <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" /> |
| | | <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" /> |
| | | </dependentAssembly> |
| | | <dependentAssembly> |
| | | <assemblyIdentity name="System.Data.SQLite.EF6" publicKeyToken="db937bc2d44ff139" culture="neutral" /> |
| | | <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" /> |
| | | </dependentAssembly> |
| | | </assemblyBinding> |
| | | </runtime> |
| | | <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup></configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <Import Project="..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props" Condition="Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" /> |
| | | <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>{230B0FFF-F6AF-45FE-AAF7-B4B66250DD58}</ProjectGuid> |
| | | <OutputType>Library</OutputType> |
| | | <AppDesignerFolder>Properties</AppDesignerFolder> |
| | | <RootNamespace>Bro.Process.DBManager</RootNamespace> |
| | | <AssemblyName>Bro.Process.DBManager</AssemblyName> |
| | | <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
| | | <FileAlignment>512</FileAlignment> |
| | | <NuGetPackageImportStamp> |
| | | </NuGetPackageImportStamp> |
| | | <TargetFrameworkProfile /> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
| | | <DebugSymbols>true</DebugSymbols> |
| | | <DebugType>full</DebugType> |
| | | <Optimize>false</Optimize> |
| | | <OutputPath>..\Debug\</OutputPath> |
| | | <DefineConstants>DEBUG;TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
| | | <DebugType>pdbonly</DebugType> |
| | | <Optimize>true</Optimize> |
| | | <OutputPath>bin\Release\</OutputPath> |
| | | <DefineConstants>TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | | <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="SQLite.CodeFirst, Version=1.5.3.29, Culture=neutral, PublicKeyToken=eb96ba0a78d831a7, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\SQLite.CodeFirst.1.5.3.29\lib\net45\SQLite.CodeFirst.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System" /> |
| | | <Reference Include="System.ComponentModel.DataAnnotations" /> |
| | | <Reference Include="System.Configuration" /> |
| | | <Reference Include="System.Core" /> |
| | | <Reference Include="System.Data.SQLite, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.Core.1.0.112.0\lib\net451\System.Data.SQLite.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.EF6, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.EF6.1.0.112.0\lib\net451\System.Data.SQLite.EF6.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.EF6.Migrations, Version=1.0.106.0, Culture=neutral, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.EF6.Migrations.1.0.106\lib\System.Data.SQLite.EF6.Migrations.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.Linq, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.Linq.1.0.112.0\lib\net451\System.Data.SQLite.Linq.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Xml.Linq" /> |
| | | <Reference Include="System.Data.DataSetExtensions" /> |
| | | <Reference Include="Microsoft.CSharp" /> |
| | | <Reference Include="System.Data" /> |
| | | <Reference Include="System.Net.Http" /> |
| | | <Reference Include="System.Xml" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Compile Include="ProductionDetectionImageRecordsManager.cs" /> |
| | | <Compile Include="ProductionDetectionRecordsDetailManager.cs" /> |
| | | <Compile Include="ProductionDetectionRecordsManager.cs" /> |
| | | <Compile Include="Properties\AssemblyInfo.cs" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\Bro.Common.Model\Bro.Common.Model.csproj"> |
| | | <Project>{1A3CBFE7-3F78-42C3-95C5-10360450DBEA}</Project> |
| | | <Name>Bro.Common.Model</Name> |
| | | </ProjectReference> |
| | | <ProjectReference Include="..\Bro.Common.Device\Bro.Common.Device.csproj"> |
| | | <Project>{987308DD-8BAA-463A-94E2-77D62E01A5BF}</Project> |
| | | <Name>Bro.Process.Common</Name> |
| | | </ProjectReference> |
| | | <ProjectReference Include="..\Bro.Process.Model\Bro.Process.Model.csproj"> |
| | | <Project>{AD645C48-5811-4B1E-B81F-D35D5E6B577F}</Project> |
| | | <Name>Bro.Process.Model</Name> |
| | | </ProjectReference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="App.config" /> |
| | | <None Include="packages.config" /> |
| | | </ItemGroup> |
| | | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
| | | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
| | | <PropertyGroup> |
| | | </PropertyGroup> |
| | | <Error Condition="!Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props'))" /> |
| | | <Error Condition="!Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets'))" /> |
| | | <Error Condition="!Exists('..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets'))" /> |
| | | </Target> |
| | | <Import Project="..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets" Condition="Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" /> |
| | | <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets')" /> |
| | | </Project> |
New file |
| | |
| | | ////using Bro.Process.Common.Helper; |
| | | //using Bro.Common.Helper; |
| | | //using Bro.Process.Model; |
| | | //using Bro.Process.Model.Model; |
| | | //using System; |
| | | //using System.Collections; |
| | | //using System.Collections.Generic; |
| | | //using System.Configuration; |
| | | //using System.Data; |
| | | //using System.Data.Common; |
| | | //using System.Data.SQLite; |
| | | //using System.Diagnostics; |
| | | //using System.Linq; |
| | | //using System.Text; |
| | | //using System.Threading.Tasks; |
| | | |
| | | //namespace Bro.M071.Process.DBManager |
| | | //{ |
| | | // public class ProductionDetectionImageRecordsManager : ModelManager<ProductionDetectionImageRecords> |
| | | // { |
| | | // DbProviderFactory Dbfactory = SQLiteFactory.Instance; |
| | | // protected override void ActionBeforeNewModel(DBModel context, ProductionDetectionImageRecords config) |
| | | // { |
| | | // CheckProductionCodeDuplicate(context, config); |
| | | // } |
| | | |
| | | // protected override void ActionBeforeUpdateModel(DBModel context, ProductionDetectionImageRecords config) |
| | | // { |
| | | // CheckProductionCodeDuplicate(context, config); |
| | | // } |
| | | |
| | | // private void CheckProductionCodeDuplicate(DBModel context, ProductionDetectionImageRecords config) |
| | | // { |
| | | // //if (context.ProductionDetectionImageRecords.Any(u => u.IS_DELETED == 0 |
| | | // // && u.ID != config.ID |
| | | // // && u.PRODUCTION_CODE == config.PRODUCTION_CODE)) |
| | | // { |
| | | // //throw new ProcessException("新增或修改的产品配置信息的产品代码不能重复", null); |
| | | // } |
| | | // } |
| | | |
| | | // public List<ProductionDetectionImageRecords> GetProductionDetectionImageRecords(string productionBatchNO, string pid) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // var list = context.ProductionDetectionImageRecords.Where(u => u.IS_DELETED == 0); |
| | | |
| | | // if (!string.IsNullOrWhiteSpace(productionBatchNO)) |
| | | // { |
| | | // list = list.Where(u => u.ProductionBatchNO.Contains(productionBatchNO)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(pid)) |
| | | // { |
| | | // list = list.Where(u => u.PId.Contains(pid)); |
| | | // } |
| | | |
| | | // var resultList = list.ToList(); |
| | | // return resultList; |
| | | // } |
| | | // } |
| | | // //public List<ProductionStatistics_Dto> GetOperationRecordsList(OperationRecordsRequest request) |
| | | // //{ |
| | | // // using (DBModel context = new DBModel()) |
| | | // // { |
| | | // // var oList = context.OperationRecords.Where(u => u.IS_DELETED == 0); |
| | | // // var pList = context.ProductionDetectionRecords.Where(u => u.IS_DELETED == 0); |
| | | // // if (!string.IsNullOrWhiteSpace(request.ProductionBatchNO)) |
| | | // // { |
| | | // // oList = oList.Where(u => u.ProductionBatchNO.Contains(request.ProductionBatchNO)); |
| | | // // } |
| | | // // if (!string.IsNullOrWhiteSpace(request.UserNO)) |
| | | // // { |
| | | // // oList = oList.Where(u => u.UserNO.Contains(request.UserNO)); |
| | | // // } |
| | | // // if (request.StartTime != null) |
| | | // // { |
| | | // // oList = oList.Where(u => u.OperationStartTime >= request.StartTime); |
| | | // // } |
| | | // // if (request.EndTime != null) |
| | | // // { |
| | | // // oList = oList.Where(u => u.OperationStartTime <= request.EndTime); |
| | | // // } |
| | | |
| | | // // var query = from operationRecords in oList |
| | | // // join productionDetectionRecords in pList |
| | | // // on operationRecords.ID equals productionDetectionRecords.OperationRecordsId |
| | | // // into opList |
| | | // // select new ProductionStatistics_Dto |
| | | // // { |
| | | // // OperationRecordsRowData = operationRecords, |
| | | // // BatchProductionTotalCount = opList.Where(u => u.ProductionBatchNO == operationRecords.ProductionBatchNO).Count(), |
| | | // // BatchProductionOKCount = opList.Where(u => u.ProductionBatchNO == operationRecords.ProductionBatchNO && u.Result == "OK").Count(), |
| | | // // BatchProductionNGCount = opList.Where(u => u.ProductionBatchNO == operationRecords.ProductionBatchNO && u.Result == "NG").Count(), |
| | | // // BatchProductionTBDCount = opList.Where(u => u.ProductionBatchNO == operationRecords.ProductionBatchNO && u.Result == "TBD").Count(), |
| | | // // IsSelected = false, |
| | | // // }; |
| | | // // var pageList = query.OrderBy(u => u.OperationRecordsRowData.OperationStartTime).ToPagedList(request); |
| | | // // request.TotalNum = oList.Count(); |
| | | // // return pageList; |
| | | // // } |
| | | // //} |
| | | // public List<ProductionDetectionImageRecords_Dto> GetProductionDetectionImageRecordsPagedList(ProductionDetectionImageRecordsRequest request) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // var imageRecordsList = context.ProductionDetectionImageRecords.Where(u => u.IS_DELETED == 0); |
| | | // var detectionRecordsList = context.ProductionDetectionRecordsDetail.Where(u => u.IS_DELETED == 0); |
| | | // var manualDetectionRecordsList = context.ManualDetectionRecords.Where(u => u.IS_DELETED == 0); |
| | | // if (!string.IsNullOrWhiteSpace(request.ProductionBatchNO)) |
| | | // { |
| | | // imageRecordsList = imageRecordsList.Where(u => u.ProductionBatchNO.Contains(request.ProductionBatchNO)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.PId)) |
| | | // { |
| | | // imageRecordsList = imageRecordsList.Where(u => u.PId.Contains(request.PId)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.Detection)) |
| | | // { |
| | | // imageRecordsList = imageRecordsList.Where(u => u.Detection.Contains(request.Detection)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.DefectName)) |
| | | // { |
| | | // imageRecordsList = imageRecordsList.Where(u => u.DefectNameList.Contains(request.DefectName)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.ManualDefectName)) |
| | | // { |
| | | // imageRecordsList = imageRecordsList.Where(u => u.ManualDefectNameList.Contains(request.ManualDefectName)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.Result)) |
| | | // { |
| | | // imageRecordsList = imageRecordsList.Where(u => u.Result == request.Result); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.ManualResult)) |
| | | // { |
| | | // manualDetectionRecordsList = manualDetectionRecordsList.Where(u => u.ManualResult == request.ManualResult); |
| | | // } |
| | | // if (request.StartTime != null) |
| | | // { |
| | | // imageRecordsList = imageRecordsList.Where(u => u.Time >= request.StartTime); |
| | | // } |
| | | // if (request.EndTime != null) |
| | | // { |
| | | // imageRecordsList = imageRecordsList.Where(u => u.Time <= request.EndTime); |
| | | // } |
| | | |
| | | // var query = from imageRecord in imageRecordsList |
| | | // join manualDetectionRecords in manualDetectionRecordsList on imageRecord.OriginalImgPath equals manualDetectionRecords.OriginalImgPath |
| | | // join detectionRecords in detectionRecordsList on imageRecord.ID equals detectionRecords.ImageRecordId |
| | | // into imageDetectionRecord |
| | | |
| | | // select new ProductionDetectionImageRecords_Dto |
| | | // { |
| | | // ProductionDetectionImageRecordsRowData = imageRecord, |
| | | // ManualDetectionRecords = manualDetectionRecords, |
| | | // ProductionDetectionRecordsDetailList = detectionRecordsList.Where(u => u.ImageRecordId == imageRecord.ID) |
| | | // }; |
| | | // var pageList = query.OrderBy(u => u.ProductionDetectionImageRecordsRowData.CREATE_TIME).ToPagedList(request); |
| | | // request.TotalNum = imageRecordsList.Count(); |
| | | |
| | | // return pageList; |
| | | // } |
| | | // } |
| | | |
| | | // public ProductionDetectionImageRecords GetConfigByProductionCode(string productionCode) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // //ProductionDetectionImageRecords RR= context.ProductionDetectionImageRecords.FirstOrDefault(u => u.IS_DELETED == 0 && u.PRODUCTION_CODE == productionCode); |
| | | // //return RR; |
| | | // return new ProductionDetectionImageRecords(); |
| | | // } |
| | | // } |
| | | // public void ADOBatchAdd(List<ProductionDetectionImageRecords> records) |
| | | // { |
| | | // Hashtable SQLStringList = new Hashtable(); |
| | | // try |
| | | // { |
| | | // var idList = records.Select(u => u.ID).ToList(); |
| | | // var disIdList = idList.Distinct().ToList(); |
| | | // if (idList.Count != disIdList.Count)//有重复id |
| | | // { |
| | | // throw new ProcessException("异常:有重复id:" + idList.ToString(), null); |
| | | // } |
| | | // //foreach (var record in records) |
| | | // //{ |
| | | // // if (IsExistId(record.ID)) |
| | | // // { |
| | | // // throw new ProcessException("异常:有重复id:" + record.ID, null); |
| | | // // } |
| | | // // StringBuilder strSql = new StringBuilder(); |
| | | // // strSql.Append("insert into ProductionDetectionImageRecords ("); |
| | | // // strSql.Append("ID,ProductionBatchNO,PId,Result,Time,Detection,DefectName,Probability,Uncertainty,DefectX,DefectY,DefectWidth,DefectHeight, RawImgPath,DefectImgPath,ImageTime,PreElapsed,DefectElapsed,AfterElapsed,TotalElapsed,PreTreatedFlag,DetectionType, SpecStandard, SpecActualValue,IS_DISABLED,IS_DELETED,CREATE_USER,CREATE_TIME, UPDATE_USER,UPDATE_TIME"); |
| | | // // strSql.Append(")values ("); |
| | | // // strSql.Append("@ID,@ProductionBatchNO,@PId,@Result,@Time,@Detection,@DefectName,@Probability,@Uncertainty,@DefectX,@DefectY,@DefectWidth,@DefectHeight,@RawImgPath,@DefectImgPath,@ImageTime,@PreElapsed,@DefectElapsed,@AfterElapsed,@TotalElapsed,@PreTreatedFlag,@DetectionType,@SpecStandard,@SpecActualValue,@IS_DISABLED,@IS_DELETED,@CREATE_USER,@CREATE_TIME,@UPDATE_USER,@UPDATE_TIME)"); |
| | | // // List<SQLiteParameter> parameters = new List<SQLiteParameter>(); |
| | | // // parameters.Add(new SQLiteParameter("@ID", record.ID)); |
| | | // // parameters.Add(new SQLiteParameter("@ProductionBatchNO", record.ProductionBatchNO)); |
| | | // // parameters.Add(new SQLiteParameter("@PId", record.PId)); |
| | | // // parameters.Add(new SQLiteParameter("@Result", record.Result)); |
| | | // // parameters.Add(new SQLiteParameter("@Time", record.Time)); |
| | | // // parameters.Add(new SQLiteParameter("@Detection", record.Detection)); |
| | | // // parameters.Add(new SQLiteParameter("@DefectName", record.DefectName)); |
| | | // // parameters.Add(new SQLiteParameter("@Probability", record.Probability)); |
| | | // // parameters.Add(new SQLiteParameter("@Uncertainty", record.Uncertainty)); |
| | | // // parameters.Add(new SQLiteParameter("@DefectX", record.DefectX)); |
| | | // // parameters.Add(new SQLiteParameter("@DefectY", record.DefectY)); |
| | | // // parameters.Add(new SQLiteParameter("@DefectWidth", record.DefectWidth)); |
| | | // // parameters.Add(new SQLiteParameter("@DefectHeight", record.DefectHeight)); |
| | | // // parameters.Add(new SQLiteParameter("@RawImgPath", record.RawImgPath)); |
| | | // // parameters.Add(new SQLiteParameter("@DefectImgPath", record.DefectImgPath)); |
| | | // // parameters.Add(new SQLiteParameter("@ImageTime", record.ImageTime)); |
| | | // // parameters.Add(new SQLiteParameter("@PreElapsed", record.PreElapsed)); |
| | | // // parameters.Add(new SQLiteParameter("@DefectElapsed", record.DefectElapsed)); |
| | | // // parameters.Add(new SQLiteParameter("@AfterElapsed", record.AfterElapsed)); |
| | | // // parameters.Add(new SQLiteParameter("@TotalElapsed", record.TotalElapsed)); |
| | | // // parameters.Add(new SQLiteParameter("@PreTreatedFlag", record.PreTreatedFlag)); |
| | | // // parameters.Add(new SQLiteParameter("@DetectionType", record.DetectionType)); |
| | | // // parameters.Add(new SQLiteParameter("@SpecStandard", record.SpecStandard)); |
| | | // // parameters.Add(new SQLiteParameter("@SpecActualValue", record.SpecActualValue)); |
| | | // // parameters.Add(new SQLiteParameter("@IS_DISABLED", record.IS_DISABLED)); |
| | | // // parameters.Add(new SQLiteParameter("@IS_DELETED", record.IS_DELETED)); |
| | | // // parameters.Add(new SQLiteParameter("@CREATE_USER", record.CREATE_USER)); |
| | | // // parameters.Add(new SQLiteParameter("@CREATE_TIME", record.CREATE_TIME)); |
| | | // // parameters.Add(new SQLiteParameter("@UPDATE_USER", record.UPDATE_USER)); |
| | | // // parameters.Add(new SQLiteParameter("@UPDATE_TIME", record.UPDATE_TIME)); |
| | | |
| | | // // SQLStringList.Add(strSql, parameters.ToArray()); |
| | | // //} |
| | | // SQLiteHelper.ExecuteSqlTran(SQLStringList); //使用数据库事务 |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // throw new ProcessException(SQLStringList.ToString() + ex.Message, null); |
| | | // } |
| | | // } |
| | | |
| | | // public void InserPatch(List<ProductionDetectionImageRecords> records) |
| | | // { |
| | | // try |
| | | // { |
| | | // using (SQLiteConnection conn = new SQLiteConnection(ConnectionString)) |
| | | // { |
| | | // using (SQLiteCommand insertRngCmd = (SQLiteCommand)conn.CreateCommand()) |
| | | // { |
| | | // StringBuilder strSql = new StringBuilder(); |
| | | // strSql.Append("insert into ProductionDetectionImageRecords ("); |
| | | // strSql.Append("ID,ProductionBatchNO,PId,ManualResult,Result,Time,DetectionSource,Detection,DefectNameList,ManualDefectNameList,RawImgPath,DefectImgPath,ImageTime,PreElapsed,DefectElapsed,AfterElapsed,TotalElapsed,PreTreatedFlag,OriginalImgPath,IS_DISABLED,IS_DELETED,CREATE_USER,CREATE_TIME, UPDATE_USER,UPDATE_TIME"); |
| | | // strSql.Append(")values ("); |
| | | // strSql.Append("@ID,@ProductionBatchNO,@PId,@ManualResult,@Result,@Time,@DetectionSource,@Detection,@DefectNameList,@ManualDefectNameList,@RawImgPath,@DefectImgPath,@ImageTime,@PreElapsed,@DefectElapsed,@AfterElapsed,@TotalElapsed,@PreTreatedFlag,@OriginalImgPath,@IS_DISABLED,@IS_DELETED,@CREATE_USER,@CREATE_TIME,@UPDATE_USER,@UPDATE_TIME)"); |
| | | |
| | | // insertRngCmd.CommandText = strSql.ToString(); |
| | | // conn.Open(); |
| | | // var transaction = conn.BeginTransaction(); |
| | | |
| | | // foreach (var record in records) |
| | | // { |
| | | // insertRngCmd.Parameters.AddWithValue("@ID", record.ID); |
| | | // insertRngCmd.Parameters.AddWithValue("@ProductionBatchNO", record.ProductionBatchNO); |
| | | // insertRngCmd.Parameters.AddWithValue("@PId", record.PId); |
| | | // insertRngCmd.Parameters.AddWithValue("@ManualResult", record.ManualResult); |
| | | // insertRngCmd.Parameters.AddWithValue("@Result", record.Result); |
| | | // insertRngCmd.Parameters.AddWithValue("@Time", record.Time); |
| | | // insertRngCmd.Parameters.AddWithValue("@DetectionSource", record.DetectionSource); |
| | | // insertRngCmd.Parameters.AddWithValue("@Detection", record.Detection); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectNameList", record.DefectNameList); |
| | | // insertRngCmd.Parameters.AddWithValue("@ManualDefectNameList", record.ManualDefectNameList); |
| | | // insertRngCmd.Parameters.AddWithValue("@RawImgPath", record.RawImgPath); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectImgPath", record.DefectImgPath); |
| | | // insertRngCmd.Parameters.AddWithValue("@ImageTime", record.ImageTime); |
| | | // insertRngCmd.Parameters.AddWithValue("@PreElapsed", record.PreElapsed); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectElapsed", record.DefectElapsed); |
| | | // insertRngCmd.Parameters.AddWithValue("@AfterElapsed", record.AfterElapsed); |
| | | // insertRngCmd.Parameters.AddWithValue("@TotalElapsed", record.TotalElapsed); |
| | | // insertRngCmd.Parameters.AddWithValue("@PreTreatedFlag", record.PreTreatedFlag); |
| | | // insertRngCmd.Parameters.AddWithValue("@OriginalImgPath", record.OriginalImgPath); |
| | | // insertRngCmd.Parameters.AddWithValue("@IS_DISABLED", record.IS_DISABLED); |
| | | // insertRngCmd.Parameters.AddWithValue("@IS_DELETED", record.IS_DELETED); |
| | | // insertRngCmd.Parameters.AddWithValue("@CREATE_USER", record.CREATE_USER); |
| | | // insertRngCmd.Parameters.AddWithValue("@CREATE_TIME", record.CREATE_TIME); |
| | | // insertRngCmd.Parameters.AddWithValue("@UPDATE_USER", record.UPDATE_USER); |
| | | // insertRngCmd.Parameters.AddWithValue("@UPDATE_TIME", record.UPDATE_TIME); |
| | | // insertRngCmd.ExecuteNonQuery(); |
| | | // } |
| | | // transaction.Commit(); |
| | | // } |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // throw new ProcessException(ex.Message, null); |
| | | // } |
| | | // } |
| | | |
| | | // public bool IsExistId(string id) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // ProductionDetectionImageRecords RR = context.ProductionDetectionImageRecords.FirstOrDefault(u => u.ID == id); |
| | | // return RR != null; |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
New file |
| | |
| | | ////using Bro.Process.Common.Helper; |
| | | //using Bro.Common.Helper; |
| | | //using Bro.Process.Model; |
| | | //using Bro.Process.Model.Model; |
| | | //using System; |
| | | //using System.Collections; |
| | | //using System.Collections.Generic; |
| | | //using System.Configuration; |
| | | //using System.Data; |
| | | //using System.Data.Common; |
| | | //using System.Data.SQLite; |
| | | //using System.Diagnostics; |
| | | //using System.Linq; |
| | | //using System.Text; |
| | | //using System.Threading.Tasks; |
| | | |
| | | //namespace Bro.M071.Process.DBManager |
| | | //{ |
| | | // public class ProductionDetectionRecordsDetailManager : ModelManager<ProductionDetectionRecordsDetail> |
| | | // { |
| | | // DbProviderFactory Dbfactory = SQLiteFactory.Instance; |
| | | // protected override void ActionBeforeNewModel(DBModel context, ProductionDetectionRecordsDetail config) |
| | | // { |
| | | // CheckProductionCodeDuplicate(context, config); |
| | | // } |
| | | |
| | | // protected override void ActionBeforeUpdateModel(DBModel context, ProductionDetectionRecordsDetail config) |
| | | // { |
| | | // CheckProductionCodeDuplicate(context, config); |
| | | // } |
| | | |
| | | // private void CheckProductionCodeDuplicate(DBModel context, ProductionDetectionRecordsDetail config) |
| | | // { |
| | | // //if (context.ProductionDetectionRecordsDetail.Any(u => u.IS_DELETED == 0 |
| | | // // && u.ID != config.ID |
| | | // // && u.PRODUCTION_CODE == config.PRODUCTION_CODE)) |
| | | // { |
| | | // //throw new ProcessException("新增或修改的产品配置信息的产品代码不能重复", null); |
| | | // } |
| | | // } |
| | | |
| | | // public List<ProductionDetectionRecordsDetail> GetProductionDetectionRecordsDetail(string productionBatchNO, string pid) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // var list = context.ProductionDetectionRecordsDetail.Where(u => u.IS_DELETED == 0 && u.OfflineDetectionId == null); |
| | | |
| | | // if (!string.IsNullOrWhiteSpace(productionBatchNO)) |
| | | // { |
| | | // list = list.Where(u => u.ProductionBatchNO.Contains(productionBatchNO)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(pid)) |
| | | // { |
| | | // list = list.Where(u => u.PId.Contains(pid)); |
| | | // } |
| | | |
| | | // var resultList = list.ToList(); |
| | | // return resultList; |
| | | // } |
| | | // } |
| | | |
| | | // public List<ProductionDetectionRecordsDetail> GetProductionDetectionRecordsDetailPagedList(ProductionDetectionRecordsDetailRequest request) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // var list = context.ProductionDetectionRecordsDetail.Where(u => u.IS_DELETED == 0); |
| | | |
| | | // if (!string.IsNullOrWhiteSpace(request.ProductionBatchNO)) |
| | | // { |
| | | // list = list.Where(u => u.ProductionBatchNO.Contains(request.ProductionBatchNO)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.PId)) |
| | | // { |
| | | // list = list.Where(u => u.PId.Contains(request.PId)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.Detection)) |
| | | // { |
| | | // list = list.Where(u => u.Detection.Contains(request.Detection)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.DefectName)) |
| | | // { |
| | | // list = list.Where(u => u.DefectName.Contains(request.DefectName)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.Result)) |
| | | // { |
| | | // list = list.Where(u => u.Result == request.Result); |
| | | // } |
| | | // if (request.StartTime != null) |
| | | // { |
| | | // list = list.Where(u => u.Time >= request.StartTime); |
| | | // } |
| | | // if (request.EndTime != null) |
| | | // { |
| | | // list = list.Where(u => u.Time <= request.EndTime); |
| | | // } |
| | | // var pageList = list.OrderBy(u => u.Time).ToPagedList(request); |
| | | // request.TotalNum = list.Count(); |
| | | // return pageList; |
| | | // } |
| | | // } |
| | | |
| | | // public ProductionDetectionRecordsDetail GetConfigByProductionCode(string productionCode) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // //ProductionDetectionRecordsDetail RR= context.ProductionDetectionRecordsDetail.FirstOrDefault(u => u.IS_DELETED == 0 && u.PRODUCTION_CODE == productionCode); |
| | | // //return RR; |
| | | // return new ProductionDetectionRecordsDetail(); |
| | | // } |
| | | // } |
| | | // public void ADOBatchAdd(List<ProductionDetectionRecordsDetail> records) |
| | | // { |
| | | // Hashtable SQLStringList = new Hashtable(); |
| | | // try |
| | | // { |
| | | // var idList = records.Select(u => u.ID).ToList(); |
| | | // var disIdList = idList.Distinct().ToList(); |
| | | // if (idList.Count != disIdList.Count)//有重复id |
| | | // { |
| | | // throw new ProcessException("异常:有重复id:" + idList.ToString(), null); |
| | | // } |
| | | // foreach (var record in records) |
| | | // { |
| | | // if (IsExistId(record.ID)) |
| | | // { |
| | | // throw new ProcessException("异常:有重复id:" + record.ID, null); |
| | | // } |
| | | // StringBuilder strSql = new StringBuilder(); |
| | | // strSql.Append("insert into ProductionDetectionRecordsDetail ("); |
| | | // strSql.Append("ID,ProductionBatchNO,PId,Result,Time,Detection,DefectName,Probability,Uncertainty,DefectX,DefectY,DefectWidth,DefectHeight, RawImgPath,DefectImgPath,ImageTime,PreElapsed,DefectElapsed,AfterElapsed,TotalElapsed,PreTreatedFlag,DetectionType, SpecStandard, SpecActualValue,IS_DISABLED,IS_DELETED,CREATE_USER,CREATE_TIME, UPDATE_USER,UPDATE_TIME"); |
| | | // strSql.Append(")values ("); |
| | | // strSql.Append("@ID,@ProductionBatchNO,@PId,@Result,@Time,@Detection,@DefectName,@Probability,@Uncertainty,@DefectX,@DefectY,@DefectWidth,@DefectHeight,@RawImgPath,@DefectImgPath,@ImageTime,@PreElapsed,@DefectElapsed,@AfterElapsed,@TotalElapsed,@PreTreatedFlag,@DetectionType,@SpecStandard,@SpecActualValue,@IS_DISABLED,@IS_DELETED,@CREATE_USER,@CREATE_TIME,@UPDATE_USER,@UPDATE_TIME)"); |
| | | // List<SQLiteParameter> parameters = new List<SQLiteParameter>(); |
| | | // parameters.Add(new SQLiteParameter("@ID", record.ID)); |
| | | // parameters.Add(new SQLiteParameter("@ProductionBatchNO", record.ProductionBatchNO)); |
| | | // parameters.Add(new SQLiteParameter("@PId", record.PId)); |
| | | // parameters.Add(new SQLiteParameter("@Result", record.Result)); |
| | | // parameters.Add(new SQLiteParameter("@Time", record.Time)); |
| | | // parameters.Add(new SQLiteParameter("@Detection", record.Detection)); |
| | | // parameters.Add(new SQLiteParameter("@DefectName", record.DefectName)); |
| | | // parameters.Add(new SQLiteParameter("@Probability", record.Probability)); |
| | | // parameters.Add(new SQLiteParameter("@Uncertainty", record.Uncertainty)); |
| | | // parameters.Add(new SQLiteParameter("@DefectX", record.DefectX)); |
| | | // parameters.Add(new SQLiteParameter("@DefectY", record.DefectY)); |
| | | // parameters.Add(new SQLiteParameter("@DefectWidth", record.DefectWidth)); |
| | | // parameters.Add(new SQLiteParameter("@DefectHeight", record.DefectHeight)); |
| | | // parameters.Add(new SQLiteParameter("@RawImgPath", record.RawImgPath)); |
| | | // parameters.Add(new SQLiteParameter("@DefectImgPath", record.DefectImgPath)); |
| | | // parameters.Add(new SQLiteParameter("@ImageTime", record.ImageTime)); |
| | | // parameters.Add(new SQLiteParameter("@PreElapsed", record.PreElapsed)); |
| | | // parameters.Add(new SQLiteParameter("@DefectElapsed", record.DefectElapsed)); |
| | | // parameters.Add(new SQLiteParameter("@AfterElapsed", record.AfterElapsed)); |
| | | // parameters.Add(new SQLiteParameter("@TotalElapsed", record.TotalElapsed)); |
| | | // parameters.Add(new SQLiteParameter("@PreTreatedFlag", record.PreTreatedFlag)); |
| | | // parameters.Add(new SQLiteParameter("@DetectionType", record.DetectionType)); |
| | | // parameters.Add(new SQLiteParameter("@SpecStandard", record.SpecStandard)); |
| | | // parameters.Add(new SQLiteParameter("@SpecActualValue", record.SpecActualValue)); |
| | | // parameters.Add(new SQLiteParameter("@IS_DISABLED", record.IS_DISABLED)); |
| | | // parameters.Add(new SQLiteParameter("@IS_DELETED", record.IS_DELETED)); |
| | | // parameters.Add(new SQLiteParameter("@CREATE_USER", record.CREATE_USER)); |
| | | // parameters.Add(new SQLiteParameter("@CREATE_TIME", record.CREATE_TIME)); |
| | | // parameters.Add(new SQLiteParameter("@UPDATE_USER", record.UPDATE_USER)); |
| | | // parameters.Add(new SQLiteParameter("@UPDATE_TIME", record.UPDATE_TIME)); |
| | | |
| | | // SQLStringList.Add(strSql, parameters.ToArray()); |
| | | // } |
| | | // SQLiteHelper.ExecuteSqlTran(SQLStringList); //使用数据库事务 |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // throw new ProcessException(SQLStringList.ToString() + ex.Message, null); |
| | | // } |
| | | // } |
| | | |
| | | // public void InserPatch(List<ProductionDetectionRecordsDetail> records) |
| | | // { |
| | | // try |
| | | // { |
| | | // using (SQLiteConnection conn = new SQLiteConnection(ConnectionString)) |
| | | // { |
| | | // using (SQLiteCommand insertRngCmd = (SQLiteCommand)conn.CreateCommand()) |
| | | // { |
| | | // StringBuilder strSql = new StringBuilder(); |
| | | // strSql.Append("insert into ProductionDetectionRecordsDetail ("); |
| | | // strSql.Append("ID,ProductionBatchNO,PId,Result,Time,DetectionSource,Detection,DefectName,Probability,Uncertainty,DefectX,DefectY,DefectWidth,DefectHeight, RawImgPath,DefectImgPath,ImageTime,PreElapsed,DefectElapsed,AfterElapsed,TotalElapsed,PreTreatedFlag,DetectionType, SpecStandard, SpecActualValue,IS_DISABLED,IS_DELETED,CREATE_USER,CREATE_TIME, UPDATE_USER,UPDATE_TIME,ImageRecordId"); |
| | | // strSql.Append(")values ("); |
| | | // strSql.Append("@ID,@ProductionBatchNO,@PId,@Result,@Time,@DetectionSource,@Detection,@DefectName,@Probability,@Uncertainty,@DefectX,@DefectY,@DefectWidth,@DefectHeight,@RawImgPath,@DefectImgPath,@ImageTime,@PreElapsed,@DefectElapsed,@AfterElapsed,@TotalElapsed,@PreTreatedFlag,@DetectionType,@SpecStandard,@SpecActualValue,@IS_DISABLED,@IS_DELETED,@CREATE_USER,@CREATE_TIME,@UPDATE_USER,@UPDATE_TIME,@ImageRecordId)"); |
| | | |
| | | // insertRngCmd.CommandText = strSql.ToString(); |
| | | // conn.Open(); |
| | | // var transaction = conn.BeginTransaction(); |
| | | |
| | | // foreach (var record in records) |
| | | // { |
| | | // insertRngCmd.Parameters.AddWithValue("@ID", record.ID); |
| | | // insertRngCmd.Parameters.AddWithValue("@ProductionBatchNO", record.ProductionBatchNO); |
| | | // insertRngCmd.Parameters.AddWithValue("@PId", record.PId); |
| | | // insertRngCmd.Parameters.AddWithValue("@Result", record.Result); |
| | | // insertRngCmd.Parameters.AddWithValue("@Time", record.Time); |
| | | // insertRngCmd.Parameters.AddWithValue("@DetectionSource", record.DetectionSource); |
| | | // insertRngCmd.Parameters.AddWithValue("@Detection", record.Detection); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectName", record.DefectName); |
| | | // insertRngCmd.Parameters.AddWithValue("@Probability", record.Probability); |
| | | // insertRngCmd.Parameters.AddWithValue("@Uncertainty", record.Uncertainty); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectX", record.DefectX); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectY", record.DefectY); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectWidth", record.DefectWidth); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectHeight", record.DefectHeight); |
| | | // insertRngCmd.Parameters.AddWithValue("@RawImgPath", record.RawImgPath); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectImgPath", record.DefectImgPath); |
| | | // insertRngCmd.Parameters.AddWithValue("@ImageTime", record.ImageTime); |
| | | // insertRngCmd.Parameters.AddWithValue("@PreElapsed", record.PreElapsed); |
| | | // insertRngCmd.Parameters.AddWithValue("@DefectElapsed", record.DefectElapsed); |
| | | // insertRngCmd.Parameters.AddWithValue("@AfterElapsed", record.AfterElapsed); |
| | | // insertRngCmd.Parameters.AddWithValue("@TotalElapsed", record.TotalElapsed); |
| | | // insertRngCmd.Parameters.AddWithValue("@PreTreatedFlag", record.PreTreatedFlag); |
| | | // insertRngCmd.Parameters.AddWithValue("@DetectionType", record.DetectionType); |
| | | // insertRngCmd.Parameters.AddWithValue("@SpecStandard", record.SpecStandard); |
| | | // insertRngCmd.Parameters.AddWithValue("@SpecActualValue", record.SpecActualValue); |
| | | // insertRngCmd.Parameters.AddWithValue("@IS_DISABLED", record.IS_DISABLED); |
| | | // insertRngCmd.Parameters.AddWithValue("@IS_DELETED", record.IS_DELETED); |
| | | // insertRngCmd.Parameters.AddWithValue("@CREATE_USER", record.CREATE_USER); |
| | | // insertRngCmd.Parameters.AddWithValue("@CREATE_TIME", record.CREATE_TIME); |
| | | // insertRngCmd.Parameters.AddWithValue("@UPDATE_USER", record.UPDATE_USER); |
| | | // insertRngCmd.Parameters.AddWithValue("@UPDATE_TIME", record.UPDATE_TIME); |
| | | // insertRngCmd.Parameters.AddWithValue("@ImageRecordId", record.ImageRecordId); |
| | | // insertRngCmd.ExecuteNonQuery(); |
| | | // } |
| | | // transaction.Commit(); |
| | | // } |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // throw new ProcessException(ex.Message, null); |
| | | // } |
| | | // } |
| | | |
| | | // public bool IsExistId(string id) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // ProductionDetectionRecordsDetail RR = context.ProductionDetectionRecordsDetail.FirstOrDefault(u => u.ID == id); |
| | | // return RR != null; |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
New file |
| | |
| | | ////using Bro.Process.Common.Helper; |
| | | //using Bro.Common.Helper; |
| | | //using Bro.Process.Model; |
| | | //using Bro.Process.Model.Model; |
| | | //using System; |
| | | //using System.Collections; |
| | | //using System.Collections.Generic; |
| | | //using System.Data.Common; |
| | | //using System.Data.SQLite; |
| | | //using System.Diagnostics; |
| | | //using System.Linq; |
| | | //using System.Text; |
| | | //using System.Threading.Tasks; |
| | | |
| | | //namespace Bro.M071.Process.DBManager |
| | | //{ |
| | | // public class ProductionDetectionRecordsManager : ModelManager<ProductionDetectionRecords> |
| | | // { |
| | | // DbProviderFactory Dbfactory = SQLiteFactory.Instance; |
| | | // protected override void ActionBeforeNewModel(DBModel context, ProductionDetectionRecords config) |
| | | // { |
| | | // CheckProductionCodeDuplicate(context, config); |
| | | // } |
| | | |
| | | // protected override void ActionBeforeUpdateModel(DBModel context, ProductionDetectionRecords config) |
| | | // { |
| | | // CheckProductionCodeDuplicate(context, config); |
| | | // } |
| | | |
| | | // private void CheckProductionCodeDuplicate(DBModel context, ProductionDetectionRecords config) |
| | | // { |
| | | // //if (context.ProductionDetectionRecords.Any(u => u.IS_DELETED == 0 |
| | | // // && u.ID != config.ID |
| | | // // && u.PRODUCTION_CODE == config.PRODUCTION_CODE)) |
| | | // { |
| | | // //throw new ProcessException("新增或修改的产品配置信息的产品代码不能重复", null); |
| | | // } |
| | | // } |
| | | |
| | | // //public void ADOBatchAdd(List<ProductionDetectionRecords> records) |
| | | // //{ |
| | | // // Hashtable SQLStringList = new Hashtable(); |
| | | // // try |
| | | // // { |
| | | // // var idList = records.Select(u => u.ID).ToList(); |
| | | // // var disIdList = idList.Distinct().ToList(); |
| | | // // if (idList.Count != disIdList.Count)//有重复id |
| | | // // { |
| | | // // throw new ProcessException("异常:有重复id:" + idList.ToString(), null); |
| | | // // } |
| | | // // foreach (var record in records) |
| | | // // { |
| | | // // if (IsExistId(record.ID)) |
| | | // // { |
| | | // // throw new ProcessException("异常:有重复id:" + record.ID, null); |
| | | // // } |
| | | // // StringBuilder strSql = new StringBuilder(); |
| | | // // strSql.Append("insert into ProductionDetectionRecords ("); |
| | | // // strSql.Append(@"ID, |
| | | // // ProductionBatchNO, |
| | | // // PId, |
| | | // // Time, |
| | | // // Result, |
| | | // // DetectionTimes, |
| | | // // DetectionDetail, |
| | | // // X, |
| | | // // Y, |
| | | // // UploadTime, |
| | | // // DequeueTime, |
| | | // // UploadResult, |
| | | // // TBDList, |
| | | // // InsideDiameter, |
| | | // // OutsideDiameter, |
| | | // // Thickness, |
| | | // // IS_DISABLED, |
| | | // // IS_DELETED, |
| | | // // CREATE_USER, |
| | | // // CREATE_TIME, |
| | | // // UPDATE_USER, |
| | | // // UPDATE_TIME"); |
| | | // // strSql.Append(")values ("); |
| | | // // strSql.Append(@"@ID, |
| | | // // @ProductionBatchNO, |
| | | // // @PId, |
| | | // // @Time, |
| | | // // @Result, |
| | | // // @DetectionTimes, |
| | | // // @DetectionDetail, |
| | | // // @X, |
| | | // // @Y, |
| | | // // @UploadTime, |
| | | // // @DequeueTime, |
| | | // // @UploadResult, |
| | | // // @TBDList, |
| | | // // @InsideDiameter, |
| | | // // @OutsideDiameter, |
| | | // // @Thickness, |
| | | // // @IS_DISABLED, |
| | | // // @IS_DELETED, |
| | | // // @CREATE_USER, |
| | | // // @CREATE_TIME, |
| | | // // @UPDATE_USER, |
| | | // // @UPDATE_TIME)"); |
| | | // // List<SQLiteParameter> parameters = new List<SQLiteParameter>(); |
| | | |
| | | // // parameters.Add(new SQLiteParameter("@ID", record.ID)); |
| | | // // parameters.Add(new SQLiteParameter("@ProductionBatchNO", record.ProductionBatchNO)); |
| | | // // parameters.Add(new SQLiteParameter("@PId", record.PId)); |
| | | // // parameters.Add(new SQLiteParameter("@Time", record.Time)); |
| | | // // parameters.Add(new SQLiteParameter("@Result", record.Result)); |
| | | // // parameters.Add(new SQLiteParameter("@DetectionTimes", record.DetectionTimes)); |
| | | // // parameters.Add(new SQLiteParameter("@DetectionDetail", record.DetectionDetail)); |
| | | // // parameters.Add(new SQLiteParameter("@X", record.X)); |
| | | // // parameters.Add(new SQLiteParameter("@Y", record.Y)); |
| | | // // parameters.Add(new SQLiteParameter("@UploadTime", record.UploadTime)); |
| | | // // parameters.Add(new SQLiteParameter("@DequeueTime", record.DequeueTime)); |
| | | // // parameters.Add(new SQLiteParameter("@UploadResult", record.UploadResult)); |
| | | // // parameters.Add(new SQLiteParameter("@TBDList", record.TBDList)); |
| | | // // parameters.Add(new SQLiteParameter("@InsideDiameter", record.InsideDiameter)); |
| | | // // parameters.Add(new SQLiteParameter("@OutsideDiameter", record.OutsideDiameter)); |
| | | // // parameters.Add(new SQLiteParameter("@Thickness", record.Thickness)); |
| | | // // parameters.Add(new SQLiteParameter("@IS_DISABLED", record.IS_DISABLED)); |
| | | // // parameters.Add(new SQLiteParameter("@IS_DELETED", record.IS_DELETED)); |
| | | // // parameters.Add(new SQLiteParameter("@CREATE_USER", record.CREATE_USER)); |
| | | // // parameters.Add(new SQLiteParameter("@CREATE_TIME", record.CREATE_TIME)); |
| | | // // parameters.Add(new SQLiteParameter("@UPDATE_USER", record.UPDATE_USER)); |
| | | // // parameters.Add(new SQLiteParameter("@UPDATE_TIME", record.UPDATE_TIME)); |
| | | |
| | | // // SQLStringList.Add(strSql, parameters.ToArray()); |
| | | // // } |
| | | // // SQLiteHelper.ExecuteSqlTran(SQLStringList); //使用数据库事务 |
| | | |
| | | // // } |
| | | // // catch (Exception ex) |
| | | // // { |
| | | // // throw new ProcessException(SQLStringList.ToString() + ex.Message, null); |
| | | // // } |
| | | // //} |
| | | |
| | | // public void InserPatch(List<ProductionDetectionRecords> records) |
| | | // { |
| | | // try |
| | | // { |
| | | // using (SQLiteConnection conn = new SQLiteConnection(ConnectionString)) |
| | | // { |
| | | // using (SQLiteCommand insertRngCmd = (SQLiteCommand)conn.CreateCommand()) |
| | | // { |
| | | // StringBuilder strSql = new StringBuilder(); |
| | | // strSql.Append("insert into ProductionDetectionRecords ("); |
| | | // strSql.Append(@"ID, |
| | | // OperationRecordsId, |
| | | // ProductionBatchNO, |
| | | // PId, |
| | | // Time, |
| | | // Source, |
| | | // Result, |
| | | // DetectionTimes, |
| | | // DetectionDetail, |
| | | // X, |
| | | // Y, |
| | | // UploadTime, |
| | | // DequeueTime, |
| | | // UploadResult, |
| | | // TBDList, |
| | | // InsideDiameter, |
| | | // OutsideDiameter, |
| | | // Thickness, |
| | | // IS_DISABLED, |
| | | // IS_DELETED, |
| | | // CREATE_USER, |
| | | // CREATE_TIME, |
| | | // UPDATE_USER, |
| | | // UPDATE_TIME"); |
| | | // strSql.Append(")values ("); |
| | | // strSql.Append(@"@ID, |
| | | // @OperationRecordsId, |
| | | // @ProductionBatchNO, |
| | | // @PId, |
| | | // @Time, |
| | | // @Source, |
| | | // @Result, |
| | | // @DetectionTimes, |
| | | // @DetectionDetail, |
| | | // @X, |
| | | // @Y, |
| | | // @UploadTime, |
| | | // @DequeueTime, |
| | | // @UploadResult, |
| | | // @TBDList, |
| | | // @InsideDiameter, |
| | | // @OutsideDiameter, |
| | | // @Thickness, |
| | | // @IS_DISABLED, |
| | | // @IS_DELETED, |
| | | // @CREATE_USER, |
| | | // @CREATE_TIME, |
| | | // @UPDATE_USER, |
| | | // @UPDATE_TIME)"); |
| | | |
| | | // insertRngCmd.CommandText = strSql.ToString(); |
| | | // conn.Open(); |
| | | // var transaction = conn.BeginTransaction(); |
| | | |
| | | // foreach (var record in records) |
| | | // { |
| | | // insertRngCmd.Parameters.AddWithValue("@ID", record.ID); |
| | | // insertRngCmd.Parameters.AddWithValue("@OperationRecordsId", record.OperationRecordsId); |
| | | // insertRngCmd.Parameters.AddWithValue("@ProductionBatchNO", record.ProductionBatchNO); |
| | | // insertRngCmd.Parameters.AddWithValue("@PId", record.PId); |
| | | // insertRngCmd.Parameters.AddWithValue("@Time", record.Time); |
| | | // insertRngCmd.Parameters.AddWithValue("@Source", record.Source); |
| | | // insertRngCmd.Parameters.AddWithValue("@Result", record.Result); |
| | | // insertRngCmd.Parameters.AddWithValue("@DetectionTimes", record.DetectionTimes); |
| | | // insertRngCmd.Parameters.AddWithValue("@DetectionDetail", record.DetectionDetail); |
| | | // insertRngCmd.Parameters.AddWithValue("@X", record.X); |
| | | // insertRngCmd.Parameters.AddWithValue("@Y", record.Y); |
| | | // insertRngCmd.Parameters.AddWithValue("@UploadTime", record.UploadTime); |
| | | // insertRngCmd.Parameters.AddWithValue("@DequeueTime", record.DequeueTime); |
| | | // insertRngCmd.Parameters.AddWithValue("@UploadResult", record.UploadResult); |
| | | // insertRngCmd.Parameters.AddWithValue("@TBDList", record.TBDList); |
| | | // insertRngCmd.Parameters.AddWithValue("@InsideDiameter", record.InsideDiameter); |
| | | // insertRngCmd.Parameters.AddWithValue("@OutsideDiameter", record.OutsideDiameter); |
| | | // insertRngCmd.Parameters.AddWithValue("@Thickness", record.Thickness); |
| | | // insertRngCmd.Parameters.AddWithValue("@IS_DISABLED", record.IS_DISABLED); |
| | | // insertRngCmd.Parameters.AddWithValue("@IS_DELETED", record.IS_DELETED); |
| | | // insertRngCmd.Parameters.AddWithValue("@CREATE_USER", record.CREATE_USER); |
| | | // insertRngCmd.Parameters.AddWithValue("@CREATE_TIME", record.CREATE_TIME); |
| | | // insertRngCmd.Parameters.AddWithValue("@UPDATE_USER", record.UPDATE_USER); |
| | | // insertRngCmd.Parameters.AddWithValue("@UPDATE_TIME", record.UPDATE_TIME); |
| | | // insertRngCmd.ExecuteNonQuery(); |
| | | // } |
| | | // transaction.Commit(); |
| | | // } |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // throw new ProcessException(ex.Message, null); |
| | | // } |
| | | // } |
| | | |
| | | // public List<ProductionDetectionRecords> GetProductionDetectionRecordsList(ProductionDetectionRecordsRequest request) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // var list = context.ProductionDetectionRecords.Where(u => u.IS_DELETED == 0); |
| | | |
| | | // if (!string.IsNullOrWhiteSpace(request.ProductionBatchNO)) |
| | | // { |
| | | // list = list.Where(u => u.ProductionBatchNO.Contains(request.ProductionBatchNO)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.PId)) |
| | | // { |
| | | // list = list.Where(u => u.PId.Contains(request.PId)); |
| | | // } |
| | | // if (!string.IsNullOrWhiteSpace(request.Result)) |
| | | // { |
| | | // list = list.Where(u => u.Result == request.Result); |
| | | // } |
| | | // if (request.StartTime != null) |
| | | // { |
| | | // list = list.Where(u => u.Time >= request.StartTime); |
| | | // } |
| | | // if (request.EndTime != null) |
| | | // { |
| | | // list = list.Where(u => u.Time <= request.EndTime); |
| | | // } |
| | | // var pageList = list.OrderBy(u => u.Time).ToPagedList(request); |
| | | // request.TotalNum = list.Count(); |
| | | // return pageList; |
| | | // } |
| | | // } |
| | | |
| | | // public ProductionDetectionRecords GetConfigByProductionCode(string productionCode) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // //ProductionDetectionRecords RR= context.ProductionDetectionRecords.FirstOrDefault(u => u.IS_DELETED == 0 && u.PRODUCTION_CODE == productionCode); |
| | | // //return RR; |
| | | // return new ProductionDetectionRecords(); |
| | | // } |
| | | // } |
| | | // public bool IsExistId(string id) |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // ProductionDetectionRecords RR = context.ProductionDetectionRecords.FirstOrDefault(u => u.ID == id); |
| | | // return RR != null; |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | |
| | | // //public class ProductionManagerkey : ModelManager<PRODUCTION_SECRETKEY> |
| | | // //{ |
| | | // // public PRODUCTION_SECRETKEY GetConfig() |
| | | // // { |
| | | // // using (DBModel context = new DBModel()) |
| | | // // { |
| | | // // //return context.PRODUCTION_SECRETKEY.FirstOrDefault(u => u.RUNDAYNUMMAX > 0); |
| | | // // return new PRODUCTION_SECRETKEY(); |
| | | // // } |
| | | // // } |
| | | // //} |
| | | //} |
New file |
| | |
| | | using System.Reflection; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Runtime.InteropServices; |
| | | |
| | | // 有关程序集的一般信息由以下 |
| | | // 控制。更改这些特性值可修改 |
| | | // 与程序集关联的信息。 |
| | | [assembly: AssemblyTitle("Bro.Process.DBManager")] |
| | | [assembly: AssemblyDescription("")] |
| | | [assembly: AssemblyConfiguration("")] |
| | | [assembly: AssemblyCompany("")] |
| | | [assembly: AssemblyProduct("Bro.Process.DBManager")] |
| | | [assembly: AssemblyCopyright("Copyright © 2018")] |
| | | [assembly: AssemblyTrademark("")] |
| | | [assembly: AssemblyCulture("")] |
| | | |
| | | // 将 ComVisible 设置为 false 会使此程序集中的类型 |
| | | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 |
| | | //请将此类型的 ComVisible 特性设置为 true。 |
| | | [assembly: ComVisible(false)] |
| | | |
| | | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID |
| | | [assembly: Guid("230b0fff-f6af-45fe-aaf7-b4b66250dd58")] |
| | | |
| | | // 程序集的版本信息由下列四个值组成: |
| | | // |
| | | // 主版本 |
| | | // 次版本 |
| | | // 生成号 |
| | | // 修订号 |
| | | // |
| | | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 |
| | | //通过使用 "*",如下所示: |
| | | // [assembly: AssemblyVersion("1.0.*")] |
| | | [assembly: AssemblyVersion("1.0.0.0")] |
| | | [assembly: AssemblyFileVersion("1.0.0.0")] |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <packages> |
| | | <package id="EntityFramework" version="6.4.0" targetFramework="net452" /> |
| | | <package id="SQLite.CodeFirst" version="1.5.3.29" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.Core" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.EF6" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.EF6.Migrations" version="1.0.106" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.Linq" version="1.0.112.0" targetFramework="net452" /> |
| | | </packages> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <configuration> |
| | | <configSections> |
| | | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
| | | <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
| | | </configSections> |
| | | <entityFramework> |
| | | <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> |
| | | <providers> |
| | | <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> |
| | | <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> |
| | | <!--<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />--> |
| | | </providers> |
| | | </entityFramework> |
| | | <connectionStrings> |
| | | <!--<add name="DBSet" connectionString="data source=(LocalDb)\MSSQLLocalDB;initial catalog=Bro.Process.Model.Model;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />--> |
| | | <!--<add name="DBModel" connectionString="data source=(LocalDb)\MSSQLLocalDB;initial catalog=Bro.Process.Model.DBModel;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />--> |
| | | <add name="DBModel" connectionString="data source=D:\PROJECTS\M071\DataBase\M071.db;BinaryGUID=False" providerName="System.Data.SQLite" /> |
| | | </connectionStrings> |
| | | <system.data> |
| | | <DbProviderFactories> |
| | | <remove invariant="System.Data.SQLite.EF6" /> |
| | | <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" /> |
| | | <remove invariant="System.Data.SQLite" /> |
| | | <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> |
| | | </DbProviderFactories> |
| | | </system.data> |
| | | <runtime> |
| | | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
| | | <dependentAssembly> |
| | | <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" /> |
| | | <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" /> |
| | | </dependentAssembly> |
| | | <dependentAssembly> |
| | | <assemblyIdentity name="System.Data.SQLite.EF6" publicKeyToken="db937bc2d44ff139" culture="neutral" /> |
| | | <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" /> |
| | | </dependentAssembly> |
| | | </assemblyBinding> |
| | | </runtime> |
| | | <startup> |
| | | <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> |
| | | </startup> |
| | | </configuration> |
New file |
| | |
| | | //using System; |
| | | //using System.Collections.Generic; |
| | | //using System.ComponentModel; |
| | | //using System.ComponentModel.DataAnnotations; |
| | | //using System.Linq; |
| | | //using System.Reflection; |
| | | //using System.Text; |
| | | //using System.Threading.Tasks; |
| | | |
| | | //namespace Bro.M071.Process.Model |
| | | //{ |
| | | // public class BaseModel |
| | | // { |
| | | // /// <summary> |
| | | // /// 编号,唯一值,使用GUID |
| | | // /// </summary> |
| | | // [Key] |
| | | // [Required(ErrorMessage = "编号不可为空!")] |
| | | // [StringLength(50)] |
| | | // public string ID { get; set; } = Guid.NewGuid().ToString().ToUpper(); |
| | | |
| | | // /// <summary> |
| | | // /// 禁用状态 0 未禁用 1 已禁用 |
| | | // /// </summary> |
| | | // [Required] |
| | | // public int IS_DISABLED { get; set; } = 0; |
| | | |
| | | // /// <summary> |
| | | // /// 删除状态 0 未删除 1 已删除 |
| | | // /// </summary> |
| | | // [Required] |
| | | // public int IS_DELETED { get; set; } = 0; |
| | | |
| | | // /// <summary> |
| | | // /// 创建人信息 |
| | | // /// </summary> |
| | | // //[Required] |
| | | // [StringLength(50)] |
| | | // public string CREATE_USER { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 创建时间 |
| | | // /// </summary> |
| | | // //[Required] |
| | | // public DateTime? CREATE_TIME { get; set; } = DateTime.Now; |
| | | |
| | | // /// <summary> |
| | | // /// 更新人信息 |
| | | // /// </summary> |
| | | // [StringLength(50)] |
| | | // public string UPDATE_USER { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 更新时间 |
| | | // /// </summary> |
| | | // public DateTime? UPDATE_TIME { get; set; } |
| | | // } |
| | | |
| | | // public static class BaseModelHelper |
| | | // { |
| | | // public static void SetNew<T>(this T t, string userId) where T : BaseModel |
| | | // { |
| | | // //t.ID = Guid.NewGuid().ToString().ToUpper(); |
| | | // t.CREATE_USER = userId; |
| | | // t.CREATE_TIME = DateTime.Now; |
| | | // } |
| | | |
| | | // public static void SetUpdate<T>(this T t, string userId) where T : BaseModel |
| | | // { |
| | | // t.UPDATE_USER = userId; |
| | | // t.UPDATE_TIME = DateTime.Now; |
| | | // } |
| | | |
| | | // static List<string> NoTransferProps = new List<string>() { "ID", "CREATE_USER", "CREATE_TIME", "UPDATE_USER", "UPDATE_TIME", "IS_DELETED" }; |
| | | // public static void DataTransfer<T>(this T destT, T sourceT) where T : BaseModel |
| | | // { |
| | | // destT.DataFrom(sourceT, NoTransferProps); |
| | | // } |
| | | |
| | | // public static void DataFrom<T1, T2>(this T1 destT, T2 sourceT, List<string> exceptionProps = null) where T1 : class where T2 : class |
| | | // { |
| | | // PropertyInfo[] propDest = destT.GetType().GetProperties().Where(p => !(p.GetMethod.IsVirtual && !p.GetMethod.IsFinal)).ToArray(); |
| | | // PropertyInfo[] propSource = sourceT.GetType().GetProperties(); |
| | | |
| | | // Array.ForEach(propDest, prop => |
| | | // { |
| | | // if (exceptionProps == null || !exceptionProps.Contains(prop.Name)) |
| | | // { |
| | | // if (prop.CanWrite) |
| | | // { |
| | | // PropertyInfo propS = propSource.FirstOrDefault(p => p.Name == prop.Name); |
| | | // if (propS != null && propS.CanRead) |
| | | // { |
| | | // prop.SetValue(destT, propS.GetValue(sourceT)); |
| | | // } |
| | | // } |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | // public static List<T> ToPagedList<T>(this IQueryable<T> orderQuery, BaseRequest request) where T : class |
| | | // { |
| | | // return orderQuery.Skip((request.PageNum - 1) * request.PageSize).Take(request.PageSize).ToList(); |
| | | // } |
| | | // } |
| | | |
| | | // public class BaseRequest : INotifyPropertyChanged |
| | | // { |
| | | |
| | | // private int pageNum = 1; |
| | | // /// <summary> |
| | | // /// 查询结果页数 |
| | | // /// </summary> |
| | | // public int PageNum |
| | | // { |
| | | // get => pageNum; |
| | | // set |
| | | // { |
| | | // if (pageNum != value) |
| | | // { |
| | | // pageNum = value; |
| | | // PropertyChanged?.BeginInvoke(this, new PropertyChangedEventArgs("PageNum"), null, null); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // private int pageSize = 100; |
| | | // /// <summary> |
| | | // /// 每页的查询结果条数 |
| | | // /// </summary> |
| | | // public int PageSize |
| | | // { |
| | | // get => pageSize; |
| | | // set |
| | | // { |
| | | // if (pageSize != value) |
| | | // { |
| | | // pageSize = value; |
| | | // PropertyChanged?.BeginInvoke(this, new PropertyChangedEventArgs("PageSize"), null, null); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // /// <summary> |
| | | // /// 查询起始时间 |
| | | // /// </summary> |
| | | // public DateTime? StartTime { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 查询结束时间 |
| | | // /// </summary> |
| | | // public DateTime? EndTime { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 启用状态过滤器 1:仅未启用 0:仅启用 -1:全部 |
| | | // /// </summary> |
| | | // public int DisableFilter { get; set; } = 0; |
| | | |
| | | // /// <summary> |
| | | // /// 查询字符串 |
| | | // /// </summary> |
| | | // public string SearchTxt { get; set; } |
| | | |
| | | // private int totalNum = 0; |
| | | // /// <summary> |
| | | // /// 数据总数 |
| | | // /// </summary> |
| | | // public int TotalNum |
| | | // { |
| | | // get => totalNum; |
| | | // set |
| | | // { |
| | | // if (totalNum != value) |
| | | // { |
| | | // totalNum = value; |
| | | // PropertyChanged?.BeginInvoke(this, new PropertyChangedEventArgs("TotalNum"), null, null); |
| | | // } |
| | | // TotalPage = (int)Math.Ceiling((double)TotalNum / PageSize); |
| | | // } |
| | | // } |
| | | |
| | | // private int totalPage = 0; |
| | | // /// <summary> |
| | | // /// 总页数 |
| | | // /// </summary> |
| | | // public int TotalPage |
| | | // { |
| | | // get => totalPage; |
| | | // set |
| | | // { |
| | | // if (totalPage != value) |
| | | // { |
| | | // totalPage = value; |
| | | // PropertyChanged?.BeginInvoke(this, new PropertyChangedEventArgs("TotalPage"), null, null); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // public event PropertyChangedEventHandler PropertyChanged; |
| | | // } |
| | | //} |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <Import Project="..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props" Condition="Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" /> |
| | | <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>{AD645C48-5811-4B1E-B81F-D35D5E6B577F}</ProjectGuid> |
| | | <OutputType>Library</OutputType> |
| | | <AppDesignerFolder>Properties</AppDesignerFolder> |
| | | <RootNamespace>Bro.Process.Model</RootNamespace> |
| | | <AssemblyName>Bro.Process.Model</AssemblyName> |
| | | <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
| | | <FileAlignment>512</FileAlignment> |
| | | <NuGetPackageImportStamp> |
| | | </NuGetPackageImportStamp> |
| | | <TargetFrameworkProfile /> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
| | | <DebugSymbols>true</DebugSymbols> |
| | | <DebugType>full</DebugType> |
| | | <Optimize>false</Optimize> |
| | | <OutputPath>..\Debug\</OutputPath> |
| | | <DefineConstants>DEBUG;TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | <PlatformTarget>AnyCPU</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> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | | <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System" /> |
| | | <Reference Include="System.ComponentModel.DataAnnotations" /> |
| | | <Reference Include="System.Core" /> |
| | | <Reference Include="System.Data.SQLite, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.Core.1.0.112.0\lib\net451\System.Data.SQLite.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.EF6, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.EF6.1.0.112.0\lib\net451\System.Data.SQLite.EF6.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.EF6.Migrations, Version=1.0.106.0, Culture=neutral, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.EF6.Migrations.1.0.106\lib\System.Data.SQLite.EF6.Migrations.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.Linq, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.Linq.1.0.112.0\lib\net451\System.Data.SQLite.Linq.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Runtime.Serialization" /> |
| | | <Reference Include="System.Security" /> |
| | | <Reference Include="System.Xml.Linq" /> |
| | | <Reference Include="System.Data.DataSetExtensions" /> |
| | | <Reference Include="Microsoft.CSharp" /> |
| | | <Reference Include="System.Data" /> |
| | | <Reference Include="System.Net.Http" /> |
| | | <Reference Include="System.Xml" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Compile Include="BaseModel.cs" /> |
| | | <Compile Include="DBModel.cs" /> |
| | | <Compile Include="Migrations\Configuration.cs" /> |
| | | <Compile Include="Model\ManualDetectionRecords.cs" /> |
| | | <Compile Include="Model\EventTimeRecords.cs" /> |
| | | <Compile Include="Model\OperationRecords.cs" /> |
| | | <Compile Include="Properties\AssemblyInfo.cs" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="App.config"> |
| | | <SubType>Designer</SubType> |
| | | <CopyToOutputDirectory>Always</CopyToOutputDirectory> |
| | | </None> |
| | | <None Include="packages.config" /> |
| | | </ItemGroup> |
| | | <ItemGroup /> |
| | | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
| | | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
| | | <PropertyGroup> |
| | | </PropertyGroup> |
| | | <Error Condition="!Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props'))" /> |
| | | <Error Condition="!Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets'))" /> |
| | | <Error Condition="!Exists('..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets'))" /> |
| | | </Target> |
| | | <Import Project="..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets" Condition="Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" /> |
| | | <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets')" /> |
| | | </Project> |
New file |
| | |
| | | //using Bro.Process.Model.Migrations; |
| | | //using Bro.Process.Model.Model; |
| | | //using System; |
| | | //using System.Data.Entity; |
| | | //using System.Data.Entity.ModelConfiguration.Conventions; |
| | | //using System.Linq; |
| | | |
| | | //namespace Bro.M071.Process.Model |
| | | //{ |
| | | // public class DBModel : DbContext |
| | | // { |
| | | // //您的上下文已配置为从您的应用程序的配置文件(App.config 或 Web.config) |
| | | // //使用“DBModel”连接字符串。默认情况下,此连接字符串针对您的 LocalDb 实例上的 |
| | | // //“Bro.Process.Model.DBModel”数据库。 |
| | | // // |
| | | // //如果您想要针对其他数据库和/或数据库提供程序,请在应用程序配置文件中修改“DBModel” |
| | | // //连接字符串。 |
| | | // public DBModel() |
| | | // : base("name=DBModel") |
| | | // { |
| | | // ////数据库迁移检查暂时放在构造函数中,回头会放到程序初始化中 |
| | | // //Database.SetInitializer(new MigrateDatabaseToLatestVersion<DBModel, Configuration>()); |
| | | // } |
| | | |
| | | // //为您要在模型中包含的每种实体类型都添加 DbSet。有关配置和使用 Code First 模型 |
| | | // //的详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=390109。 |
| | | |
| | | // // public virtual DbSet<MyEntity> MyEntities { get; set; } |
| | | // //public virtual DbSet<PRODUCTION_SECRETKEY> PRODUCTION_SECRETKEY { get; set; } |
| | | // //public virtual DbSet<PRODUCTION_CONFIG> PRODUCTION_CONFIG { get; set; } |
| | | |
| | | |
| | | // public virtual DbSet<ProductionDetectionRecords> ProductionDetectionRecords { get; set; } |
| | | // public virtual DbSet<ProductionDetectionRecordsDetail> ProductionDetectionRecordsDetail { get; set; } |
| | | // public virtual DbSet<OperationRecords> OperationRecords { get; set; } |
| | | // public virtual DbSet<ProductionDetectionImageRecords> ProductionDetectionImageRecords { get; set; } |
| | | // public virtual DbSet<ManualDetectionRecords> ManualDetectionRecords { get; set; } |
| | | // public virtual DbSet<EventTimeRecords> EventTimeRecords { get; set; } |
| | | |
| | | // protected override void OnModelCreating(DbModelBuilder modelBuilder) |
| | | // { |
| | | // //base.OnModelCreating(modelBuilder); |
| | | |
| | | // #region for sqlite db |
| | | // modelBuilder.Conventions.Remove<PluralizingTableNameConvention>(); |
| | | // modelBuilder.Configurations.AddFromAssembly(typeof(DBModel).Assembly); |
| | | // #endregion |
| | | // } |
| | | // } |
| | | |
| | | // public static class DatabaseInitialize |
| | | // { |
| | | // public static void Initialize() |
| | | // { |
| | | // Database.SetInitializer(new MigrateDatabaseToLatestVersion<DBModel, Configuration>()); |
| | | // using (DbContext dbContext = new DBModel()) |
| | | // { |
| | | // dbContext.Database.Initialize(true); |
| | | // } |
| | | // } |
| | | // } |
| | | // //public class MyEntity |
| | | // //{ |
| | | // // public int Id { get; set; } |
| | | // // public string Name { get; set; } |
| | | // //} |
| | | //} |
New file |
| | |
| | | //namespace Bro.M071.Process.Model.Migrations |
| | | //{ |
| | | // using System; |
| | | // using System.Data.Entity; |
| | | // using System.Data.Entity.Migrations; |
| | | // using System.Data.SQLite.EF6.Migrations; |
| | | // using System.Linq; |
| | | |
| | | // public sealed class Configuration : DbMigrationsConfiguration<Bro.Process.Model.DBModel> |
| | | // { |
| | | // public Configuration() |
| | | // { |
| | | // AutomaticMigrationsEnabled = true; |
| | | // AutomaticMigrationDataLossAllowed = true; |
| | | |
| | | // #region for sqlite db |
| | | // SetSqlGenerator("System.Data.SQLite", new SQLiteMigrationSqlGenerator()); |
| | | // #endregion |
| | | // } |
| | | |
| | | // protected override void Seed(Bro.Process.Model.DBModel context) |
| | | // { |
| | | // // This method will be called after migrating to the latest version. |
| | | |
| | | // // You can use the DbSet<T>.AddOrUpdate() helper extension method |
| | | // // to avoid creating duplicate seed data. E.g. |
| | | // // |
| | | // // context.People.AddOrUpdate( |
| | | // // p => p.FullName, |
| | | // // new Person { FullName = "Andrew Peters" }, |
| | | // // new Person { FullName = "Brice Lambson" }, |
| | | // // new Person { FullName = "Rowan Miller" } |
| | | // // ); |
| | | // // |
| | | // } |
| | | // } |
| | | //} |
New file |
| | |
| | | |
| | | //using System; |
| | | //using System.ComponentModel.DataAnnotations; |
| | | |
| | | //namespace Bro.M071.Process.Model.Model |
| | | //{ |
| | | // /// <summary> |
| | | // /// 事件时间记录 |
| | | // /// </summary> |
| | | // public class EventTimeRecords : BaseModel |
| | | // { |
| | | // /// <summary> |
| | | // /// 操作员编号 |
| | | // /// </summary> |
| | | // [StringLength(64)] |
| | | // public string UserNO { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 班次 |
| | | // /// </summary> |
| | | // public int Shift { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 事件类型(空闲 故障 正常运行) |
| | | // /// </summary> |
| | | // public int EventType { get; set; } |
| | | |
| | | // ///// <summary> |
| | | // ///// 事件开始/结束 |
| | | // ///// </summary> |
| | | // //public int EventStatus { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 事件时间 |
| | | // /// </summary> |
| | | // public DateTime EventTime { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 事件备注 |
| | | // /// </summary> |
| | | // [StringLength(256)] |
| | | // public string Remark { get; set; } |
| | | // } |
| | | |
| | | // public class EventTimeRecordsRequest : BaseRequest |
| | | // { |
| | | // public string UserNO { get; set; } |
| | | // public int Shift { get; set; } |
| | | // public int EventType { get; set; } |
| | | // } |
| | | |
| | | //} |
New file |
| | |
| | | //using System; |
| | | //using System.Collections.Generic; |
| | | //using System.ComponentModel; |
| | | //using System.ComponentModel.DataAnnotations; |
| | | //using System.Linq; |
| | | //using System.Text; |
| | | //using System.Threading.Tasks; |
| | | |
| | | //namespace Bro.M071.Process.Model.Model |
| | | //{ |
| | | // public class ManualDetectionRecords : BaseModel, INotifyPropertyChanged |
| | | // { |
| | | // /// <summary> |
| | | // /// 检测图片的路径(原始图片 预处理图片路径) 关联到检测记录表(一张图片多次检测 原始路径不变) |
| | | // /// </summary> |
| | | // [StringLength(512)] |
| | | // public string OriginalImgPath { get; set; } |
| | | |
| | | |
| | | // private string manualResult = null; |
| | | // /// <summary> |
| | | // /// 人工对标结果 |
| | | // /// </summary> |
| | | // [StringLength(64)] |
| | | // public string ManualResult |
| | | // { |
| | | // get => manualResult; |
| | | // set |
| | | // { |
| | | // if (manualResult != value) |
| | | // { |
| | | // manualResult = value; |
| | | // PropertyChanged?.BeginInvoke(this, new PropertyChangedEventArgs("ManualResult"), null, null); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // private string manualDefectNameList = null; |
| | | // /// <summary> |
| | | // /// 人工对标缺陷名称 |
| | | // /// </summary> |
| | | // [StringLength(256)] |
| | | // public string ManualDefectNameList |
| | | // { |
| | | // get => manualDefectNameList; |
| | | // set |
| | | // { |
| | | // if (manualDefectNameList != value) |
| | | // { |
| | | // manualDefectNameList = value; |
| | | // PropertyChanged?.BeginInvoke(this, new PropertyChangedEventArgs("ManualDefectNameList"), null, null); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // public event PropertyChangedEventHandler PropertyChanged; |
| | | // } |
| | | //} |
New file |
| | |
| | | |
| | | //using System; |
| | | //using System.ComponentModel.DataAnnotations; |
| | | |
| | | //namespace Bro.M071.Process.Model.Model |
| | | //{ |
| | | // public class OperationRecords : BaseModel |
| | | // { |
| | | // /// <summary> |
| | | // /// 操作员编号 |
| | | // /// </summary> |
| | | // [StringLength(64)] |
| | | // public string UserNO { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 操作员生产的批次号 |
| | | // /// </summary> |
| | | // [StringLength(64)] |
| | | // public string ProductionBatchNO { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 操作开始时间 |
| | | // /// </summary> |
| | | // public DateTime OperationStartTime { get; set; } |
| | | |
| | | // /// <summary> |
| | | // /// 操作结束时间 |
| | | // /// </summary> |
| | | // public DateTime? OperationEndTime { get; set; } |
| | | |
| | | |
| | | // } |
| | | |
| | | // public class OperationRecordsRequest : BaseRequest |
| | | // { |
| | | // public string UserNO { get; set; } |
| | | // public string ProductionBatchNO { get; set; } |
| | | // } |
| | | |
| | | // public class ProductionStatistics_Dto |
| | | // { |
| | | |
| | | // public OperationRecords OperationRecordsRowData { get; set; } |
| | | |
| | | // public int BatchProductionTotalCount { get; set; } |
| | | |
| | | // public int BatchProductionOKCount { get; set; } |
| | | |
| | | // public int BatchProductionNGCount { get; set; } |
| | | |
| | | // public int BatchProductionTBDCount { get; set; } |
| | | |
| | | // public bool IsSelected { get; set; } |
| | | |
| | | // public ProductionStatistics_Dto() |
| | | // { |
| | | |
| | | // } |
| | | // } |
| | | //} |
New file |
| | |
| | | using System.Reflection; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Runtime.InteropServices; |
| | | |
| | | // 有关程序集的一般信息由以下 |
| | | // 控制。更改这些特性值可修改 |
| | | // 与程序集关联的信息。 |
| | | [assembly: AssemblyTitle("Bro.Process.Model")] |
| | | [assembly: AssemblyDescription("")] |
| | | [assembly: AssemblyConfiguration("")] |
| | | [assembly: AssemblyCompany("")] |
| | | [assembly: AssemblyProduct("Bro.Process.Model")] |
| | | [assembly: AssemblyCopyright("Copyright © 2018")] |
| | | [assembly: AssemblyTrademark("")] |
| | | [assembly: AssemblyCulture("")] |
| | | |
| | | // 将 ComVisible 设置为 false 会使此程序集中的类型 |
| | | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 |
| | | //请将此类型的 ComVisible 特性设置为 true。 |
| | | [assembly: ComVisible(false)] |
| | | |
| | | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID |
| | | [assembly: Guid("ad645c48-5811-4b1e-b81f-d35d5e6b577f")] |
| | | |
| | | // 程序集的版本信息由下列四个值组成: |
| | | // |
| | | // 主版本 |
| | | // 次版本 |
| | | // 生成号 |
| | | // 修订号 |
| | | // |
| | | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 |
| | | //通过使用 "*",如下所示: |
| | | // [assembly: AssemblyVersion("1.0.*")] |
| | | [assembly: AssemblyVersion("1.0.0.0")] |
| | | [assembly: AssemblyFileVersion("1.0.0.0")] |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <packages> |
| | | <package id="EntityFramework" version="6.4.0" targetFramework="net452" /> |
| | | <package id="SQLite.CodeFirst" version="1.5.3.29" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.Core" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.EF6" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.EF6.Migrations" version="1.0.106" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.Linq" version="1.0.112.0" targetFramework="net452" /> |
| | | </packages> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <configuration> |
| | | <configSections> |
| | | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
| | | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
| | | <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> |
| | | <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> |
| | | </configSections> |
| | | <system.data> |
| | | <DbProviderFactories> |
| | | <remove invariant="System.Data.SQLite.EF6" /> |
| | | <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" /> |
| | | <remove invariant="System.Data.SQLite" /> |
| | | <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> |
| | | </DbProviderFactories> |
| | | </system.data> |
| | | <entityFramework> |
| | | <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> |
| | | <providers> |
| | | <provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> |
| | | <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" /> |
| | | </providers> |
| | | </entityFramework> |
| | | <runtime> |
| | | <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |
| | | <dependentAssembly> |
| | | <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" /> |
| | | <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" /> |
| | | </dependentAssembly> |
| | | <dependentAssembly> |
| | | <assemblyIdentity name="System.Data.SQLite.EF6" publicKeyToken="db937bc2d44ff139" culture="neutral" /> |
| | | <bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" /> |
| | | </dependentAssembly> |
| | | </assemblyBinding> |
| | | </runtime> |
| | | <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup></configuration> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| | | <Import Project="..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props" Condition="Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" /> |
| | | <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>{65302D6E-9918-4E4C-92B4-75C8830C6BA7}</ProjectGuid> |
| | | <OutputType>Library</OutputType> |
| | | <AppDesignerFolder>Properties</AppDesignerFolder> |
| | | <RootNamespace>Bro.Process.DBManager</RootNamespace> |
| | | <AssemblyName>Bro.Process.DBManager</AssemblyName> |
| | | <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
| | | <FileAlignment>512</FileAlignment> |
| | | <NuGetPackageImportStamp> |
| | | </NuGetPackageImportStamp> |
| | | <TargetFrameworkProfile /> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
| | | <DebugSymbols>true</DebugSymbols> |
| | | <DebugType>full</DebugType> |
| | | <Optimize>false</Optimize> |
| | | <OutputPath>..\Debug\</OutputPath> |
| | | <DefineConstants>DEBUG;TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
| | | <DebugType>pdbonly</DebugType> |
| | | <Optimize>true</Optimize> |
| | | <OutputPath>bin\Release\</OutputPath> |
| | | <DefineConstants>TRACE</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | | <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\EntityFramework.6.4.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="SQLite.CodeFirst, Version=1.5.3.29, Culture=neutral, PublicKeyToken=eb96ba0a78d831a7, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\SQLite.CodeFirst.1.5.3.29\lib\net45\SQLite.CodeFirst.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System" /> |
| | | <Reference Include="System.ComponentModel.DataAnnotations" /> |
| | | <Reference Include="System.Configuration" /> |
| | | <Reference Include="System.Core" /> |
| | | <Reference Include="System.Data.SQLite, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.Core.1.0.112.0\lib\net451\System.Data.SQLite.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.EF6, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.EF6.1.0.112.0\lib\net451\System.Data.SQLite.EF6.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.EF6.Migrations, Version=1.0.106.0, Culture=neutral, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.EF6.Migrations.1.0.106\lib\System.Data.SQLite.EF6.Migrations.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Data.SQLite.Linq, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> |
| | | <HintPath>..\..\packages\System.Data.SQLite.Linq.1.0.112.0\lib\net451\System.Data.SQLite.Linq.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="System.Xml.Linq" /> |
| | | <Reference Include="System.Data.DataSetExtensions" /> |
| | | <Reference Include="Microsoft.CSharp" /> |
| | | <Reference Include="System.Data" /> |
| | | <Reference Include="System.Net.Http" /> |
| | | <Reference Include="System.Xml" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Compile Include="ModelManager.cs" /> |
| | | <Compile Include="Properties\AssemblyInfo.cs" /> |
| | | <Compile Include="SQLiteHelper.cs" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\Bro.Common.Model\Bro.Common.Model.csproj"> |
| | | <Project>{1A3CBFE7-3F78-42C3-95C5-10360450DBEA}</Project> |
| | | <Name>Bro.Common.Model</Name> |
| | | </ProjectReference> |
| | | <ProjectReference Include="..\Bro.Common.Device\Bro.Common.Device.csproj"> |
| | | <Project>{987308DD-8BAA-463A-94E2-77D62E01A5BF}</Project> |
| | | <Name>Bro.Common.Device</Name> |
| | | </ProjectReference> |
| | | <ProjectReference Include="..\Bro.M071.Process.Model\Bro.M071.Process.Model.csproj"> |
| | | <Project>{AD645C48-5811-4B1E-B81F-D35D5E6B577F}</Project> |
| | | <Name>Bro.M071.Process.Model</Name> |
| | | </ProjectReference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="App.config" /> |
| | | <None Include="packages.config" /> |
| | | </ItemGroup> |
| | | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
| | | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
| | | <PropertyGroup> |
| | | </PropertyGroup> |
| | | <Error Condition="!Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\EntityFramework.6.4.0\build\EntityFramework.props'))" /> |
| | | <Error Condition="!Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets'))" /> |
| | | <Error Condition="!Exists('..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets'))" /> |
| | | </Target> |
| | | <Import Project="..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets" Condition="Exists('..\..\packages\EntityFramework.6.4.0\build\EntityFramework.targets')" /> |
| | | <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.112.0\build\net451\System.Data.SQLite.Core.targets')" /> |
| | | </Project> |
New file |
| | |
| | | //using Bro.Process.Model; |
| | | //using System; |
| | | //using System.Collections.Generic; |
| | | //using System.Configuration; |
| | | //using System.Data.Common; |
| | | //using System.Data.Entity; |
| | | //using System.Data.SQLite; |
| | | //using System.Linq; |
| | | //using System.Reflection; |
| | | //using System.Text; |
| | | //using System.Threading.Tasks; |
| | | |
| | | //namespace Bro.Process.DBManager |
| | | //{ |
| | | // public class ModelManager<T> where T : BaseModel, new() |
| | | // { |
| | | // private PropertyInfo TableProperty = null; |
| | | // public static string ConnectionString = ConfigurationManager.ConnectionStrings["DBModel"].ConnectionString; |
| | | // public ModelManager() |
| | | // { |
| | | // T t = new T(); |
| | | // using (DBModel db = new DBModel()) |
| | | // { |
| | | // TableProperty = db.GetType().GetProperties().FirstOrDefault(u => u.Name == t.GetType().Name); |
| | | // } |
| | | // } |
| | | |
| | | // public void NewModel(T t, string userId = "") |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // ActionBeforeNewModel(context, t); |
| | | |
| | | // t.SetNew(userId); |
| | | // (TableProperty.GetValue(context) as DbSet<T>).Add(t); |
| | | |
| | | // context.SaveChanges(); |
| | | // } |
| | | // } |
| | | |
| | | // public void BatchAdd(List<T> t, string userId = "") |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // (TableProperty.GetValue(context) as DbSet<T>).AddRange(t); |
| | | // context.SaveChanges(); |
| | | // } |
| | | // } |
| | | |
| | | // public void UpdateModel(T t, string userId = "") |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // ActionBeforeUpdateModel(context, t); |
| | | |
| | | // DbSet<T> set = TableProperty.GetValue(context) as DbSet<T>; |
| | | // T oldT = set.FirstOrDefault(u => u.ID == t.ID); |
| | | |
| | | // oldT.DataTransfer(t); |
| | | // oldT.SetUpdate(userId); |
| | | // context.SaveChanges(); |
| | | // } |
| | | // } |
| | | |
| | | // public void DeleteModel(string id, bool isDelete = true, string userId = "") |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // ActionBeforeDeleteModel(context, id); |
| | | |
| | | // DbSet<T> set = TableProperty.GetValue(context) as DbSet<T>; |
| | | // T oldT = set.FirstOrDefault(u => u.ID == id); |
| | | // oldT.IS_DELETED = isDelete ? 1 : 0; |
| | | // oldT.SetUpdate(userId); |
| | | |
| | | // context.SaveChanges(); |
| | | // } |
| | | // } |
| | | |
| | | // public void DisableModel(string id, bool isDisable = true, string userId = "") |
| | | // { |
| | | // using (DBModel context = new DBModel()) |
| | | // { |
| | | // ActionBeforeEnableModel(context, id); |
| | | |
| | | // DbSet<T> set = TableProperty.GetValue(context) as DbSet<T>; |
| | | // T oldT = set.FirstOrDefault(u => u.ID == id); |
| | | // oldT.IS_DISABLED = isDisable ? 1 : 0; |
| | | // oldT.SetUpdate(userId); |
| | | |
| | | // context.SaveChanges(); |
| | | // } |
| | | // } |
| | | |
| | | // #region "" |
| | | // protected virtual void ActionBeforeNewModel(DBModel context, T t) |
| | | // { |
| | | // } |
| | | |
| | | // protected virtual void ActionBeforeUpdateModel(DBModel context, T t) |
| | | // { |
| | | // } |
| | | |
| | | // protected virtual void ActionBeforeDeleteModel(DBModel context, string id) |
| | | // { |
| | | // } |
| | | |
| | | // protected virtual void ActionBeforeEnableModel(DBModel context, string id) |
| | | // { |
| | | // } |
| | | // #endregion |
| | | // } |
| | | //} |
New file |
| | |
| | | using System.Reflection; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Runtime.InteropServices; |
| | | |
| | | // 有关程序集的一般信息由以下 |
| | | // 控制。更改这些特性值可修改 |
| | | // 与程序集关联的信息。 |
| | | [assembly: AssemblyTitle("Bro.Process.DBManager")] |
| | | [assembly: AssemblyDescription("")] |
| | | [assembly: AssemblyConfiguration("")] |
| | | [assembly: AssemblyCompany("")] |
| | | [assembly: AssemblyProduct("Bro.Process.DBManager")] |
| | | [assembly: AssemblyCopyright("Copyright © 2018")] |
| | | [assembly: AssemblyTrademark("")] |
| | | [assembly: AssemblyCulture("")] |
| | | |
| | | // 将 ComVisible 设置为 false 会使此程序集中的类型 |
| | | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 |
| | | //请将此类型的 ComVisible 特性设置为 true。 |
| | | [assembly: ComVisible(false)] |
| | | |
| | | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID |
| | | [assembly: Guid("230b0fff-f6af-45fe-aaf7-b4b66250dd58")] |
| | | |
| | | // 程序集的版本信息由下列四个值组成: |
| | | // |
| | | // 主版本 |
| | | // 次版本 |
| | | // 生成号 |
| | | // 修订号 |
| | | // |
| | | // 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 |
| | | //通过使用 "*",如下所示: |
| | | // [assembly: AssemblyVersion("1.0.*")] |
| | | [assembly: AssemblyVersion("1.0.0.0")] |
| | | [assembly: AssemblyFileVersion("1.0.0.0")] |
New file |
| | |
| | | |
| | | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Specialized; |
| | | using System.Data; |
| | | using System.Data.SQLite; |
| | | using System.Configuration; |
| | | |
| | | namespace Bro.Process.DBManager |
| | | { |
| | | public class SQLiteHelper |
| | | { |
| | | //数据库连接字符串 |
| | | public static string connectionString = ConfigurationManager.ConnectionStrings["DBModel"].ConnectionString; |
| | | |
| | | public SQLiteHelper() { } |
| | | |
| | | #region 公用方法 |
| | | |
| | | public static int GetMaxID(string FieldName, string TableName) |
| | | { |
| | | string strsql = "select max(" + FieldName + ")+1 from " + TableName; |
| | | object obj = GetSingle(strsql); |
| | | if (obj == null) |
| | | { |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | return int.Parse(obj.ToString()); |
| | | } |
| | | } |
| | | |
| | | public static bool Exists(string strSql) |
| | | { |
| | | object obj = GetSingle(strSql); |
| | | int cmdresult; |
| | | if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value))) |
| | | { |
| | | cmdresult = 0; |
| | | } |
| | | else |
| | | { |
| | | cmdresult = int.Parse(obj.ToString()); |
| | | } |
| | | if (cmdresult == 0) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | public static bool Exists(string strSql, params SQLiteParameter[] cmdParms) |
| | | { |
| | | object obj = GetSingle(strSql, cmdParms); |
| | | int cmdresult; |
| | | if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value))) |
| | | { |
| | | cmdresult = 0; |
| | | } |
| | | else |
| | | { |
| | | cmdresult = int.Parse(obj.ToString()); |
| | | } |
| | | if (cmdresult == 0) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 执行简单SQL语句 |
| | | |
| | | /// <summary> |
| | | /// 执行SQL语句,返回影响的记录数 |
| | | /// </summary> |
| | | /// <param name="SQLString">SQL语句</param> |
| | | /// <returns>影响的记录数</returns> |
| | | public static int ExecuteSql(string SQLString) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | using (SQLiteCommand cmd = new SQLiteCommand(SQLString, connection)) |
| | | { |
| | | try |
| | | { |
| | | connection.Open(); |
| | | int rows = cmd.ExecuteNonQuery(); |
| | | return rows; |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException E) |
| | | { |
| | | connection.Close(); |
| | | throw new Exception(E.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行SQL语句,设置命令的执行等待时间 |
| | | /// </summary> |
| | | /// <param name="SQLString"></param> |
| | | /// <param name="Times"></param> |
| | | /// <returns></returns> |
| | | public static int ExecuteSqlByTime(string SQLString, int Times) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | using (SQLiteCommand cmd = new SQLiteCommand(SQLString, connection)) |
| | | { |
| | | try |
| | | { |
| | | connection.Open(); |
| | | cmd.CommandTimeout = Times; |
| | | int rows = cmd.ExecuteNonQuery(); |
| | | return rows; |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException E) |
| | | { |
| | | connection.Close(); |
| | | throw new Exception(E.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行多条SQL语句,实现数据库事务。 |
| | | /// </summary> |
| | | /// <param name="SQLStringList">多条SQL语句</param> |
| | | public static bool ExecuteSqlTran(ArrayList SQLStringList) |
| | | { |
| | | bool isSuccess = false; |
| | | using (SQLiteConnection conn = new SQLiteConnection(connectionString)) |
| | | { |
| | | conn.Open(); |
| | | SQLiteCommand cmd = new SQLiteCommand(); |
| | | cmd.Connection = conn; |
| | | cmd.CommandText = "PRAGMA synchronous = OFF;"; |
| | | cmd.ExecuteNonQuery(); |
| | | SQLiteTransaction tx = conn.BeginTransaction(); |
| | | cmd.Transaction = tx; |
| | | try |
| | | { |
| | | for (int n = 0; n < SQLStringList.Count; n++) |
| | | { |
| | | string strsql = SQLStringList[n].ToString(); |
| | | if (strsql.Trim().Length > 1) |
| | | { |
| | | cmd.CommandText = strsql; |
| | | cmd.ExecuteNonQuery(); |
| | | } |
| | | } |
| | | tx.Commit(); |
| | | isSuccess = true; |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException E) |
| | | { |
| | | tx.Rollback(); |
| | | isSuccess = false; |
| | | throw new Exception(E.Message); |
| | | } |
| | | } |
| | | return isSuccess; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行带一个存储过程参数的的SQL语句。 |
| | | /// </summary> |
| | | /// <param name="SQLString">SQL语句</param> |
| | | /// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param> |
| | | /// <returns>影响的记录数</returns> |
| | | public static int ExecuteSql(string SQLString, string content) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | SQLiteCommand cmd = new SQLiteCommand(SQLString, connection); |
| | | SQLiteParameter myParameter = new SQLiteParameter("@content", DbType.String); |
| | | myParameter.Value = content; |
| | | cmd.Parameters.Add(myParameter); |
| | | try |
| | | { |
| | | connection.Open(); |
| | | int rows = cmd.ExecuteNonQuery(); |
| | | return rows; |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException E) |
| | | { |
| | | throw new Exception(E.Message); |
| | | } |
| | | finally |
| | | { |
| | | cmd.Dispose(); |
| | | connection.Close(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行带一个存储过程参数的的SQL语句。 |
| | | /// </summary> |
| | | /// <param name="SQLString">SQL语句</param> |
| | | /// <param name="content">参数内容,比如一个字段是格式复杂的文章,有特殊符号,可以通过这个方式添加</param> |
| | | /// <returns>影响的记录数</returns> |
| | | public static object ExecuteSqlGet(string SQLString, string content) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | SQLiteCommand cmd = new SQLiteCommand(SQLString, connection); |
| | | SQLiteParameter myParameter = new SQLiteParameter("@content", DbType.String); |
| | | myParameter.Value = content; |
| | | cmd.Parameters.Add(myParameter); |
| | | try |
| | | { |
| | | connection.Open(); |
| | | object obj = cmd.ExecuteScalar(); |
| | | if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value))) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return obj; |
| | | } |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException E) |
| | | { |
| | | throw new Exception(E.Message); |
| | | } |
| | | finally |
| | | { |
| | | cmd.Dispose(); |
| | | connection.Close(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 向数据库里插入图像格式的字段(和上面情况类似的另一种实例) |
| | | /// </summary> |
| | | /// <param name="strSQL">SQL语句</param> |
| | | /// <param name="fs">图像字节,数据库的字段类型为image的情况</param> |
| | | /// <returns>影响的记录数</returns> |
| | | public static int ExecuteSqlInsertImg(string strSQL, byte[] fs) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | SQLiteCommand cmd = new SQLiteCommand(strSQL, connection); |
| | | SQLiteParameter myParameter = new SQLiteParameter("@fs", DbType.Binary); |
| | | myParameter.Value = fs; |
| | | cmd.Parameters.Add(myParameter); |
| | | try |
| | | { |
| | | connection.Open(); |
| | | int rows = cmd.ExecuteNonQuery(); |
| | | return rows; |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException E) |
| | | { |
| | | throw new Exception(E.Message); |
| | | } |
| | | finally |
| | | { |
| | | cmd.Dispose(); |
| | | connection.Close(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行一条计算查询结果语句,返回查询结果(object)。 |
| | | /// </summary> |
| | | /// <param name="SQLString">计算查询结果语句</param> |
| | | /// <returns>查询结果(object)</returns> |
| | | public static object GetSingle(string SQLString) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | using (SQLiteCommand cmd = new SQLiteCommand(SQLString, connection)) |
| | | { |
| | | try |
| | | { |
| | | connection.Open(); |
| | | object obj = cmd.ExecuteScalar(); |
| | | if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value))) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return obj; |
| | | } |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException e) |
| | | { |
| | | connection.Close(); |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行查询语句,返回SQLiteDataReader(使用该方法切记要手工关闭SQLiteDataReader和连接) |
| | | /// </summary> |
| | | /// <param name="strSQL">查询语句</param> |
| | | /// <returns>SQLiteDataReader</returns> |
| | | public static SQLiteDataReader ExecuteReader(string strSQL) |
| | | { |
| | | SQLiteConnection connection = new SQLiteConnection(connectionString); |
| | | SQLiteCommand cmd = new SQLiteCommand(strSQL, connection); |
| | | try |
| | | { |
| | | connection.Open(); |
| | | SQLiteDataReader myReader = cmd.ExecuteReader(); |
| | | return myReader; |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | //finally //不能在此关闭,否则,返回的对象将无法使用 |
| | | //{ |
| | | // cmd.Dispose(); |
| | | // connection.Close(); |
| | | //} |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行查询语句,返回DataSet |
| | | /// </summary> |
| | | /// <param name="SQLString">查询语句</param> |
| | | /// <returns>DataSet</returns> |
| | | public static DataSet Query(string SQLString) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | DataSet ds = new DataSet(); |
| | | try |
| | | { |
| | | connection.Open(); |
| | | SQLiteDataAdapter command = new SQLiteDataAdapter(SQLString, connection); |
| | | command.Fill(ds, "ds"); |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | return ds; |
| | | } |
| | | } |
| | | |
| | | public static DataSet Query(string SQLString, string TableName) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | DataSet ds = new DataSet(); |
| | | try |
| | | { |
| | | connection.Open(); |
| | | SQLiteDataAdapter command = new SQLiteDataAdapter(SQLString, connection); |
| | | command.Fill(ds, TableName); |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | return ds; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行查询语句,返回DataSet,设置命令的执行等待时间 |
| | | /// </summary> |
| | | /// <param name="SQLString"></param> |
| | | /// <param name="Times"></param> |
| | | /// <returns></returns> |
| | | public static DataSet Query(string SQLString, int Times) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | DataSet ds = new DataSet(); |
| | | try |
| | | { |
| | | connection.Open(); |
| | | SQLiteDataAdapter command = new SQLiteDataAdapter(SQLString, connection); |
| | | command.SelectCommand.CommandTimeout = Times; |
| | | command.Fill(ds, "ds"); |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | return ds; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 执行带参数的SQL语句 |
| | | |
| | | /// <summary> |
| | | /// 执行SQL语句,返回影响的记录数 |
| | | /// </summary> |
| | | /// <param name="SQLString">SQL语句</param> |
| | | /// <returns>影响的记录数</returns> |
| | | public static int ExecuteSql(string SQLString, params SQLiteParameter[] cmdParms) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | using (SQLiteCommand cmd = new SQLiteCommand()) |
| | | { |
| | | try |
| | | { |
| | | PrepareCommand(cmd, connection, null, SQLString, cmdParms); |
| | | int rows = cmd.ExecuteNonQuery(); |
| | | cmd.Parameters.Clear(); |
| | | return rows; |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException E) |
| | | { |
| | | throw new Exception(E.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行多条SQL语句,实现数据库事务。 |
| | | /// </summary> |
| | | /// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的SQLiteParameter[])</param> |
| | | public static void ExecuteSqlTran(Hashtable SQLStringList) |
| | | { |
| | | using (SQLiteConnection conn = new SQLiteConnection(connectionString)) |
| | | { |
| | | conn.Open(); |
| | | using (SQLiteTransaction trans = conn.BeginTransaction()) |
| | | { |
| | | SQLiteCommand cmd = new SQLiteCommand(); |
| | | try |
| | | { |
| | | //循环 |
| | | foreach (DictionaryEntry myDE in SQLStringList) |
| | | { |
| | | string cmdText = myDE.Key.ToString(); |
| | | SQLiteParameter[] cmdParms = (SQLiteParameter[])myDE.Value; |
| | | PrepareCommand(cmd, conn, trans, cmdText, cmdParms); |
| | | int val = cmd.ExecuteNonQuery(); |
| | | cmd.Parameters.Clear(); |
| | | } |
| | | trans.Commit(); |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException e) |
| | | { |
| | | trans.Rollback(); |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行一条计算查询结果语句,返回查询结果(object)。 |
| | | /// </summary> |
| | | /// <param name="SQLString">计算查询结果语句</param> |
| | | /// <returns>查询结果(object)</returns> |
| | | public static object GetSingle(string SQLString, params SQLiteParameter[] cmdParms) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | using (SQLiteCommand cmd = new SQLiteCommand()) |
| | | { |
| | | try |
| | | { |
| | | PrepareCommand(cmd, connection, null, SQLString, cmdParms); |
| | | object obj = cmd.ExecuteScalar(); |
| | | cmd.Parameters.Clear(); |
| | | if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value))) |
| | | { |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | return obj; |
| | | } |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行查询语句,返回SQLiteDataReader (使用该方法切记要手工关闭SQLiteDataReader和连接) |
| | | /// </summary> |
| | | /// <param name="strSQL">查询语句</param> |
| | | /// <returns>SQLiteDataReader</returns> |
| | | public static SQLiteDataReader ExecuteReader(string SQLString, params SQLiteParameter[] cmdParms) |
| | | { |
| | | SQLiteConnection connection = new SQLiteConnection(connectionString); |
| | | SQLiteCommand cmd = new SQLiteCommand(); |
| | | try |
| | | { |
| | | PrepareCommand(cmd, connection, null, SQLString, cmdParms); |
| | | SQLiteDataReader myReader = cmd.ExecuteReader(); |
| | | cmd.Parameters.Clear(); |
| | | return myReader; |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | //finally //不能在此关闭,否则,返回的对象将无法使用 |
| | | //{ |
| | | // cmd.Dispose(); |
| | | // connection.Close(); |
| | | //} |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 执行查询语句,返回DataSet |
| | | /// </summary> |
| | | /// <param name="SQLString">查询语句</param> |
| | | /// <returns>DataSet</returns> |
| | | public static DataSet Query(string SQLString, params SQLiteParameter[] cmdParms) |
| | | { |
| | | using (SQLiteConnection connection = new SQLiteConnection(connectionString)) |
| | | { |
| | | SQLiteCommand cmd = new SQLiteCommand(); |
| | | PrepareCommand(cmd, connection, null, SQLString, cmdParms); |
| | | using (SQLiteDataAdapter da = new SQLiteDataAdapter(cmd)) |
| | | { |
| | | DataSet ds = new DataSet(); |
| | | try |
| | | { |
| | | da.Fill(ds, "ds"); |
| | | cmd.Parameters.Clear(); |
| | | } |
| | | catch (System.Data.SQLite.SQLiteException ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | return ds; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void PrepareCommand(SQLiteCommand cmd, SQLiteConnection conn, |
| | | SQLiteTransaction trans, string cmdText, SQLiteParameter[] cmdParms) |
| | | { |
| | | if (conn.State != ConnectionState.Open) |
| | | conn.Open(); |
| | | cmd.Connection = conn; |
| | | cmd.CommandText = cmdText; |
| | | if (trans != null) |
| | | cmd.Transaction = trans; |
| | | cmd.CommandType = CommandType.Text;//cmdType; |
| | | if (cmdParms != null) |
| | | { |
| | | foreach (SQLiteParameter parameter in cmdParms) |
| | | { |
| | | if ((parameter.Direction == ParameterDirection.InputOutput |
| | | || parameter.Direction == ParameterDirection.Input) && |
| | | (parameter.Value == null)) |
| | | { |
| | | parameter.Value = DBNull.Value; |
| | | } |
| | | cmd.Parameters.Add(parameter); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 参数转换 |
| | | /// <summary> |
| | | /// 放回一个SQLiteParameter |
| | | /// </summary> |
| | | /// <param name="name">参数名字</param> |
| | | /// <param name="type">参数类型</param> |
| | | /// <param name="size">参数大小</param> |
| | | /// <param name="value">参数值</param> |
| | | /// <returns>SQLiteParameter的值</returns> |
| | | public static SQLiteParameter MakeSQLiteParameter(string name, |
| | | DbType type, int size, object value) |
| | | { |
| | | SQLiteParameter parm = new SQLiteParameter(name, type, size); |
| | | parm.Value = value; |
| | | return parm; |
| | | } |
| | | |
| | | public static SQLiteParameter MakeSQLiteParameter(string name, DbType type, object value) |
| | | { |
| | | SQLiteParameter parm = new SQLiteParameter(name, type); |
| | | parm.Value = value; |
| | | return parm; |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <packages> |
| | | <package id="EntityFramework" version="6.4.0" targetFramework="net452" /> |
| | | <package id="SQLite.CodeFirst" version="1.5.3.29" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.Core" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.EF6" version="1.0.112.0" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.EF6.Migrations" version="1.0.106" targetFramework="net452" /> |
| | | <package id="System.Data.SQLite.Linq" version="1.0.112.0" targetFramework="net452" /> |
| | | </packages> |