96 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			96 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using System.Collections;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace BLL
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public class ReviewDrawingsService
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        public static bool Insert(Model.Comprehensive_ReviewDrawings model)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Funs.DB.Comprehensive_ReviewDrawings.InsertOnSubmit(model);
							 | 
						|||
| 
								 | 
							
								                Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								                return true;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception ex)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ErrLogInfo.WriteLog($"插入数据失败,原因:{ex.Message}");
							 | 
						|||
| 
								 | 
							
								                return false;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static bool Update(Model.Comprehensive_ReviewDrawings model)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var result = Funs.DB.Comprehensive_ReviewDrawings.FirstOrDefault(a => a.Id == model.Id);
							 | 
						|||
| 
								 | 
							
								                if (result != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    result.CNProfessionalId = model.CNProfessionalId;
							 | 
						|||
| 
								 | 
							
								                    result.DraCode = model.DraCode;
							 | 
						|||
| 
								 | 
							
								                    result.ReviewDate = model.ReviewDate;
							 | 
						|||
| 
								 | 
							
								                    result.UnitWorkId = model.UnitWorkId;
							 | 
						|||
| 
								 | 
							
								                    result.ReceiveUnits = model.ReceiveUnits;
							 | 
						|||
| 
								 | 
							
								                    result.Status = model.Status;
							 | 
						|||
| 
								 | 
							
								                    result.Remarks = model.Remarks;
							 | 
						|||
| 
								 | 
							
								                    Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                return true;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception ex)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ErrLogInfo.WriteLog($"更新表数据失败,原因:{ex.Message}");
							 | 
						|||
| 
								 | 
							
								                return false;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static bool Delete(List<string> newId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var result = Funs.DB.Comprehensive_ReviewDrawings.Where(a => newId.Contains(a.Id)).ToList();
							 | 
						|||
| 
								 | 
							
								                if (result.Count > 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Funs.DB.Comprehensive_ReviewDrawings.DeleteAllOnSubmit(result);
							 | 
						|||
| 
								 | 
							
								                    Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                return true;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception ex)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ErrLogInfo.WriteLog($"删除数据失败,原因:{ex.Message}");
							 | 
						|||
| 
								 | 
							
								                return false;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static bool Delete(string newId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            try
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                var result = Funs.DB.Comprehensive_ReviewDrawings.Where(a => a.Id == newId).ToList();
							 | 
						|||
| 
								 | 
							
								                if (result.Count > 0)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Funs.DB.Comprehensive_ReviewDrawings.DeleteAllOnSubmit(result);
							 | 
						|||
| 
								 | 
							
								                    Funs.DB.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                return true;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            catch (Exception ex)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ErrLogInfo.WriteLog($"删除数据失败,原因:{ex.Message}");
							 | 
						|||
| 
								 | 
							
								                return false;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        public static Model.Comprehensive_ReviewDrawings Detail(string newId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var result = Funs.DB.Comprehensive_ReviewDrawings.FirstOrDefault(a => a.Id == newId);
							 | 
						|||
| 
								 | 
							
								            return result;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |