using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class DrillSortCService
{
public static Model.SGGLDB db = Funs.DB;
///
/// 根据月报告主键获取所有月报告应急演练信息
///
/// 月报告主键
///
public static List GetDrillSortsByMonthReportId(string monthReportId)
{
return (from x in Funs.DB.Manager_DrillSortC where x.MonthReportId == monthReportId orderby x.SortIndex select x).ToList();
}
///
/// 增加月报告应急演练信息
///
/// 月报告应急演练实体
public static void AddDrillSort(Model.Manager_DrillSortC checkSort)
{
Model.SGGLDB db = Funs.DB;
string newKeyID = SQLHelper.GetNewID(typeof(Model.Manager_DrillSortC));
Model.Manager_DrillSortC newDrillSort = new Model.Manager_DrillSortC
{
DrillSortId = newKeyID,
MonthReportId = checkSort.MonthReportId,
SortIndex = checkSort.SortIndex,
DrillContent = checkSort.DrillContent,
DrillDate = checkSort.DrillDate,
JointUnit = checkSort.JointUnit,
JoinPerson = checkSort.JoinPerson
};
db.Manager_DrillSortC.InsertOnSubmit(newDrillSort);
db.SubmitChanges();
}
///
/// 根据月报告主键删除对应的所有月报告应急演练信息
///
/// 月报告主键
public static void DeleteDrillSortsByMonthReportId(string monthReportId)
{
var q = (from x in db.Manager_DrillSortC where x.MonthReportId == monthReportId select x).ToList();
db.Manager_DrillSortC.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}