示例#1
0
        public DepartmentRankViewModel GetViewModelByBuild(string userName, string buildId)
        {
            DateTime              today       = DateTime.Now;
            DateTime              monthBegin  = new DateTime(today.Year, today.Month, 1);
            DateTime              monthEnd    = monthBegin.AddMonths(1).AddDays(-1);
            IHomeDbContext        homeContext = new HomeDbContext();
            List <BuildViewModel> builds      = homeContext.GetBuildsByUserName(userName);


            List <EnergyItemDict> energys = reportContext.GetEnergyItemDictByBuild(buildId);

            string energyCode;

            if (energys.Count > 0)
            {
                energyCode = energys.First().EnergyItemCode;
            }
            else
            {
                energyCode = "";
            }

            List <EMSValue> list = context.GetRankList(buildId, monthBegin.ToString("yyyy-MM-dd"), monthEnd.ToString("yyyy-MM-dd"), energyCode);

            DepartmentRankViewModel model = new DepartmentRankViewModel();

            model.Builds     = builds;
            model.Energys    = energys;
            model.RankValues = list;

            return(model);
        }
示例#2
0
        public DepartmentRankViewModel GetViewModel(string buildId, string date)
        {
            DateTime monthBegin           = Utils.Util.ConvertString2DateTime(date + "-01", "yyyy-MM-dd");
            DateTime monthEnd             = monthBegin.AddMonths(1).AddDays(-1);
            List <EnergyItemDict> energys = reportContext.GetEnergyItemDictByBuild(buildId);

            string energyCode;

            if (energys.Count > 0)
            {
                energyCode = energys.First().EnergyItemCode;
            }
            else
            {
                energyCode = "";
            }

            List <EMSValue>         list  = context.GetRankList(buildId, monthBegin.ToString("yyyy-MM-dd"), monthEnd.ToString("yyyy-MM-dd"), energyCode);
            DepartmentRankViewModel model = new DepartmentRankViewModel();

            model.Energys    = energys;
            model.RankValues = list;

            return(model);
        }
示例#3
0
        public DepartmentRankViewModel GetViewModel(string buildId, string date, string energyCode)
        {
            DateTime monthBegin = Utils.Util.ConvertString2DateTime(date + "-01", "yyyy-MM-dd");
            DateTime monthEnd   = monthBegin.AddMonths(1).AddDays(-1);

            List <EMSValue>         list  = context.GetRankList(buildId, monthBegin.ToString("yyyy-MM-dd"), monthEnd.ToString("yyyy-MM-dd"), energyCode);
            DepartmentRankViewModel model = new DepartmentRankViewModel();

            model.RankValues = list;

            return(model);
        }