69 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			69 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | 
 | |||
|  | namespace BLL | |||
|  | { | |||
|  |     /// <summary> | |||
|  |     /// 下周质量控制重点 | |||
|  |     /// </summary> | |||
|  |     public static class NextQualityControlService | |||
|  |     { | |||
|  |         public static Model.SGGLDB db = Funs.DB; | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键获取下周质量控制点 | |||
|  |         /// </summary> | |||
|  |         /// <param name="nextQualityControlId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.Report_NextQualityControl GetNextQualityControlById(string nextQualityControlId) | |||
|  |         { | |||
|  |             return Funs.DB.Report_NextQualityControl.FirstOrDefault(e => e.NextQualityControlId == nextQualityControlId); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据周(月)报Id获取相关下周质量控制点 | |||
|  |         /// </summary> | |||
|  |         /// <param name="reportId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static List<Model.Report_NextQualityControl> GetNextQualityControlByReportId(string reportId) | |||
|  |         { | |||
|  |             return (from x in Funs.DB.Report_NextQualityControl | |||
|  |                     where x.ReportId == reportId | |||
|  |                     select | |||
|  |                         x).ToList(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 添加下周质量控制点 | |||
|  |         /// </summary> | |||
|  |         /// <param name="nextQualityControl"></param> | |||
|  |         public static void AddNextQualityControl(Model.Report_NextQualityControl nextQualityControl) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             Model.Report_NextQualityControl newNextQualityControl = new Model.Report_NextQualityControl(); | |||
|  |             newNextQualityControl.NextQualityControlId = nextQualityControl.NextQualityControlId; | |||
|  |             newNextQualityControl.ReportId = nextQualityControl.ReportId; | |||
|  |             newNextQualityControl.NextQualityControlContent = nextQualityControl.NextQualityControlContent; | |||
|  |             db.Report_NextQualityControl.InsertOnSubmit(newNextQualityControl); | |||
|  |             db.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据周(月)报Id删除下周质量控制点 | |||
|  |         /// </summary> | |||
|  |         /// <param name="reportId"></param> | |||
|  |         public static void DeleteNextQualityControlByReportId(string reportId) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             var q = (from x in db.Report_NextQualityControl where x.ReportId == reportId select x).ToList(); | |||
|  |             if (q.Count() > 0) | |||
|  |             { | |||
|  |                 db.Report_NextQualityControl.DeleteAllOnSubmit(q); | |||
|  |                 db.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |