110 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			110 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			C#
		
	
	
	
using System.Collections.Generic;
 | 
						|
using System.Linq;
 | 
						|
 | 
						|
namespace BLL
 | 
						|
{
 | 
						|
    /// <summary>
 | 
						|
    /// 开工前检查明细表
 | 
						|
    /// </summary>
 | 
						|
    public static class Check_CheckWorkDetailService
 | 
						|
    {
 | 
						|
        /// <summary>
 | 
						|
        /// 根据开工前检查id获取所有相关明细信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="CheckRectifyId"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static List<Model.Check_CheckWorkDetail> GetCheckWorkDetailByCheckWorkId(string checkWorkId)
 | 
						|
        {
 | 
						|
            return (from x in Funs.DB.Check_CheckWorkDetail where x.CheckWorkId == checkWorkId select x).ToList();
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据主键获取开工前检查明细信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="checkWorkDetailId"></param>
 | 
						|
        /// <returns></returns>
 | 
						|
        public static Model.Check_CheckWorkDetail GetCheckWorkDetailByCheckWorkDetailId(string checkWorkDetailId)
 | 
						|
        {
 | 
						|
            return Funs.DB.Check_CheckWorkDetail.FirstOrDefault(e => e.CheckWorkDetailId == checkWorkDetailId);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 增加开工前检查明细信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="checkWorkDetail"></param>
 | 
						|
        public static void AddCheckWorkDetail(Model.Check_CheckWorkDetail checkWorkDetail)
 | 
						|
        {
 | 
						|
            Model.Check_CheckWorkDetail newCheckWorkDetail = new Model.Check_CheckWorkDetail
 | 
						|
            {
 | 
						|
                CheckWorkDetailId = checkWorkDetail.CheckWorkDetailId,
 | 
						|
                CheckWorkId = checkWorkDetail.CheckWorkId,
 | 
						|
                CheckItem = checkWorkDetail.CheckItem,
 | 
						|
                CheckResult = checkWorkDetail.CheckResult,
 | 
						|
                CheckOpinion = checkWorkDetail.CheckOpinion,
 | 
						|
                CheckStation = checkWorkDetail.CheckStation,
 | 
						|
                HandleResult = checkWorkDetail.HandleResult,
 | 
						|
                CheckContent = checkWorkDetail.CheckContent,
 | 
						|
                WorkArea = checkWorkDetail.WorkArea,
 | 
						|
                SortIndex = checkWorkDetail.SortIndex,
 | 
						|
            };
 | 
						|
            Funs.DB.Check_CheckWorkDetail.InsertOnSubmit(newCheckWorkDetail);
 | 
						|
            Funs.DB.SubmitChanges();
 | 
						|
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 修改开工前检查明细信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="CheckWorkDetail"></param>
 | 
						|
        public static void UpdateCheckWorkDetail(Model.Check_CheckWorkDetail CheckWorkDetail)
 | 
						|
        {
 | 
						|
            var newCheckWorkDetail = Funs.DB.Check_CheckWorkDetail.FirstOrDefault(x => x.CheckWorkDetailId == CheckWorkDetail.CheckWorkDetailId);
 | 
						|
            if (newCheckWorkDetail != null)
 | 
						|
            {
 | 
						|
                newCheckWorkDetail.CheckResult = CheckWorkDetail.CheckResult;
 | 
						|
                newCheckWorkDetail.CheckOpinion = CheckWorkDetail.CheckOpinion;
 | 
						|
                newCheckWorkDetail.CheckStation = CheckWorkDetail.CheckStation;
 | 
						|
                newCheckWorkDetail.HandleResult = CheckWorkDetail.HandleResult;
 | 
						|
                newCheckWorkDetail.CheckContent = CheckWorkDetail.CheckContent;
 | 
						|
                newCheckWorkDetail.WorkArea = CheckWorkDetail.WorkArea;
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据开工前检查ID删除所有开工前检查明细信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="checkWorkId"></param>
 | 
						|
        public static void DeleteCheckWorkDetails(string checkWorkId)
 | 
						|
        {
 | 
						|
            var q = (from x in Funs.DB.Check_CheckWorkDetail where x.CheckWorkId == checkWorkId select x).ToList();
 | 
						|
            if (q != null)
 | 
						|
            {
 | 
						|
                foreach (var item in q)
 | 
						|
                {
 | 
						|
                    ////删除附件表
 | 
						|
                    BLL.CommonService.DeleteAttachFileById(item.CheckWorkDetailId);
 | 
						|
                }
 | 
						|
                Funs.DB.Check_CheckWorkDetail.DeleteAllOnSubmit(q);
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// 根据开工前检查ID删除一条开工前检查明细信息
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="checkWorkDetailId"></param>
 | 
						|
        public static void DeleteCheckWorkDetailById(string checkWorkDetailId)
 | 
						|
        {
 | 
						|
            var q = (from x in Funs.DB.Check_CheckWorkDetail where x.CheckWorkDetailId == checkWorkDetailId select x).FirstOrDefault();
 | 
						|
            if (q != null)
 | 
						|
            {
 | 
						|
                ////删除附件表
 | 
						|
                BLL.CommonService.DeleteAttachFileById(q.CheckWorkDetailId);
 | 
						|
                Funs.DB.Check_CheckWorkDetail.DeleteOnSubmit(q);
 | 
						|
                Funs.DB.SubmitChanges();
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |