163 lines
		
	
	
		
			6.3 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			163 lines
		
	
	
		
			6.3 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | using System.Threading.Tasks; | |||
|  | 
 | |||
|  | namespace BLL | |||
|  | { | |||
|  |     public class PerformanceService | |||
|  |     { | |||
|  |         /// <summary> | |||
|  |         /// 根据年月删除 | |||
|  |         /// </summary> | |||
|  |         /// <param name="CreateDateMonth"></param> | |||
|  |         public static void Delete(string Gid) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             List<Model.CQMS_Performance> list = db.CQMS_Performance.Where(e => e.PerformanceGid == Gid).ToList(); | |||
|  |             if (list.Count > 0) | |||
|  |             { | |||
|  |                 ///删除主表记录 | |||
|  |                 db.CQMS_Performance.DeleteAllOnSubmit(list); | |||
|  | 
 | |||
|  |                 //删除子表1数据 | |||
|  |                 var child1List = db.CQMS_Performance_Child1.Where(x => x.PerformanceGid == Gid).ToList(); | |||
|  |                 if (child1List.Count > 0) | |||
|  |                 { | |||
|  |                     //删除子表2数据 | |||
|  |                     var child2List = db.CQMS_Performance_Child2.Where(x => x.PerformanceGid == Gid).ToList(); | |||
|  |                     if (child2List.Count > 0) | |||
|  |                     { | |||
|  |                         //删除子表3数据 | |||
|  |                         var child3List = db.CQMS_Performance_Child3.Where(x => x.PerformanceGid == Gid).ToList(); | |||
|  |                         if (child3List.Count > 0) | |||
|  |                         { | |||
|  |                             db.CQMS_Performance_Child3.DeleteAllOnSubmit(child3List); | |||
|  |                         } | |||
|  |                         db.CQMS_Performance_Child2.DeleteAllOnSubmit(child2List); | |||
|  |                     } | |||
|  |                     db.CQMS_Performance_Child1.DeleteAllOnSubmit(child1List); | |||
|  |                 } | |||
|  |                 db.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改每周计划 | |||
|  |         /// </summary> | |||
|  |         /// <param name="model"></param> | |||
|  |         public static void UpdateChild2(Model.CQMS_Performance_Child2 model) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             var NewModel = db.CQMS_Performance_Child2.FirstOrDefault(x => x.Performance_ChildGid2 == model.Performance_ChildGid2); | |||
|  |             NewModel.TaskCompletContent = model.TaskCompletContent; | |||
|  |             db.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 用户下拉框 | |||
|  |         /// </summary> | |||
|  |         /// <param name="dropName">下拉框名字</param> | |||
|  |         /// <param name="projectId">项目id</param> | |||
|  |         /// <param name="isShowPlease">是否显示请选择</param> | |||
|  |         public static void InitUserDropDownList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease) | |||
|  |         { | |||
|  |             dropName.DataValueField = "CreateMan"; | |||
|  |             dropName.DataTextField = "CreateManName"; | |||
|  |             dropName.DataSource = GetProjectUserListByProjectId(projectId); | |||
|  |             dropName.DataBind(); | |||
|  |             if (isShowPlease) | |||
|  |             { | |||
|  |                 Funs.FineUIPleaseSelect(dropName); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 用户下拉框 | |||
|  |         /// </summary> | |||
|  |         /// <param name="dropName">下拉框名字</param> | |||
|  |         /// <param name="projectId">项目id</param> | |||
|  |         /// <param name="isShowPlease">是否显示请选择</param> | |||
|  |         public static void InitUserDropDownListByUser(FineUIPro.DropDownList dropName, string projectId,string userId, bool isShowPlease) | |||
|  |         { | |||
|  |             dropName.DataValueField = "CreateMan"; | |||
|  |             dropName.DataTextField = "CreateManName"; | |||
|  |             dropName.DataSource = GetProjectUserListByProjectId(projectId, userId); | |||
|  |             dropName.DataBind(); | |||
|  |             if (isShowPlease) | |||
|  |             { | |||
|  |                 Funs.FineUIPleaseSelect(dropName); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         public static void InitAllUserDropDownList(FineUIPro.DropDownList dropName,  bool isShowPlease) | |||
|  |         { | |||
|  |             dropName.DataValueField = "CreateMan"; | |||
|  |             dropName.DataTextField = "CreateManName"; | |||
|  |             dropName.DataSource = GetProjectAllUserListByProjectId(); | |||
|  |             dropName.DataBind(); | |||
|  |             if (isShowPlease) | |||
|  |             { | |||
|  |                 Funs.FineUIPleaseSelect(dropName); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         public class PerformanceUser { | |||
|  |             public string CreateMan { get; set; } | |||
|  | 
 | |||
|  |             public string CreateManName { get; set; } | |||
|  |         } | |||
|  | 
 | |||
|  |         public static List<PerformanceUser> GetProjectUserListByProjectId(string projectId) { | |||
|  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { | |||
|  |                 var list = (from x in db.CQMS_Performance | |||
|  |                             join y in db.Sys_User on x.CreateMan equals y.UserId | |||
|  |                             where x.ProjectId==projectId && x.States=="1" | |||
|  |                             select new PerformanceUser | |||
|  |                             { | |||
|  |                                 CreateMan=x.CreateMan, | |||
|  |                                 CreateManName=BLL.UserService.GetUserByUserId(x.CreateMan).UserName | |||
|  |                             }).ToList(); | |||
|  |                 return list; | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         public static List<PerformanceUser> GetProjectUserListByProjectId(string projectId,string userId) | |||
|  |         { | |||
|  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | |||
|  |             { | |||
|  |                 var list = (from x in db.CQMS_Performance | |||
|  |                             join y in db.Sys_User on x.CreateMan equals y.UserId | |||
|  |                             where x.ProjectId == projectId && x.States == "1" && x.ScorMan== userId | |||
|  |                             select new PerformanceUser | |||
|  |                             { | |||
|  |                                 CreateMan = x.CreateMan, | |||
|  |                                 CreateManName = BLL.UserService.GetUserByUserId(x.CreateMan).UserName | |||
|  |                             }).ToList(); | |||
|  |                 return list; | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         public static List<PerformanceUser> GetProjectAllUserListByProjectId() | |||
|  |         { | |||
|  |             using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) | |||
|  |             { | |||
|  |                 var list = (from x in db.CQMS_Performance | |||
|  |                             join y in db.Sys_User on x.CreateMan equals y.UserId | |||
|  |                             where x.States == "1" | |||
|  |                             select new PerformanceUser | |||
|  |                             { | |||
|  |                                 CreateMan = x.CreateMan, | |||
|  |                                 CreateManName = BLL.UserService.GetUserByUserId(x.CreateMan).UserName | |||
|  |                             }).Distinct().ToList(); | |||
|  |                  | |||
|  |                 return list; | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |     } | |||
|  | } |