197 lines
		
	
	
		
			7.2 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			197 lines
		
	
	
		
			7.2 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Text; | |||
|  | using System.Threading.Tasks; | |||
|  | 
 | |||
|  | namespace BLL | |||
|  | { | |||
|  |    public static  class GJSXService | |||
|  |     { | |||
|  |         public static Model.SGGLDB db = Funs.DB; | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键获取信息 | |||
|  |         /// </summary> | |||
|  |         /// <param name="groupId"></param> | |||
|  |         /// <returns></returns> | |||
|  |         public static Model.GJSX GetGJSXById(string _GJSXID) | |||
|  |         { | |||
|  |             return Funs.DB.GJSX.FirstOrDefault(e => e.GJSXID == _GJSXID); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 添加 | |||
|  |         /// </summary> | |||
|  |         /// <param name="?"></param> | |||
|  |         public static void AddGJSX(Model.GJSX _GJSX) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             Model.GJSX newGJSX = new Model.GJSX | |||
|  |             { | |||
|  |                     GJSXID = _GJSX.GJSXID, | |||
|  |                     Detail = _GJSX.Detail, | |||
|  |                     UserID = _GJSX.UserID, | |||
|  |                     CreateDate = _GJSX.CreateDate, | |||
|  |                     User_ReceiveID = _GJSX.User_ReceiveID, | |||
|  |                     CNProfessional_ID = _GJSX.CNProfessional_ID, | |||
|  |                     ProjectId = _GJSX.ProjectId, | |||
|  |                     UnitId = _GJSX.UnitId, | |||
|  |                     CloseDate = _GJSX.CloseDate, | |||
|  |                     State = _GJSX.State, | |||
|  |                     QuestionTypeID = _GJSX.QuestionTypeID, | |||
|  |                     IsManypeople = _GJSX.IsManypeople, | |||
|  |                     CompleteDate = _GJSX.CompleteDate, | |||
|  |                     AttachUrl = _GJSX.AttachUrl, | |||
|  |                     User_Acceptance = _GJSX.User_Acceptance | |||
|  |             }; | |||
|  | 
 | |||
|  |             db.GJSX.InsertOnSubmit(newGJSX); | |||
|  |             db.SubmitChanges(); | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 修改 | |||
|  |         /// </summary> | |||
|  |         /// <param name="teamGroup"></param> | |||
|  |         public static void UpdateGJSX(Model.GJSX _GJSX) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             Model.GJSX newGJSX = db.GJSX.FirstOrDefault(e => e.GJSXID == _GJSX.GJSXID); | |||
|  |             if (newGJSX != null) | |||
|  |             { | |||
|  |                 newGJSX.GJSXID = _GJSX.GJSXID; | |||
|  |                 newGJSX.Detail = _GJSX.Detail; | |||
|  |                 newGJSX.UserID = _GJSX.UserID; | |||
|  |                 newGJSX.CreateDate = _GJSX.CreateDate; | |||
|  |                 newGJSX.User_ReceiveID = _GJSX.User_ReceiveID; | |||
|  |                 newGJSX.CNProfessional_ID = _GJSX.CNProfessional_ID; | |||
|  |                 newGJSX.ProjectId = _GJSX.ProjectId; | |||
|  |                 newGJSX.UnitId = _GJSX.UnitId; | |||
|  |                 newGJSX.CloseDate = _GJSX.CloseDate; | |||
|  |                 newGJSX.State = _GJSX.State; | |||
|  |                 newGJSX.QuestionTypeID = _GJSX.QuestionTypeID; | |||
|  |                 newGJSX.IsManypeople = _GJSX.IsManypeople; | |||
|  |                 newGJSX.CompleteDate = _GJSX.CompleteDate; | |||
|  |                 newGJSX.AttachUrl = _GJSX.AttachUrl; | |||
|  |                 newGJSX.User_Acceptance = _GJSX.User_Acceptance; | |||
|  |                 db.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 根据主键删除信息 | |||
|  |         /// </summary> | |||
|  |         /// <param name="_GJSXID"></param> | |||
|  |         public static void DeleteGJSXById(string _GJSXID) | |||
|  |         { | |||
|  |             Model.SGGLDB db = Funs.DB; | |||
|  |             Model.GJSX _GJSX = db.GJSX.FirstOrDefault(e => e.GJSXID == _GJSXID); | |||
|  |             { | |||
|  |                 db.GJSX.DeleteOnSubmit(_GJSX); | |||
|  |                 db.SubmitChanges(); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         private static int count; | |||
|  |          | |||
|  |         public static System.Collections.IEnumerable GetListData(string projectId) | |||
|  |         { | |||
|  |             IQueryable<Model.GJSX> q =GetGJSXList().AsQueryable(); | |||
|  | 
 | |||
|  |               | |||
|  |             if (!string.IsNullOrEmpty(projectId)) | |||
|  |             { | |||
|  |                 q = q.Where(e => e.ProjectId == projectId); | |||
|  |             } | |||
|  |   | |||
|  | 
 | |||
|  |             count = q.Count(); | |||
|  |             if (count == 0) | |||
|  |             { | |||
|  |                 return new object[] { "" }; | |||
|  |             } | |||
|  |             return from x in q | |||
|  |                    select new | |||
|  |                    { | |||
|  |                        x.GJSXID, | |||
|  |                        x.Detail, | |||
|  |                        tcr = (from y in db.Sys_User where y.UserId == x.UserID select y.UserName).First(), | |||
|  |                        x.CreateDate, | |||
|  |                        zrr = (from y in db.Sys_User where y.UserId == x.UserID select y.UserName).First(), | |||
|  |                        regipient = x.GJSXID, | |||
|  |                        qrr = (from y in db.Sys_User where y.UserId == x.UserID select y.UserName).First(), | |||
|  |                        sjqrr = (from y in db.Sys_User where y.UserId == x.UserID select y.UserName).First(), | |||
|  |                        x.CNProfessional_ID, | |||
|  |                        AffprojectId = (from y in db.Base_Project where y.ProjectId == x.ProjectId select y.ProjectName).First(), | |||
|  |                        unit = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(), | |||
|  |                        x.CloseDate, | |||
|  |                        x.State, | |||
|  |                        x.QuestionTypeID, | |||
|  |                        x.CompleteDate, | |||
|  |                        x.AttachUrl, | |||
|  |                        x.User_Acceptance | |||
|  |                        //Acceptance = (from y in db.Sys_User where y.UserId == x.Acceptance select y.UserName).FirstOrDefault() | |||
|  |                    }; | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 获取问题下拉项 | |||
|  |         /// </summary> | |||
|  |         /// <returns></returns> | |||
|  |         public static List<Model.GJSX> GetGJSXList() | |||
|  |         { | |||
|  |             var list = (from x in Funs.DB.GJSX orderby x.QuestionTypeID select x).ToList(); | |||
|  |             return list; | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         ///  类型表下拉框 | |||
|  |         /// </summary> | |||
|  |         /// <param name="dropName">下拉框名字</param> | |||
|  |         /// <param name="isShowPlease">是否显示请选择</param> | |||
|  |         public static void InitQuestionTypeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease) | |||
|  |         { | |||
|  |             dropName.DataValueField = "GJSXID"; | |||
|  |             dropName.DataTextField = "QuestionTypeName"; | |||
|  |             dropName.DataSource = GetGJSXList(); | |||
|  |             dropName.DataBind(); | |||
|  |             if (isShowPlease) | |||
|  |             { | |||
|  |                 Funs.FineUIPleaseSelect(dropName); | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         //public static Model.GJSX GetQuestionTypeByName(string name) | |||
|  |         //{ | |||
|  |         //    return Funs.DB.GJSX.FirstOrDefault(e => e.QuestionTypeName == name); | |||
|  |         //} | |||
|  |         ///// <summary> | |||
|  |         ///// 根据工程类别获取专项方案类别下拉项 | |||
|  |         ///// </summary> | |||
|  |         ///// <returns></returns> | |||
|  |         //public static List<Model.GJSX> GetQuestionTypeByTempleteList(string ProjectId) | |||
|  |         //{ | |||
|  |         //    var list = (from x in Funs.DB.GJSX where x.ProjectId == ProjectId orderby x.QuestionTypeCode select x).ToList(); | |||
|  |         //    return list; | |||
|  |         //} | |||
|  | 
 | |||
|  |         ///// <summary> | |||
|  |         /////  类型表下拉框 | |||
|  |         ///// </summary> | |||
|  |         ///// <param name="dropName">下拉框名字</param> | |||
|  |         ///// <param name="isShowPlease">是否显示请选择</param> | |||
|  |         //public static void InitQuestionTypeByTempleteDropDownList(FineUIPro.DropDownList dropName, string ProjectId, bool isShowPlease) | |||
|  |         //{ | |||
|  |         //    dropName.DataValueField = "GJSXID"; | |||
|  |         //    dropName.DataTextField = "QuestionTypeName"; | |||
|  |         //    dropName.DataSource = GetQuestionTypeByTempleteList(ProjectId); | |||
|  |         //    dropName.DataBind(); | |||
|  |         //    if (isShowPlease) | |||
|  |         //    { | |||
|  |         //        Funs.FineUIPleaseSelect(dropName); | |||
|  |         //    } | |||
|  |         //} | |||
|  |     } | |||
|  | } |