Beispiel #1
0
 public bool ModifyBuildingOperateRule(int buildingID, string operateRule)
 {
     try
     {
         BuildingBriefInfo bBriefInfo = _dataContext.BuildingBriefInfos.Where(x => x.BDI_ID == buildingID).SingleOrDefault();
         bBriefInfo.BDI_OperateRule = operateRule;
         _dataContext.SubmitChanges();
         return(true);
     }catch (Exception) {
         return(false);
     }
 }
Beispiel #2
0
 public bool ModifyBuildingHJFlag(int buildingID, byte hJFlag)
 {
     try
     {
         BuildingBriefInfo bBriefInfo = _dataContext.BuildingBriefInfos.Where(x => x.BDI_ID == buildingID).SingleOrDefault();
         bBriefInfo.BDI_HJFlag = hJFlag;
         _dataContext.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Beispiel #3
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);
            }
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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);
            }
        }
Beispiel #6
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);
            }
        }
Beispiel #7
0
        public BuildingBriefInfo GetBuildingByBuildingID(int buildingID)
        {
            BuildingBriefInfo bBriefInfo = _dataContext.BuildingBriefInfos.Where(x => x.BDI_ID == buildingID).SingleOrDefault();

            return(bBriefInfo);
        }