68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
|
using Model;
|
|||
|
using NPOI.HSSF.EventUserModel;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace BLL
|
|||
|
{
|
|||
|
public class WelderTestService
|
|||
|
{
|
|||
|
public bool Add(Model.Welder_TestInfo input)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var model = new Model.Welder_TestInfo();
|
|||
|
model.Id = SQLHelper.GetNewID(typeof(Welder_TestInfo));
|
|||
|
model.WeldMethod = input.WeldMethod;
|
|||
|
model.MaterialId = input.MaterialId;
|
|||
|
model.Remark = input.Remark;
|
|||
|
model.CreatedDate = input.CreatedDate;
|
|||
|
model.IsPass = input.IsPass;
|
|||
|
Funs.DB.Welder_TestInfo.InsertOnSubmit(model);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
return true;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ErrLogInfo.WriteLog(ex, "添加焊工考试错误");
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
public bool Edit(Model.Welder_TestInfo input)
|
|||
|
{
|
|||
|
var result=Funs.DB.Welder_TestInfo.FirstOrDefault(t=>t.Id== input.Id);
|
|||
|
if (result == null)
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
result.WeldMethod = input.WeldMethod;
|
|||
|
result.MaterialId = input.MaterialId;
|
|||
|
result.Remark = input.Remark;
|
|||
|
result.CreatedDate = input.CreatedDate;
|
|||
|
result.IsPass = input.IsPass;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
return true;
|
|||
|
}
|
|||
|
public Model.Welder_TestInfo Get(string Id)
|
|||
|
{
|
|||
|
var result = Funs.DB.Welder_TestInfo.FirstOrDefault(t => t.Id == Id);
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public bool Delete(string Id)
|
|||
|
{
|
|||
|
var result = Funs.DB.Welder_TestInfo.FirstOrDefault(t => t.Id == Id);
|
|||
|
if (result == null)
|
|||
|
return false;
|
|||
|
|
|||
|
Funs.DB.Welder_TestInfo.DeleteOnSubmit(result);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|