Esempio n. 1
0
  private void GetDataListHtml()
  {
    string dataTabID = Request.Form["datatab"];
    string id = Request.Form["id"];

    Configuration config = AppContext.GetConfiguration();
    Configuration.DataTabRow dataTab = config.DataTab.First(o => o.DataTabID == dataTabID);
    DataListBuilder dataListBuilder = new DataListBuilder();

    using (OleDbCommand command = dataTab.GetDatabaseCommand())
    {
      command.Parameters[0].Value = id;

      if (command.Parameters.Count > 1)
      {
        command.Parameters[1].Value = AppUser.GetRole();
      }

      using (OleDbDataReader reader = command.ExecuteReader())
      {
        dataListBuilder.AddFromReader(reader);
      }

      command.Connection.Dispose();
    }

    Response.ContentType = "text/html";
    dataListBuilder.RenderToStream(Response.OutputStream);
  }
Esempio n. 2
0
    private void GetDataListHtml()
    {
        string dataTabID = Request.Form["datatab"];
        string id        = Request.Form["id"];

        Configuration config = AppContext.GetConfiguration();

        Configuration.DataTabRow dataTab         = config.DataTab.First(o => o.DataTabID == dataTabID);
        DataListBuilder          dataListBuilder = new DataListBuilder();

        using (OleDbCommand command = dataTab.GetDatabaseCommand())
        {
            command.Parameters[0].Value = id;

            if (command.Parameters.Count > 1)
            {
                command.Parameters[1].Value = AppUser.GetRole();
            }

            using (OleDbDataReader reader = command.ExecuteReader())
            {
                dataListBuilder.AddFromReader(reader);
            }

            command.Connection.Dispose();
        }

        Response.ContentType = "text/html";
        dataListBuilder.RenderToStream(Response.OutputStream);
    }
Esempio n. 3
0
    private void ShowTabData(string dataTabID, string id)
    {
        Configuration config = AppContext.GetConfiguration();

        Configuration.DataTabRow dataTab = config.DataTab.First(o => o.DataTabID == dataTabID);

        using (OleDbCommand command = dataTab.GetDatabaseCommand())
        {
            command.Parameters[0].Value = id;

            if (command.Parameters.Count > 1)
            {
                command.Parameters[1].Value = AppUser.GetRole();
            }

            using (OleDbDataReader reader = command.ExecuteReader())
            {
                DataListBuilder dataListBuilder = new DataListBuilder();
                dataListBuilder.AddFromReader(reader);
                pnlContent.Controls.Add(dataListBuilder.BuiltControl);
            }

            command.Connection.Dispose();
        }
    }
Esempio n. 4
0
    private void ShowTabData(string dataTabID, string id)
    {
        bool print = !String.IsNullOrEmpty(Request.QueryString["print"]);

        Configuration config = AppContext.GetConfiguration();

        Configuration.DataTabRow dataTab = config.DataTab.First(o => o.DataTabID == dataTabID);

        using (OleDbCommand command = dataTab.GetDatabaseCommand())
        {
            command.Parameters[0].Value = id;

            if (command.Parameters.Count > 1)
            {
                command.Parameters[1].Value = AppUser.GetRole();
            }

            using (OleDbDataReader reader = command.ExecuteReader())
            {
                DataListBuilder dataListBuilder = new DataListBuilder();
                dataListBuilder.AddFromReader(reader);
                pnlContent.Controls.Add(dataListBuilder.BuiltControl);
            }

            command.Connection.Dispose();
        }

        cmdPrint.Visible  = !print;
        autoPrint.Visible = print;

        if (print)
        {
            Title = "Print";
        }
    }
Esempio n. 5
0
    private void SearchMapTab(string mapTabID, double x, double y, double distance, bool addSpace)
    {
        double scale = ParseDouble(Request.QueryString["scale"], 1);

        string[] visibleLayers = ParseStringArray(Request.QueryString["visiblelayers"], '\u0001');
        string   levelID       = Request.QueryString["level"];

        DataListBuilder dataListBuilder = MapIdentifyHandler.SearchMapTab(mapTabID, visibleLayers, levelID, x, y, distance, scale, addSpace);

        pnlContent.Controls.Add(dataListBuilder.BuiltControl);
    }
Esempio n. 6
0
    private void DefaultMethod()
    {
        string mapTabID = Request.Form["maptab"];

        string[] visibleLayers = Request.Form["visiblelayers"].Split('\u0001');
        string   levelID       = Request.Form["level"];
        double   x             = Convert.ToDouble(Request.Form["x"]);
        double   y             = Convert.ToDouble(Request.Form["y"]);
        double   distance      = Convert.ToDouble(Request.Form["distance"]);
        double   scale         = Convert.ToDouble(Request.Form["scale"]);

        DataListBuilder dataListBuilder = SearchMapTab(mapTabID, visibleLayers, levelID, x, y, distance, scale, false);

        Response.ContentType = "text/html";
        dataListBuilder.RenderToStream(Response.OutputStream);
    }
Esempio n. 7
0
    public static DataListBuilder SearchMapTab(string mapTabID, string[] visibleLayers, string levelID, double x, double y,
                                               double distance, double scale, bool addSpace)
    {
        DataListBuilder dataListBuilder = new DataListBuilder();

        Configuration config = AppContext.GetConfiguration();

        Configuration.MapTabRow mapTab    = config.MapTab.First(o => o.MapTabID == mapTabID);
        CommonDataFrame         dataFrame = AppContext.GetDataFrame(mapTab);

        Dictionary <String, Configuration.LayerRow>         layers         = new Dictionary <String, Configuration.LayerRow>();
        Dictionary <String, Configuration.LayerFunctionRow> layerFunctions = new Dictionary <String, Configuration.LayerFunctionRow>();

        bool useDefaultVisible = visibleLayers.Length == 1 && visibleLayers[0] == "*";

        foreach (Configuration.MapTabLayerRow mapTabLayer in mapTab.GetMapTabLayerRows())
        {
            bool isCandidateLayer = mapTab.IsInteractiveLegendNull() || mapTab.InteractiveLegend == 0;

            if (!isCandidateLayer)
            {
                bool shownInLegend   = !mapTabLayer.IsShowInLegendNull() && mapTabLayer.ShowInLegend == 1;
                bool checkedInLegend = mapTabLayer.IsCheckInLegendNull() || mapTabLayer.CheckInLegend < 0 || visibleLayers.Any(o => o == mapTabLayer.LayerID);
                bool defaultVisible  = useDefaultVisible && !mapTabLayer.IsCheckInLegendNull() && mapTabLayer.CheckInLegend == 1;
                isCandidateLayer = !shownInLegend || checkedInLegend || defaultVisible;
            }

            if (isCandidateLayer)
            {
                Configuration.LayerRow         layer         = mapTabLayer.LayerRow;
                Configuration.LayerFunctionRow layerFunction = layer.GetLayerFunctionRows().FirstOrDefault(o => o.FunctionName.ToLower() == "identify");

                if (layerFunction != null)
                {
                    layers.Add(layer.LayerName, layer);
                    layerFunctions.Add(layer.LayerName, layerFunction);
                }
            }
        }

        foreach (CommonLayer commonLayer in dataFrame.Layers)
        {
            DataTable table = null;

            if (layers.ContainsKey(commonLayer.Name) && commonLayer.IsWithinScaleThresholds(scale))
            {
                Configuration.LayerRow layer = layers[commonLayer.Name];

                if (commonLayer.Type == CommonLayerType.Feature)
                {
                    CommonField keyField   = commonLayer.FindField(layer.KeyField);
                    string      levelQuery = layer.GetLevelQuery(commonLayer, levelID);
                    table = commonLayer.GetFeatureTable(keyField.Name, levelQuery, x, y, commonLayer.FeatureType == OgcGeometryType.MultiPolygon ? 0 : distance * scale);
                }

                if (commonLayer.Type == CommonLayerType.Image && commonLayer is AgsLayer)
                {
                    string id = ((AgsLayer)commonLayer).GetRasterValue(x, y);
                    table = new DataTable();
                    table.Columns.Add("ID");
                    table.Rows.Add(id);
                }
            }

            if (table != null && table.Rows.Count > 0)
            {
                Configuration.LayerFunctionRow layerFunction = layerFunctions[commonLayer.Name];

                foreach (DataRow row in table.Rows)
                {
                    string id = row[0].ToString();

                    using (OleDbCommand command = layerFunction.GetDatabaseCommand())
                    {
                        command.Parameters[0].Value = id;

                        if (command.Parameters.Count > 1)
                        {
                            command.Parameters[1].Value = AppUser.GetRole();
                        }

                        using (OleDbDataReader reader = command.ExecuteReader())
                        {
                            dataListBuilder.AddFromReader(reader, addSpace);
                        }

                        command.Connection.Dispose();
                    }
                }
            }
        }

        return(dataListBuilder);
    }
Esempio n. 8
0
  public static DataListBuilder SearchMapTab(string mapTabID, string[] visibleLayers, string levelID, double x, double y, 
    double distance, double scale, bool addSpace)
  {
    DataListBuilder dataListBuilder = new DataListBuilder();

    Configuration config = AppContext.GetConfiguration();
    Configuration.MapTabRow mapTab = config.MapTab.First(o => o.MapTabID == mapTabID);
    CommonDataFrame dataFrame = AppContext.GetDataFrame(mapTab);

    Dictionary<String, Configuration.LayerRow> layers = new Dictionary<String, Configuration.LayerRow>();
    Dictionary<String, Configuration.LayerFunctionRow> layerFunctions = new Dictionary<String, Configuration.LayerFunctionRow>();

    bool useDefaultVisible = visibleLayers.Length == 1 && visibleLayers[0] == "*";

    foreach (Configuration.MapTabLayerRow mapTabLayer in mapTab.GetMapTabLayerRows())
    {
      bool isCandidateLayer = mapTab.IsInteractiveLegendNull() || mapTab.InteractiveLegend == 0;

      if (!isCandidateLayer)
      {
        bool shownInLegend = !mapTabLayer.IsShowInLegendNull() && mapTabLayer.ShowInLegend == 1;
        bool checkedInLegend = mapTabLayer.IsCheckInLegendNull() || mapTabLayer.CheckInLegend < 0 || visibleLayers.Any(o => o == mapTabLayer.LayerID);
        bool defaultVisible = useDefaultVisible && !mapTabLayer.IsCheckInLegendNull() && mapTabLayer.CheckInLegend == 1;
        isCandidateLayer = !shownInLegend || checkedInLegend || defaultVisible;
      }

      if (isCandidateLayer)
      {
        Configuration.LayerRow layer = mapTabLayer.LayerRow;
        Configuration.LayerFunctionRow layerFunction = layer.GetLayerFunctionRows().FirstOrDefault(o => o.FunctionName.ToLower() == "identify");

        if (layerFunction != null)
        {
          layers.Add(layer.LayerName, layer);
          layerFunctions.Add(layer.LayerName, layerFunction);
        }
      }
    }

    foreach (CommonLayer commonLayer in dataFrame.Layers)
    {
      DataTable table = null;

      if (layers.ContainsKey(commonLayer.Name) && commonLayer.IsWithinScaleThresholds(scale))
      {
        Configuration.LayerRow layer = layers[commonLayer.Name];

        if (commonLayer.Type == CommonLayerType.Feature)
        {
          CommonField keyField = commonLayer.FindField(layer.KeyField);
          string levelQuery = layer.GetLevelQuery(commonLayer, levelID);
          table = commonLayer.GetFeatureTable(keyField.Name, levelQuery, x, y, commonLayer.FeatureType == OgcGeometryType.MultiPolygon ? 0 : distance * scale);
        }

        if (commonLayer.Type == CommonLayerType.Image && commonLayer is AgsLayer)
        {
          string id = ((AgsLayer)commonLayer).GetRasterValue(x, y);
          table = new DataTable();
          table.Columns.Add("ID");
          table.Rows.Add(id);
        }
      }

      if (table != null && table.Rows.Count > 0)
      {
        Configuration.LayerFunctionRow layerFunction = layerFunctions[commonLayer.Name];

        foreach (DataRow row in table.Rows)
        {
          string id = row[0].ToString();

          using (OleDbCommand command = layerFunction.GetDatabaseCommand())
          {
            command.Parameters[0].Value = id;

            if (command.Parameters.Count > 1)
            {
              command.Parameters[1].Value = AppUser.GetRole();
            }

            using (OleDbDataReader reader = command.ExecuteReader())
            {
              dataListBuilder.AddFromReader(reader, addSpace);
            }

            command.Connection.Dispose();
          }
        }
      }
    }

    return dataListBuilder;
  }
Esempio n. 9
0
  private void ShowTabData(string dataTabID, string id)
  {
    Configuration config = AppContext.GetConfiguration();
    Configuration.DataTabRow dataTab = config.DataTab.First(o => o.DataTabID == dataTabID);

    using (OleDbCommand command = dataTab.GetDatabaseCommand())
    {
      command.Parameters[0].Value = id;

      if (command.Parameters.Count > 1)
      {
        command.Parameters[1].Value = AppUser.GetRole();
      }

      using (OleDbDataReader reader = command.ExecuteReader())
      {
        DataListBuilder dataListBuilder = new DataListBuilder();
        dataListBuilder.AddFromReader(reader);
        pnlContent.Controls.Add(dataListBuilder.BuiltControl);
      }

      command.Connection.Dispose();
    }
  }