using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
    /// 
    /// 企业安全文件上报
    /// 
    public static class SubUnitReportItemService
    {
        /// 
        /// 根据明细主键获取信息
        /// 
        /// 
        /// 
        public static Model.Supervise_SubUnitReportItem GetSubUnitReportItemById(string subUnitReportItemId)
        {
            return Funs.DB.Supervise_SubUnitReportItem.FirstOrDefault(e => e.SubUnitReportItemId == subUnitReportItemId);
        }
        /// 
        /// 根据企业安全文件上报Id获取明细信息
        /// 
        /// 
        /// 
        public static Model.Supervise_SubUnitReportItem GetSubUnitReportItemBySubUnitReportId(string subUnitReportId)
        {
            return Funs.DB.Supervise_SubUnitReportItem.FirstOrDefault(e => e.SubUnitReportId == subUnitReportId);
        }
        /// 
        /// 修改企业安全文件上报明细信息
        /// 
        /// 
        public static void UpdateSubUnitReportItem(Model.Supervise_SubUnitReportItem subUnitReportItem)
        {
            Model.Supervise_SubUnitReportItem newSubUnitReportItem = Funs.DB.Supervise_SubUnitReportItem.FirstOrDefault(e => e.SubUnitReportItemId == subUnitReportItem.SubUnitReportItemId);
            if (newSubUnitReportItem != null)
            {
                newSubUnitReportItem.ReportTitle = subUnitReportItem.ReportTitle;
                newSubUnitReportItem.ReportContent = subUnitReportItem.ReportContent;
                newSubUnitReportItem.AttachUrl = subUnitReportItem.AttachUrl;
                newSubUnitReportItem.ReportDate = subUnitReportItem.ReportDate;
                newSubUnitReportItem.State = subUnitReportItem.State;
                newSubUnitReportItem.UpState = subUnitReportItem.UpState;
                Funs.DB.SubmitChanges();
            }
        }
    }
}