using SqlSugar;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Text;
|
using System.Transactions;
|
|
namespace IStation.DAL
|
{
|
/// <summary>
|
/// 泵曲线
|
/// </summary>
|
public partial class PumpCurve : CorpTraceDAL<Entity.PumpCurve>
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public override ConnectionConfig ConnectionConfig
|
{
|
get { return ConfigHelper.DefaultConnectionConfig; }
|
|
}
|
|
|
/// <summary>
|
/// 更新曲线编码
|
/// </summary>
|
public bool UpdateCurveCode(long CorpID, long ID, string CurveCode,long UpdateUserID,DateTime UpdateTime)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Updateable<Entity.PumpCurve>()
|
.SetColumns(x => x.CurveCode == CurveCode)
|
.SetColumns(x=>x.UpdateUserID==UpdateUserID)
|
.SetColumns(x=>x.UpdateTime==UpdateTime)
|
.Where(x => x.CorpID == CorpID && x.ID == ID)
|
.ExecuteCommand() > 0;
|
}
|
}
|
|
/// <summary>
|
/// 更新曲线来源
|
/// </summary>
|
public bool UpdateSourceFrom(long CorpID, long ID, int SourceFrom, long UpdateUserID, DateTime UpdateTime)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Updateable<Entity.PumpCurve>()
|
.SetColumns(x => x.SourceFrom == SourceFrom)
|
.SetColumns(x => x.UpdateUserID == UpdateUserID)
|
.SetColumns(x => x.UpdateTime == UpdateTime)
|
.Where(x => x.CorpID == CorpID && x.ID == ID).ExecuteCommand() > 0;
|
}
|
}
|
|
/// <summary>
|
/// 更新创建方法
|
/// </summary>
|
public bool UpdateCreateMethod(long CorpID, long ID, int CreateMethod, long UpdateUserID, DateTime UpdateTime)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Updateable<Entity.PumpCurve>()
|
.SetColumns(x => x.CreateMethod == CreateMethod)
|
.SetColumns(x => x.UpdateUserID == UpdateUserID)
|
.SetColumns(x => x.UpdateTime == UpdateTime)
|
.Where(x => x.CorpID == CorpID && x.ID == ID).ExecuteCommand() > 0;
|
}
|
}
|
|
/// <summary>
|
/// 更新曲线信息
|
/// </summary>
|
public bool UpdateCurveInfo(long CorpID, long ID, string CurveInfo, long UpdateUserID, DateTime UpdateTime)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Updateable<Entity.PumpCurve>()
|
.SetColumns(x => x.CurveInfo == CurveInfo)
|
.SetColumns(x => x.UpdateUserID == UpdateUserID)
|
.SetColumns(x => x.UpdateTime == UpdateTime)
|
.Where(x => x.CorpID == CorpID && x.ID == ID).ExecuteCommand() > 0;
|
}
|
}
|
|
/// <summary>
|
/// 更新点信息
|
/// </summary>
|
public bool UpdatePointInfo(long CorpID, long ID, string PointInfo, long UpdateUserID, DateTime UpdateTime)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Updateable<Entity.PumpCurve>()
|
.SetColumns(x => x.PointInfo == PointInfo)
|
.SetColumns(x => x.UpdateUserID == UpdateUserID)
|
.SetColumns(x => x.UpdateTime == UpdateTime)
|
.Where(x => x.CorpID == CorpID && x.ID == ID).ExecuteCommand() > 0;
|
}
|
}
|
|
/// <summary>
|
/// 更新坐标参数
|
/// </summary>
|
public bool UpdateCoordParas(long CorpID, long ID, string CoordParas, long UpdateUserID, DateTime UpdateTime)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Updateable<Entity.PumpCurve>()
|
.SetColumns(x => x.CoordParas == CoordParas)
|
.SetColumns(x => x.UpdateUserID == UpdateUserID)
|
.SetColumns(x => x.UpdateTime == UpdateTime)
|
.Where(x => x.CorpID == CorpID && x.ID == ID).ExecuteCommand() > 0;
|
}
|
}
|
|
/// <summary>
|
/// 更新可信度
|
/// </summary>
|
public bool UpdateReliabilityStatus(long CorpID, long ID, int ReliabilityStatus, long UpdateUserID, DateTime UpdateTime)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
return db.Updateable<Entity.PumpCurve>()
|
.SetColumns(x => x.ReliabilityStatus == ReliabilityStatus)
|
.SetColumns(x => x.UpdateUserID == UpdateUserID)
|
.SetColumns(x => x.UpdateTime == UpdateTime)
|
.Where(x => x.CorpID == CorpID && x.ID == ID).ExecuteCommand() > 0;
|
}
|
}
|
|
/// <summary>
|
/// 通过 ID 删除 同时删除映射
|
/// </summary>
|
public bool DeleteWithMappingByID(long CorpID, long ID)
|
{
|
using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
|
{
|
try
|
{
|
db.BeginTran();
|
var bol = db.Deleteable<Entity.PumpCurve>().Where(x => x.CorpID == CorpID && x.ID == ID).ExecuteCommand() > 0;
|
if (!bol)
|
{
|
db.RollbackTran();
|
return default;
|
}
|
db.Deleteable<Entity.PumpCurveMapping>().Where(x => x.CorpID == CorpID && x.CurveID == ID).ExecuteCommand();
|
db.CommitTran();
|
return true;
|
}
|
catch
|
{
|
db.RollbackTran();
|
throw;
|
}
|
}
|
}
|
|
|
}
|
}
|