Ejemplo n.º 1
0
 public SendTables(DataSet ResultsDataSet, string Format, LoggedInfo ActivityInfo, Dictionary <string, string> ExtraInfo)
 {
     this.Format         = Format;
     this.ResultsDataSet = ResultsDataSet;
     this.ActivityInfo   = ActivityInfo;
     this.ExtraInfo      = ExtraInfo;
 }
Ejemplo n.º 2
0
        public RequestMisc(HttpRequestMessage request, string EntryPoint)
        {
            try
            {
                //this.dictionary = request.GetQueryNameValuePairs().ToDictionary(kv => kv.Key, kv => kv.Value, StringComparer.OrdinalIgnoreCase);
                try
                {
                    this.dictionary = GetDict(request.RequestUri.ParseQueryString());
                }
                catch (Exception e)
                {
                    throw new ArgumentException("Check input parameters properly.\n" + e.Message);
                }

                this.server_name  = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
                this.windows_name = System.Environment.MachineName;


                this.ActivityInfo                     = new LoggedInfo();
                this.ActivityInfo.EntryPoint          = EntryPoint;
                this.ActivityInfo.ClientIP            = GetClientIP(dictionary);             //GetClientIP sets the value of IsDirectUserConnection as well.
                request.RequestUri                    = AddEntryPointToURI(request.RequestUri);
                this.ActivityInfo.TaskName            = GetTaskName(dictionary, EntryPoint); // must be executed right after GetClientIP(dictionary);
                this.ActivityInfo.ShortTaskName       = SetShortTaskName(this.ActivityInfo.TaskName);
                this.ActivityInfo.Headers             = request.Headers;
                this.ActivityInfo.URI                 = request.RequestUri;
                this.ActivityInfo.DoShowInUserHistory = bool.Parse(DefineShowingInUserHistory(this.ActivityInfo.TaskName));
                this.ActivityInfo.Referrer            = GetReferrer();
            }
            catch { throw; }
        }
Ejemplo n.º 3
0
        public void AthenticateUser(LoggedInfo ActivityInfo)
        {
            IEnumerable <string> values;
            string token = "";

            //try getting token from the Header
            if (ActivityInfo.Headers.TryGetValues(KeyWords.XAuthToken, out values))
            {
                try
                {
                    token = values.First();
                }
                catch (Exception e) { }
            }
            //try getting token from cookie in Header
            else
            {
                try
                {
                    IEnumerable <string> cookies = ActivityInfo.Headers.GetValues("Cookie");
                    string info = KeyWords.CookieToken + "=";
                    foreach (string cookie in cookies)
                    {
                        if (cookie.Contains(info))
                        {
                            string tok = cookie.Split(';').Where((i => i.Contains(info))).First().Trim();
                            token = tok.Remove(tok.IndexOf(info), info.Length);
                        }
                    }
                }
                catch { }
            }
            //try getting token from the URI:
            if (ActivityInfo.URI != null && String.IsNullOrEmpty(token))
            {
                try
                {
                    NameValueCollection col = ActivityInfo.URI.ParseQueryString();
                    token = col.Get("token");
                }
                catch { }
            }


            if (!String.IsNullOrEmpty(token))
            {
                try
                {
                    Token = token;
                    var userAccess = Keystone.Authenticate(token);
                    userid      = userAccess.User.Id;
                    user_name   = userAccess.User.Name;
                    IsValidUser = true;
                }
                catch { IsValidUser = false; }
            }
            HasAthenticatedWithActivityInfo = true;
        }
