public string GetSelectPage(int flag) { string json = ""; switch (flag) { case 1: List <Sys_User> list = this._userService.Entities(); List <List> listResult = new List <List>(); foreach (Sys_User item in list) { listResult.Add(new List { id = item.Id, desc = item.UserName }); } json = ResponseJson.Success(JsonUtil.SerializerObject(listResult), "SUCCESS"); break; default: break; } return(json); }
public string DeleteFile(string fileName) { try { //调用文件服务 ServiceFileClient.ServiceFileClient client = new ServiceFileClient.ServiceFileClient(); CustomFileInfo customFileInfo = new CustomFileInfo(); customFileInfo.NewName = fileName; customFileInfo = client.DeleteFile(customFileInfo); if (customFileInfo.State == 0) { return(ResponseJson.Success(customFileInfo, "删除成功")); } else { return(ResponseJson.Error("删除失败")); } } catch (Exception ex) { return(ResponseJson.Error(ex.Message)); } }
public string Login(UserVM form) { try { this._userService.Login(form); return(ResponseJson.Success()); } catch (BaseException ex) { _logger.Info(ex.GetMessage()); return(ResponseJson.Error(ex.GetExceptionFlag(), ex.GetMessage())); } catch (Exception ex) { _logger.Info(ex.Message); return(ResponseJson.Error(ex.Message)); } }
public string RoleEdit(UserRoleVM form, int typ = 0) { try { this._roleService.Update(form); return(ResponseJson.Success()); } catch (BaseException ex) { _logger.Info(ex.GetMessage()); return(ResponseJson.Error(ex.GetExceptionFlag(), ex.GetMessage())); } catch (Exception ex) { _logger.Info(ex.Message); return(ResponseJson.Error(ex.Message)); } }
public string PermissionEdit(PermissionVM form, int type = 0) { try { this._permissionService.Update(form); return(ResponseJson.Success()); } catch (BaseException ex) { _logger.Info(ex.GetMessage()); return(ResponseJson.Error(ex.GetExceptionFlag(), ex.GetMessage())); } catch (Exception ex) { _logger.Info(ex.Message); return(ResponseJson.Error(ex.Message)); } }
public string ModuleInsert(ModuleVM form) { try { this._moduleService.Insert(form); return(ResponseJson.Success()); } catch (BaseException ex) { _logger.Info(ex.GetMessage()); return(ResponseJson.Error(ex.GetExceptionFlag(), ex.GetMessage())); } catch (Exception ex) { _logger.Info(ex.Message); return(ResponseJson.Error(ex.Message)); } }
public string AuthorizePermission(string json) { try { List <Sys_PermissionRole> list = JsonUtil.DeserializeJsonToList <Sys_PermissionRole>(json); this._roleService.InsertPermissionRole(list); return(ResponseJson.Success()); } catch (BaseException ex) { _logger.Info(ex.GetMessage()); return(ResponseJson.Error(ex.GetExceptionFlag(), ex.GetMessage())); } catch (Exception ex) { _logger.Info(ex.Message); return(ResponseJson.Error(ex.Message)); } }
public string UserSetRolesUser(string json, int userId) { try { List <Sys_RoleUser> list = JsonUtil.DeserializeJsonToList <Sys_RoleUser>(json); this._roleService.InsertRoleUser(list, userId); return(ResponseJson.Success()); } catch (BaseException ex) { _logger.Info(ex.GetMessage()); return(ResponseJson.Error(ex.GetExceptionFlag(), ex.GetMessage())); } catch (Exception ex) { _logger.Info(ex.Message); return(ResponseJson.Error(ex.Message)); } }
public string UpdatePwd(string oldPassword, string password) { try { UserSession userSession = this.UserSession(); this._userService.UpdatePwd(oldPassword, password, userSession.UserId); return(ResponseJson.Success()); } catch (BaseException ex) { _logger.Info(ex.GetMessage()); return(ResponseJson.Error(ex.GetExceptionFlag(), ex.GetMessage())); } catch (Exception ex) { _logger.Info(ex.Message); return(ResponseJson.Error(ex.Message)); } }
public string UploadImg() { try { FileInfo file = new FileInfo(Request.Files[0].FileName); string extension = file.Extension; string fileName = file.Name; string[] allowExt = { ".jpg", ".jpge", ".gif", ".png" }; if (!allowExt.Contains(extension.ToLower())) { return(ResponseJson.Error("文件格式不正确")); } int FileLen = Request.Files[0].ContentLength; byte[] bytes = new byte[FileLen]; Stream MyStream = Request.Files[0].InputStream; MyStream.Read(bytes, 0, FileLen); MyStream.Close(); //调用文件服务 //FtpUtil.Upload(file, FileLen, bytes); ServiceFileClient.ServiceFileClient client = new ServiceFileClient.ServiceFileClient(); CustomFileInfo customFileInfo = new CustomFileInfo { OldName = fileName, SendByte = bytes }; string baseFileString = Convert.ToBase64String(bytes); customFileInfo.SendByteStr = baseFileString; customFileInfo.Extension = extension; customFileInfo = client.UpLoadFileInfo(customFileInfo); return(ResponseJson.Success(customFileInfo, "上传成功")); } catch (Exception ex) { return(ResponseJson.Error(ex.Message)); } }