using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
   public static class DCGLCheckRectifyService
    {
        /// 
        /// 根据整改ID获取督查检查信息
        /// 
        /// 
        /// 
        public static Model.DCGL_Check_CheckRectify GetCheckRectifyByCheckRectifyId(string checkRectifyId)
        {
            return Funs.DB.DCGL_Check_CheckRectify.FirstOrDefault(e => e.CheckRectifyId == checkRectifyId);
        }
        /// 
        /// 添加督查检查整改
        /// 
        /// 
        public static void AddCheckRectify(Model.DCGL_Check_CheckRectify checkRectify)
        {
            Model.DCGL_Check_CheckRectify newCheckRectify = new Model.DCGL_Check_CheckRectify
            {
                CheckRectifyId = checkRectify.CheckRectifyId,
                CheckRectifyCode = checkRectify.CheckRectifyCode,
                ProjectId = checkRectify.ProjectId,
                UnitId = checkRectify.UnitId,
                CheckDate = checkRectify.CheckDate,
                IssueMan = checkRectify.IssueMan,
                IssueDate = checkRectify.IssueDate,
                HandleState = checkRectify.HandleState
            };
            Funs.DB.DCGL_Check_CheckRectify.InsertOnSubmit(newCheckRectify);
            Funs.DB.SubmitChanges();
        }
        /// 
        /// 修改督查检查整改
        /// 
        /// 
        public static void UpdateCheckRectify(Model.DCGL_Check_CheckRectify checkRectify)
        {
            Model.DCGL_Check_CheckRectify newCheckRectify = Funs.DB.DCGL_Check_CheckRectify.FirstOrDefault(e => e.CheckRectifyId == checkRectify.CheckRectifyId);
            if (newCheckRectify != null)
            {
                newCheckRectify.CheckRectifyCode = checkRectify.CheckRectifyCode;
                newCheckRectify.ProjectId = checkRectify.ProjectId;
                newCheckRectify.UnitId = checkRectify.UnitId;
                newCheckRectify.CheckDate = checkRectify.CheckDate;
                newCheckRectify.IssueMan = checkRectify.IssueMan;
                newCheckRectify.IssueDate = checkRectify.IssueDate;
                newCheckRectify.HandleState = checkRectify.HandleState;
                Funs.DB.SubmitChanges();
            }
        }
    }
}