Esempio n. 1
0
        // GET: api/roles/1
        public async Task<IHttpActionResult> GetRole(int uuid)
        {
            var errResult = TextHelper.CheckAuthorized(Request);
            if (errResult != null)
                return errResult;

            Role item = await this.repository.GetByIdAsync(uuid);
            if (item == null)
                return NotFound();

            var result = new
            {
                ID = item.ID,
                Name = item.Name,
                Description = item.Description,
                Status = item.Status,
                CreateTime = item.CreateTime,
                Remark = item.Remark
            };

            return Ok(result);
        }
        public async Task<IHttpActionResult> GetDevice(string uuid)
        {
            var errResult = TextHelper.CheckAuthorized(Request);
            if (errResult != null)
                return errResult;

            Device item = await this.repository.GetByIdAsync(uuid);
            if (item == null)
                return NotFound();

            var result = new
            {
                DeviceNo = item.DeviceNo,
                BuildingNo=item.Room.BuildingNo,
                BuildingName=item.Room.Building.Name,
                Floor=item.Room.Floor,
                RoomNo = item.RoomNo,
                TypeID = item.TypeID,
                TypeName = item.DeviceType.Name,
                Protocol = item.Protocol,
                Scope = item.Scope,
                DeviceName = item.DeviceName,
                PhyAddr = item.PhyAddr,
                ItemID = item.ItemID,
                ItemName = item.ItemName,
                ItemDescription = item.ItemDescription,
                Status = item.Status,
                Value = item.Value,
                Rate = item.Rate,
                Unit = item.DeviceType.Unit,
                Price1 = TextHelper.ConvertMoney(item.DeviceType.Price1),
                Price2 = TextHelper.ConvertMoney(item.DeviceType.Price2),
                Price3 = TextHelper.ConvertMoney(item.DeviceType.Price3),
                Price4 = TextHelper.ConvertMoney(item.DeviceType.Price4),
                Price5 = TextHelper.ConvertMoney(item.DeviceType.Price5),
                IsArchive = item.IsArchive,
                ArchiveInterval = item.ArchiveInterval,
                Remark1 = item.Remark1,
                Remark2 = item.Remark2,
                Remark3 = item.Remark3
            };

            return Ok(result);
        }
Esempio n. 3
0
        public async Task<IHttpActionResult> GetMsg(int uuid)
        {
            var errResult = TextHelper.CheckAuthorized(Request);
            if (errResult != null)
                return errResult;

            Msg item = await this.repository.GetByIdAsync(uuid);
            if (item == null)
                return NotFound();

            var result = new
            {
                ID = item.ID,
                RoomNo = item.RoomNo,
                Content = item.Content,
                PostType = item.PostType,
                Status = item.Status,
                CreateTime = item.CreateTime,
                Remark = item.Remark
            };

            return Ok(result);
        }
Esempio n. 4
0
        public async Task<IHttpActionResult> GetRoom(string uuid)
        {
            var errResult = TextHelper.CheckAuthorized(Request);
            if (errResult != null)
                return errResult;

            Room item = await this.roomRepository.GetByIdAsync(uuid);
            if (item == null)
                return NotFound();

            var result = new
            {
                RoomNo = item.RoomNo,
                BuildingNo = item.BuildingNo,
                BuildingName = item.Building.Name,
                Floors = item.Building.Floors,
                Floor = item.Floor,
                Area = item.Area,
                Price = item.Price,
                RealName = item.RealName,
                Phone = item.Phone,
                Email = item.Email,
                AccountBalance = TextHelper.ConvertMoney(item.AccountBalance),
                AccountWarnLimit = TextHelper.ConvertMoney(item.AccountWarnLimit),
                CreditScore = item.CreditScore,
                AlipayAccount = item.AlipayAccount,
                WechatAccount = item.WechatAccount,
                BankAccount = item.BankAccount,
                CreateTime = item.CreateTime,
                Remark = item.Remark
            };

            return Ok(result);
        }
        public async Task<IHttpActionResult> GetRecharge(string uuid)
        {
            var errResult = TextHelper.CheckAuthorized(Request);
            if (errResult != null)
                return errResult;

            Recharge item = await this.rechargeRespository.GetByIdAsync(uuid);
            if (item == null)
                return NotFound();

            var result = new
            {
                UUID = item.UUID,
                RoomNo = item.RoomNo,
                RealName = item.Room.RealName,
                Money = TextHelper.ConvertMoney(item.Money),
                DateTime = item.DateTime,
                Remark = item.Remark
            };

            return Ok(result);
        }
        public async Task<IHttpActionResult> GetCutout(int uuid)
        {
            var errResult = TextHelper.CheckAuthorized(Request);
            if (errResult != null)
                return errResult;

            Cutout item = await this.repository.GetByIdAsync(uuid);
            if (item == null)
                return NotFound();

            var result = new
            {
                ID = item.ID,
                DeviceNo = item.DeviceNo,
                DeviceName = item.Device.DeviceName,
                Reason = item.Reason,
                CreateTime = item.CreateTime,
                Remark = item.Remark
            };

            return Ok(result);
        }
        public async Task<IHttpActionResult> GetCredit(string uuid)
        {
            var errResult = TextHelper.CheckAuthorized(Request);
            if (errResult != null)
                return errResult;

            Credit item = await this.repository.GetByIdAsync(uuid);
            if (item == null)
                return NotFound();

            var result = new
            {
                UUID = item.UUID,
                Name = item.Name,
                Description = item.Description,
                MinScore = item.MinScore,
                MaxScore = item.MaxScore,
                Arrears = TextHelper.ConvertMoney(item.Arrears),
                CreateTime = item.CreateTime,
                Remark = item.Remark
            };

            return Ok(result);
        }