Example #1
0
        /// <summary>
        /// 空间被载入后发生事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (uInfo != null)
            {
                this.UserNameText.Text   = uInfo["name"].ToString();
                this.PoliceTypeText.Text = uInfo["pType"].ToString();
                if (!String.IsNullOrEmpty(uInfo["age"].ToString()))
                {
                    TimeSpan nowTick  = new TimeSpan(DateTime.Now.Ticks);
                    TimeSpan birTick  = new TimeSpan(Convert.ToDateTime(uInfo["age"].ToString()).Ticks);
                    TimeSpan diffTick = nowTick.Subtract(birTick).Duration();
                    this.AgeText.Text = Math.Floor((diffTick.TotalDays / 365)).ToString();
                }
                if (uInfo["sex"].ToString() == "1")
                {
                    this.SexText.Text = "男";
                }
                else
                {
                    this.SexText.Text = "女";
                }
                this.AreaText.Text  = uInfo["area"].ToString();
                UserInfoStatic.O    = Convert.ToDouble(uInfo["O"]);
                UserInfoStatic.R    = Convert.ToDouble(uInfo["R"]);
                UserInfoStatic.T    = Convert.ToDouble(uInfo["T"]);
                UserInfoStatic.E    = Convert.ToDouble(uInfo["E"]);
                UserInfoStatic.W    = Convert.ToDouble(uInfo["W"]);
                UserInfoStatic.HRVS = Convert.ToDouble(uInfo["HRVS"]);
            }
            if (medal != null)
            {
                if (Convert.ToInt32(medal["ALLC"]) == 1)
                {
                    this.CourseAllMark.Visibility = System.Windows.Visibility.Hidden;
                    this.CourseAllShow.Visibility = System.Windows.Visibility.Visible;
                }
                if (Convert.ToInt32(medal["ALLT"]) == 1)
                {
                    this.TrainAllMark.Visibility = System.Windows.Visibility.Hidden;
                    this.TrainAllShow.Visibility = System.Windows.Visibility.Visible;
                }
                if (Convert.ToInt32(medal["ALLE"]) == 1)
                {
                    this.EPAllMark.Visibility = System.Windows.Visibility.Hidden;
                    this.EPAllShow.Visibility = System.Windows.Visibility.Visible;
                }
            }
            GetUserInfo udb = new GetUserInfo();

            this.SystemNoticeText.Text = udb.GetNotice();
            strNotice = this.SystemNoticeText.Text;

            NoticeTimer          = new DispatcherTimer();
            NoticeTimer.Tick    += new EventHandler(OnTimerNotice);
            NoticeTimer.Interval = new TimeSpan(0, 0, 0, 10, 0);
            NoticeTimer.Start();
        }
Example #2
0
        private void OnTimerNotice(object source, EventArgs e)
        {
            GetUserInfo udb = new GetUserInfo();

            this.SystemNoticeText.Text = udb.GetNotice();
            if (strNotice != this.SystemNoticeText.Text)
            {
                strNotice = this.SystemNoticeText.Text;
                PmtsMessageBox.CustomControl1.Show("有新的系统公告,请在右侧面板查看!", PmtsMessageBox.ServerMessageBoxButtonType.OK);
            }
        }
Example #3
0
        public void OnRefreshInfo()
        {
            GetUserInfo udb = new GetUserInfo();

            uInfo = udb.GetUserInfoByUID();
            medal = udb.GetUserMedal();
            if (uInfo != null)
            {
                this.UserNameText.Text   = uInfo["name"].ToString();
                this.PoliceTypeText.Text = uInfo["pType"].ToString();
                if (!String.IsNullOrEmpty(uInfo["age"].ToString()))
                {
                    TimeSpan nowTick  = new TimeSpan(DateTime.Now.Ticks);
                    TimeSpan birTick  = new TimeSpan(Convert.ToDateTime(uInfo["age"].ToString()).Ticks);
                    TimeSpan diffTick = nowTick.Subtract(birTick).Duration();
                    this.AgeText.Text = Math.Floor((diffTick.TotalDays / 365)).ToString();
                }
                if (uInfo["sex"].ToString() == "1")
                {
                    this.SexText.Text = "男";
                }
                else
                {
                    this.SexText.Text = "女";
                }
                this.AreaText.Text  = uInfo["area"].ToString();
                UserInfoStatic.O    = Convert.ToDouble(uInfo["O"]);
                UserInfoStatic.R    = Convert.ToDouble(uInfo["R"]);
                UserInfoStatic.T    = Convert.ToDouble(uInfo["T"]);
                UserInfoStatic.E    = Convert.ToDouble(uInfo["E"]);
                UserInfoStatic.W    = Convert.ToDouble(uInfo["W"]);
                UserInfoStatic.HRVS = Convert.ToDouble(uInfo["HRVS"]);
            }
            if (medal != null)
            {
                if (Convert.ToInt32(medal["ALLC"]) == 1)
                {
                    this.CourseAllMark.Visibility = System.Windows.Visibility.Hidden;
                    this.CourseAllShow.Visibility = System.Windows.Visibility.Visible;
                }
                if (Convert.ToInt32(medal["ALLT"]) == 1)
                {
                    this.TrainAllMark.Visibility = System.Windows.Visibility.Hidden;
                    this.TrainAllShow.Visibility = System.Windows.Visibility.Visible;
                }
                if (Convert.ToInt32(medal["ALLE"]) == 1)
                {
                    this.EPAllMark.Visibility = System.Windows.Visibility.Hidden;
                    this.EPAllShow.Visibility = System.Windows.Visibility.Visible;
                }
            }
            this.SystemNoticeText.Text = udb.GetNotice();
        }