using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using YBDevice.Application;
using YBDevice.Application.ViewInfo;
using YBDevice.Entity;

namespace YBDevice.NWeb.Pages.Result
{
    /// <summary>
    /// 测量记录
    /// </summary>
    public class IndexModel : BaseModel
    {
        public List<YB_Business> buss = new List<YB_Business>();
        public List<YB_DeviceType> types = new List<YB_DeviceType>();
        private IBusinessService _businessService;
        private IDeviceService _deviceService;
        public string defaulttime = "";
        public int IsShowBodyType = 0;//是否展示体质信息
        public int IsShowPhone = 0;//是否展示手机号
        private IViewEngineService _viewEngineService;
        public ViewS2SDto viewdata = new ViewS2SDto();
        public IndexModel(IBusinessService businessService, IDeviceService deviceService, IViewEngineService viewEngineService)
        {
            _businessService = businessService;
            _deviceService = deviceService;
            _viewEngineService = viewEngineService;
            if (Baseuser.AccountType == AccountType.platform || BusinessShowConst.PhoneShowIds.Contains(Baseuser.BusinessId))
            {
                IsShowPhone = 1;
            }
        }
        public async Task OnGetAsync()
        {
            var BaseUser = BaseInfoService.GetUserInfo();
            if (BaseUser.AccountType == AccountType.platform || BaseUser.BusinessId == 14)
            {
                IsShowBodyType = 1;
            }
            defaulttime = $"{DateTime.Now.Date} ~ {DateTime.Now.Date.AddDays(1).AddSeconds(-1)}";
            buss = await _businessService.GetAllListAsync();
            types = await _deviceService.GetTypeListAsync();
            viewdata = await _viewEngineService.GetBtnListAsync();
        }
    }
}
