76 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			76 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Threading.Tasks;
 | |
| 
 | |
| namespace BLL
 | |
| {
 | |
|     /// <summary>
 | |
|     /// 检验批表格库
 | |
|     /// </summary>
 | |
|     public static class InspectionLotService
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// 根据主键获取检验批信息
 | |
|         /// </summary>
 | |
|         /// <param name="generalPlanApprovalId"></param>
 | |
|         /// <returns></returns>
 | |
|         public static Model.CQMS_DataBase_InspectionLot GetInspectionLotById(string inspectionLotId)
 | |
|         {
 | |
|             return Funs.DB.CQMS_DataBase_InspectionLot.FirstOrDefault(e => e.InspectionLotId == inspectionLotId);
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 添加检验批信息
 | |
|         /// </summary>
 | |
|         /// <param name="inspectionLot"></param>
 | |
|         public static void AddInspectionLot(Model.CQMS_DataBase_InspectionLot inspectionLot)
 | |
|         {
 | |
|             Model.CQMS_DataBase_InspectionLot newInspectionLot = new Model.CQMS_DataBase_InspectionLot();
 | |
|             newInspectionLot.InspectionLotId = inspectionLot.InspectionLotId;
 | |
|             newInspectionLot.CNProfessionalId = inspectionLot.CNProfessionalId;
 | |
|             newInspectionLot.InspectionLotName = inspectionLot.InspectionLotName;
 | |
|             newInspectionLot.CNProfessionaType = inspectionLot.CNProfessionaType;
 | |
|             newInspectionLot.FileUpload = inspectionLot.FileUpload;
 | |
| 
 | |
|             Funs.DB.CQMS_DataBase_InspectionLot.InsertOnSubmit(newInspectionLot);
 | |
|             Funs.DB.SubmitChanges();
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 修改检验批信息
 | |
|         /// </summary>
 | |
|         /// <param name="generalPlanApproval"></param>
 | |
|         public static void UpdateInspectionLot(Model.CQMS_DataBase_InspectionLot inspectionLot)
 | |
|         {
 | |
|             Model.CQMS_DataBase_InspectionLot newInspectionLot = Funs.DB.CQMS_DataBase_InspectionLot.FirstOrDefault(e => e.InspectionLotId == inspectionLot.InspectionLotId);
 | |
|             if (newInspectionLot != null)
 | |
|             {
 | |
|                 newInspectionLot.CNProfessionalId = inspectionLot.CNProfessionalId;
 | |
|                 newInspectionLot.InspectionLotName = inspectionLot.InspectionLotName;
 | |
|                 newInspectionLot.CNProfessionaType = inspectionLot.CNProfessionaType;
 | |
|                 newInspectionLot.FileUpload = inspectionLot.FileUpload;
 | |
|                 Funs.DB.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 根据主键删除检验批信息
 | |
|         /// </summary>
 | |
|         /// <param name="generalPlanApprovalId"></param>
 | |
|         public static void DeleteInspectionLotById(string inspectionLotId)
 | |
|         {
 | |
|             Model.CQMS_DataBase_InspectionLot inspectionLot = Funs.DB.CQMS_DataBase_InspectionLot.FirstOrDefault(e => e.InspectionLotId == inspectionLotId);
 | |
|             if (inspectionLot != null)
 | |
|             {
 | |
|                 if (!string.IsNullOrEmpty(inspectionLot.FileUpload))
 | |
|                 {
 | |
|                     BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, inspectionLot.FileUpload);//删除附件
 | |
|                 }
 | |
|                 Funs.DB.CQMS_DataBase_InspectionLot.DeleteOnSubmit(inspectionLot);
 | |
|                 Funs.DB.SubmitChanges();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| } |