CNCEC_SUBQHSE_WUHUAN/SGGL/BLL/CQMS/ManageReport/ThisWeekOrMonthContentServi...

65 lines
2.5 KiB
C#
Raw Normal View History

2021-04-30 10:28:37 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
/// <summary>
/// 本周主要工作内容
/// </summary>
public static class ThisWeekOrMonthContentService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 根据主键获取本周主要工作内容
/// </summary>
/// <param name="thisWeekOrMonthContentId"></param>
/// <returns></returns>
public static Model.Report_ThisWeekOrMonthContent GetThisWeekOrMonthContentById(string thisWeekOrMonthContentId)
{
return Funs.DB.Report_ThisWeekOrMonthContent.FirstOrDefault(e => e.ContentId == thisWeekOrMonthContentId);
}
/// <summary>
/// 根据周报表Id获取相关本周主要工作内容
/// </summary>
/// <param name="reportId"></param>
/// <returns></returns>
public static List<Model.Report_ThisWeekOrMonthContent> GetThisWeekOrMonthContentByReportId(string reportId)
{
return (from x in Funs.DB.Report_ThisWeekOrMonthContent where x.ReportId == reportId select x).ToList();
}
/// <summary>
/// 添加本周主要工作内容
/// </summary>
/// <param name="thisWeekOrMonthContent"></param>
public static void AddThisWeekOrMonthContent(Model.Report_ThisWeekOrMonthContent thisWeekOrMonthContent)
{
Model.SGGLDB db = Funs.DB;
Model.Report_ThisWeekOrMonthContent newThisWeekOrMonthContent = new Model.Report_ThisWeekOrMonthContent();
newThisWeekOrMonthContent.ContentId = thisWeekOrMonthContent.ContentId;
newThisWeekOrMonthContent.ReportId = thisWeekOrMonthContent.ReportId;
newThisWeekOrMonthContent.Contents = thisWeekOrMonthContent.Contents;
db.Report_ThisWeekOrMonthContent.InsertOnSubmit(newThisWeekOrMonthContent);
db.SubmitChanges();
}
/// <summary>
/// 根据周报Id删除所有相关本周主要工作内容
/// </summary>
/// <param name="reportId"></param>
public static void DeleteThisWeekOrMonthContentByReportId(string reportId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.Report_ThisWeekOrMonthContent where x.ReportId == reportId select x).ToList();
if (q.Count() > 0)
{
db.Report_ThisWeekOrMonthContent.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
}