106 lines
3.5 KiB
C#
106 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 工程创优报备
|
|
/// </summary>
|
|
public class ReportPreparationService
|
|
{
|
|
public static bool Insert(Model.Project_ReportPreparation model)
|
|
{
|
|
try
|
|
{
|
|
Funs.DB.Project_ReportPreparation.InsertOnSubmit(model);
|
|
Funs.DB.SubmitChanges();
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog($"插入数据失败,原因:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static bool Update(Model.Project_ReportPreparation model)
|
|
{
|
|
try
|
|
{
|
|
var result = Funs.DB.Project_ReportPreparation.FirstOrDefault(a => a.Id == model.Id);
|
|
if (result != null)
|
|
{
|
|
result.ProjectScale = model.ProjectScale;
|
|
result.StartTime = model.StartTime;
|
|
result.EndTime = model.EndTime;
|
|
result.AwardsName = model.AwardsName;
|
|
result.AwardsUnit = model.AwardsUnit;
|
|
result.AwardsLevel = model.AwardsLevel;
|
|
result.CreateTime = model.CreateTime;
|
|
result.NodePlan = model.NodePlan;
|
|
result.Progress = model.Progress;
|
|
result.AwardsPersonName = model.AwardsPersonName;
|
|
result.PersonPhone = model.PersonPhone;
|
|
result.UnitPersonName = model.UnitPersonName;
|
|
result.UnitPersonName = model.UnitPersonName;
|
|
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.Project_ReportPreparation.Where(a => newId.Contains(a.Id)).ToList();
|
|
if (result.Count > 0)
|
|
{
|
|
Funs.DB.Project_ReportPreparation.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.Project_ReportPreparation.Where(a => a.Id == newId).ToList();
|
|
if (result.Count > 0)
|
|
{
|
|
Funs.DB.Project_ReportPreparation.DeleteAllOnSubmit(result);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ErrLogInfo.WriteLog($"删除数据失败,原因:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static Model.Project_ReportPreparation Detail(string newId)
|
|
{
|
|
var result = Funs.DB.Project_ReportPreparation.FirstOrDefault(a => a.Id == newId);
|
|
return result;
|
|
}
|
|
}
|
|
}
|