예제 #1
0
        /// <summary>
        /// 判断权限编码是否存在
        /// </summary>
        /// <param name="roleCode">权限编码</param>
        /// <returns></returns>
        private bool CheckRightCodeExist(string rightCode)
        {
            bool       isExist  = false;
            string     strSql   = "";
            RightModel rightDTO = null;

            try
            {
                List <RightModel> RequestList = _Repository.GetRightList();
                rightDTO = RequestList.Find(a => a.RightCode == rightCode);
                if (rightDTO == null)
                {
                    isExist = false;
                }
                if (long.Parse(rightDTO.RightID) > 0)
                {
                    isExist = true;
                }
                else
                {
                    isExist = false;
                }
            }
            catch
            {
                isExist = false;
            }
            return(isExist);
        }
예제 #2
0
    public override void StateChanged(StateManager.State newState)
    {
        switch (newState)
        {
        case StateManager.State.init:
            break;

        case StateManager.State.positioned:
            InfoText.text = "Great!\nNow look straight forward and press your right grip button to calibrate your height.";
            RightGripMarker.SetActive(true);
            break;

        case StateManager.State.calibrated:
            InfoText.text    = "Place your hands inside the marked areas and press your left grip button to Arm / Disarm. When disarmed, move the Nao with the left Touchpad as shown above.";
            StatusText.text  = "Calibrated";
            StatusText.color = Color.green;

            ChangeLayerRecursive(Nao, 0);
            LeftModel.SetMeshRendererState(false);
            RightModel.SetMeshRendererState(false);

            ImageCanvas.SetActive(true);
            RightGripMarker.SetActive(false);
            //LeftGripMarker.SetActive(true);
            RightHandMarker.SetActive(true);
            LeftHandMarker.SetActive(true);
            FloorMarker.SetActive(false);
            break;

        case StateManager.State.disarmed:
            StatusText.text     = "Disarmed";
            StatusText.color    = new Color(1, 0.5f, 0.2f);
            publisher.DoPublish = false;

            RightGripMarker.SetActive(false);
            //LeftGripMarker.SetActive(true);
            RightHandMarker.SetActive(true);
            LeftHandMarker.SetActive(true);
            break;

        case StateManager.State.armed:
            InfoCanvas.SetActive(false);
            StatusText.text     = "Armed";
            StatusText.color    = Color.red;
            publisher.DoPublish = true;

            ImageCanvas.SetActive(false);
            ChangeLayerRecursive(NaoMirror, 0);
            LeftDisplay.SetActive(true);
            RightDisplay.SetActive(true);
            LeftGripMarker.SetActive(false);
            RightHandMarker.SetActive(false);
            LeftHandMarker.SetActive(false);
            break;
        }
    }
예제 #3
0
        public async Task <object> InsertAsync(RightModel rightModel)
        {
            if (rightModel == null)
            {
                throw new ArgumentException("O valor de 'RightModel' não pode ser nulo");
            }

            var insertedId = await _connection.Insert(rightModel);

            return(insertedId);
        }
예제 #4
0
        public static Right FromDal(this RightModel rightModel)
        {
            if (rightModel == null)
            {
                return(null);
            }
            var result = new Right
            {
                Id   = rightModel.RightId,
                Name = rightModel.Name,
            };

            return(result.SyncBase(rightModel));
        }
예제 #5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            RightModel = await _context.Rights.FirstOrDefaultAsync(m => m.Id == id);

            if (RightModel == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            RightModel = await _context.Rights.FindAsync(id);

            if (RightModel != null)
            {
                _context.Rights.Remove(RightModel);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
예제 #7
0
        public IViewComponentResult Invoke()
        {
            RightModel model = new RightModel();


            List <Comment> listComment = new List <Comment>();


            List <User> listUser = new List <User>();


            List <Book> listBook = new List <Book>();


            List <Quotation> listQuotation = new List <Quotation>();


            var users = _appUserService.GetNotAdmin();

            users.ShuffleMethod();
            var fiveUsers = users.Take(3);

            foreach (var fiveUser in fiveUsers)
            {
                User user = new User();
                user.UserName         = fiveUser.UserName;
                user.FirstName        = fiveUser.FirstName;
                user.LastName         = fiveUser.LastName;
                user.ProfileImageFile = fiveUser.ProfileImageFile;
                user.Description      = fiveUser.Description;
                listUser.Add(user);
            }

            model.Users = listUser;


            var books = _bookService.GetList();

            books.ShuffleMethod();
            var fiveBooks = books.Take(4);

            foreach (var fiveBook in fiveBooks)
            {
                Book book = new Book();
                book.Title         = fiveBook.Title;
                book.Id            = fiveBook.Id;
                book.BookImageUrl  = fiveBook.BookImageUrl;
                book.BookPublisher = fiveBook.BookPublisher;
                book.DatePublished = fiveBook.DatePublished;
                listBook.Add(book);
            }

            model.Books = listBook;

            var comments = _commentService.GetComments();

            comments.ShuffleMethod();
            var fiveComments = comments.Take(3);

            foreach (var fivecomment in fiveComments)
            {
                Comment comment = new Comment();
                comment.Id         = fivecomment.Id;
                comment.ReviewText = fivecomment.ReviewText;
                comment.Rating     = fivecomment.Rating;
                comment.HeadLine   = fivecomment.HeadLine;
                comment.CreatedOn  = fivecomment.CreatedOn;
                comment.BookStatus = fivecomment.BookStatus;
                comment.BookId     = fivecomment.BookId;
                comment.AppUserId  = fivecomment.AppUserId;
                comment.Book       = new Book
                {
                    Title        = fivecomment.Book.Title,
                    BookImageUrl = fivecomment.Book.BookImageUrl
                };
                comment.User = new User
                {
                    UserName  = fivecomment.AppUser.UserName,
                    FirstName = fivecomment.AppUser.FirstName,
                    LastName  = fivecomment.AppUser.LastName
                };
                comment.User.LastName = fivecomment.AppUser.LastName;
                listComment.Add(comment);
            }

            model.Comments = listComment;



            var quotations = _quotationService.GetQuotations();

            quotations.ShuffleMethod();
            var fivequotations = quotations.Take(3);

            foreach (var fivequotation in fivequotations)
            {
                Quotation quotation = new Quotation();
                quotation.AppUserId     = fivequotation.AppUserId;
                quotation.Id            = fivequotation.Id;
                quotation.QuotationText = fivequotation.QuotationText;
                quotation.CurrentPage   = fivequotation.CurrentPage;
                quotation.BookId        = fivequotation.BookId;
                quotation.CreatedOn     = fivequotation.CreatedOn;
                quotation.Book          = new Book
                {
                    Title        = fivequotation.Book.Title,
                    BookImageUrl = fivequotation.Book.BookImageUrl
                };
                quotation.User = new User
                {
                    UserName  = fivequotation.AppUser.UserName,
                    FirstName = fivequotation.AppUser.FirstName,
                    LastName  = fivequotation.AppUser.LastName
                };
                listQuotation.Add(quotation);
            }

            model.Quotations = listQuotation;

            return(View(model));
        }