123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using DbCommon.BusinessCore.DbCore;
- using DbCommon.Enties.DbModels;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DbCommon.BusinessCore.BaseCore
- {
- public class StationInfoManager : DbContext<StationInfo>
- {
- public void Init()
- {
- //If no exist create datebase
- Db.DbMaintenance.CreateDatabase();
- if (!Db.DbMaintenance.IsAnyTable("StationInfo", false))
- {
- //Create tables
- Db.CodeFirst.InitTables(typeof(StationInfo));
- }
- }
- public bool UpdateStatus(StationInfo data)
- {
- return Db.Updateable(data)
- .IgnoreColumns("Command", "CountInterval", "CountAlarm", "CountStartTime")
- .ExecuteCommand() > 0;
- }
- public bool UpdateStatus(List<StationInfo> dataList)
- {
- return Db.Updateable(dataList)
- .IgnoreColumns("Command", "CountInterval", "CountAlarm", "CountStartTime")
- .ExecuteCommand() > 0;
- }
- public bool UpdateCommand(StationInfo data)
- {
- return Db.Updateable(data)
- .UpdateColumns(it => new { it.Command })
- .ExecuteCommand() > 0;
- }
- public bool UpdateCountdown(List<StationInfo> dataList)
- {
- return Db.Updateable(dataList)
- .UpdateColumns(it => new { it.CountInterval, it.CountAlarm})
- .ExecuteCommand() > 0;
- }
- public bool UpdateCountStart(List<StationInfo> dataList)
- {
- return Db.Updateable(dataList)
- .UpdateColumns(it => new { it.Command, it.CountStartTime })
- .ExecuteCommand() > 0;
- }
- }
- }
|