上传文件至「/」
This commit is contained in:
26
AlarmContentService.cs
Normal file
26
AlarmContentService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Cowain.Bake.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.BLL
|
||||
{
|
||||
public class AlarmContentService : ServiceBase
|
||||
{
|
||||
public AlarmContentService(IUnityContainer unityContainer) : base(unityContainer)
|
||||
{
|
||||
}
|
||||
|
||||
public List<TAlarmContent> GetAll()
|
||||
{
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
return (from c in Context.Set<TAlarmContent>()
|
||||
select c).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
108
AlarmService.cs
Normal file
108
AlarmService.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using Cowain.Bake.Common.Enums;
|
||||
using Cowain.Bake.Model;
|
||||
using Cowain.Bake.Model.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.BLL
|
||||
{
|
||||
public class AlarmService : ServiceBase
|
||||
{
|
||||
public AlarmService(IUnityContainer unityContainer) : base(unityContainer)
|
||||
{
|
||||
}
|
||||
|
||||
public TAlarm GetInAlarm(Variable node, string desc)
|
||||
{
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
return (from a in Context.Set<TAlarm>()
|
||||
where a.Desc == desc
|
||||
&& a.StationId == node.StationId
|
||||
&& a.StopTime == null
|
||||
select a).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public TAlarm GetInAlarm(int tagId)
|
||||
{
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
return (from a in Context.Set<TAlarm>()
|
||||
where a.TagId == tagId && a.StopTime == null
|
||||
select a).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<TAlarm> GetInAlarms()
|
||||
{
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
return (from a in Context.Set<TAlarm>()
|
||||
where a.StopTime == null
|
||||
select a).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public int CancelAlarm(TAlarm alarm)
|
||||
{
|
||||
|
||||
alarm.Status = EAlarmStatus.Renew.GetDescription();
|
||||
alarm.StopTime = DateTime.Now;
|
||||
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
Context.Set<TAlarm>().Attach(alarm);//将数据附加到上下文,支持实体修改和新实体,重置为UnChanged
|
||||
Context.Entry<TAlarm>(alarm).State = EntityState.Modified;
|
||||
return Context.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
//一个信号报警
|
||||
public int Insert(TAlarm alarm)
|
||||
{
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
Context.Set<TAlarm>().Add(alarm);
|
||||
return Context.SaveChanges();
|
||||
}
|
||||
}
|
||||
public List<TAlarm> GetAlarmReport(string startTime, string endTime)
|
||||
{
|
||||
DateTime startDateTime = DateTime.Parse(startTime + " 00:00:01");
|
||||
DateTime endDateTime = DateTime.Parse(endTime + " 23:59:59");
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
return (from a in Context.Set<TAlarm>()
|
||||
where a.StartTime >= startDateTime
|
||||
&& a.StartTime <= endDateTime
|
||||
select a).OrderByDescending(x => x.StartTime).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public int Insert(Variable node, string desc)
|
||||
{
|
||||
TAlarm model = new TAlarm()
|
||||
{
|
||||
Desc = desc,
|
||||
StationId = node.StationId,
|
||||
StartTime = DateTime.Now,
|
||||
Status = EAlarmStatus.Alert.GetDescription()
|
||||
};
|
||||
|
||||
using (var Context = new BakingEntities())
|
||||
{
|
||||
Context.Set<TAlarm>().Add(model);
|
||||
return Context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
29
App.config
Normal file
29
App.config
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
|
||||
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>
|
||||
80
Cowain.Bake.sln
Normal file
80
Cowain.Bake.sln
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32228.343
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.Main", "Cowain.Bake.Main\Cowain.Bake.Main.csproj", "{8E1456EF-EDF6-4DC3-BF95-62655997D912}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{09EF460A-9D14-4090-B0D5-CA43E4B72A66} = {09EF460A-9D14-4090-B0D5-CA43E4B72A66}
|
||||
{152AAF38-8F84-4EBB-93C0-15C71C2B85EB} = {152AAF38-8F84-4EBB-93C0-15C71C2B85EB}
|
||||
{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} = {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}
|
||||
{3D24095D-B703-438D-AB17-C6BD7E9EF514} = {3D24095D-B703-438D-AB17-C6BD7E9EF514}
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.Common", "Cowain.Bake.Common\Cowain.Bake.Common.csproj", "{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.Model", "Cowain.Bake.Model\Cowain.Bake.Model.csproj", "{362F196C-7C59-4DFB-9A3E-85F880791312}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.UI", "Cowain.Bake.UI\Cowain.Bake.UI.csproj", "{09EF460A-9D14-4090-B0D5-CA43E4B72A66}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{152AAF38-8F84-4EBB-93C0-15C71C2B85EB} = {152AAF38-8F84-4EBB-93C0-15C71C2B85EB}
|
||||
{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} = {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}
|
||||
{3D24095D-B703-438D-AB17-C6BD7E9EF514} = {3D24095D-B703-438D-AB17-C6BD7E9EF514}
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.BLL", "Cowain.Bake.BLL\Cowain.Bake.BLL.csproj", "{3D24095D-B703-438D-AB17-C6BD7E9EF514}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} = {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.Communication", "Cowain.Bake.Communication\Cowain.Bake.Communication.csproj", "{152AAF38-8F84-4EBB-93C0-15C71C2B85EB}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} = {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}
|
||||
{3D24095D-B703-438D-AB17-C6BD7E9EF514} = {3D24095D-B703-438D-AB17-C6BD7E9EF514}
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8E1456EF-EDF6-4DC3-BF95-62655997D912}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8E1456EF-EDF6-4DC3-BF95-62655997D912}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8E1456EF-EDF6-4DC3-BF95-62655997D912}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8E1456EF-EDF6-4DC3-BF95-62655997D912}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{362F196C-7C59-4DFB-9A3E-85F880791312}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{09EF460A-9D14-4090-B0D5-CA43E4B72A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{09EF460A-9D14-4090-B0D5-CA43E4B72A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{09EF460A-9D14-4090-B0D5-CA43E4B72A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{09EF460A-9D14-4090-B0D5-CA43E4B72A66}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3D24095D-B703-438D-AB17-C6BD7E9EF514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3D24095D-B703-438D-AB17-C6BD7E9EF514}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3D24095D-B703-438D-AB17-C6BD7E9EF514}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3D24095D-B703-438D-AB17-C6BD7E9EF514}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{152AAF38-8F84-4EBB-93C0-15C71C2B85EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{152AAF38-8F84-4EBB-93C0-15C71C2B85EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{152AAF38-8F84-4EBB-93C0-15C71C2B85EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{152AAF38-8F84-4EBB-93C0-15C71C2B85EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A1A7434F-D795-4316-AE65-571C8FCE6F55}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user