93 lines
2.8 KiB
C#
93 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 证件存储
|
|
/// </summary>
|
|
public class HSSESystem_CertificateService
|
|
{
|
|
public static bool Insert(Model.HSSESystem_Certificate model)
|
|
{
|
|
try
|
|
{
|
|
Funs.DB.HSSESystem_Certificate.InsertOnSubmit(model);
|
|
Funs.DB.SubmitChanges();
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog($"插入数据失败,原因:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static bool Update(Model.HSSESystem_Certificate model)
|
|
{
|
|
try
|
|
{
|
|
var result = Funs.DB.HSSESystem_Certificate.FirstOrDefault(a => a.Id == model.Id);
|
|
if (result != null)
|
|
{
|
|
result.Name = model.Name;
|
|
result.CreateTime = model.CreateTime;
|
|
result.FileContents = model.FileContents;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog($"更新表数据失败,原因:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static bool Delete(List<string> newId)
|
|
{
|
|
try
|
|
{
|
|
var result = Funs.DB.HSSESystem_Certificate.Where(a => newId.Contains(a.Id)).ToList();
|
|
if (result.Count > 0)
|
|
{
|
|
Funs.DB.HSSESystem_Certificate.DeleteAllOnSubmit(result);
|
|
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.HSSESystem_Certificate.Where(a => a.Id == newId).ToList();
|
|
if (result.Count > 0)
|
|
{
|
|
Funs.DB.HSSESystem_Certificate.DeleteAllOnSubmit(result);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog($"删除数据失败,原因:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static Model.HSSESystem_Certificate Detail(string newId)
|
|
{
|
|
var result = Funs.DB.HSSESystem_Certificate.FirstOrDefault(a => a.Id == newId);
|
|
return result;
|
|
}
|
|
}
|
|
}
|