Ejemplo n.º 4
0
        public void LogActivity(LoggedInfo ActivityInfo, string TypeOfLogging)
        {
            if (!HasAthenticatedWithActivityInfo)
            {
                AthenticateUser(ActivityInfo);
            }


            Logger log = (HttpContext.Current.ApplicationInstance as MvcApplication).Log;

            if (TypeOfLogging == "CustomMessage")
            {
                message = log.CreateCustomMessage(KeyWords.loggingMessageType, ActivityInfo.Message);
            }
            else if (TypeOfLogging == "SkyserverMessage")
            {
                message = log.CreateSkyserverMessage(ActivityInfo.Message, ActivityInfo.DoShowInUserHistory);
            }
            else if (TypeOfLogging == "DebugMessage")
            {
                message = log.CreateDebugMessage(ActivityInfo.Message);
            }
            else if (TypeOfLogging == "ErrorMessage")
            {
                message = log.CreateErrorMessage(ActivityInfo.Exception, ActivityInfo.Message);
            }
            else if (TypeOfLogging == "FatalMessage")
            {
                message = log.CreateFatalMessage(ActivityInfo.Exception, ActivityInfo.Message);
            }
            else if (TypeOfLogging == "InfoMessage")
            {
                message = log.CreateInfoMessage(ActivityInfo.Message);
            }
            else if (TypeOfLogging == "WarnMessage")
            {
                message = log.CreateWarnMessage(ActivityInfo.Message);
                //message = log.CreateCustomMessage(KeyWords.loggingMessageType, api.ControllerContext.Request.ToString());break;
            }
            else
            {
                message = log.CreateInfoMessage("Empty Message");
                //message = log.CreateCustomMessage(KeyWords.loggingMessageType, api.ControllerContext.Request.ToString());break;
            }
            message.UserId    = userid;
            message.ClientIP  = ActivityInfo.ClientIP ?? "";
            message.TaskName  = ActivityInfo.TaskName ?? "";
            message.UserName  = user_name;
            message.UserToken = String.IsNullOrEmpty(this.Token) ? null : Token;
            log.SendMessage(message);
        }
