using Nirvana.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YBDevice.Entity;

namespace YBDevice.Service.DBServices
{
    /// <summary>
    /// 统计管理
    /// </summary>
    public partial class ReportApp : Repository<YB_Combined>
    {
        /// <summary>
        /// 获取合计信息
        /// </summary>
        /// <returns></returns>
        public async Task<YB_Combined> GetCombinedInfoAsync()
        {
            using (var dbClient = ReadDbContext.GetInstance())
            {
                var data= await dbClient.Queryable<YB_Combined>().FirstAsync();
                if(data == null)
                {
                    data = new YB_Combined {
                        TodayRegCnt=0,
                        TodayDevCnt=0,
                        TotalDevCnt=0,
                        TodayIncome=0,
                        TodayResultCnt=0,
                        TotalIncome=0,
                        TotalRegCnt=0,
                        TotalResultCnt=0
                    };
                }
                return data;
            }
        }
    }
}
