public WorkingMood(pmts_net.AppWindow.Main MainWindow, String UserID, String HostIp) { InitializeComponent(); Main = MainWindow; user = UserID; hostIP = HostIp; if (MoodDB == null) { MoodDB = new pmts_net.Plugin.WorkMood(user, hostIP); } ArrayList dates = MoodDB.OnGetMoodDate(DateTime.Now); SetCalendarHighLight(DateTime.Now, dates); }
/// <summary> /// 提交工作心理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_2(object sender, RoutedEventArgs e) { if (MoodDB == null) { MoodDB = new pmts_net.Plugin.WorkMood(user, hostIP); } if (MoodDB.OnInsertMood(this.MoodValueSlider.Value, this.MoodText.Text)) { moodValue = this.MoodValueSlider.Value; isInput = true; PmtsMessageBox.CustomControl1.Show("写入数据库成功。", PmtsMessageBox.ServerMessageBoxButtonType.OK); this.MoodText.Clear(); this.MoodValueSlider.Value = 50; } }
/// <summary> /// 点击具体日期查看当天详情 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void fsCalendar1_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { if (this.fsCalendar1.SelectedDate != null) { System.Diagnostics.Debug.Write("选择的日期" + this.fsCalendar1.SelectedDate + "\n"); this.InputPage.Visibility = System.Windows.Visibility.Hidden; this.DetailePage.Visibility = System.Windows.Visibility.Visible; DateTime selectDate = (DateTime)this.fsCalendar1.SelectedDate; if (MoodDB == null) { MoodDB = new pmts_net.Plugin.WorkMood(user, hostIP); } List <pmts_net.Plugin.MoodDataList> moodList = MoodDB.OnGetMoodDetail(selectDate); this.ShowMoodDetaile.DataContext = moodList; this.ShowMoodDetaile.Items.Refresh(); } this.fsCalendar1.SelectedDate = null; }
/// <summary> /// 上个月按钮重写 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnPrevMonthButtonClick(object sender, RoutedEventArgs e) { DateTime nowDate = (DateTime)this.fsCalendar1.DisplayDate; int newMonth = nowDate.Month - 1; int newYear = nowDate.Year; if (newMonth < 1) { newMonth = 12; newYear -= 1; } DateTime newDate = new DateTime(newYear, newMonth, 1); if (MoodDB == null) { MoodDB = new pmts_net.Plugin.WorkMood(user, hostIP); } ArrayList dates = MoodDB.OnGetMoodDate(newDate); SetCalendarHighLight(newDate, dates); SetCalendarDispaly(newDate); this.fsCalendar1.DisplayDate = newDate; }