Ejemplo n.º 5
0
 public SciserverLogging(LoggedInfo ActivityInfo)
 {
     AthenticateUser(ActivityInfo);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessRequest"/> class.
        /// </summary>
        /// <param name="request">The current Http request from the client.</param>
        /// <param name="EntryPoint">The name of the unique entry point to the Api, defined in the controller.</param>
        public ProcessRequest(HttpRequestMessage request, string EntryPoint)
        {
            try
            {
                rm = new RequestMisc(request, EntryPoint);

                this.server_name  = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
                this.windows_name = System.Environment.MachineName;

                this.dictionary             = rm.GetDict(request.RequestUri.ParseQueryString());
                this.ClientIP               = rm.GetClientIP(dictionary);             //GetClientIP sets the value of IsDirectUserConnection as well.
                this.TaskName               = rm.GetTaskName(dictionary, EntryPoint); // must be executed right after GetClientIP(ref dictionary);
                this.ActivityInfo           = rm.ActivityInfo;
                this.IsDirectUserConnection = rm.IsDirectUserConnection;

                //datarelease = HttpContext.Current.Request.RequestContext.RouteData.Values["anything"] as string; /// which SDSS Data release is to be accessed
                datarelease = ConfigurationManager.AppSettings["DataRelease"];
                /// this is temporary read from the web.config
                string skyserverUrl = ConfigurationManager.AppSettings["skyServerUrl"];

                // get data release number
                string drnumber = datarelease.ToUpper().Replace("DR", "");

                dictionary.Add("skyserverUrl", skyserverUrl);
                dictionary.Add("datarelease", drnumber);
                ExtraInfo.Add("ClientIP", ClientIP);
                ExtraInfo.Add("TaskName", TaskName);
                ExtraInfo.Add("server_name", server_name);
                ExtraInfo.Add("windows_name", windows_name);
                dictionary.Add("server_name", server_name);
                dictionary.Add("windows_name", windows_name);
                ExtraInfo.Add("EntryPoint", EntryPoint);


                ExtraInfo.Add("fp", "");
                ExtraInfo.Add("syntax", "");
                ExtraInfo.Add("QueryForUserDisplay", "");
                ExtraInfo.Add("query", "");
                ExtraInfo.Add("SaveResult", dictionary.ContainsKey("SaveResult") ? dictionary["SaveResult"] : "false");// default is to show result on webpage instead of saving it to a file.
                ExtraInfo.Add("IsDirectUserConnection", IsDirectUserConnection.ToString());
                ExtraInfo.Add("TableName", dictionary.ContainsKey("TableName") ? dictionary["TableName"] : "");
                string ShowAsHtml = dictionary.ContainsKey("SaveResult") ? dictionary["SaveResult"] : "false"; // default is to show result on webpage instead of saving it to a file.
                string ReturnHtml = dictionary.ContainsKey("ReturnHtml") ? dictionary["ReturnHtml"] : "false"; // default is to show result on webpage instead of saving it to a file.

                if (dictionary.ContainsKey("format"))
                {
                    if (dictionary["format"].ToLower() == "html" || ReturnHtml.ToLower() == "true")
                    {
                        ExtraInfo.Add("DoReturnHtml", "True");
                    }
                    else
                    {
                        ExtraInfo.Add("DoReturnHtml", "False");
                    }
                }
                else
                {
                    ExtraInfo.Add("DoReturnHtml", "False");
                }
            }
            catch { throw; }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Runs the query for the proximity kind of search.
        /// </summary>
        /// <param name="api">The API.</param>
        /// <param name="queryType">Type of the query.</param>
        /// <param name="positionType">Type of the position.</param>
        /// <param name="Message">The message.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">
        /// Check input parameters properly.\n + e.Message
        /// or
        /// Neither upload file nor list specified for Proximity search.
        /// </exception>
        /// <exception cref="System.Exception">Error while uploading coordinates to create a temporary table.  + exp.Message</exception>
        public IHttpActionResult proximityQuery(ApiController api, string queryType, string positionType, string Message)
        {
            // This dict stores extra info needed for running and rendering the query results.

/*
 *          Dictionary<string, string> ExtraInfo = new Dictionary<string, string>();
 *          ExtraInfo.Add("fp", "");
 *          ExtraInfo.Add("syntax", "");
 *          ExtraInfo.Add("QueryForUserDisplay", "");
 */

            try
            {
                //string datarelease = HttpContext.Current.Request.RequestContext.RouteData.Values["anything"] as string; /// which SDSS Data release is to be accessed

                ///
                HttpResponseMessage resp = new HttpResponseMessage();
                Logger log   = (HttpContext.Current.ApplicationInstance as MvcApplication).Log;
                String query = "";

                /*
                 * try
                 * {
                 *  if (dictionary == null)
                 *      dictionary = api.Request.GetQueryNameValuePairs().ToDictionary(kv => kv.Key, kv => kv.Value, StringComparer.OrdinalIgnoreCase);
                 * }
                 * catch (Exception e)
                 * {
                 *  throw new ArgumentException("Check input parameters properly.\n" + e.Message);
                 * }
                 *
                 *
                 * if (string.IsNullOrEmpty(this.ClientIP))
                 *  this.ClientIP = rm.GetClientIP(dictionary);//GetClientIP sets the value of IsDirectUserConnection as well.
                 * if (string.IsNullOrEmpty(this.TaskName))
                 *  this.TaskName = rm.GetTaskName(dictionary, Message);// must be executed right after GetClientIP(ref dictionary);
                 * if (string.IsNullOrEmpty(this.server_name))
                 *  try { server_name = HttpContext.Current.Request.ServerVariables["SERVER_NAME"]; }
                 *  catch { }
                 * if (string.IsNullOrEmpty(this.windows_name))
                 *  try { windows_name = System.Environment.MachineName; }
                 *  catch { };
                 *
                 * dictionary.Add("server_name", server_name);
                 * dictionary.Add("windows_name", windows_name);
                 *
                 *
                 * // get data release number
                 * string drnumber = datarelease.ToUpper().Replace("DR", "");
                 *
                 * dictionary.Add("datarelease", drnumber);
                 */
                var task = api.Request.Content.ReadAsStreamAsync();
                task.Wait();
                Stream stream = task.Result;

                bool HasFile      = false;
                bool HasRaDecText = false;

                string radiusDefault = "1";// in arcminutes
                try { radiusDefault = float.Parse(dictionary["radiusDefault"]).ToString(); }
                catch { }

                try
                {
                    using (UploadDataReader up = new UploadDataReader(new StreamReader(stream), radiusDefault))
                    {
                        if (stream.Length > 0)
                        {
                            try
                            {
                                query  += up.UploadTo(queryType, dictionary["searchNearBy"]);
                                HasFile = true;
                            }
                            catch { }
                        }
                        else
                        {
                            try
                            {
                                query += up.UploadTo(dictionary["radecTextarea"], queryType, dictionary["searchNearBy"]);
                                if (dictionary["radecTextarea"].Length > 0)
                                {
                                    HasRaDecText = true;
                                }
                            }
                            catch { }
                        }
                        if (!HasRaDecText && !HasFile)
                        {
                            //query = "SELECT 'ERROR: Neither upload file nor list specified for Proximity search.'--";
                            throw new ArgumentException("Neither upload file nor list specified for Proximity search.");
                        }
                    }
                }
                catch { throw; }

                //query += QueryTools.BuildQuery.buildQuery(queryType, dictionary, positionType);

                QueryTools.BuildQuery.buildQueryMaster(queryType, dictionary, positionType);
                ExtraInfo["QueryForUserDisplay"] = query + QueryTools.BuildQuery.QueryForUserDisplay;
                query += QueryTools.BuildQuery.query;
                query  = query.Replace("'", "''");
                query  = "EXEC spExecuteSQL '" + query + "', @webserver='" + this.server_name + "', @winname='" + this.windows_name + "', @clientIP='" + this.ClientIP + "', @access='" + this.TaskName + "', @filter=0, @log=1";

                //RunCasjobs run = new RunCasjobs();
                //resp.Content = new StringContent(run.postCasjobs(query, token, casjobsMessage).Content.ReadAsStringAsync().Result);
                //return resp;
                String format = "";
                try
                {
                    if (format.Equals(""))
                    {
                        format = dictionary["format"].ToLower();
                    }

                    switch (format)
                    {
                    case "csv": format = KeyWords.contentCSV; ExtraInfo.Add("FormatFromUser", format); break;

                    case "xml": format = KeyWords.contentXML; ExtraInfo.Add("FormatFromUser", format); break;

                    case "votable": format = KeyWords.contentVOTable; ExtraInfo.Add("FormatFromUser", format); break;

                    case "json": format = KeyWords.contentJson; ExtraInfo.Add("FormatFromUser", format); break;

                    case "fits": format = KeyWords.contentFITS; ExtraInfo.Add("FormatFromUser", format); break;

                    case "dataset": format = KeyWords.contentDataset; ExtraInfo.Add("FormatFromUser", format); break;

                    case "html": format = KeyWords.contentDataset; ExtraInfo.Add("FormatFromUser", "html"); break;

                    case "mydb":
                        ExtraInfo.Add("FormatFromUser", format); format = "mydb"; break;

                    default: format = KeyWords.contentJson; ExtraInfo.Add("FormatFromUser", format); break;
                    }
                }
                catch (Exception exp)
                {
                    format = KeyWords.contentCSV;
                    ExtraInfo.Add("FormatFromUser", KeyWords.contentCSV);
                }


                //logging -----------------------------------------------------------------------------------------------------------------------
                if (ActivityInfo == null)
                {
                    ActivityInfo          = new LoggedInfo();
                    ActivityInfo.ClientIP = ClientIP;
                    ActivityInfo.TaskName = TaskName;
                    ActivityInfo.Headers  = api.ControllerContext.Request.Headers;
                }

                //creating the message that is being logged
                ActivityInfo.Message = rm.GetLoggedMessage(ExtraInfo["QueryForUserDisplay"]);   //request.ToString();

                //return new RunCasjobs(query, token, casjobsMessage, format, datarelease);
                //return new RunDBquery(query, format, this.TaskName, ExtraInfo);return new RunCasjobs(query, token, this.TaskName, format, datarelease, ExtraInfo, this.ClientIP);
                return(new RunDBquery(query, format, this.TaskName, ExtraInfo, ActivityInfo, queryType, positionType));
            }
            catch (Exception exp)
            {
                throw new Exception("Error while uploading coordinates to create a temporary table. " + exp.Message);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Executes the query for most kinds of searches (except proximity)
        /// </summary>
        /// <param name="api">The API controller.</param>
        /// <param name="queryType">Type of the query</param>
        /// <param name="positionType">Type of the position.</param>
        /// <param name="Task">The TaskName, that uniquely identifies the search (or web service entry point).</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">Check input parameters properly.\n+e.Message</exception>
        public IHttpActionResult runquery(ApiController api, string queryType, string positionType, string Task)
        {
            //api.Request.Headers.Add("TaskName", Task);
            //api.Request.Headers.Add("EntryPoint", Task);


            DataSet ResultsDataSet = new DataSet();

            HttpResponseMessage resp = new HttpResponseMessage();
            Logger log = (HttpContext.Current.ApplicationInstance as MvcApplication).Log;

/*
 *          try
 *          {
 *              if(dictionary == null)
 *                  dictionary = api.Request.GetQueryNameValuePairs().ToDictionary(kv => kv.Key, kv => kv.Value, StringComparer.OrdinalIgnoreCase);
 *          }
 *          catch (Exception e)
 *          {
 *              throw new ArgumentException("Check input parameters properly.\n"+e.Message);
 *          }
 */
            String format = "";
            String query  = "";

            /*
             * if (string.IsNullOrEmpty(this.ClientIP))
             *  this.ClientIP = rm.GetClientIP(dictionary);//GetClientIP sets the value of IsDirectUserConnection as well.
             * if (string.IsNullOrEmpty(this.TaskName))
             *  this.TaskName = rm.GetTaskName(dictionary, Task);// must be executed right after GetClientIP(ref dictionary);
             * if (string.IsNullOrEmpty(this.server_name))
             *  try { this.server_name = HttpContext.Current.Request.ServerVariables["SERVER_NAME"]; }
             *  catch { }
             * if (string.IsNullOrEmpty(this.windows_name))
             *  try { this.windows_name = System.Environment.MachineName; }
             *  catch { };
             */


            switch (queryType)
            {
            case "UserHistory":
                UserHistory history = new UserHistory(dictionary, ExtraInfo, HttpContext.Current.Request);
                ResultsDataSet = history.ResultDataSet;
                ExtraInfo["QueryForUserDisplay"] = history.query;
                ExtraInfo["query"] = history.query;
                //DataTable dt = new DataTable();
                //dt.Columns.Add("query", typeof(string));
                //dt.Rows.Add(new object[] { history.query });
                //ResultsDataSet.Merge(dt);
                break;

            case "SqlSearch":
                SqlSearch sqlsearch = new SqlSearch(dictionary, ExtraInfo);
                query = sqlsearch.query;     // here the query is wrapped inside SpExecuteSQL, both logging and security checking
                ExtraInfo["syntax"] = sqlsearch.syntax;
                ExtraInfo["QueryForUserDisplay"] = sqlsearch.QueryForUserDisplay;
                ExtraInfo["query"] = query;
                break;

            case "CrossIdSearch":
                CrossIdSearch crossId = new CrossIdSearch(dictionary, ExtraInfo, HttpContext.Current.Request, api.Request.Content);
                query = crossId.query;     // // here the query is wrapped inside SpExecuteSQL, both logging and security checking of the user query part.
                //Format = crossId.Format;
                ExtraInfo["QueryForUserDisplay"] = crossId.QueryForUserDisplay;
                ExtraInfo["query"] = query;
                break;

            case "ObjectSearch":    // here, multiple queries might be run in order to resolve the object. That's why we have to run them here and get the dataset immediately (no routing to RunDBquery but to SendTables);
                ObjectSearch objectSearch = new ObjectSearch(dictionary, ExtraInfo, HttpContext.Current.Request);
                ResultsDataSet = objectSearch.ResultDataSet;
                //Format = objectSearch.Format;
                break;

            case "RectangularSearch":
                RectangularSearch rectangular = new RectangularSearch(dictionary, ExtraInfo);
                query = rectangular.query;
                ExtraInfo["QueryForUserDisplay"] = rectangular.QueryForUserDisplay;
                ExtraInfo["query"] = query;
                break;

            case "RadialSearch":
                RadialSearch radial = new RadialSearch(dictionary, ExtraInfo);
                query           = radial.query;
                ExtraInfo["fp"] = radial.fp;
                ExtraInfo["QueryForUserDisplay"] = radial.QueryForUserDisplay;
                ExtraInfo["query"] = query;
                break;

            case "ConeSearch":
                try
                {
                    format = dictionary["format"].ToLower();
                    if (format.Equals("votable"))
                    {
                        format = "dataset";
                    }
                }
                catch (Exception e)
                {
                    format = "dataset";     // or votable
                }
                ConeSearch.ConeSearch cs = new ConeSearch.ConeSearch(dictionary);
                query = cs.getConeSearchQuery();
                ExtraInfo["QueryForUserDisplay"] = query;
                ExtraInfo["query"] = query;
                break;

            case "SDSSFields":
                try
                {
                    format = dictionary["format"].ToLower();
                    if (format.Equals("votable"))
                    {
                        format = "dataset";
                    }
                }
                catch (Exception e)
                {
                    format = "dataset";
                }
                NewSDSSFields sf = new NewSDSSFields(dictionary, positionType);
                query = sf.sqlQuery;
                ExtraInfo["QueryForUserDisplay"] = query;
                ExtraInfo["query"] = query;
                break;

            case "SIAP":
                ActivityInfo.Message = rm.GetLoggedMessage(ExtraInfo["QueryForUserDisplay"]);                  //request.ToString();
                return(new ReturnSIAPresults(positionType, "VOTable", datarelease, dictionary, ActivityInfo)); // this is tricky code

                break;

            default:    // runs all the Imaging, Spectro and SpectroIR queries in SkyServer
                QueryTools.BuildQuery.buildQueryMaster(queryType, dictionary, positionType);
                query = QueryTools.BuildQuery.query;
                query = query.Replace("'", "''");
                query = "EXEC spExecuteSQL '" + query + "', @webserver='" + this.server_name + "', @winname='" + this.windows_name + "', @clientIP='" + this.ClientIP + "', @access='" + this.TaskName + "', @filter=0, @log=1";
                ExtraInfo["QueryForUserDisplay"] = QueryTools.BuildQuery.QueryForUserDisplay;
                ExtraInfo["query"] = query;
                break;
            }

            query = Regex.Replace(query, @"\/\*(.*\n)*\*\/", "");                                       // remove all multi-line comments
            query = Regex.Replace(query, @"^[ \t\f\v]*--.*\r\n", "", RegexOptions.Multiline);           // remove all isolated single-line comments
            query = Regex.Replace(query, @"--[^\r^\n]*", "");                                           // remove all embedded single-line comments
            query = Regex.Replace(query, @"[ \t\f\v]+", " ");                                           // replace multiple whitespace with single space
            query = Regex.Replace(query, @"^[ \t\f\v]*\r\n", "", RegexOptions.Multiline);               // remove empty lines
            try
            {
                if (format.Equals(""))
                {
                    format = dictionary["format"].ToLower();
                }

                switch (format)
                {
                case "txt":
                case "text/plain":
                case "csv":
                    ExtraInfo.Add("FormatFromUser", format); format = KeyWords.contentCSV; break;

                case "xml":
                case "application/xml":
                    ExtraInfo.Add("FormatFromUser", format); format = KeyWords.contentXML; break;

                case "votable":
                case "application/x-votable+xml":
                    ExtraInfo.Add("FormatFromUser", format); format = KeyWords.contentVOTable; break;

                case "json":
                case "application/json":
                    ExtraInfo.Add("FormatFromUser", format); format = KeyWords.contentJson; break;

                case "fits":
                case "application/fits":
                    ExtraInfo.Add("FormatFromUser", format); format = KeyWords.contentFITS; break;

                case "dataset":
                case "application/x-dataset":
                    ExtraInfo.Add("FormatFromUser", format); format = KeyWords.contentDataset; break;

                case "html":
                    ExtraInfo.Add("FormatFromUser", "html"); format = KeyWords.contentDataset; break;

                case "mydb":
                    ExtraInfo.Add("FormatFromUser", format); format = "mydb"; break;

                default:
                    ExtraInfo.Add("FormatFromUser", format); format = KeyWords.contentJson; break;
                }
            }
            catch (Exception exp)
            {
                if (IsDirectUserConnection)//in case the user did not specify a format
                {
                    format = KeyWords.contentJson;
                    string val;
                    if (!ExtraInfo.TryGetValue("FormatFromUser", out val))
                    {
                        ExtraInfo.Add("FormatFromUser", "json");
                    }
                }
                else
                {
                    format = KeyWords.contentDataset;//which is a dataset
                    string val;
                    if (!ExtraInfo.TryGetValue("FormatFromUser", out val))
                    {
                        ExtraInfo.Add("FormatFromUser", "dataset");
                    }
                }
            }


            //logging -----------------------------------------------------------------------------------------------------------------------
            if (ActivityInfo == null)
            {
                ActivityInfo          = new LoggedInfo();
                ActivityInfo.ClientIP = ClientIP;
                ActivityInfo.TaskName = TaskName;
                ActivityInfo.Headers  = api.ControllerContext.Request.Headers;
            }

            //creating the message that is being logged
            ActivityInfo.Message = rm.GetLoggedMessage(ExtraInfo["QueryForUserDisplay"]);   //request.ToString();

            switch (queryType)
            {
            case "SqlSearch":
                return(new RunDBquery(query, format, TaskName, ExtraInfo, ActivityInfo, queryType, positionType));   // queries are sent through direct database connection.

            case "ObjectSearch":
            case "UserHistory":
                return(new SendTables(ResultsDataSet, format, ActivityInfo, ExtraInfo));

            default:
                return(new RunDBquery(query, format, TaskName, ExtraInfo, ActivityInfo, queryType, positionType));
            }
        }
Ejemplo n.º 9
0
 public SendTables()
 {
     this.Format         = "";
     this.ResultsDataSet = new DataSet();
     this.ActivityInfo   = new LoggedInfo();
 }