Exemplo n.º 1
0
        private GSearchResultCube FormatResultKey(GSearchResultCube result)
        {
            bool isErrored = false;

            result.DataSource = new SqlClientManager(ConnectionString, IdpeKeyTypes.ConnectionStringSqlCe)
                                .ExecuteQuery("select name from idpedatasource ds inner join idpekeydatasource kds on kds.datasourceid = ds.id where keyid = " + result.ReferenceId
                                              , ref isErrored);

            int keyType = 0;

            if (int.TryParse(result.Param1, out keyType))
            {
                IdpeKeyTypes idpeKeyType = (IdpeKeyTypes)keyType;
                result.Param1 = idpeKeyType.ToString();

                if (result.Param1.Contains("OutputWriter"))
                {
                    result.Where = "Output Writer";
                }
                else if (result.Param1 == "Custom")
                {
                    result.Where = "Custom - " + result.ReferenceName;
                }
                else
                {
                    result.Where = result.Param1;
                }
            }

            return(result);
        }
Exemplo n.º 2
0
        private GSearchResultCube FormatResultRule(GSearchResultCube result)
        {
            bool   isErrored = false;
            string info      = new SqlClientManager(ConnectionString, IdpeKeyTypes.ConnectionStringSqlCe)
                               .ExecuteQuery("select name, rulesettype from idpedatasource ds inner join idperuledatasource rds on rds.datasourceid = ds.id where ruleid = " + result.ReferenceId
                                             , ref isErrored);

            if ((info == "NULL") || (string.IsNullOrEmpty(info)))
            {
                result.DataSource = "0-General";
                result.Where      = "Master";
            }
            else
            {
                info = info.Replace("NULL", string.Empty);
                result.DataSource = info.Split("|".ToCharArray())[0];
                string strRuleType = info.Split("|".ToCharArray())[1];

                int ruleType = 0;
                if (int.TryParse(strRuleType, out ruleType))
                {
                    RuleSetTypes ruleSetTypes = (RuleSetTypes)ruleType;
                    result.Param1 = ruleSetTypes.ToString();
                    result.Where  = "Rule - " + ruleSetTypes.ToString();
                }
                else
                {
                    result.Where = "Unknown";
                }
            }

            result.Value = string.Empty;
            return(result);
        }
Exemplo n.º 3
0
        private List <GSearchResultCube> FormatResults(List <GSearchResultCube> results, int dataSourceId)
        {
            List <GSearchResultCube> formattedResults = new List <GSearchResultCube>();

            foreach (GSearchResultCube result in results)
            {
                GSearchResultCube formattedResult = result;
                switch (result.TableName)
                {
                case "IdpeAttribute":
                    result.DataSource = "0-General";
                    result.Type       = "Attribute";
                    result.Where      = "Master";
                    formattedResult   = FormatResult(result);
                    //formattedResult = FormatResultAttribute(formattedResults, result);
                    break;

                case "IdpeKey":
                    result.Type     = "Key";
                    formattedResult = FormatResultKey(result);
                    break;

                case "IdpeRule":
                    result.Type     = "Rule";
                    formattedResult = FormatResultRule(result);
                    break;

                default:
                    result.Type     = "General";
                    formattedResult = FormatResult(result);
                    break;
                }

                formattedResults.Add(formattedResult);
            }

            formattedResults = formattedResults.OrderBy(r => r.DataSource).ToList();

            if (dataSourceId > 0)
            {
                string dataSourceName = new Manager().GetApplicationName(dataSourceId);
                formattedResults = formattedResults.Where(r => r.DataSource == dataSourceName).ToList();
            }
            return(formattedResults);
        }
Exemplo n.º 4
0
        private GSearchResultCube FormatResultAttribute(List <GSearchResultCube> formattedResults, GSearchResultCube result)
        {
            result.Type = "";
            bool      isErrored = false;
            DataTable table     = new SqlClientManager(ConnectionString, IdpeKeyTypes.ConnectionStringSqlCe)
                                  .ExecuteQueryAndGetDataTable("select name, issystem from idpedatasource ds inner join idpeattributedatasource ads on ads.datasourceid = ds.id where attributeId = " + result.ReferenceId
                                                               , ref isErrored);

            foreach (DataRow row in table.Rows)
            {
                GSearchResultCube cube = result;
                cube.DataSource = row[0].ToString();
                cube.Where      = row[1].ToString() == "True" ? "System Data Source" : "Data Source";
                cube.Value      = string.Empty;
                formattedResults.Add(cube);
            }
            return(result);
        }
Exemplo n.º 5
0
 private GSearchResultCube FormatResult(GSearchResultCube result)
 {
     return(result);
 }