コード例 #1
0
        public DepartmentCompareViewModel GetViewModel(string buildId, string energyCode, string date)
        {
            ITreeViewDbContext   treeViewDb = new TreeViewDbContext();
            List <TreeViewModel> treeView   = treeViewDb.GetDepartmentTreeViewList(buildId, energyCode);

            string departmentID;

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

            List <EMSValue> CompareValue = context.GetDepartmentCompareValueList(buildId, energyCode, departmentID, date);

            DepartmentCompareViewModel CompareViewModel = new DepartmentCompareViewModel();

            CompareViewModel.TreeView    = treeView;
            CompareViewModel.CompareData = CompareValue;

            return(CompareViewModel);
        }
コード例 #2
0
        public DepartmentCompareViewModel GetViewModelByBuild(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;

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

            ITreeViewDbContext   treeViewDb = new TreeViewDbContext();
            List <TreeViewModel> treeView   = treeViewDb.GetDepartmentTreeViewList(buildId, energyCode);
            string departmentID             = treeView.First().Id;

            List <EMSValue> CompareValue = context.GetDepartmentCompareValueList(buildId, energyCode, departmentID, today.ToString("yyyy-MM-dd"));

            DepartmentCompareViewModel CompareViewModel = new DepartmentCompareViewModel();

            CompareViewModel.Builds      = builds;
            CompareViewModel.Energys     = energys;
            CompareViewModel.TreeView    = treeView;
            CompareViewModel.CompareData = CompareValue;

            return(CompareViewModel);
        }
コード例 #3
0
        /// <summary>
        /// 部门用能同比分析
        /// 根据建筑ID和时间,获取该建筑对应的能源按钮列表,第一个部门用能数据
        /// </summary>
        /// <param name="buildId">建筑ID</param>
        /// <param name="date">时间</param>
        /// <returns>返回:能源按钮列表,部门列表,以及第一个部门用能数据</returns>
        public DepartmentCompareViewModel GetViewModel(string buildId, string date)
        {
            List <EnergyItemDict> energys = reportContext.GetEnergyItemDictByBuild(buildId);

            string energyCode;

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

            ITreeViewDbContext   treeViewDb = new TreeViewDbContext();
            List <TreeViewModel> treeView   = treeViewDb.GetDepartmentTreeViewList(buildId, energyCode);
            string departmentID             = treeView.First().Id;

            List <EMSValue> CompareValue = context.GetDepartmentCompareValueList(buildId, energyCode, departmentID, date);

            DepartmentCompareViewModel CompareViewModel = new DepartmentCompareViewModel();

            CompareViewModel.Energys     = energys;
            CompareViewModel.TreeView    = treeView;
            CompareViewModel.CompareData = CompareValue;

            return(CompareViewModel);
        }
コード例 #4
0
ファイル: DepartmentReportService.cs プロジェクト: Mx1014/EMS
        /// <summary>
        /// 部门用能统计报表
        /// 根据建筑ID和日期,获取能源按钮列表,部门列表,以及用能数据天报表
        /// </summary>
        /// <param name="buildId">建筑ID</param>
        /// <param name="date">时间</param>
        /// <returns>返回完整的数据:能源按钮列表,部门列表,以及用能数据天报表</returns>
        public DepartmentReportViewModel GetViewModel(string buildId, string date, string type)
        {
            type = type.ToUpper();
            List <EnergyItemDict> energys = reportContext.GetEnergyItemDictByBuild(buildId);

            string energyCode;

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

            ITreeViewDbContext   treeViewDb = new TreeViewDbContext();
            List <TreeViewModel> treeView   = treeViewDb.GetDepartmentTreeViewList(buildId, energyCode);

            string[]           departmentIDs = treeViewDb.GetDepartmentIDs(buildId, energyCode);
            List <ReportValue> reportValue   = context.GetReportValueList(energyCode, departmentIDs, date, type);

            DepartmentReportViewModel reportView = new DepartmentReportViewModel();

            reportView.Energys    = energys;
            reportView.TreeView   = treeView;
            reportView.Data       = reportValue;
            reportView.ReportType = type;

            return(reportView);
        }
コード例 #5
0
        public void TestGetDepartmentTreeView()
        {
            ITreeViewDbContext context = new TreeViewDbContext();
            //DateTime today = DateTime.Now;

            List <TreeViewModel> treeViewModel = context.GetDepartmentTreeViewList("000001G001", "01000");

            Console.WriteLine(UtilTest.GetJson(treeViewModel));
        }
コード例 #6
0
ファイル: DepartmentReportService.cs プロジェクト: Mx1014/EMS
        public DepartmentReportViewModel GetViewModel(string buildId, string date, string energyCode, string type)
        {
            type = type.ToUpper();
            ITreeViewDbContext   treeViewDb = new TreeViewDbContext();
            List <TreeViewModel> treeView   = treeViewDb.GetDepartmentTreeViewList(buildId, energyCode);

            string[]           departmentIDs = treeViewDb.GetDepartmentIDs(buildId, energyCode);
            List <ReportValue> reportValue   = context.GetReportValueList(energyCode, departmentIDs, date, type);

            DepartmentReportViewModel reportView = new DepartmentReportViewModel();

            reportView.TreeView   = treeView;
            reportView.Data       = reportValue;
            reportView.ReportType = type;

            return(reportView);
        }
コード例 #7
0
ファイル: DepartmentReportService.cs プロジェクト: Mx1014/EMS
        /// <summary>
        /// 部门用能统计报表
        /// 初始加载:获取用户名查询建筑列表,第一栋建筑对应的分类,第一个分类对应的所有部门的用能天报表
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>返回完整的数据:包含建筑列表,能源按钮列表,部门列表,以及用能数据天报表</returns>
        public DepartmentReportViewModel GetViewModel(string userName)
        {
            DateTime              today       = DateTime.Now;
            IHomeDbContext        homeContext = new HomeDbContext();
            List <BuildViewModel> builds      = homeContext.GetBuildsByUserName(userName);
            string buildId = builds.First().BuildID;

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

            //增加分类能耗过滤信息
            //修改方法参数,修改SQL语句
            string energyCode;

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

            ITreeViewDbContext   treeViewDb = new TreeViewDbContext();
            List <TreeViewModel> treeView   = treeViewDb.GetDepartmentTreeViewList(buildId, energyCode);

            string[]           departmentIDs = treeViewDb.GetDepartmentIDs(buildId, energyCode);
            List <ReportValue> reportValue   = context.GetReportValueList(energyCode, departmentIDs, today.ToString("yyyy-MM-dd 00:00:00"), "DD");

            DepartmentReportViewModel reportView = new DepartmentReportViewModel();

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

            return(reportView);
        }