using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public static class TrainCService
{
private static Model.SGGLDB db = Funs.DB;
///
/// 根据月报Id获取HSSE培训
///
///
///
public static List GetTrainByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_Month_TrainC where x.MonthReportId == monthReportId orderby x.SortIndex select x).ToList();
}
///
/// 添加HSSE培训
///
///
public static void AddTrain(Model.Manager_Month_TrainC train)
{
Model.SGGLDB db = Funs.DB;
Model.Manager_Month_TrainC newTrain = new Model.Manager_Month_TrainC
{
TrainId = SQLHelper.GetNewID(typeof(Model.Manager_Month_TrainC)),
MonthReportId = train.MonthReportId,
TrainName = train.TrainName,
TrainMan = train.TrainMan,
TrainDate = train.TrainDate,
TrainObject = train.TrainObject,
Remark = train.Remark,
SortIndex = train.SortIndex
};
db.Manager_Month_TrainC.InsertOnSubmit(newTrain);
db.SubmitChanges();
}
///
/// 根据月报Id删除HSSE培训
///
///
public static void DeleteTrainByMonthReportId(string monthReportId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.Manager_Month_TrainC where x.MonthReportId == monthReportId select x).ToList();
if (q != null)
{
db.Manager_Month_TrainC.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
}