コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
        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)));
        }