using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
    public class TestRunMonthSummaryReportService
    {
        /// 
        /// 根据主键获取开车月技术总结
        /// 
        /// 
        /// 
        public static Model.ZHGL_TestRunMonthSummaryReport GetTestRunMonthSummaryReportById(string TestRunMonthSummaryReportId)
        {
            return Funs.DB.ZHGL_TestRunMonthSummaryReport.FirstOrDefault(e => e.TestRunMonthSummaryReportId == TestRunMonthSummaryReportId);
        }
        /// 
        /// 添加开车月技术总结
        /// 
        /// 
        public static void AddTestRunMonthSummaryReport(Model.ZHGL_TestRunMonthSummaryReport TestRunMonthSummaryReport)
        {
            Model.SGGLDB db = Funs.DB;
            Model.ZHGL_TestRunMonthSummaryReport newTestRunMonthSummaryReport = new Model.ZHGL_TestRunMonthSummaryReport
            {
                TestRunMonthSummaryReportId = TestRunMonthSummaryReport.TestRunMonthSummaryReportId,
                Year = TestRunMonthSummaryReport.Year,
                UserId = TestRunMonthSummaryReport.UserId,
                CompileMan = TestRunMonthSummaryReport.CompileMan,
                CompileDate = TestRunMonthSummaryReport.CompileDate
            };
            db.ZHGL_TestRunMonthSummaryReport.InsertOnSubmit(newTestRunMonthSummaryReport);
            db.SubmitChanges();
        }
        /// 
        /// 修改开车月技术总结
        /// 
        /// 
        public static void UpdateTestRunMonthSummaryReport(Model.ZHGL_TestRunMonthSummaryReport TestRunMonthSummaryReport)
        {
            Model.SGGLDB db = Funs.DB;
            Model.ZHGL_TestRunMonthSummaryReport newTestRunMonthSummaryReport = db.ZHGL_TestRunMonthSummaryReport.FirstOrDefault(e => e.TestRunMonthSummaryReportId == TestRunMonthSummaryReport.TestRunMonthSummaryReportId);
            if (newTestRunMonthSummaryReport != null)
            {
                newTestRunMonthSummaryReport.Year = TestRunMonthSummaryReport.Year;
                newTestRunMonthSummaryReport.UserId = TestRunMonthSummaryReport.UserId;
                newTestRunMonthSummaryReport.CompileMan = TestRunMonthSummaryReport.CompileMan;
                newTestRunMonthSummaryReport.CompileDate = TestRunMonthSummaryReport.CompileDate;
                db.SubmitChanges();
            }
        }
        /// 
        /// 根据主键删除开车月技术总结
        /// 
        /// 
        public static void DeleteTestRunMonthSummaryReportById(string TestRunMonthSummaryReportId)
        {
            Model.SGGLDB db = Funs.DB;
            Model.ZHGL_TestRunMonthSummaryReport TestRunMonthSummaryReport = db.ZHGL_TestRunMonthSummaryReport.FirstOrDefault(e => e.TestRunMonthSummaryReportId == TestRunMonthSummaryReportId);
            if (TestRunMonthSummaryReport != null)
            {
                db.ZHGL_TestRunMonthSummaryReport.DeleteOnSubmit(TestRunMonthSummaryReport);
                db.SubmitChanges();
            }
        }
    }
}