Example #1
0
        //添加事件
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            IncidentBean bean = (IncidentBean)DataContext;

            bean.Title = bean.Title.Trim();
            if (bean.Title == string.Empty)
            {
                MessageBox.Show("标题不得为空", "提示", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            else
            {
                if (bean.Title.Length > 20)
                {
                    MessageBox.Show("标题不得超过20个字符", "提示", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }
                if (bean.Explain.Length > 500)
                {
                    MessageBox.Show("备注不得超过500个字符", "提示", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }
            }
            AddRecordService.AddIncident(bean);
        }
Example #2
0
        //加载页面
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            IncidentBean bean = AddRecordService.GetBean();

            DataContext = bean;
            if (bean.CreateTime == DateTime.MinValue)
            {
                return;
            }
            TimeSpan time = DateTime.Now - bean.CreateTime;

            timeSpan.Text = "距离上一次记录:- 天".Replace(" - ", time.Days.ToString());
        }
Example #3
0
 public AdminController()
 {
     _addRecordSvc = new AddRecordService();
 }
Example #4
0
 public HomeController()
 {
     _addRecordSvc = new AddRecordService();
 }