| | |
| | | using System.Runtime.InteropServices; |
| | | using System.IO; |
| | | using WIDESEAWCS_DTO.Telescopic; |
| | | using System.Reflection.PortableExecutable; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | |
| | | namespace WIDESEAWCS_SystemServices |
| | | { |
| | |
| | | public WebResponseContent DeleteUserData(string account) |
| | | { |
| | | try |
| | | |
| | | { |
| | | |
| | | // 2. æ¥è¯¢äººè¸åºåç» ID |
| | |
| | | try |
| | | { |
| | | int totalCount = 0; |
| | | var Role = _RoleServer.Db.Queryable<Sys_Role>(); |
| | | var query = Role.InnerJoin<Sys_User>((a, b) => a.RoleId == b.Role_Id); |
| | | //var Role = _RoleServer.Db.Queryable<Sys_Role>(); |
| | | //var query = Role.InnerJoin<Sys_User>((a, b) => a.RoleId == b.Role_Id) |
| | | // .InnerJoin<Sys_UserFace>((a, b, c) => b.UserName == c.UserName); |
| | | |
| | | var User = BaseDal.Db.Queryable<Sys_User>(); //æ¥åºç¨æ·è¡¨ |
| | | var query = User.LeftJoin<Sys_UserFace>((a, b) => a.UserName == b.UserName); |
| | | |
| | | |
| | | //æç´¢å
³é®å |
| | | if (!string.IsNullOrEmpty(pagination.searchKeyword)) |
| | | { |
| | | query = query.Where((a, b) => |
| | | b.UserName.Contains(pagination.searchKeyword) || |
| | | b.UserTrueName.Contains(pagination.searchKeyword) || |
| | | b.PhoneNo.Contains(pagination.searchKeyword) || |
| | | a.UserName.Contains(pagination.searchKeyword) || |
| | | a.UserTrueName.Contains(pagination.searchKeyword) || |
| | | a.PhoneNo.Contains(pagination.searchKeyword) || |
| | | a.RoleName.Contains(pagination.searchKeyword)); |
| | | } |
| | | //æ¶é´æ¥è¯¢ |
| | | if (pagination.startDate.HasValue && pagination.endDate.HasValue) |
| | | { |
| | | query = query.Where((a, b) => b.CreateDate >= pagination.startDate.Value && b.CreateDate <= pagination.endDate.Value); |
| | | query = query.Where((a, b) => a.CreateDate >= pagination.startDate.Value && a.CreateDate <= pagination.endDate.Value); |
| | | } |
| | | //æåº |
| | | if (!string.IsNullOrEmpty(pagination.sortField)) |
| | |
| | | { |
| | | |
| | | |
| | | "CreateDate" => isAcs ? query.OrderBy((a, b) => b.CreateDate) : query.OrderByDescending((a, b) => b.CreateDate), |
| | | "CreateDate" => isAcs ? query.OrderBy((a, b) => a.CreateDate) : query.OrderByDescending((a, b) => a.CreateDate), |
| | | |
| | | _ => query.OrderByDescending((a, b) => b.Creater) // é»è®¤æå建æ¶é´éåº |
| | | _ => query.OrderByDescending((a, b) => a.Creater) // é»è®¤æå建æ¶é´éåº |
| | | }; |
| | | |
| | | } |
| | | else |
| | | { |
| | | query = query.OrderByDescending((a, b) => b.Creater); |
| | | query = query.OrderByDescending((a, b) => a.Creater); |
| | | } |
| | | var reslut = query.Select((a, b) => new |
| | | { |
| | | b.User_Id, |
| | | b.UserName, |
| | | b.UserTrueName, |
| | | b.Unit, |
| | | b.Userteam, |
| | | b.Role_Id, |
| | | b.IsLeader, |
| | | //b.RoleName, |
| | | b.CardNumber, |
| | | b.PhoneNo, |
| | | b.UserPwd, |
| | | b.DeptName, |
| | | b.Dept_Id, |
| | | b.Email, |
| | | b.Enable, |
| | | b.Gender, |
| | | b.HeadImageUrl, |
| | | b.Address, |
| | | b.CreateDate, |
| | | b.Creater, |
| | | a.User_Id, |
| | | a.UserName, |
| | | a.UserTrueName, |
| | | a.Unit, |
| | | a.Userteam, |
| | | a.Role_Id, |
| | | a.IsLeader, |
| | | a.CardNumber, |
| | | a.PhoneNo, |
| | | a.UserPwd, |
| | | a.DeptName, |
| | | a.Dept_Id, |
| | | a.Email, |
| | | a.Enable, |
| | | a.Gender, |
| | | //b.HeadImageUrl, |
| | | b.UserFaceImageName, |
| | | a.Address, |
| | | a.CreateDate, |
| | | a.Creater, |
| | | a.RoleName, |
| | | |
| | | }).ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount); |
| | |
| | | return new WebResponseContent { Status = false, Message = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¹éå é¤ |
| | | /// </summary> |
| | | /// <param name="keys">ç¨æ·id</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent DelUserList(int[] keys) |
| | | { |
| | | WebResponseContent webResponse=new WebResponseContent(); |
| | | foreach (int key in keys) |
| | | { |
| | | var user = BaseDal.QueryData(x => x.User_Id == key).FirstOrDefault(); |
| | | if (user == null) |
| | | { |
| | | return webResponse.Error("æ²¡ææ¾å°è¯¥ç¨æ·"); |
| | | } |
| | | var main = _MainServer.QueryData(x => x.UserAccount == user.UserName).FirstOrDefault(); |
| | | |
| | | BaseDal.DeleteData(user); |
| | | _MainServer.DeleteData(main); |
| | | } |
| | | |
| | | return webResponse.OK(); |
| | | } |
| | | } |
| | | } |