public JsonModel DeleteBuilding(EmsModel.Building build, string flag)
        {
            //定义JSON标准格式实体中
            JsonModel jsonModel = new JsonModel();

            try
            {
                //事务
                using (SqlTransaction trans = dal.GetTran())
                {
                    try
                    {
                        if (new EmsDAL.EquipDetail().IsHasEquipByRoomIds(build.Id.ToString(), flag))
                        {
                            jsonModel.Status = "exist";
                            jsonModel.Msg    = flag == "room" ? "该房间内已存放仪器,不能删除!" : (flag == "layer" ? "该楼层的房间内已存放仪器,不能删除!" : "该楼房的房间内已存放仪器,不能删除!");
                            return(jsonModel);
                        }
                        int upCount = dal.UpdateBatch(trans, build.Id.ToString(), flag);
                        if (upCount <= 0)
                        {
                            trans.Rollback();//回滚
                            jsonModel.Status = "no";
                            jsonModel.Msg    = "删除失败";
                            return(jsonModel);
                        }
                        trans.Commit();//提交
                    }
                    catch (Exception)
                    {
                        trans.Rollback();//回滚
                        throw;
                    }
                }
                jsonModel.Status = "ok";
                jsonModel.Msg    = "操作成功";
                return(jsonModel);
            }
            catch (Exception ex)
            {
                jsonModel.Status = "error";
                jsonModel.Msg    = ex.ToString();
                return(jsonModel);
            }
        }
        /// <summary>
        /// 获取楼房列表数据 分页
        /// </summary>
        /// <param name="Mod">查询条件</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">页容量,每页显示条数</param>
        /// <returns></returns>
        public EmsModel.JsonModel GetJsonModel(EmsModel.Building Mod, int pageIndex, int pageSize)
        {
            List <EmsModel.Building> modList = dal.GetListByPage(Mod, ((pageIndex - 1) * pageSize) + 1, (pageIndex * pageSize));
            //定义分页数据实体
            PagedDataModel <EmsModel.Building> pagedDataModel = null;
            //定义JSON标准格式实体中
            JsonModel jsonModel = null;

            if (modList.Count > 0)
            {
                var list = modList;
                //总条数
                int rowCount = dal.GetListByPageCount(Mod);
                //总页数
                int pageCount = (int)Math.Ceiling(rowCount * 1.0 / pageSize);
                //将数据封装到PagedDataModel分页数据实体中
                pagedDataModel = new PagedDataModel <EmsModel.Building>()
                {
                    PageCount = pageCount,
                    PagedData = list,
                    PageIndex = pageIndex,
                    PageSize  = pageSize,
                    RowCount  = rowCount
                };
                //将分页数据实体封装到JSON标准实体中
                jsonModel = new JsonModel()
                {
                    Data    = pagedDataModel,
                    Msg     = "成功",
                    Status  = "ok",
                    BackUrl = ""
                };
                return(jsonModel);
            }
            else
            {
                jsonModel = new JsonModel()
                {
                    Status = "no",
                    Msg    = "失败"
                };
                return(jsonModel);
            }
        }