コード例 #1
0
        private void loadSiteCCTV(vwSiteDegree site)
        {
            // throw new NotImplementedException();
            MapApplication.Web.DbContext db = new Web.DbContext();
            string site_id = site.SITE_ID;
            EntityQuery<tblCCTV> qry = from n in db.GetTblCCTVQuery() where n.SITE_ID == site_id select n;
            LoadOperation<tblCCTV> lo = db.Load<tblCCTV>(qry);

            lo.Completed += (s, a) =>
               {
                   if (lo.Error != null)
                   {
                       MessageBox.Show(lo.Error.Message);
                       return;

                   }
                   dictCCTVs.Clear();
                   this.lstCCTV.ItemsSource = lo.Entities;
                   foreach (tblCCTV cctvInfo  in lo.Entities   )
                   {
                       ElementLayer lyr = this.map1.Layers["sensorLyr"] as ElementLayer;
                       CCTV sensor = new CCTV();

                       MapPoint mp = ConvertMapPointTo102100(new MapPoint((double)cctvInfo.X, (double)cctvInfo.Y));
                       sensor.DataContext = cctvInfo;

                       ElementLayer.SetEnvelope(sensor, new Envelope(mp, mp));
                       dictCCTVs.Add(cctvInfo.CCTV_ID, sensor);
                       lyr.Children.Add(sensor);
                   }

               };
        }
コード例 #2
0
        void loadSiteSensor(vwSiteDegree site)
        {
            MapApplication.Web.DbContext db = new Web.DbContext();

            string site_id = site.SITE_ID;
            if (sensorsCollection != null)
                sensorsCollection.Clear();

                EntityQuery<vwSensorDegree> qry = from n in db.GetVwSensorDegreeQuery() where n.SITE_ID == site_id select n;
                LoadOperation<vwSensorDegree> lo = db.Load<vwSensorDegree>(qry);
                lo.Completed += (s, a) =>
                    {
                        if (lo.Error != null)
                        {
                            MessageBox.Show(lo.Error.Message);
                            return;

                        }
                        dictSensors.Clear();
                        sensorsCollection = new ObservableCollection<vwSensorDegree>(lo.Entities);
                        this.lstMenu.ItemTemplate = this.Resources["SITE_VIEW_TEMPLATE"] as DataTemplate;
                        this.lstMenu.ItemsSource = sensorsCollection;
                        foreach (vwSensorDegree sensorInfo in sensorsCollection)
                        {
                            ElementLayer lyr = this.map1.Layers["sensorLyr"] as ElementLayer;
                            Sensor sensor = new Sensor();

                            MapPoint mp = ConvertMapPointTo102100(new MapPoint((double)sensorInfo.X, (double)sensorInfo.Y));
                            sensor.DataContext = sensorInfo;

                            ElementLayer.SetEnvelope(sensor, new Envelope(mp, mp));
                            dictSensors.Add(sensorInfo.SENSOR_ID, sensor);
                            lyr.Children.Add(sensor);

                        }

                    };
        }
コード例 #3
0
ファイル: DB.Designer.cs プロジェクト: ufjl0683/sshmc
 /// <summary>
 /// 建立新 vwSiteDegree 物件。
 /// </summary>
 /// <param name="sITE_ID">SITE_ID 屬性的初始值。</param>
 public static vwSiteDegree CreatevwSiteDegree(global::System.String sITE_ID)
 {
     vwSiteDegree vwSiteDegree = new vwSiteDegree();
     vwSiteDegree.SITE_ID = sITE_ID;
     return vwSiteDegree;
 }
コード例 #4
0
ファイル: DB.Designer.cs プロジェクト: ufjl0683/sshmc
 /// <summary>
 /// 將新物件加入 vwSiteDegree EntitySet 的方法已被取代。請考慮改為使用關聯的 ObjectSet&lt;T&gt; 屬性的 .Add 方法。
 /// </summary>
 public void AddTovwSiteDegree(vwSiteDegree vwSiteDegree)
 {
     base.AddObject("vwSiteDegree", vwSiteDegree);
 }
コード例 #5
0
ファイル: DB.Designer.cs プロジェクト: ufjl0683/sshmc
 /// <summary>
 /// 建立新 vwSiteDegree 物件。
 /// </summary>
 /// <param name="sITE_ID">SITE_ID 屬性的初始值。</param>
 /// <param name="sITE_NAME">SITE_NAME 屬性的初始值。</param>
 /// <param name="sITE_ADDRESS">SITE_ADDRESS 屬性的初始值。</param>
 /// <param name="eNVIRONMENT">ENVIRONMENT 屬性的初始值。</param>
 /// <param name="x">X 屬性的初始值。</param>
 /// <param name="y">Y 屬性的初始值。</param>
 /// <param name="cURRENT_DEGREE">CURRENT_DEGREE 屬性的初始值。</param>
 /// <param name="cUSTOMER_NAME">CUSTOMER_NAME 屬性的初始值。</param>
 /// <param name="cUSTOMER_ID">CUSTOMER_ID 屬性的初始值。</param>
 public static vwSiteDegree CreatevwSiteDegree(global::System.String sITE_ID, global::System.String sITE_NAME, global::System.String sITE_ADDRESS, global::System.String eNVIRONMENT, global::System.Double x, global::System.Double y, global::System.Int32 cURRENT_DEGREE, global::System.String cUSTOMER_NAME, global::System.Int32 cUSTOMER_ID)
 {
     vwSiteDegree vwSiteDegree = new vwSiteDegree();
     vwSiteDegree.SITE_ID = sITE_ID;
     vwSiteDegree.SITE_NAME = sITE_NAME;
     vwSiteDegree.SITE_ADDRESS = sITE_ADDRESS;
     vwSiteDegree.ENVIRONMENT = eNVIRONMENT;
     vwSiteDegree.X = x;
     vwSiteDegree.Y = y;
     vwSiteDegree.CURRENT_DEGREE = cURRENT_DEGREE;
     vwSiteDegree.CUSTOMER_NAME = cUSTOMER_NAME;
     vwSiteDegree.CUSTOMER_ID = cUSTOMER_ID;
     return vwSiteDegree;
 }
