| 123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using System.Linq;
- using BO.AppServer.Data.Entity;
- using Quadarax.Foundation.Core.Data;
- using Quadarax.Foundation.Core.Data.Domain;
- using Quadarax.Foundation.Core.Data.Interface.Domain;
- using Quadarax.Foundation.Core.Data.Repository;
- namespace BO.AppServer.Data.Repository
- {
- public class StatisticRepo : EntityRepository<long, Statistic>
- {
- public StatisticRepo(IUnitOfWork<DataDomain> unitOfWork) : base(unitOfWork)
- {
- }
- public Statistic GetCurrent()
- {
- var timestamp = DateTime.Now;
- var current = Query(Paging.NoPaging())
- .FirstOrDefault(x => x.Day == timestamp.Day && x.Month == timestamp.Month && x.Year == timestamp.Year);
- if (current != null)
- return current;
- current = New();
- current.Day = timestamp.Day;
- current.Month = timestamp.Month;
- current.Year = timestamp.Year;
- current.Created = DateTime.Now;
- Set(current);
- Commit();
- return current;
- }
- }
- }
|