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(); }
public MainRight(Hashtable sysMeg) { InitializeComponent(); GetUserInfo udb = new GetUserInfo(sysMeg); uInfo = udb.GetUserInfoByUID(); medal = udb.GetUserMedal(); UserInfoStatic.UserName = uInfo["name"].ToString(); if (Convert.ToInt32(uInfo["sex"]) != 1) { UserInfoStatic.UserSex = "女"; } UserInfoStatic.UserAge = uInfo["age"].ToString(); UserInfoStatic.UserWorkYear = Convert.ToInt32(uInfo["wYear"]); UserInfoStatic.UserWorkType = uInfo["pType"].ToString(); UserInfoStatic.UserWorkArea = uInfo["wArea"].ToString(); UserInfoStatic.UserMR = uInfo["mr"].ToString(); }