Ejemplo n.º 1
0
        public EnergyItemCompareViewModel GetEnergyItemCompareViewModelByBuild(string userName, string buildId)
        {
            DateTime              today       = DateTime.Now;
            IHomeDbContext        homeContext = new HomeDbContext();
            List <BuildViewModel> builds      = homeContext.GetBuildsByUserName(userName);

            List <EnergyItemDict> energys = reportContext.GetEnergyItemDictByBuild(buildId);
            //string energyCode = energys.First().EnergyItemCode;

            IEnergyItemTreeViewDbContext energyItemtreeView = new EnergyItemTreeViewDbContext();
            List <TreeViewModel>         treeView           = energyItemtreeView.GetEnergyItemTreeViewList(buildId);

            string treeId;

            if (treeView.Count == 0)
            {
                treeId = "";
            }
            else
            {
                treeId = treeView.First().Id;
            }

            List <EnergyItemValue> energyItemCompareValue = context.GetEnergyItemCompareValueList(buildId, treeId, today.ToString());

            EnergyItemCompareViewModel energyItemCompareView = new EnergyItemCompareViewModel();

            energyItemCompareView.Builds      = builds;
            energyItemCompareView.Energys     = energys;
            energyItemCompareView.TreeView    = treeView;
            energyItemCompareView.CompareData = energyItemCompareValue;

            return(energyItemCompareView);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 分项用能同比分析
        /// </summary>
        /// <param name="buildId">建筑ID</param>
        /// <param name="date"> 传入的日期("yyyy-MM-dd HH:mm:ss")</param>
        /// <returns>返回完整的数据:能源按钮列表,分项列表,以及第一个分项用能数据</returns>
        public EnergyItemCompareViewModel GetEnergyItemCompareViewModel(string buildId, string date)
        {
            List <EnergyItemDict> energys = reportContext.GetEnergyItemDictByBuild(buildId);
            //string energyCode = energys.First().EnergyItemCode;

            IEnergyItemTreeViewDbContext energyItemtreeView = new EnergyItemTreeViewDbContext();
            List <TreeViewModel>         treeView           = energyItemtreeView.GetEnergyItemTreeViewList(buildId);

            string treeId;

            if (treeView.Count == 0)
            {
                treeId = "";
            }
            else
            {
                treeId = treeView.First().Id;
            }

            List <EnergyItemValue> energyItemCompareValue = context.GetEnergyItemCompareValueList(buildId, treeId, date);

            EnergyItemCompareViewModel energyItemCompareView = new EnergyItemCompareViewModel();

            energyItemCompareView.Energys     = energys;
            energyItemCompareView.TreeView    = treeView;
            energyItemCompareView.CompareData = energyItemCompareValue;

            return(energyItemCompareView);
        }
Ejemplo n.º 3
0
        public EnergyItemReportViewModel GetEnergyItemReportViewModelByBuild(string userName, string buildId)
        {
            DateTime              today       = DateTime.Now;
            IHomeDbContext        homeContext = new HomeDbContext();
            List <BuildViewModel> builds      = homeContext.GetBuildsByUserName(userName);

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

            IEnergyItemTreeViewDbContext energyItemtreeView = new EnergyItemTreeViewDbContext();
            List <TreeViewModel>         treeView           = energyItemtreeView.GetEnergyItemTreeViewList(buildId);

            List <EnergyItemInfo> EnergyItemInfos = energyItemtreeView.GetEnergyItemInfoList(buildId);

            string[]           formulaIDs  = GetEnergyItemCodes(EnergyItemInfos);
            List <ReportValue> reportValue = context.GetReportValueList(formulaIDs, today.ToString(), "DD");

            EnergyItemReportViewModel energyItemReportView = new EnergyItemReportViewModel();

            energyItemReportView.Builds     = builds;
            energyItemReportView.Energys    = energys;
            energyItemReportView.TreeView   = treeView;
            energyItemReportView.Data       = reportValue;
            energyItemReportView.ReportType = "DD";

            return(energyItemReportView);
        }
Ejemplo n.º 4
0
        public void TestGetEnergyItemReportDayValue()
        {
            IEnergyItemReportDbContext   context         = new EnergyItemReportDbContext();
            IEnergyItemTreeViewDbContext TreeViewcontext = new EnergyItemTreeViewDbContext();
            DateTime today   = DateTime.Now.AddDays(-1);
            string   buildID = "000001G001";
            List <EnergyItemInfo> energyItemInfos = TreeViewcontext.GetEnergyItemInfoList(buildID);

            string[] energyCodes = GetEnergyItemCodes(energyItemInfos);

            List <ReportValue> reportValue = context.GetReportValueList(energyCodes, today.ToString(), "DD");

            Console.WriteLine(UtilTest.GetJson(reportValue));
        }
Ejemplo n.º 5
0
        public void TestGetEnergyItemTreeView()
        {
            IEnergyItemTreeViewDbContext context = new EnergyItemTreeViewDbContext();
            //DateTime today = DateTime.Now;

            List <TreeViewModel> treeViewModel = context.GetEnergyItemTreeViewList("000001G008");
            string treeView = UtilTest.GetJson(treeViewModel);

            Console.WriteLine("分项用能列表:{0}", treeView);
            //foreach (var item in treeViewModel)
            //{
            //    Console.WriteLine("分项ID:{0}, 分项名称:{1}, 子节点:{2};", item.Id, item.Text,item.Nodes);
            //}
        }
Ejemplo n.º 6
0
        public void TestGetEnergyItemReportViewModelByEnergyItemIDAndTypeYear()
        {
            DateTime today   = DateTime.Now;
            string   buildId = "000001G001";
            IEnergyItemTreeViewDbContext energyItemtreeView = new EnergyItemTreeViewDbContext();
            List <TreeViewModel>         treeView           = energyItemtreeView.GetEnergyItemTreeViewList(buildId);

            List <EnergyItemInfo> EnergyItemInfos = energyItemtreeView.GetEnergyItemInfoList(buildId);

            string[] formulaIDs = GetEnergyItemCodes(EnergyItemInfos);

            EnergyItemReportService   service             = new EnergyItemReportService();
            EnergyItemReportViewModel EnergyReportViewDay = service.GetEnergyItemReportViewModel(formulaIDs, today.ToString(), "YY");

            Console.WriteLine(UtilTest.GetJson(EnergyReportViewDay));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 分项用能统计
        /// 根据建筑ID和日期,获取第一个分类对应的所有分项当日的用能概况
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="date">时间</param>
        /// <returns>返回完整的数据:能源按钮列表,分项列表,以及第一分类的当日用能数据</returns>
        public EnergyItemReportViewModel GetEnergyItemReportViewModel(string buildId, string date)
        {
            List <EnergyItemDict>        energys            = reportContext.GetEnergyItemDictByBuild(buildId);
            IEnergyItemTreeViewDbContext energyItemtreeView = new EnergyItemTreeViewDbContext();
            List <TreeViewModel>         treeView           = energyItemtreeView.GetEnergyItemTreeViewList(buildId);

            List <EnergyItemInfo> EnergyItemInfos = energyItemtreeView.GetEnergyItemInfoList(buildId);

            string[]           formulaIDs  = GetEnergyItemCodes(EnergyItemInfos);
            List <ReportValue> reportValue = context.GetReportValueList(formulaIDs, date, "DD");

            EnergyItemReportViewModel energyItemReportView = new EnergyItemReportViewModel();

            energyItemReportView.Energys    = energys;
            energyItemReportView.TreeView   = treeView;
            energyItemReportView.Data       = reportValue;
            energyItemReportView.ReportType = "DD";

            return(energyItemReportView);
        }