| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using System.Collections; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace BLL | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     /// <summary> | 
					
						
							|  |  |  |  |     /// 设计图纸清单 | 
					
						
							|  |  |  |  |     /// </summary> | 
					
						
							|  |  |  |  |     public static class DesignDrawingsService | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         public static Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 记录数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public static int count | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get; | 
					
						
							|  |  |  |  |             set; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取分页列表 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="projectId"></param> | 
					
						
							|  |  |  |  |         /// <param name="startRowIndex"></param> | 
					
						
							|  |  |  |  |         /// <param name="maximumRows"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static IEnumerable GetListData(string projectId, string cnProfessionalId, string startDate, string endDate, string sendstartDate, string sendendDate, int startRowIndex, int maximumRows) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             IQueryable<Model.Comprehensive_DesignDrawings> q = from x in db.Comprehensive_DesignDrawings | 
					
						
							|  |  |  |  |                                                                where x.ProjectId == projectId | 
					
						
							|  |  |  |  |                                                                orderby x.RemarkCode | 
					
						
							|  |  |  |  |                                                                select x; | 
					
						
							|  |  |  |  |             if (cnProfessionalId != "0") | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 q = q.Where(e => e.CNProfessionalId == cnProfessionalId); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(startDate)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 q = q.Where(e => e.ReceiveDate >= Funs.GetNewDateTime(startDate)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(endDate)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 q = q.Where(e => e.ReceiveDate <= Funs.GetNewDateTime(endDate)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(sendstartDate)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 q = q.Where(e => e.SendDate >= Funs.GetNewDateTime(sendstartDate)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(sendendDate)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 q = q.Where(e => e.SendDate <= Funs.GetNewDateTime(sendendDate)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             count = q.Count(); | 
					
						
							|  |  |  |  |             if (count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return new object[] { }; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return from x in q.Skip(startRowIndex).Take(maximumRows) | 
					
						
							|  |  |  |  |                    select new | 
					
						
							| 
									
										
										
										
											2024-10-09 09:03:19 +08:00
										 |  |  |  |                    {  | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                        x.DesignDrawingsId, | 
					
						
							|  |  |  |  |                        x.ProjectId, | 
					
						
							|  |  |  |  |                        x.CNProfessionalId, | 
					
						
							|  |  |  |  |                        ProfessionalName = (from y in db.Base_CNProfessional where y.CNProfessionalId == x.CNProfessionalId select y.ProfessionalName).FirstOrDefault(), | 
					
						
							|  |  |  |  |                        x.DesignDrawingsCode, | 
					
						
							|  |  |  |  |                        UnitWorkName = x.UnitWorkId != null ? BLL.UnitWorkService.GetUnitWorkName(x.UnitWorkId) : null, | 
					
						
							|  |  |  |  |                        x.DesignDrawingsContent, | 
					
						
							|  |  |  |  |                        x.Edition, | 
					
						
							|  |  |  |  |                        x.PageNumber, | 
					
						
							|  |  |  |  |                        x.ReceiveDate, | 
					
						
							|  |  |  |  |                        x.SendDate, | 
					
						
							|  |  |  |  |                        ReceiveUnits = BLL.UnitService.getUnitNamesUnitIds(x.ReceiveUnits), | 
					
						
							|  |  |  |  |                        x.ReceiveMan, | 
					
						
							|  |  |  |  |                        x.Remark | 
					
						
							|  |  |  |  |                    }; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取分页列表数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="projectId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static int GetListCount(string projectId, string cnProfessionalId, string startDate, string endDate, string sendstartDate, string sendendDate) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return count; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据主键获取设计图纸清单 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="designDrawingsId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static Model.Comprehensive_DesignDrawings GetDesignDrawingsById(string designDrawingsId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return Funs.DB.Comprehensive_DesignDrawings.FirstOrDefault(e => e.DesignDrawingsId == designDrawingsId); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 添加设计图纸清单 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="designDrawings"></param> | 
					
						
							|  |  |  |  |         public static void AddDesignDrawings(Model.Comprehensive_DesignDrawings designDrawings) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  |             Model.Comprehensive_DesignDrawings newDesignDrawings = new Model.Comprehensive_DesignDrawings(); | 
					
						
							|  |  |  |  |             newDesignDrawings.DesignDrawingsId = designDrawings.DesignDrawingsId; | 
					
						
							|  |  |  |  |             newDesignDrawings.ProjectId = designDrawings.ProjectId; | 
					
						
							|  |  |  |  |             newDesignDrawings.CNProfessionalId = designDrawings.CNProfessionalId; | 
					
						
							|  |  |  |  |             newDesignDrawings.DesignDrawingsCode = designDrawings.DesignDrawingsCode; | 
					
						
							|  |  |  |  |             newDesignDrawings.DesignDrawingsContent = designDrawings.DesignDrawingsContent; | 
					
						
							|  |  |  |  |             newDesignDrawings.Edition = designDrawings.Edition; | 
					
						
							|  |  |  |  |             newDesignDrawings.PageNumber = designDrawings.PageNumber; | 
					
						
							|  |  |  |  |             newDesignDrawings.ReceiveDate = designDrawings.ReceiveDate; | 
					
						
							|  |  |  |  |             newDesignDrawings.SendDate = designDrawings.SendDate; | 
					
						
							|  |  |  |  |             newDesignDrawings.ReceiveUnits = designDrawings.ReceiveUnits; | 
					
						
							|  |  |  |  |             newDesignDrawings.ReceiveMan = designDrawings.ReceiveMan; | 
					
						
							|  |  |  |  |             newDesignDrawings.Remark = designDrawings.Remark; | 
					
						
							|  |  |  |  |             newDesignDrawings.RemarkCode = designDrawings.RemarkCode; | 
					
						
							|  |  |  |  |             newDesignDrawings.UnitWorkId = designDrawings.UnitWorkId; | 
					
						
							| 
									
										
										
										
											2023-04-28 17:46:41 +08:00
										 |  |  |  |             newDesignDrawings.CompileMan = designDrawings.CompileMan; | 
					
						
							|  |  |  |  |             newDesignDrawings.Status = designDrawings.Status; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             db.Comprehensive_DesignDrawings.InsertOnSubmit(newDesignDrawings); | 
					
						
							|  |  |  |  |             db.SubmitChanges(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 修改设计图纸清单 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="designDrawings"></param> | 
					
						
							|  |  |  |  |         public static void UpdateDesignDrawings(Model.Comprehensive_DesignDrawings designDrawings) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  |             Model.Comprehensive_DesignDrawings newDesignDrawings = db.Comprehensive_DesignDrawings.FirstOrDefault(e => e.DesignDrawingsId == designDrawings.DesignDrawingsId); | 
					
						
							|  |  |  |  |             if (newDesignDrawings != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 newDesignDrawings.ProjectId = designDrawings.ProjectId; | 
					
						
							|  |  |  |  |                 newDesignDrawings.CNProfessionalId = designDrawings.CNProfessionalId; | 
					
						
							|  |  |  |  |                 newDesignDrawings.DesignDrawingsCode = designDrawings.DesignDrawingsCode; | 
					
						
							|  |  |  |  |                 newDesignDrawings.DesignDrawingsContent = designDrawings.DesignDrawingsContent; | 
					
						
							|  |  |  |  |                 newDesignDrawings.Edition = designDrawings.Edition; | 
					
						
							|  |  |  |  |                 newDesignDrawings.PageNumber = designDrawings.PageNumber; | 
					
						
							|  |  |  |  |                 newDesignDrawings.ReceiveDate = designDrawings.ReceiveDate; | 
					
						
							|  |  |  |  |                 newDesignDrawings.SendDate = designDrawings.SendDate; | 
					
						
							|  |  |  |  |                 newDesignDrawings.ReceiveUnits = designDrawings.ReceiveUnits; | 
					
						
							|  |  |  |  |                 newDesignDrawings.ReceiveMan = designDrawings.ReceiveMan; | 
					
						
							|  |  |  |  |                 newDesignDrawings.Remark = designDrawings.Remark; | 
					
						
							|  |  |  |  |                 newDesignDrawings.RemarkCode = designDrawings.RemarkCode; | 
					
						
							|  |  |  |  |                 newDesignDrawings.UnitWorkId = designDrawings.UnitWorkId; | 
					
						
							| 
									
										
										
										
											2023-04-28 17:46:41 +08:00
										 |  |  |  |                 newDesignDrawings.Status = designDrawings.Status; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 db.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据主键删除设计图纸清单 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="designDrawingsId"></param> | 
					
						
							|  |  |  |  |         public static void DeleteDesignDrawingsById(string designDrawingsId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  |             Model.Comprehensive_DesignDrawings designDrawings = db.Comprehensive_DesignDrawings.FirstOrDefault(e => e.DesignDrawingsId == designDrawingsId); | 
					
						
							|  |  |  |  |             if (designDrawings != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 db.Comprehensive_DesignDrawings.DeleteOnSubmit(designDrawings); | 
					
						
							|  |  |  |  |                 db.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |