public int ManageDelete(Guid id)
        {
            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                try
                {
                    BuildingsBLL                buildingsBLL                = new BuildingsBLL();
                    BuildingsDataBLL            buildingsDataBLL            = new BuildingsDataBLL();
                    BuildingMonthModifyCountBLL buildingMonthModifyCountBLL = new BuildingMonthModifyCountBLL();
                    BuildingMonthInfoDataBLL    buildingMonthInfoDataBLL    = new BuildingMonthInfoDataBLL();
                    BuildingMonthInfoBLL        buildingMonthInfoBLL        = new BuildingMonthInfoBLL();

                    buildingMonthModifyCountBLL.ManageDeleteByBuildingID(id);
                    buildingMonthInfoDataBLL.ManageDeleteByBuildingID(id);
                    buildingMonthInfoBLL.ManageDeleteByBuildingID(id);

                    buildingsBLL.ManageDelete(id);
                    buildingsDataBLL.ManageDelete(id);
                    BaseDb.Delete(id);
                    scope.Complete();
                    return(1);
                }
                catch (Exception ex)
                {
                    return(0);
                }
            }
        }
        /// <summary>
        /// 管理员编辑(除了BuildingsAndBuildingMonthInfo外,需要更新BuildingMonthInfoDataBLL,BuildingMonthInfoBLL,BuildingsBLL,BuildingsDataBLL)
        /// </summary>
        /// <param name="model"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public int ManageUpdate(RoadFlow.Data.Model.BuildingsModel building, RoadFlow.Data.Model.BuildingMonthInfoModel monthInfo, Guid buildingID)
        {
            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                bool isUpdate = Update <RoadFlow.Data.Model.BuildingsModel>(building, buildingID) > 0 && Update <RoadFlow.Data.Model.BuildingMonthInfoModel>(monthInfo, buildingID) > 0;//更新组合表
                if (isUpdate)
                {
                    #region BuildingMonthInfo
                    BuildingMonthInfoDataBLL buildingMonthInfoDataBLL = new BuildingMonthInfoDataBLL();
                    var monthDataList = buildingMonthInfoDataBLL.GetListByBuildingID(buildingID);
                    var monthDataLast = monthDataList.OrderByDescending(i => i.TimeArea).FirstOrDefault();
                    if (monthDataLast != null)
                    {//有最新每月信息则更新每月信息
                        BuildingMonthInfoBLL buildingMonthInfoBLL = new BuildingMonthInfoBLL();
                        isUpdate = buildingMonthInfoDataBLL.ManageUpdate(monthInfo, monthDataLast.ID.Value) > 0 && buildingMonthInfoBLL.ManageUpdate(monthInfo, monthDataLast.BuildingMonthInfoID.Value) > 0;
                    }

                    #endregion
                    if (isUpdate)
                    {//更新楼栋基本信息
                        #region Building
                        BuildingsBLL     buildingsBLL     = new BuildingsBLL();
                        BuildingsDataBLL buildingsDataBLL = new BuildingsDataBLL();
                        building.ID = null;
                        isUpdate    = buildingsBLL.ManageUpdate(building, buildingID) > 0 && buildingsDataBLL.ManageUpdate(building, buildingID) > 0;
                        #endregion
                        if (isUpdate)
                        {
                            scope.Complete();
                            return(1);
                        }
                    }
                }
            }
            return(0);
        }