示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataService.SSHMCDataServiceClient client = new DataService.SSHMCDataServiceClient();

               DataService.tblPre_disasterNotified[] res= client.GetDisasterInfo();
               string htmlstr="";
               foreach (DataService.tblPre_disasterNotified info in res)
               {
               string classtype = "side";

               if (info.PRE_ADMONISH_CLASS.Contains("雨"))
                   classtype = "main2";
               else if (info.PRE_ADMONISH_CLASS.Contains("地震") || info.PRE_ADMONISH_CLASS.Contains("颱風"))
                   classtype = "side";

               htmlstr+= GenerateDivInformation(  info.TITLE, ((DateTime)info.TIMESTAMP).ToString("yyyy/MM/dd HH:mm:ss"), info.CONTENT, classtype  );

               }
               this.Literal1.Text = htmlstr;
        }
示例#2
0
        // 使用者巡覽至這個頁面時執行。
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            UserID=  this.NavigationContext.QueryString["userid"].ToString();

              DataService.SSHMCDataServiceClient client = new DataService.SSHMCDataServiceClient();
            client.GettblReportNotifiedCompleted+=(s,a)=>
                {
                    if (a.Error != null)

                        return;

                    var q = from n in a.Result orderby n.TYPE, n.DATATIME  descending
                            group n by new {n.SITE_ID,  n.SITE_NAME }     into g
                            select new BindingData { SITE_NAME=g.Key.SITE_NAME,Count= g.Count(),
                            Items=g.ToArray() ,
                            SITE_ID=g.Key.SITE_ID
                            };

                    this.lstSite.ItemsSource =q ;

                };
               client.GettblReportNotifiedAsync(UserID);
        }
示例#3
0
        void Load_Site(string customerid)
        {
            #region old ria service
            //MapApplication.Web.DbContext db = new Web.DbContext();
            //if (this.siteCollection == null)
            //{
            //    EntityQuery<vwSiteDegree> q ;
            //    if (customerid == "1")
            //    {
            //        q = db.GetVwSiteDegreeQuery();
            //        (this.map1.Layers["buildingPointLyr"] as FeatureLayer).Visible = false;
            //      //  (this.map1.Layers["buildingPointLyr"] as FeatureLayer).Refresh();
            //    }
            //    else
            //    {
            //        q = db.GetVwSiteDegreeQuery().Where(n => n.CUSTOMER_ID == System.Convert.ToInt32(customerid) || n.CUSTOMER_ID == 1);

            //        (this.map1.Layers["buildingPointLyr"] as FeatureLayer).Where = "CUSTOMER_ID<>1 and CUSTOMER_ID<>" + customerid;
            //        (this.map1.Layers["buildingPointLyr"] as FeatureLayer).Refresh();
            //    }
                
            //    LoadOperation<vwSiteDegree> lo = db.Load<vwSiteDegree>(q);
            //    lo.Completed += (s, a) =>
            //        {
            //            if (lo.Error != null)
            //            {
            //                MessageBox.Show(lo.Error.Message);
            //                return;
            //            }

            //            siteCollection = new ObservableCollection<vwSiteDegree>(lo.Entities);
            //            DisplayGlobalAndBindingSite();
            //            BindingMenu();

            //            return;
            //        };

            //}
            #endregion

            DataService.SSHMCDataServiceClient client = new DataService.SSHMCDataServiceClient();
            client.GetSiteInfoCompleted  += (s, a) =>
                {
                    if (a.Error != null)
                    {
                        MessageBox.Show(a.Error.Message);
                        return;
                    }
                    siteCollection = new ObservableCollection<DataService.vwSiteDegree>(a.Result);
                               DisplayGlobalAndBindingSite();
                               BindingMenu();

                                return;
                };
            client.GetSiteInfoAsync(UserID);
            if (siteCollection!=null)
             BindingMenu();

           
        }
示例#4
0
        public void UpdateSiteDegree(string customerid)
        {
           // MapApplication.Web.DbContext db = new Web.DbContext();
           //EntityQuery<vwSiteDegree> qry;
           // if(customerid=="1")
           //      qry= from n in db.GetVwSiteDegreeQuery() select n; 
           // else
           //     qry= from n in db.GetVwSiteDegreeQuery() where n.CUSTOMER_ID==System.Convert.ToInt32(customerid)  select n;
           //LoadOperation<vwSiteDegree> lo = db.Load<vwSiteDegree>(qry);
           //lo.Completed += (s, a) =>
           //    {
           //        if (lo.Error != null)
           //            return;
           //        foreach (vwSiteDegree siteinfo in lo.Entities)
           //        {
           //            if (!dictPins.ContainsKey(siteinfo.SITE_ID))
           //                continue;

           //            (dictPins[siteinfo.SITE_ID].DataContext as vwSiteDegree).CURRENT_DEGREE = siteinfo.CURRENT_DEGREE;

           //        }
           //    };
            DataService.SSHMCDataServiceClient client = new DataService.SSHMCDataServiceClient();
            client.GetSiteInfoCompleted+=(s,a)=>
                {
                    if (a.Error != null)
                        return;
                     foreach (DataService.vwSiteDegree siteinfo in a.Result)
                     {
                         if (!dictPins.ContainsKey(siteinfo.SITE_ID))
                             continue;

                         (dictPins[siteinfo.SITE_ID].DataContext as DataService.vwSiteDegree).CURRENT_DEGREE = siteinfo.CURRENT_DEGREE;

                         (dictPins[siteinfo.SITE_ID].DataContext as DataService.vwSiteDegree).NID = siteinfo.NID;
                      //   (dictPins[siteinfo.SITE_ID].DataContext as DataService.vwSiteDegree).SurveyImageFilePath = siteinfo.SurveyImageFilePath;
                     }

                };
            client.GetSiteInfoAsync(UserID);
            
        }