| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using System.Web.UI.WebControls; | 
					
						
							|  |  |  |  | using System.Collections; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace BLL | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     /// <summary> | 
					
						
							|  |  |  |  |     /// 工种表 | 
					
						
							|  |  |  |  |     /// </summary> | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |     public static class PostService | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |     { | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         public static Model.SGGLDB db = Funs.DB; | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 记录数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private static int count | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get; | 
					
						
							|  |  |  |  |             set; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取分页列表 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="postName"></param> | 
					
						
							|  |  |  |  |         /// <param name="startRowIndex"></param> | 
					
						
							|  |  |  |  |         /// <param name="maximumRows"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static IEnumerable GetListData(string postName, int startRowIndex, int maximumRows) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             IQueryable<Model.Base_Post> q = from x in db.Base_Post orderby x.PostName select x; | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(postName)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 q = q.Where(e => e.PostName.Contains(postName)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             count = q.Count(); | 
					
						
							|  |  |  |  |             if (count == 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return new object[] { "" }; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return from x in q.Skip(startRowIndex).Take(maximumRows) | 
					
						
							|  |  |  |  |                    select new | 
					
						
							|  |  |  |  |                    { | 
					
						
							|  |  |  |  |                        x.PostId, | 
					
						
							|  |  |  |  |                        x.PostName, | 
					
						
							|  |  |  |  |                        x.Remark | 
					
						
							|  |  |  |  |                    }; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取分页列表数 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="postName"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static int GetListCount(string postName) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return count; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据主键获取岗位信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="postId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static Model.Base_Post GetPostById(string postId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return Funs.DB.Base_Post.FirstOrDefault(e => e.PostId == postId); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         public static string GetPostNameById(string postId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string name = string.Empty; | 
					
						
							|  |  |  |  |             var q = Funs.DB.Base_Post.FirstOrDefault(e => e.PostId == postId); | 
					
						
							|  |  |  |  |             if (q != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 name = q.PostName; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return name; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 添加工种信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="post"></param> | 
					
						
							|  |  |  |  |         public static void AddPost(Model.Base_Post post) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  |             Model.Base_Post newPost = new Model.Base_Post(); | 
					
						
							|  |  |  |  |             newPost.PostId = post.PostId; | 
					
						
							|  |  |  |  |             newPost.PostName = post.PostName; | 
					
						
							|  |  |  |  |             newPost.Remark = post.Remark; | 
					
						
							|  |  |  |  |             db.Base_Post.InsertOnSubmit(newPost); | 
					
						
							|  |  |  |  |             db.SubmitChanges(); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 修改工种信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="post"></param> | 
					
						
							|  |  |  |  |         public static void UpdatePost(Model.Base_Post post) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  |             Model.Base_Post newPost = db.Base_Post.FirstOrDefault(e => e.PostId == post.PostId); | 
					
						
							|  |  |  |  |             if (newPost != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 newPost.PostName = post.PostName; | 
					
						
							|  |  |  |  |                 newPost.Remark = post.Remark; | 
					
						
							|  |  |  |  |                 db.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-24 19:04:32 +08:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据主键删除工种信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="postId"></param> | 
					
						
							|  |  |  |  |         public static void DeletePost(string postId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Model.SGGLDB db = Funs.DB; | 
					
						
							|  |  |  |  |             Model.Base_Post newPost = db.Base_Post.FirstOrDefault(e => e.PostId == postId); | 
					
						
							|  |  |  |  |             if (newPost != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 db.Base_Post.DeleteOnSubmit(newPost); | 
					
						
							|  |  |  |  |                 db.SubmitChanges(); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         ///  获取工种名称项 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="projectId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static ListItem[] drpPostNameItemList() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var q = (from x in Funs.DB.Base_Post orderby x.PostName select x).ToList(); | 
					
						
							|  |  |  |  |             ListItem[] list = new ListItem[q.Count()]; | 
					
						
							|  |  |  |  |             for (int i = 0; i < list.Count(); i++) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 list[i] = new ListItem(q[i].PostName ?? "", q[i].PostId); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return list; | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void InitPostDownList(FineUIPro.DropDownList dropName, bool isShowPlease) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             dropName.DataValueField = "Value"; | 
					
						
							|  |  |  |  |             dropName.DataTextField = "Text"; | 
					
						
							|  |  |  |  |             dropName.DataSource = drpPostNameItemList(); | 
					
						
							|  |  |  |  |             dropName.DataBind(); | 
					
						
							|  |  |  |  |             if (isShowPlease) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Funs.FineUIPleaseSelect(dropName); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |