Exemplo n.º 1
0
        private void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                MapEventLayer layer = cboType.SelectedItem as MapEventLayer;

                EventDetails item = new EventDetails();
                item.Point       = _currentPoint;
                item.Description = txtDescription.Text;
                item.Date        = dtpDate.DateTime;
                item.TypeId      = layer.TypeId;
                item.EventType   = layer.EventTypeName;

                string sql = $"insert into Geo_Event(LinkCode, Latitude, Longitude, EventTypeId, Description, EventDate)" +
                             $" values('{_eventInfo.KeyCode}', {item.Point.Y}, {item.Point.X}, {item.TypeId}, '{item.Description}', '{item.Date}'); SELECT SCOPE_IDENTITY()";
                item.Id = Convert.ToInt32(_hmCon.SQLExecutor.ExecuteScalar(sql, _hmCon.TRConnection));

                _eventInfo.EventList.Add(item);
                cboEvents.Properties.Items.Add(item);
                cboEvents.SelectedIndex = cboEvents.Properties.Items.Count - 1;
                InDrawingStatus(false);

                _map.FinishDraw(item);
            }
            catch (Exception ex)
            {
                _pop.ShowPopup("Sql exception: " + ex.Message);
            }
        }
Exemplo n.º 2
0
        public void AddEventLayer(MapEventLayer layer, int layerIndex)
        {
            _layerList.Add(layer, layerIndex);

            cboType.Properties.Items.Clear();
            cboType.Properties.Items.AddRange(_layerList.Keys);
        }
Exemplo n.º 3
0
 public PenEvent(MapEventLayer layerInfo)
 {
     _layerInfo            = layerInfo;
     _layerInfo.MarkerType = EventMarkerType.Proportional;
 }
Exemplo n.º 4
0
        public ucDrawEvents(HMCon con, TUC_HMDevXManager.TUC_HMDevXManager hmDevMgr, WpfMapDrawBase map, MapEventLayer layer, int layerIndex)
            : base(con, hmDevMgr, map)
        {
            InitializeComponent();

            _layerList = new Dictionary <MapEventLayer, int>()
            {
                { layer, layerIndex }
            };
            cboType.Properties.Items.AddRange(_layerList.Keys);
            cboType.SelectedIndex = 0;

            gcAttr.DataSource = _attrTable;

            InDrawingStatus(false);
        }
Exemplo n.º 5
0
        public Form1()
        {
            InitializeComponent();

            hmConn = new HMConnection.HMCon("web_qa_re", "CSMSQL2012", 12, "ying");
            //hmConn = new HMConnection.HMCon("WEB_DEMO_MASTER_V11", "REFLEXDEMOSERV", 12, "ying");
            hmDevMgr = new TUC_HMDevXManager.TUC_HMDevXManager();

            List <IMapLayer> layers     = new List <IMapLayer>();
            MapShapeLayer    shapeLayer = new MapShapeLayer()
            {
                LinkTable  = "Test",
                LinkColumn = "Asset Code"
            };

            shapeLayer.Attributes.Add(new AttrInfo("Category", "Category"));
            shapeLayer.Attributes.Add(new AttrInfo("Location", "Location"));
            shapeLayer.Attributes.Add(new AttrInfo("Asset Code", "Asset Code"));
            layers.Add(shapeLayer);

            MapPointLayer pointLayer = new MapPointLayer()
            {
                LinkTable  = "Test",
                LinkColumn = "Asset Code",
            };

            pointLayer.Attributes.Add(new AttrInfo("Desc", "Description"));
            pointLayer.Attributes.Add(new AttrInfo("Asset Code", "Asset Code"));
            //pointLayer.HilightMarkerSymbol = new PictureMarkerSymbol();
            //((PictureMarkerSymbol)pointLayer.HilightMarkerSymbol).SetSourceAsync(new System.Uri("http://static.arcgis.com/images/Symbols/Basic/GoldShinyPin.png"));
            //pointLayer.MarkerSymbol = new PictureMarkerSymbol();
            //((PictureMarkerSymbol)pointLayer.MarkerSymbol).SetSourceAsync(new System.Uri("http://static.arcgis.com/images/Symbols/Basic/GreenShinyPin.png"));
            layers.Add(pointLayer);

            MapLineLayer lineLayer = new MapLineLayer()
            {
                LinkTable  = "Test",
                LinkColumn = "Asset Code"
            };

            lineLayer.Attributes.Add(new AttrInfo("Category", "Category"));
            lineLayer.Attributes.Add(new AttrInfo("Location", "Location"));
            lineLayer.Attributes.Add(new AttrInfo("Asset Code", "Asset Code"));
            layers.Add(lineLayer);

            var eventList = MapEventLayer.GetEventLayers(hmConn, "Test", "Asset Code");

            layers.AddRange(eventList);

            string sql = $"exec sp_FA_SearchBuildingAssets '{hmConn.MLUser}E', 'E'";

            hmConn.SQLExecutor.ExecuteNonQuery(sql, hmConn.TRConnection);

            sql = $"SELECT distinct eqi_code, [Asset Code], Description, Category, Class, Location " +
                  $"FROM working_Fixed_Assets_search WHERE(username = '******')";

            var table = hmConn.SQLExecutor.ExecuteDataAdapter(sql, hmConn.TRConnection);

            gc.DataSource = table;

            gv.Columns.ToList().ForEach(x => x.Caption = x.Name + "Cap");

            ucMap1.Init(hmConn, hmDevMgr, gv, layers);
        }