Пример #1
0
        /// <summary>
        /// 修改楼宇
        /// </summary>
        /// <param name="buildingID"></param>
        /// <param name="areaID"></param>
        /// <param name="buildingName"></param>
        /// <param name="buildingCode"></param>
        /// <returns></returns>
        public bool ModifyBuildingPart(int buildingID, int areaID, string buildingName, string buildingCode)
        {
            try
            {
                BuildingBriefInfo bb = _dataContext.BuildingBriefInfos.Single(x => x.BDI_ID == buildingID);
                if (bb.SAI_ID != areaID)
                {
                    // 修改建筑信息本身的区域ID
                    bb.SAI_ID = areaID;
                    // 修改AMP表中对应的建筑区域
                    if (_dataContext.AnalogMeasurePoints.Where(x => x.AMP_BuildingID == bb.BDI_ID).Count() > 0)
                    {
                        _dataContext.ExecuteCommand("update AnalogMeasurePoint set AMP_SAreaID={0} where AMP_BuildingID={1}", areaID, bb.BDI_ID);
                        // 修改父测点编号
                        var modifiedAMPs = _dataContext.AnalogMeasurePoints.Where(x => x.AMP_BuildingID == bb.BDI_ID && x.AMP_RoomID == 0 && x.AMP_ParentNo > 1).ToList();
                        foreach (var item in modifiedAMPs)
                        {
                            var parentPoint = _dataContext.AnalogMeasurePoints.Where(x => x.AMP_CptFlag == 0 && x.AMP_Statistic == 1 && x.AMP_SAreaID == areaID && x.AMP_BuildingID == 0 && x.AMP_PowerType == item.AMP_PowerType).SingleOrDefault();
                            if (parentPoint != null)
                            {
                                item.AMP_ParentNo = parentPoint.AMP_AnalogNo;
                            }
                            else
                            {
                                item.AMP_ParentNo = 0;
                            }
                        }
                    }
                }
                bb.BDI_Name = buildingName;

                BuildingDetailInfo bd = _dataContext.BuildingDetailInfos.Single(x => x.BDI_ID == buildingID);
                bd.BDI_Name = buildingName;
                bd.BDI_Code = buildingCode;

                _dataContext.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 增加楼宇
        /// </summary>
        /// <param name="b"></param>
        /// <param name="areaID"></param>
        /// <returns>成功返回新的楼宇ID,否则返回0</returns>
        public int AddBuilding(BuildingDetailInfo b, int areaID)
        {
            try
            {
                _dataContext.BuildingDetailInfos.InsertOnSubmit(b);
                _dataContext.SubmitChanges();

                BuildingBriefInfo bb = new BuildingBriefInfo();
                bb.BDI_ID   = b.BDI_ID;
                bb.BDI_Name = b.BDI_Name;
                bb.SAI_ID   = areaID;
                bb.BDI_Flag = 1;
                _dataContext.BuildingBriefInfos.InsertOnSubmit(bb);
                _dataContext.SubmitChanges();
                return(b.BDI_ID);
            }
            catch (Exception)
            {
                return(0);
            }
        }
Пример #3
0
        /// <summary>
        /// 增加楼宇
        /// </summary>
        /// <param name="buildingName"></param>
        /// <param name="areaID"></param>
        /// <param name="buildingCode"></param>
        /// <returns></returns>
        public bool AddBuildingPart(string buildingName, int areaID, string buildingCode)
        {
            try
            {
                BuildingDetailInfo bd = new BuildingDetailInfo();
                bd.BDI_Name = buildingName;
                bd.BDI_Code = buildingCode;
                _dataContext.BuildingDetailInfos.InsertOnSubmit(bd);
                _dataContext.SubmitChanges();

                BuildingBriefInfo bb = new BuildingBriefInfo();
                bb.BDI_ID   = bd.BDI_ID;
                bb.BDI_Name = buildingName;
                bb.SAI_ID   = areaID;
                _dataContext.BuildingBriefInfos.InsertOnSubmit(bb);

                _dataContext.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #4
0
        /// <summary>
        /// 修改建筑
        /// </summary>
        /// <param name="b"></param>
        /// <param name="areaID"></param>
        /// <returns></returns>
        public bool ModifyBuilding(BuildingDetailInfo b, int areaID)
        {
            try
            {
                BuildingBriefInfo bb = _dataContext.BuildingBriefInfos.SingleOrDefault(x => x.BDI_ID == b.BDI_ID);
                if (bb.SAI_ID != areaID)
                {
                    // 修改建筑信息本身的区域ID
                    bb.SAI_ID = areaID;
                    // 修改AMP表中对应的建筑区域
                    if (_dataContext.AnalogMeasurePoints.Where(x => x.AMP_BuildingID == bb.BDI_ID).Count() > 0)
                    {
                        _dataContext.ExecuteCommand("update AnalogMeasurePoint set AMP_SAreaID={0} where AMP_BuildingID={1}", areaID, bb.BDI_ID);
                        // 修改父测点编号
                        var modifiedAMPs = _dataContext.AnalogMeasurePoints.Where(x => x.AMP_BuildingID == bb.BDI_ID && x.AMP_RoomID == 0 && x.AMP_ParentNo > 1).ToList();
                        foreach (var item in modifiedAMPs)
                        {
                            var parentPoint = _dataContext.AnalogMeasurePoints.Where(x => x.AMP_CptFlag == 0 && x.AMP_Statistic == 1 && x.AMP_SAreaID == areaID && x.AMP_BuildingID == 0 && x.AMP_PowerType == item.AMP_PowerType).SingleOrDefault();
                            if (parentPoint != null)
                            {
                                item.AMP_ParentNo = parentPoint.AMP_AnalogNo;
                            }
                            else
                            {
                                item.AMP_ParentNo = 0;
                            }
                        }
                    }
                }
                bb.BDI_Name = b.BDI_Name;

                BuildingDetailInfo bd = _dataContext.BuildingDetailInfos.SingleOrDefault(x => x.BDI_ID == b.BDI_ID);
                bd.BDI_Name             = b.BDI_Name;
                bd.BDI_Address          = b.BDI_Address;
                bd.BDI_Code             = b.BDI_Code;
                bd.BDI_Introduction     = b.BDI_Introduction;
                bd.BDI_Telephone        = b.BDI_Telephone;
                bd.BDI_LinkMan          = b.BDI_LinkMan;
                bd.BDI_LinkManPhone     = b.BDI_LinkManPhone;
                bd.BDI_StatMan          = b.BDI_StatMan;
                bd.BDI_StatManPhone     = b.BDI_StatManPhone;
                bd.BDI_Academy          = b.BDI_Academy;
                bd.BDI_Date             = b.BDI_Date;
                bd.BDI_Direction        = b.BDI_Direction;
                bd.BDI_Users            = b.BDI_Users;
                bd.BDI_RunPerWeek       = b.BDI_RunPerWeek;
                bd.BDI_WeekStart        = b.BDI_WeekStart;
                bd.BDI_WeekEnd          = b.BDI_WeekEnd;
                bd.BDI_RunPreMonth      = b.BDI_RunPreMonth;
                bd.BDI_MonthStart       = b.BDI_MonthStart;
                bd.BDI_MonthEnd         = b.BDI_MonthEnd;
                bd.BDI_RunPerYear       = b.BDI_RunPerYear;
                bd.BDI_YearStart        = b.BDI_YearStart;
                bd.BDI_YearEnd          = b.BDI_YearEnd;
                bd.BDI_Holiday          = b.BDI_Holiday;
                bd.BDI_Height           = b.BDI_Height;
                bd.BDI_FloorUp          = b.BDI_FloorUp;
                bd.BDI_FloorDn          = b.BDI_FloorDn;
                bd.BDI_FloorHeight      = b.BDI_FloorHeight;
                bd.BDI_Area             = b.BDI_Area;
                bd.BDI_AreaAir          = b.BDI_AreaAir;
                bd.BDI_AreaHot          = b.BDI_AreaHot;
                bd.BDI_AreaSpe          = b.BDI_AreaSpe;
                bd.BDI_AauditFlag       = b.BDI_AauditFlag;
                bd.BDI_AauditDate       = b.BDI_AauditDate;
                bd.BDI_TransforFlag     = b.BDI_TransforFlag;
                bd.BDI_TransforContent  = b.BDI_TransforContent;
                bd.BDI_ElectricCompName = b.BDI_ElectricCompName;
                bd.BDI_GasCompName      = b.BDI_GasCompName;
                bd.BDI_Type             = b.BDI_Type;
                bd.BDI_TypeOther        = b.BDI_TypeOther;
                bd.BDI_AreaRatio        = b.BDI_AreaRatio;
                bd.BDI_KindsOut         = b.BDI_KindsOut;
                bd.BDI_WarmKeep         = b.BDI_WarmKeep;
                bd.BDI_Structure        = b.BDI_Structure;
                bd.BDI_WinOut           = b.BDI_WinOut;
                bd.BDI_Visor            = b.BDI_Visor;
                bd.BDI_Glass            = b.BDI_Glass;
                bd.BDI_Win               = b.BDI_Win;
                bd.BDI_TemCool           = b.BDI_TemCool;
                bd.BDI_TemHot            = b.BDI_TemHot;
                bd.BDI_TemSepcialCool    = b.BDI_TemSepcialCool;
                bd.BDI_TemSepcialHot     = b.BDI_TemSepcialHot;
                bd.BDI_AirSys            = b.BDI_AirSys;
                bd.BDI_DevCool           = b.BDI_DevCool;
                bd.BDI_DevHot            = b.BDI_DevHot;
                bd.BDI_LiBr              = b.BDI_LiBr;
                bd.BDI_BoilerPower       = b.BDI_BoilerPower;
                bd.BDI_AirSplit          = b.BDI_AirSplit;
                bd.BDI_Boiler            = b.BDI_Boiler;
                bd.BDI_PowerHot          = b.BDI_PowerHot;
                bd.BDI_DevOther          = b.BDI_DevOther;
                bd.BDI_LightIn           = b.BDI_LightIn;
                bd.BDI_LightOut          = b.BDI_LightOut;
                bd.BDI_LightOutPower     = b.BDI_LightOutPower;
                bd.BDI_LightOutWorkHours = b.BDI_LightOutWorkHours;
                if (!String.IsNullOrWhiteSpace(b.BDI_ImageUrl))
                {
                    bd.BDI_ImageUrl = b.BDI_ImageUrl;
                }

                _dataContext.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #5
0
 /// <summary>
 /// 获取公示数据
 /// </summary>
 /// <param name="dateType"></param>
 /// <param name="buildingId"></param>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 /// <param name="powerType"></param>
 /// <returns></returns>
 public ActionResult GetQueryElecAjax(int dateType, int?buildingId, DateTime?startTime, DateTime?endTime, string powerType)
 {
     if (Request.IsAjaxRequest() && buildingId.HasValue && buildingId.Value > 0)
     {
         IList    list       = new ArrayList();
         string[] powerTypes = null;
         if (!string.IsNullOrWhiteSpace(powerType))
         {
             powerTypes = powerType.Split(new char[] { '_' });
         }
         string[]           powerTypesEach = new string[1];
         double             sum            = -1;
         var                days           = 0;
         BuildingDetailInfo bdi            = _buildingRepos.GetBuilding(buildingId.Value);
         if (dateType == 1)
         {
             DateTime endDate   = DateTime.Today;
             DateTime startDate = DateTime.Parse(endDate.ToString("yyyy-MM-01"));
             days = (endDate - startDate).Days;
             sum  = _analogHistoryRepos.GetEnergy(3, buildingId.Value, powerTypes, startDate, endDate);
             for (int i = 0; i < powerTypes.Length; i++)
             {
                 if (powerTypes[i] != "001" && powerTypes[i] != "002" && powerTypes[i] != "003" && powerTypes[i] != "001007" && powerTypes[i] != "001006" && powerTypes[i] != "002005")
                 {
                     powerTypesEach[0] = powerTypes[i];
                     double powerTypeSum = _analogHistoryRepos.GetEnergy(3, buildingId.Value, powerTypesEach, startDate, endDate);
                     list.Add(new
                     {
                         powerTypeName = _powerClassRepos.GetPowerTypeName(powerTypes[i]).PC_Name,
                         powerTypeSum  = powerTypeSum.ToString("f1"),
                         average       = bdi.BDI_Area.HasValue ? (powerTypeSum / bdi.BDI_Area.Value).ToString("f1") : null
                     });
                 }
             }
         }
         else
         {
             DateTime startDate = startTime.Value;
             DateTime endDate   = endTime.Value;
             days = (endDate - startDate).Days;
             sum  = _analogHistoryRepos.GetEnergy(3, buildingId.Value, powerTypes, startDate, endDate);
             for (int i = 0; i < powerTypes.Length; i++)
             {
                 if (powerTypes[i] != "001" && powerTypes[i] != "002" && powerTypes[i] != "003" && powerTypes[i] != "001007" && powerTypes[i] != "001006" && powerTypes[i] != "002005")
                 {
                     powerTypesEach[0] = powerTypes[i];
                     double powerTypeSum = _analogHistoryRepos.GetEnergy(3, buildingId.Value, powerTypesEach, startDate, endDate);
                     list.Add(new
                     {
                         powerTypeName = _powerClassRepos.GetPowerTypeName(powerTypes[i]).PC_Name,
                         powerTypeSum  = powerTypeSum.ToString("f1"),
                         average       = bdi.BDI_Area.HasValue ? (powerTypeSum / bdi.BDI_Area.Value).ToString("f1") : null
                     });
                 }
             }
         }
         days++;
         string average = null;
         if (bdi.BDI_Area != null)
         {
             average = bdi.BDI_Area.HasValue ? (sum / bdi.BDI_Area.Value).ToString("f1"):null;
         }
         var data = new
         {
             sum     = sum.ToString("f1"),
             days    = days,
             average = average,
             list    = list
         };
         return(Json(data, JsonRequestBehavior.AllowGet));
     }
     return(null);
 }
Пример #6
0
        private void BuildingDetailReport_ItemDataBinding(object sender, EventArgs e)
        {
            var buildingIDObj = ReportParameters["buildingID"].Value;

            if (buildingIDObj != null)
            {
                int                buildingID    = Convert.ToInt32(buildingIDObj);
                IBuildingRepos     buildingRepos = new BuildingRepos();
                BuildingDetailInfo building      = buildingRepos.GetBuilding(buildingID);
                if (building == null)
                {
                    return;
                }
                buildingTable.DataSource = building;

                var lightDataList        = buildingRepos.GetLight(buildingID);
                var officeDataList       = buildingRepos.GetOfficeEquip(buildingID);
                var elevatorDataList     = buildingRepos.GetElevator(buildingID);
                var waterPumpDataList    = buildingRepos.GetWaterPump(buildingID);
                var windMachDataList     = buildingRepos.GetWindMach(buildingID);
                var kitchenEquipDataList = buildingRepos.GetKitchenEquip(buildingID);

                lightTable.DataSource        = lightDataList;
                officeEquipTable.DataSource  = officeDataList;
                elevatorTable.DataSource     = elevatorDataList;
                waterPumpTable.DataSource    = waterPumpDataList;
                windMachTable.DataSource     = windMachDataList;
                kitchenEquipTable.DataSource = kitchenEquipDataList;

                Parameter subReportPara = new Parameter("buildingID", buildingID);
                //A1A2A3
                if (!String.IsNullOrWhiteSpace(building.BDI_AirSys))
                {
                    if (building.BDI_AirSys == "集中式全空气系统")
                    {
                        NavigateToReportAction a1ReportAction = new NavigateToReportAction();
                        a1ReportAction.Parameters.Add(subReportPara);
                        a1ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixA1, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                        textBox26.Action = a1ReportAction;
                        textBox26.Value  = "详见附表A1";
                    }
                    else if (building.BDI_AirSys == "风机盘管+新风系统")
                    {
                        NavigateToReportAction a2ReportAction = new NavigateToReportAction();
                        a2ReportAction.Parameters.Add(subReportPara);
                        a2ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixA2, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                        textBox25.Action = a2ReportAction;
                        textBox25.Value  = "详见附表A2";
                    }
                    else if (building.BDI_AirSys == "分体式空调或VRV的局部式机组系统")
                    {
                        NavigateToReportAction a3ReportAction = new NavigateToReportAction();
                        a3ReportAction.Parameters.Add(subReportPara);
                        a3ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixA3, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                        textBox28.Action = a3ReportAction;
                        textBox28.Value  = "详见附表A3";
                    }
                }
                //B1
                if (!String.IsNullOrWhiteSpace(building.BDI_DevCool))
                {
                    NavigateToReportAction b1ReportAction = new NavigateToReportAction();
                    b1ReportAction.Parameters.Add(subReportPara);
                    b1ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixB1, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                    textBox34.Action = b1ReportAction;
                    textBox34.Value  = "详见附表B1";
                }
                //B2
                if (!String.IsNullOrWhiteSpace(building.BDI_DevHot))
                {
                    NavigateToReportAction b2ReportAction = new NavigateToReportAction();
                    b2ReportAction.Parameters.Add(subReportPara);
                    b2ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixB2, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                    textBox36.Action = b2ReportAction;
                    textBox36.Value  = "详见附表B2";
                }
                //B3
                if (!String.IsNullOrWhiteSpace(building.BDI_LiBr))
                {
                    NavigateToReportAction b3ReportAction = new NavigateToReportAction();
                    b3ReportAction.Parameters.Add(subReportPara);
                    b3ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixB3, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                    textBox60.Action = b3ReportAction;
                    textBox60.Value  = "详见附表B3";
                }
                //B4
                if (!String.IsNullOrWhiteSpace(building.BDI_AirSplit))
                {
                    NavigateToReportAction b4ReportAction = new NavigateToReportAction();
                    b4ReportAction.Parameters.Add(subReportPara);
                    b4ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixB4, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                    textBox37.Action = b4ReportAction;
                    textBox37.Value  = "详见附表B4";
                }
                //B5
                if (!String.IsNullOrWhiteSpace(building.BDI_BoilerPower))
                {
                    NavigateToReportAction b5ReportAction = new NavigateToReportAction();
                    b5ReportAction.Parameters.Add(subReportPara);
                    b5ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixB5, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                    textBox39.Action = b5ReportAction;
                    textBox39.Value  = "详见附表B5";
                }
                //B6
                if (!String.IsNullOrWhiteSpace(building.BDI_Boiler))
                {
                    NavigateToReportAction b6ReportAction = new NavigateToReportAction();
                    b6ReportAction.Parameters.Add(subReportPara);
                    b6ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixB6, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                    textBox41.Action = b6ReportAction;
                    textBox41.Value  = "详见附表B6";
                }
                //B7
                if (!String.IsNullOrWhiteSpace(building.BDI_PowerHot))
                {
                    NavigateToReportAction b7ReportAction = new NavigateToReportAction();
                    b7ReportAction.Parameters.Add(subReportPara);
                    b7ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixB7, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                    textBox45.Action = b7ReportAction;
                    textBox45.Value  = "详见附表B7";
                }
                //B8
                if (!String.IsNullOrWhiteSpace(building.BDI_DevOther))
                {
                    NavigateToReportAction b8ReportAction = new NavigateToReportAction();
                    b8ReportAction.Parameters.Add(subReportPara);
                    b8ReportAction.ReportDocumentType = "EnergyMonitor.Controllers.Admin.ReportsTemplate.BuildingAppendixB8, Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
                    textBox47.Action = b8ReportAction;
                    textBox47.Value  = "详见附表B8";
                }
            }
        }