using MaterialTraceability.Entity.DAO; using MaterialTraceability.SqlSugar; using MaterialTraceability.SqlSugar.ServiceImpl; using MaterialTraceabilityUI.Common; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace MaterialTraceabilityUI { /// /// LogRecordControl.xaml 的交互逻辑 /// public partial class MesRequestControl : UserControl { private IBaseServices baseServices = new BaseServices(); public MesRequestControl() { InitializeComponent(); } private void Seach_Click(object sender, RoutedEventArgs e) { Refresh(); } private void Refresh() { Expression> exp = s1 => true; if (this.beginTime.Text.ToString() != "") { DateTime beginTime = Convert.ToDateTime(this.beginTime.Text.ToString()); exp = exp.And(x => Convert.ToDateTime(x.requestTime) >= beginTime); } if (this.endTime.Text.ToString() != "") { DateTime endTime = Convert.ToDateTime(this.endTime.Text.ToString()); exp = exp.And(x => Convert.ToDateTime(x.requestTime) <= endTime); } if (Convert.ToString(this.isAlarmInfo.SelectedItem) != "") { int isAlarm = Convert.ToString(this.isAlarmInfo.SelectedItem) == "是" ? 1 : 0; exp = exp.And(x => x.responseCode == isAlarm); } List recordLogInfos = baseServices.Query(exp).Result; recordLogInfos.ForEach(x => { x.responseResult = x.responseCode == 0 ? "成功" : "失败"; }); this.ReadRecordDataGrid.ItemsSource = recordLogInfos; } private void UserControl_Loaded(object sender, RoutedEventArgs e) { this.beginTime.Text = DateTime.Now.ToLongDateString(); this.endTime.Text = DateTime.Now.AddDays(1).ToLongDateString(); List isAlarm = new List() { "是", "否", "" }; this.isAlarmInfo.ItemsSource = isAlarm; Refresh(); } } }