コード例 #6
0
ファイル: DB1.Designer.cs プロジェクト: ufjl0683/sshmc
 /// <summary>
 /// 建立新 vwSiteDegree 物件。
 /// </summary>
 /// <param name="sITE_ID">SITE_ID 屬性的初始值。</param>
 /// <param name="sITE_NAME">SITE_NAME 屬性的初始值。</param>
 /// <param name="sITE_ADDRESS">SITE_ADDRESS 屬性的初始值。</param>
 /// <param name="x">X 屬性的初始值。</param>
 /// <param name="y">Y 屬性的初始值。</param>
 /// <param name="cUSTOMER_ID">CUSTOMER_ID 屬性的初始值。</param>
 /// <param name="iSBIM">ISBIM 屬性的初始值。</param>
 public static vwSiteDegree CreatevwSiteDegree(global::System.String sITE_ID, global::System.String sITE_NAME, global::System.String sITE_ADDRESS, global::System.Double x, global::System.Double y, global::System.Int32 cUSTOMER_ID, global::System.Boolean iSBIM)
 {
     vwSiteDegree vwSiteDegree = new vwSiteDegree();
     vwSiteDegree.SITE_ID = sITE_ID;
     vwSiteDegree.SITE_NAME = sITE_NAME;
     vwSiteDegree.SITE_ADDRESS = sITE_ADDRESS;
     vwSiteDegree.X = x;
     vwSiteDegree.Y = y;
     vwSiteDegree.CUSTOMER_ID = cUSTOMER_ID;
     vwSiteDegree.ISBIM = iSBIM;
     return vwSiteDegree;
 }
コード例 #7
0
        void loadSiteSensor(vwSiteDegree site)
        {
            MapApplication.Web.DbContext db = new Web.DbContext();

            string site_id = site.SITE_ID;
            if (sensorsCollection != null)
                sensorsCollection.Clear();

                EntityQuery<vwSensorDegree> qry = from n in db.GetVwSensorDegreeQuery() where n.SITE_ID == site_id select n;
                LoadOperation<vwSensorDegree> lo = db.Load<vwSensorDegree>(qry);
                lo.Completed += (s, a) =>
                    {
                        if (lo.Error != null)
                        {
                            MessageBox.Show(lo.Error.Message);
                            return;

                        }
                        dictSensors.Clear();
                        sensorsCollection = new ObservableCollection<vwSensorDegree>(lo.Entities);
                        this.lstMenu.ItemTemplate = this.Resources["SITE_VIEW_TEMPLATE"] as DataTemplate;
                        this.lstMenu.ItemsSource = sensorsCollection;
                        foreach (vwSensorDegree sensorInfo in sensorsCollection)
                        {
                            ElementLayer lyr = this.map1.Layers["sensorLyr"] as ElementLayer;
                            Sensor sensor = new Sensor();

                            MapPoint mp = ConvertMapPointTo102100(new MapPoint((double)sensorInfo.X, (double)sensorInfo.Y));
                            sensor.DataContext = sensorInfo;

                            ElementLayer.SetEnvelope(sensor, new Envelope(mp, mp));
                            dictSensors.Add(sensorInfo.SENSOR_ID, sensor);
                            lyr.Children.Add(sensor);

                        }

                    };
                EntityQuery<tblTC> qBA = from n in db.GetTblTCQuery() where n.SITE_ID == this.CURRENT_SITE_ID && n.DEVICE_TYPE == "BA" select n;
                LoadOperation<tblTC> loBA = db.Load<tblTC>(qBA);
                loBA.Completed += (s, a) =>
                {
                    if (loBA.Error != null)
                    {
                        MessageBox.Show(lo.Error.Message);
                        return;
                    }
                    if (loBA.Entities.Count() == 0)
                        txtBA.Visibility = System.Windows.Visibility.Collapsed;
                    else
                    {
                        txtBA.Visibility = System.Windows.Visibility.Visible;
                        if (loBA.Entities.FirstOrDefault().ISCONNECTED == "N")
                            txtBA.Foreground = new SolidColorBrush(Colors.Gray);
                        else
                            txtBA.Foreground = new SolidColorBrush(Colors.Green);
                    }

                };
        }