| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using System.Threading.Tasks; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace BLL | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     /// <summary> | 
					
						
							|  |  |  |  |     /// 标准规范 | 
					
						
							|  |  |  |  |     /// </summary> | 
					
						
							|  |  |  |  |     public static class ConstructionStandardListProjectService | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据项目标准规范清单Id获取一个项目标准规范清单信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="standardCode">项目标准规范清单Id</param> | 
					
						
							|  |  |  |  |         /// <returns>一个项目标准规范清单实体</returns> | 
					
						
							|  |  |  |  |         public static Model.CQMS_Law_ConstructionStandardListProject GetConstructionStandardListProjectByStandardCode(int standardCode, string projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return Funs.DB.CQMS_Law_ConstructionStandardListProject.FirstOrDefault(x => x.StandardCode == standardCode && x.ProjectId == projectId); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 查询的项目标准规范信息的数量 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <returns>项目标准规范信息的数量</returns> | 
					
						
							|  |  |  |  |         public static int GetCountConstructionStandardListProject(string projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return (from x in Funs.DB.CQMS_Law_ConstructionStandardListProject where x.ProjectId == projectId select x).Count(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 查询最大的项目标准规范序号 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <returns>最大的项目标准规范序号</returns> | 
					
						
							|  |  |  |  |         public static int GetMaxStandardCode(string projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return (from x in Funs.DB.CQMS_Law_ConstructionStandardListProject where x.ProjectId == projectId select x.StandardCode).Max(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 增加项目标准规范清单信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="ConstructionStandardListProject">项目标准规范清单实体</param> | 
					
						
							|  |  |  |  |         public static void AddConstructionStandardListProject(Model.CQMS_Law_ConstructionStandardListProject ConstructionStandardListProject) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.CQMS_Law_ConstructionStandardListProject newConstructionStandardListProject = new Model.CQMS_Law_ConstructionStandardListProject(); | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.StandardCode = ConstructionStandardListProject.StandardCode; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.ProjectId = ConstructionStandardListProject.ProjectId; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.StandardGrade = ConstructionStandardListProject.StandardGrade; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.StandardNo = ConstructionStandardListProject.StandardNo; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.StandardName = ConstructionStandardListProject.StandardName; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.AttachUrl = ConstructionStandardListProject.AttachUrl; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.Memo = ConstructionStandardListProject.Memo; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.Status = ConstructionStandardListProject.Status; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.ImpDate = ConstructionStandardListProject.ImpDate; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.PubDate = ConstructionStandardListProject.PubDate; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.UseLevel = ConstructionStandardListProject.UseLevel; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.StandardType = ConstructionStandardListProject.StandardType; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.ReplaceStandard = ConstructionStandardListProject.ReplaceStandard; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected1 = ConstructionStandardListProject.IsSelected1; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected2 = ConstructionStandardListProject.IsSelected2; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected3 = ConstructionStandardListProject.IsSelected3; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected4 = ConstructionStandardListProject.IsSelected4; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected5 = ConstructionStandardListProject.IsSelected5; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected6 = ConstructionStandardListProject.IsSelected6; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected7 = ConstructionStandardListProject.IsSelected7; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected8 = ConstructionStandardListProject.IsSelected8; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected9 = ConstructionStandardListProject.IsSelected9; | 
					
						
							|  |  |  |  |             newConstructionStandardListProject.IsSelected10 = ConstructionStandardListProject.IsSelected10; | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |             newConstructionStandardListProject.IsChecked = ConstructionStandardListProject.IsChecked; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             Funs.DB.CQMS_Law_ConstructionStandardListProject.InsertOnSubmit(newConstructionStandardListProject); | 
					
						
							|  |  |  |  |             Funs.DB.SubmitChanges(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 修改项目标准规范清单信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="ConstructionStandardListProject">项目标准规范清单实体</param> | 
					
						
							|  |  |  |  |         public static void UpdateConstructionStandardListProject(Model.CQMS_Law_ConstructionStandardListProject ConstructionStandardListProject) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.CQMS_Law_ConstructionStandardListProject newConstructionStandardListProject = Funs.DB.CQMS_Law_ConstructionStandardListProject.FirstOrDefault(e => e.StandardCode == ConstructionStandardListProject.StandardCode && e.ProjectId == ConstructionStandardListProject.ProjectId); | 
					
						
							|  |  |  |  |             if (newConstructionStandardListProject != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.StandardGrade = ConstructionStandardListProject.StandardGrade; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.StandardNo = ConstructionStandardListProject.StandardNo; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.StandardName = ConstructionStandardListProject.StandardName; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.AttachUrl = ConstructionStandardListProject.AttachUrl; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.Memo = ConstructionStandardListProject.Memo; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.Status = ConstructionStandardListProject.Status; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.ImpDate = ConstructionStandardListProject.ImpDate; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.PubDate = ConstructionStandardListProject.PubDate; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.UseLevel = ConstructionStandardListProject.UseLevel; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.StandardType = ConstructionStandardListProject.StandardType; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.ReplaceStandard = ConstructionStandardListProject.ReplaceStandard; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected1 = ConstructionStandardListProject.IsSelected1; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected2 = ConstructionStandardListProject.IsSelected2; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected3 = ConstructionStandardListProject.IsSelected3; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected4 = ConstructionStandardListProject.IsSelected4; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected5 = ConstructionStandardListProject.IsSelected5; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected6 = ConstructionStandardListProject.IsSelected6; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected7 = ConstructionStandardListProject.IsSelected7; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected8 = ConstructionStandardListProject.IsSelected8; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected9 = ConstructionStandardListProject.IsSelected9; | 
					
						
							|  |  |  |  |                 newConstructionStandardListProject.IsSelected10 = ConstructionStandardListProject.IsSelected10; | 
					
						
							| 
									
										
										
										
											2021-08-13 11:15:59 +08:00
										 |  |  |  |                 newConstructionStandardListProject.IsChecked = ConstructionStandardListProject.IsChecked; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 Funs.DB.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据项目标准规范清单Id删除一个项目标准规范清单信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="standardCode">项目标准规范清单Id</param> | 
					
						
							|  |  |  |  |         public static void DeleteConstructionStandardListProject(int standardCode, string projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.CQMS_Law_ConstructionStandardListProject ConstructionStandardListProject = Funs.DB.CQMS_Law_ConstructionStandardListProject.First(e => e.StandardCode == standardCode && e.ProjectId == projectId); | 
					
						
							|  |  |  |  |             if (ConstructionStandardListProject != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Funs.DB.CQMS_Law_ConstructionStandardListProject.DeleteOnSubmit(ConstructionStandardListProject); | 
					
						
							|  |  |  |  |                 Funs.DB.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据项目ID删除所有标准规范 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="projectId"></param> | 
					
						
							|  |  |  |  |         public static void DeleteConstructionStandardListByProjectId(string projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var ConstructionStandardList = from x in Funs.DB.CQMS_Law_ConstructionStandardListProject where x.ProjectId == projectId select x; | 
					
						
							|  |  |  |  |             if (ConstructionStandardList != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Funs.DB.CQMS_Law_ConstructionStandardListProject.DeleteAllOnSubmit(ConstructionStandardList); | 
					
						
							|  |  |  |  |                 Funs.DB.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据项目信息获取项目标准规范标准级别列表 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="projectId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static List<string> GetStandardGradeDistinctList(string projectId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return ((from x in Funs.DB.CQMS_Law_ConstructionStandardListProject where x.ProjectId == projectId orderby x.StandardGrade select x.StandardGrade).Distinct()).ToList(); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |