183 lines
		
	
	
		
			8.6 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			183 lines
		
	
	
		
			8.6 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace BLL
 | |
| {
 | |
|     public class InspectionManagementDetailService
 | |
|     {
 | |
|         public static Model.SUBQHSEDB db = Funs.DB;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 获取共检记录明细
 | |
|         /// </summary>
 | |
|         /// <param name="satartRowIndex"></param>
 | |
|         /// <param name="maximumRows"></param>
 | |
|         /// <returns></returns>
 | |
|         public static IEnumerable getListData(string InspectionId)
 | |
|         {
 | |
|             return from x in db.ProcessControl_InspectionManagementDetail
 | |
|                    where x.InspectionId == InspectionId
 | |
|                    select new
 | |
|                    {
 | |
|                        x.InspectionDetailId,
 | |
|                        x.InspectionId,
 | |
|                        x.UnitWorkId,
 | |
|                        x.Branch,
 | |
|                        x.ControlPointType,
 | |
|                    };
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 添加共检记录明细
 | |
|         /// </summary>
 | |
|         /// <param name="InspectionDetail"></param>
 | |
|         public static void AddInspectionDetail(Model.ProcessControl_InspectionManagementDetail InspectionDetail)
 | |
|         {
 | |
|             Model.SUBQHSEDB db = Funs.DB;
 | |
|             Model.ProcessControl_InspectionManagementDetail newInspectionDetail = new Model.ProcessControl_InspectionManagementDetail();
 | |
|             newInspectionDetail.InspectionDetailId = InspectionDetail.InspectionDetailId;
 | |
|             newInspectionDetail.InspectionId = InspectionDetail.InspectionId;
 | |
|             newInspectionDetail.UnitWorkId = InspectionDetail.UnitWorkId;
 | |
|             newInspectionDetail.Branch = InspectionDetail.Branch;
 | |
|             newInspectionDetail.ControlPointType = InspectionDetail.ControlPointType;
 | |
|             newInspectionDetail.CreateDate = InspectionDetail.CreateDate;
 | |
| 
 | |
|             db.ProcessControl_InspectionManagementDetail.InsertOnSubmit(newInspectionDetail);
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
|         public static void AddInspectionDetailForApi(Model.ProcessControl_InspectionManagementDetail InspectionDetail)
 | |
|         {
 | |
|             using (var db = new Model.SUBQHSEDB(Funs.ConnString))
 | |
|             {
 | |
|                 Model.ProcessControl_InspectionManagementDetail newInspectionDetail = new Model.ProcessControl_InspectionManagementDetail();
 | |
|                 newInspectionDetail.InspectionDetailId = InspectionDetail.InspectionDetailId;
 | |
|                 newInspectionDetail.InspectionId = InspectionDetail.InspectionId;
 | |
|                 newInspectionDetail.UnitWorkId = InspectionDetail.UnitWorkId;
 | |
|                 newInspectionDetail.Branch = InspectionDetail.Branch;
 | |
|                 newInspectionDetail.ControlPointType = InspectionDetail.ControlPointType;
 | |
|                 newInspectionDetail.CreateDate = InspectionDetail.CreateDate;
 | |
| 
 | |
|                 db.ProcessControl_InspectionManagementDetail.InsertOnSubmit(newInspectionDetail);
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
|         /// <summary>
 | |
|         /// 修改共检记录明细
 | |
|         /// </summary>
 | |
|         /// <param name="InspectionDetail"></param>
 | |
|         public static void UpdateInspectionDetail(Model.ProcessControl_InspectionManagementDetail InspectionDetail)
 | |
|         {
 | |
|             Model.SUBQHSEDB db = Funs.DB;
 | |
|             Model.ProcessControl_InspectionManagementDetail newInspectionDetail = db.ProcessControl_InspectionManagementDetail.First(e => e.InspectionDetailId == InspectionDetail.InspectionDetailId);
 | |
|             newInspectionDetail.UnitWorkId = InspectionDetail.UnitWorkId;
 | |
|             newInspectionDetail.Branch = InspectionDetail.Branch;
 | |
|             newInspectionDetail.ControlPointType = InspectionDetail.ControlPointType;
 | |
|             newInspectionDetail.CreateDate = InspectionDetail.CreateDate;
 | |
| 
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据共检记录明细Id删除一个共检记录信息明细
 | |
|         /// </summary>
 | |
|         /// <param name="InspectionDetailId"></param>
 | |
|         public static void DeleteInspectionDetail(string InspectionDetailId)
 | |
|         {
 | |
|             Model.SUBQHSEDB db = Funs.DB;
 | |
|             Model.ProcessControl_InspectionManagementDetail InspectionDetail = db.ProcessControl_InspectionManagementDetail.First(e => e.InspectionDetailId == InspectionDetailId);
 | |
|             db.ProcessControl_InspectionManagementDetail.DeleteOnSubmit(InspectionDetail);
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
|         public static void DeleteInspectionDetailForApi(string InspectionDetailId)
 | |
|         {
 | |
|             using (var db = new Model.SUBQHSEDB(Funs.ConnString))
 | |
|             {
 | |
|                 Model.ProcessControl_InspectionManagementDetail InspectionDetail = db.ProcessControl_InspectionManagementDetail.First(e => e.InspectionDetailId == InspectionDetailId);
 | |
|                 db.ProcessControl_InspectionManagementDetail.DeleteOnSubmit(InspectionDetail);
 | |
|                 db.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
|         /// <summary>
 | |
|         /// 根据共检记录主表删除所有共检记录信息明细
 | |
|         /// </summary>
 | |
|         /// <param name="DrawingAuditId"></param>
 | |
|         public static void DeleteAllInspectionDetail(string InspectionId)
 | |
|         {
 | |
|             Model.SUBQHSEDB db = Funs.DB;
 | |
|             var q = (from x in db.ProcessControl_InspectionManagementDetail where x.InspectionId == InspectionId select x).ToList();
 | |
|             db.ProcessControl_InspectionManagementDetail.DeleteAllOnSubmit(q);
 | |
|             db.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据共检记录明细Id获取一个共检记录信息明细
 | |
|         /// </summary>
 | |
|         /// <param name="InspectionDetailId"></param>
 | |
|         public static Model.ProcessControl_InspectionManagementDetail GetInspectionDetail(string InspectionDetailId)
 | |
|         {
 | |
|             return Funs.DB.ProcessControl_InspectionManagementDetail.FirstOrDefault(e => e.InspectionDetailId == InspectionDetailId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据共检记录Id获取一个共检记录信息明细
 | |
|         /// </summary>
 | |
|         /// <param name="InspectionDetailId"></param>
 | |
|         public static Model.ProcessControl_InspectionManagementDetail GetInspectionDetailBySoptCheckCode(string InspectionId)
 | |
|         {
 | |
|             return Funs.DB.ProcessControl_InspectionManagementDetail.FirstOrDefault(e => e.InspectionId == InspectionId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据共检记录主键获取所有共检记录信息明细
 | |
|         /// </summary>
 | |
|         /// <param name="InspectionId"></param>
 | |
|         public static List<Model.ProcessControl_InspectionManagementDetail> GetInspectionDetails(string InspectionId)
 | |
|         {
 | |
|             using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
 | |
|             {
 | |
|                 return (from x in db.ProcessControl_InspectionManagementDetail
 | |
|                         where x.InspectionId == InspectionId
 | |
|                         select x).ToList();
 | |
|             }
 | |
|         }
 | |
|         public static List<Model.ProcessControl_InspectionManagementDetail> GetInspectionDetailsForApi(string InspectionId)
 | |
|         {
 | |
|             using (var db = new Model.SUBQHSEDB(Funs.ConnString))
 | |
|             {
 | |
|                 return (from x in db.ProcessControl_InspectionManagementDetail
 | |
|                         where x.InspectionId == InspectionId
 | |
|                         select x).ToList();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据共检记录主键获取所有实体合格共检记录信息明细
 | |
|         /// </summary>
 | |
|         /// <param name="InspectionId"></param>
 | |
|         public static List<Model.ProcessControl_InspectionManagementDetail> GetOKInspectionDetails(string InspectionId)
 | |
|         {
 | |
|             using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
 | |
|             {
 | |
|                 return (from x in db.ProcessControl_InspectionManagementDetail
 | |
|                         join y in db.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
 | |
|                         where x.InspectionId == InspectionId && y.IsOnceQualified == true
 | |
|                         select x).ToList();
 | |
|             }
 | |
|         }
 | |
|         public static List<Model.ProcessControl_InspectionManagementDetail> GetOKInspectionDetailsForApi(string InspectionId)
 | |
|         {
 | |
|             using (var db = new Model.SUBQHSEDB(Funs.ConnString))
 | |
|             {
 | |
|                 return (from x in db.ProcessControl_InspectionManagementDetail
 | |
|                         join y in db.ProcessControl_InspectionManagement on x.InspectionId equals y.InspectionId
 | |
|                         where x.InspectionId == InspectionId && y.IsOnceQualified == true
 | |
|                         select x).ToList();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 |