public string GetUserAndRole(SqlMapOptionModel model) { var argument = $"-u " + model.HostName + " –users –roles --batch"; processStartInfo.Arguments = argument; using (Process process = Process.Start(processStartInfo)) { using (StreamReader reader = process.StandardOutput) { string result = reader.ReadToEnd(); return(result); } } }
public string GetCurrentUserDatabaseAndHostnameInformation(SqlMapOptionModel model) { var argument = $"-u " + model.HostName + " –current-user –current-db –hostname --batch"; processStartInfo.Arguments = argument; using (Process process = Process.Start(processStartInfo)) { using (StreamReader reader = process.StandardOutput) { string result = reader.ReadToEnd(); return(result); } } }
public IActionResult GetUserAndRole([FromQuery] SqlMapOptionModel model) { string fileName = OnkeiUtil.GenerateTimeStamp(); var result = _sqlMapService.GetUserAndRole(model); if (result == null) { return(BadRequest( BaseResponseModel.PrepareDataFail("Model is not correct") )); } string link = "http://" + HttpContext.Request.Host.Value + "/file/download/" + OnkeiUtil.SaveFile(fileName, result); return(Ok(BaseResponseModel.PrepareDataSuccess(result, "Success", link))); }