151 lines
3.7 KiB
C#
151 lines
3.7 KiB
C#
|
using DM_Weight.Models;
|
|||
|
using Prism.Commands;
|
|||
|
using Prism.Mvvm;
|
|||
|
using Prism.Regions;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using DM_Weight.Report;
|
|||
|
|
|||
|
namespace DM_Weight.ViewModels
|
|||
|
{
|
|||
|
public class DrugTakeCheckInWindowViewModel:BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
|||
|
{
|
|||
|
private int _pageNum = 1;
|
|||
|
public int PageNum
|
|||
|
{
|
|||
|
get => _pageNum;
|
|||
|
set
|
|||
|
{
|
|||
|
SetProperty(ref _pageNum, value);
|
|||
|
RequestData();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private int _pageCount = 1;
|
|||
|
public int PageCount
|
|||
|
{
|
|||
|
get => _pageCount;
|
|||
|
set
|
|||
|
{
|
|||
|
SetProperty(ref _pageCount, value);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private int _pageSize = 8;
|
|||
|
public int PageSize
|
|||
|
{
|
|||
|
get => _pageSize;
|
|||
|
set
|
|||
|
{
|
|||
|
SetProperty(ref _pageSize, value);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private int _totalCount = 0;
|
|||
|
public int TotalCount
|
|||
|
{
|
|||
|
get => _totalCount;
|
|||
|
set
|
|||
|
{
|
|||
|
SetProperty(ref _totalCount, value);
|
|||
|
}
|
|||
|
}
|
|||
|
private DateTime? _startDate = 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);
|
|||
|
}
|
|||
|
RequestData();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
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);
|
|||
|
}
|
|||
|
|
|||
|
RequestData();
|
|||
|
}
|
|||
|
}
|
|||
|
private List<MachineRecord>? machineRecords;
|
|||
|
|
|||
|
public List<MachineRecord>? MachineRecords
|
|||
|
{
|
|||
|
get { return machineRecords; }
|
|||
|
set { SetProperty(ref machineRecords, value); }
|
|||
|
}
|
|||
|
public bool KeepAlive => false;
|
|||
|
|
|||
|
|
|||
|
public DelegateCommand Query
|
|||
|
{
|
|||
|
get => new DelegateCommand(() =>
|
|||
|
{
|
|||
|
RequestData();
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
public DelegateCommand Download
|
|||
|
{
|
|||
|
get => new DelegateCommand(() =>
|
|||
|
{
|
|||
|
//GridReportUtil.PrintReportDrugTakeCheckIn(StartDate, EndDate);
|
|||
|
|
|||
|
});
|
|||
|
}
|
|||
|
private void RequestData()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
|||
|
{
|
|||
|
continuationCallback(true);
|
|||
|
}
|
|||
|
|
|||
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|||
|
{
|
|||
|
Task.Factory.StartNew(() =>
|
|||
|
{
|
|||
|
RequestData();
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|