80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
public class LeaderCheckService
|
|
{
|
|
public static bool Insert(Model.Report_LeaderCheck model)
|
|
{
|
|
try
|
|
{
|
|
Funs.DB.Report_LeaderCheck.InsertOnSubmit(model);
|
|
Funs.DB.SubmitChanges();
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog($"插入数据失败,原因:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static bool Update(Model.Report_LeaderCheck model)
|
|
{
|
|
try
|
|
{
|
|
var result = Funs.DB.Report_LeaderCheck.FirstOrDefault(a => a.Id == model.Id);
|
|
if (result != null)
|
|
{
|
|
result.Unitid = model.Unitid;
|
|
result.Months = model.Months;
|
|
result.States = model.States;
|
|
result.ProjectId = model.ProjectId;
|
|
|
|
result.CLeaders = model.CLeaders;
|
|
result.BLeaders = model.BLeaders;
|
|
result.CheckDate = model.CheckDate;
|
|
result.Hiddendangers = model.Hiddendangers;
|
|
result.CloseDate = model.CloseDate;
|
|
result.CloseType = model.CloseType;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog($"更新表数据失败,原因:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static bool Delete(string newId)
|
|
{
|
|
try
|
|
{
|
|
var result = Funs.DB.Report_LeaderCheck.Where(a => a.Id == newId).ToList();
|
|
if (result.Count > 0)
|
|
{
|
|
Funs.DB.Report_LeaderCheck.DeleteAllOnSubmit(result);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog($"删除数据失败,原因:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static Model.Report_LeaderCheck Detail(string newId)
|
|
{
|
|
var result = Funs.DB.Report_LeaderCheck.FirstOrDefault(a => a.Id == newId);
|
|
return result;
|
|
}
|
|
}
|
|
}
|