using DM_Weight.Models; using DM_Weight.Report; using DM_Weight.util; using Prism.Commands; using Prism.Mvvm; using Prism.Regions; using System; using System.Collections.Generic; using System.Configuration; using System.Drawing.Printing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DM_Weight.ViewModels { public class UseAccountWindowViewModel : BindableBase, INavigationAware { private DateTime? _startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); private DateTime? nowDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); public DateTime? StartDate { get => _startDate; set { if (value != null) { SetProperty(ref _startDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0)); } else { SetProperty(ref _startDate, value); } } } private DateTime? _endDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 59, 59); public DateTime? EndDate { get => _endDate; set { if (value != null) { TimeSpan ershisi = new TimeSpan(23, 59, 59); SetProperty(ref _endDate, new DateTime(value?.Year ?? 0, value?.Month ?? 0, value?.Day ?? 0, 23, 59, 59)); } else { SetProperty(ref _endDate, value); } } } private string _name; public string Name { get => _name; set { SetProperty(ref _name, value); } } /// /// 麻醉医师姓名 /// private List _UserInfos; public List UserInfos { get => _UserInfos; set { SetProperty(ref _UserInfos, value); } } private UserList _User; public UserList User { get => _User; set { SetProperty(ref _User, value); } } private static List boxDefine = new List { "1号手术间", "2号手术间", "3号手术间", "4号手术间", "5号手术间", "6号手术间", "7号手术间", "8号手术间", "9号手术间", "10号手术间", "11号手术间", "12号手术间", "13号手术间", "14号手术间", "15号手术间", "16号手术间", "17号手术间", "18号手术间" }; private List _Boxs = boxDefine; public List Boxs { get => _Boxs; set { SetProperty(ref _Boxs, value); } } private string _Box; public string Box { get => _Box; set { SetProperty(ref _Box, value); } } private static readonly DateTime Jan1st1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); public long CurrentTimeMillis() { return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds; } public void OnNavigatedTo(NavigationContext navigationContext) { //绑定用户信息 UserInfos = SqlSugarHelper.Db.Queryable() .Where(ul => ul.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM5")).ToList(); } public bool IsNavigationTarget(NavigationContext navigationContext) { return true; } public void OnNavigatedFrom(NavigationContext navigationContext) { } /// /// 导出账册 /// public DelegateCommand DownloadAccountBook { get => new DelegateCommand(() => { GridReportUtil.UserAccount(StartDate, EndDate, User == null ? "" : User.Nickname, Box); }); } public bool KeepAlive => true; } }