public async Task <IHttpActionResult> CreateAttemptAsync(GoalAttemptData attempt)
        {
            _log.LogDebug($"Request: {JsonConvert.SerializeObject(attempt)}");

            User user;

            try
            {
                user = await ControllerUtils.GetUserForRequestHeaderTokenAsync(this, _tokenStore, _userStore, _log);
            }
            catch (AuthenticationException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (InternalServerException)
            {
                return(InternalServerError());
            }

            Goal goal = await _goalStore.GetGoalAsync(attempt.GoalId);

            if (goal == null || goal.UserId != user.Id)
            {
                _log.LogDebug($"Goal not found with id {attempt.GoalId} for user {user.Id}.");
                return(NotFound());
            }

            GoalAttempt newAttempt = await _attemptStore.CreateAttemptAsync(attempt.GoalId);

            _log.LogInfo($"Created goal-attempt for user {user.Id} : {newAttempt}");

            return(StatusCode(HttpStatusCode.Created));
        }
Example #2
0
        public UISecureTradeEOD(UIEODController controller) : base(controller)
        {
            var ctr = ControllerUtils.BindController <SecureTradeController>(this);

            InitUI();
            InitEOD();
        }
Example #3
0
        /// <summary>
        /// 检查modelstat,参数是否验证成功,且token是否正确,如果正确返回null;
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="param"></param>
        /// <returns></returns>
        private Result <T> CheckModelState <T>(TokenType tokenType, BaseParams param, ModelStateDictionary modelState)
        {
            Result <T> result = ControllerUtils.getErrorResult <T>(modelState, param);

            if (result == null)
            {
                Boolean isOutDate = true;
                switch (tokenType)
                {
                case TokenType.Doctor:
                {
                    isOutDate = tokenService.IsDoctorTokenOutDate(param.user_id, param.token);
                }; break;

                case TokenType.Patient:
                {
                    isOutDate = tokenService.IsPatientTokenOutDate(param.user_id, param.token);
                }; break;
                }

                if (isOutDate)
                {
                    return(Result <T> .CreateInstance(ResultCode.TokenOutDate, "登录已过期,请重新登录。"));
                }
                else
                {
                    return(null);
                }
            }
            return(result);
        }
        public IActionResult Create(BodyExerciseViewModel bodyExerciseViewModel, IFormFile imageFile)
        {
            if (ModelState.IsValid)
            {
                var bodyExercise = new BodyExercise()
                {
                    Name                 = bodyExerciseViewModel.Name,
                    MuscleId             = bodyExerciseViewModel.MuscleId,
                    ExerciseCategoryType = Utils.IntToEnum <TExerciseCategoryType>(bodyExerciseViewModel.ExerciseCategoryType),
                    ExerciseUnitType     = Utils.IntToEnum <TExerciseUnitType>(bodyExerciseViewModel.ExerciseUnitType)
                };
                bodyExercise = _bodyExercisesService.CreateBodyExercise(bodyExercise);
                if (bodyExercise == null || bodyExercise.Id == 0)
                {
                    _logger.LogError("Create new Body Exercise fail");
                }
                else if (ImageUtils.CheckUploadedImageIsCorrect(imageFile, "png"))
                {
                    ImageUtils.SaveImage(imageFile, Path.Combine(_env.WebRootPath, "images", "bodyexercises"), bodyExercise.ImageName);
                }

                return(RedirectToAction("Index"));
            }

            ViewBag.Muscles            = ControllerUtils.CreateSelectMuscleItemList(_musclesService.FindMuscles(), 0);
            ViewBag.ExerciseCategories = ControllerUtils.CreateSelectExerciseCategoryTypeItemList(0);
            ViewBag.ExerciseUnitTypes  = ControllerUtils.CreateSelectExerciseUnitTypeItemList(0);

            return(View(bodyExerciseViewModel));
        }
Example #5
0
        public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext)
        {
            Result <Object> result     = new Result <Object>();
            BaseController  controller = (BaseController)actionContext.ControllerContext.Controller;
            BaseParams      baseParams = GetBaseParams(actionContext);

            //设置游客账号为例外。
            if (guestUserID.Equals(baseParams.user_id) && guestUserToken.Equals(baseParams.token))
            {
                if (ControllerUtils.getErrorResult <Object>(actionContext.ModelState, baseParams) == null)
                {
                    controller.IsAuthrized = true;
                    return;
                }
            }
            result = tokenDAL.CheckDoctorModelState <Object>(baseParams, actionContext.ModelState);
            if (result == null)
            {
                controller.IsAuthrized = true;
            }
            else
            {
                controller.IsAuthrized      = false;
                controller.AuthFilterResult = result;
            }
        }
Example #6
0
        private Message AddMessage(Message message)
        {
            if (ActiveMessages.Count(x => x.Type == message.Type) >= 3)
            {
                HIT.HITVM.Get().PlaySoundEvent("ui_call_q_full");
                return(null);
            }

            var existing = (message.Type == MessageType.ReadLetter)?GetLetterByID(message.LetterID):GetMessageByUser(message.Type, message.User.Type, message.User.Id);

            if (existing != null)
            {
                return(existing);
            }

            var window = new UIMessageWindow();

            ControllerUtils.BindController <MessagingWindowController>(window).Init(message, this);
            Game.AddWindow(window);
            MessageWindows.Add(message, window);
            ActiveMessages.Add(message);

            Tray.SetItems(ActiveMessages);
            UpdateTray();

            return(message);
        }
Example #7
0
        public void loadDocumentList(int documentSetUID = 0)
        {
            // Image list
            //
            ImageList imageList = ControllerUtils.GetImageList();

            // Binding
            tvFileList.ImageList = imageList;

            // Clear nodes
            tvFileList.Nodes.Clear();

            var docoList = new DocumentList();

            docoList.ListDocSet(documentSetUID);

            // Load document in the treeview
            //
            Document root = new Document();

            root.CUID       = "ROOT";
            root.RecordType = FCMConstant.RecordType.FOLDER;
            root.UID        = 0;
            // root.Read();

            //root = RepDocument.Read(false, 0, "ROOT");
            root = BUSDocument.GetRootDocument();

            DocumentList.ListInTree(tvFileList, docoList, root);
            tvFileList.Nodes[0].Expand();
        }
Example #8
0
        public UIBulletinDialog(uint nhoodID) : base(UIDialogStyle.Close, true)
        {
            Board              = new UIBulletinBoard();
            Board.OnSelection += SelectedPost;
            Post         = new UIBulletinPost();
            Post.Opacity = 0;
            Post.Visible = false;
            Post.OnBack += Return;
            DynamicOverlay.Add(Board);
            DynamicOverlay.Add(Post);

            CurrentNeigh = new Binding <Neighborhood>()
                           .WithBinding(this, "Caption", "Neighborhood_Name", (name) =>
            {
                return(GameFacade.Strings.GetString("f120", "1", new string[] { (string)name }));
            })
                           .WithBinding(this, "MayorID", "Neighborhood_MayorID");

            Caption = GameFacade.Strings.GetString("f120", "1", new string[] { "" });
            SetSize(600, 610);

            var controller = ControllerUtils.BindController <BulletinDialogController>(this);

            controller.LoadNhood(nhoodID);

            GlobalInstance = this;
        }
Example #9
0
        public async Task <IHttpActionResult> CreateGoalAsync(GoalData goalData)
        {
            _log.LogDebug($"Request: {JsonConvert.SerializeObject(goalData)}");

            User user;

            try
            {
                user = await ControllerUtils.GetUserForRequestHeaderTokenAsync(this, _tokenStore, _userStore, _log);
            }
            catch (AuthenticationException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (InternalServerException)
            {
                return(InternalServerError());
            }

            Goal goal = await _goalStore.CreateGoalAsync(
                user.Id,
                goalData.Name,
                goalData.PeriodInHours,
                goalData.FrequencyWithinPeriod,
                goalData.StartDate);

            _log.LogDebug($"Goal created: {goal}");

            return(Ok(
                       JsonConvert.SerializeObject(
                           Mapper.Map <GoalData>(goal))));
        }
Example #10
0
        public IActionResult Edit(MuscleViewModel viewModel)
        {
            if (ModelState.IsValid && viewModel.Id > 0)
            {
                // Verify not exist on id
                var key = new MuscleKey()
                {
                    Id = viewModel.Id
                };
                var muscle = _musclesService.GetMuscle(key);
                if (muscle != null)
                {
                    muscle.Name            = viewModel.Name;
                    muscle.MuscularGroupId = viewModel.MuscularGroupId;
                    muscle = _musclesService.UpdateMuscle(muscle);
                    return(RedirectToAction("Index"));
                }
            }

            int muscularGroupId = 0;

            if (viewModel != null)
            {
                muscularGroupId = viewModel.MuscularGroupId;
            }

            ViewBag.MuscularGroups = ControllerUtils.CreateSelectMuscularGroupItemList(_muscularGroupsService.FindMuscularGroups(), muscularGroupId);

            return(View(viewModel));
        }
Example #11
0
        public UIRatingList(uint avatarID)
        {
            InnerBackground = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            InnerBackground.SetSize(475, 349);
            Add(InnerBackground);

            RatingList = new UIListBox()
            {
                RowHeight = 69,
                Size      = new Vector2(475, 352)
            };
            RatingList.Columns.Add(new UIListBoxColumn()
            {
                Width = 475
            });
            RatingList.ScrollbarGutter = 5;
            Add(RatingList);
            RatingList.ScrollbarImage = GetTexture(0x31000000001);
            RatingList.InitDefaultSlider();

            Size     = new Vector2(490, 352);
            AvatarID = avatarID;

            ControllerUtils.BindController <RatingListController>(this);
        }
Example #12
0
        private void ChangeState <TView, TController>(Callback <TView, TController> onCreated) where TView : UIScreen
        {
            Binding.DisposeAll();
            GameThread.InUpdate(() =>
            {
                GameFacade.Cursor.SetCursor(Common.Rendering.Framework.CursorType.Normal); //reset cursor
                if (CurrentController != null)
                {
                    if (CurrentController is IDisposable)
                    {
                        ((IDisposable)CurrentController).Dispose();
                    }
                }

                var view       = (UIScreen)Kernel.Get <TView>();
                var controller = ControllerUtils.BindController <TController>(view);
                GameFacade.Screens.RemoveCurrent();
                GameFacade.Screens.AddScreen(view);

                CurrentController = controller;
                CurrentView       = view;

                onCreated((TView)view, controller);
            });
        }
Example #13
0
        public IActionResult Index(StorageModel model)
        {
            // Apply input history from cookie
            var cu = ControllerUtils.From(this);

            cu.PersistInput("StrageAccountName", model, StorageModel.Default.StrageAccountName);
            cu.PersistInput("Key", model, StorageModel.Default.Key);
            cu.PersistInput("Page", model, StorageModel.Default.Page);
            cu.PersistInput("BlobContainerName", model, StorageModel.Default.BlobContainerName);
            cu.PersistInput("BlobName", model, StorageModel.Default.BlobName);
            cu.PersistInput("FileShareName", model, StorageModel.Default.FileShareName);
            cu.PersistInput("FileName", model, StorageModel.Default.FileName);
            cu.PersistInput("TableName", model, StorageModel.Default.TableName);
            cu.PersistInput("TablePartition", model, StorageModel.Default.TablePartition);
            cu.PersistInput("TableKey", model, StorageModel.Default.TableKey);
            cu.PersistInput("QueueName", model, StorageModel.Default.QueueName);

            if (!model.Pages.Contains(model.Page))
            {
                model.Page = "Blob";
            }
            switch (model.Page)
            {
            case "Blob": return(Blob(model));

            case "File": return(File(model));

            case "Table": return(Table(model));

            case "Queue": return(Queue(model));

            default: return(NotFound($"Page {model.Page} not found."));
            }
        }
Example #14
0
        public IActionResult Index(KeyVaultModel model)
        {
            Request.Headers.Add("X-WI-ApplicationID", model.ApplicationID);
            Request.Headers.Add("X-WI-ClientSecret", model.ClientSecret);

            // Apply input history from cookie
            var cu = ControllerUtils.From(this);

            cu.PersistInput("Url", model, KeyVaultModel.Default.Url);
            cu.PersistInput("ApplicationID", model, KeyVaultModel.Default.ApplicationID);
            cu.PersistInput("ClientSecret", model, KeyVaultModel.Default.ClientSecret);
            cu.PersistInput("Key", model, KeyVaultModel.Default.Key);

            if (!model.SkipRequest)
            {
                try
                {
                    model.Value = GetSecretAsync(model).ConfigureAwait(false).GetAwaiter().GetResult();
                }
                catch (Exception ex)
                {
                    model.ErrorMessage = ex.Message;
                }
            }
            model.SkipRequest = false;

            return(View(model));
        }
        public IActionResult Edit(int id)
        {
            if (id > 0)
            {
                var key = new BodyExerciseKey()
                {
                    Id = id
                };
                var bodyExercise = _bodyExercisesService.GetBodyExercise(key);
                if (bodyExercise != null)
                {
                    var bodyExerciseViewModel = new BodyExerciseViewModel();
                    bodyExerciseViewModel.Id                   = bodyExercise.Id;
                    bodyExerciseViewModel.Name                 = bodyExercise.Name;
                    bodyExerciseViewModel.MuscleId             = bodyExercise.MuscleId;
                    bodyExerciseViewModel.MuscleName           = Translation.GetInDB(MuscleTransformer.GetTranslationKey(bodyExercise.MuscleId));
                    bodyExerciseViewModel.ExerciseCategoryType = (int)bodyExercise.ExerciseCategoryType;
                    bodyExerciseViewModel.ExerciseUnitType     = (int)bodyExercise.ExerciseUnitType;
                    bodyExerciseViewModel.ImageUrl             = ImageUtils.GetImageUrl(_env.WebRootPath, "bodyexercises", bodyExercise.ImageName);

                    ViewBag.Muscles            = ControllerUtils.CreateSelectMuscleItemList(_musclesService.FindMuscles(), bodyExercise.MuscleId);
                    ViewBag.ExerciseCategories = ControllerUtils.CreateSelectExerciseCategoryTypeItemList((int)bodyExercise.ExerciseCategoryType);
                    ViewBag.ExerciseUnitTypes  = ControllerUtils.CreateSelectExerciseUnitTypeItemList((int)bodyExercise.ExerciseUnitType);

                    return(View(bodyExerciseViewModel));
                }
            }
            return(RedirectToAction("Index"));
        }
Example #16
0
        public async Task <IHttpActionResult> GetGoalsAsync()
        {
            _log.LogDebug("Request received.");

            User user;

            try
            {
                user = await ControllerUtils.GetUserForRequestHeaderTokenAsync(this, _tokenStore, _userStore, _log);
            }
            catch (AuthenticationException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (InternalServerException)
            {
                return(InternalServerError());
            }

            var usersGoals = await _goalStore.GetGoalsAsync(user.Id);

            var goalDatas = new List <GoalData>();

            usersGoals.ForEach(g => goalDatas.Add(Mapper.Map <GoalData>(g)));

            goalDatas.Sort((g1, g2) => string.Compare(g1.Name, g2.Name));

            string serializeData = JsonConvert.SerializeObject(goalDatas);

            _log.LogDebug($"Returning goals {serializeData}.");

            return(Ok(serializeData));
        }
Example #17
0
        public IActionResult Index(IotModel model)
        {
            var cu = ControllerUtils.From(this);

            cu.PersistInput("HostName", model, IotModel.Default.HostName);
            cu.PersistInput("DeviceId", model, IotModel.Default.DeviceId);
            cu.PersistInput("DeviceKey", model, IotModel.Default.DeviceKey);

            if (model.Message.StartsWith("IoT Test Message at "))
            {
                model.Message = $"IoT Test Message at {DateTime.UtcNow.ToString(Tono.TimeUtil.FormatYMDHMS)}";
            }

            // Send Message to IoT Hub
            try
            {
                var client = DeviceClient.Create(model.HostName, new DeviceAuthenticationWithRegistrySymmetricKey(model.DeviceId, model.DeviceKey), model.TransportType);
                var mes    = new Message(Encoding.UTF8.GetBytes(model.Message));
                client.SendEventAsync(
                    message: mes,
                    cancellationToken: new CancellationTokenSource(TimeSpan.FromMilliseconds(5000)).Token
                    ).ConfigureAwait(false).GetAwaiter().GetResult();

                model.Result = $"Successfully sent the message '{model.Message}' from Device [{model.DeviceId}]";
            }
            catch (Exception ex)
            {
                model.ErrorMessage = ex.Message;
            }

            return(View(model));
        }
Example #18
0
        // ------------------------------------------
        //            List Documents
        // ------------------------------------------
        public void loadDocumentList()
        {
            // Image list
            //
            ImageList imageList = ControllerUtils.GetImageList();

            // Binding
            tvProjectPlanDoco.ImageList = imageList;

            // Clear nodes
            tvProjectPlanDoco.Nodes.Clear();

            var docoList = new DocumentList();

            docoList.List();

            // Load document in the treeview
            //
            //docoList.ListInTree(tvProjectPlanDoco);
            Document root = new Document();

            root.CUID       = "ROOT";
            root.RecordType = FCMConstant.RecordType.FOLDER;
            root.UID        = 0;
            // root.Read();

            // root = RepDocument.Read(false, 0, "ROOT");

            // Using Business Layer

            root = BUSDocument.GetRootDocument();

            DocumentList.ListInTree(tvProjectPlanDoco, docoList, root);
            tvProjectPlanDoco.ExpandAll();
        }
        public IActionResult Edit(BodyExerciseViewModel bodyExerciseViewModel, IFormFile imageFile)
        {
            if (ModelState.IsValid)
            {
                // Verify not exist on bodyExercise name
                var key = new BodyExerciseKey()
                {
                    Id = bodyExerciseViewModel.Id
                };
                var bodyExercise = _bodyExercisesService.GetBodyExercise(key);
                if (bodyExercise != null)
                {
                    string oldImageName = bodyExercise.ImageName;
                    bodyExercise.Name                 = bodyExerciseViewModel.Name;
                    bodyExercise.MuscleId             = bodyExerciseViewModel.MuscleId;
                    bodyExercise.ExerciseCategoryType = Utils.IntToEnum <TExerciseCategoryType>(bodyExerciseViewModel.ExerciseCategoryType);
                    bodyExercise.ExerciseUnitType     = Utils.IntToEnum <TExerciseUnitType>(bodyExerciseViewModel.ExerciseUnitType);
                    bodyExercise = _bodyExercisesService.UpdateBodyExercise(bodyExercise);
                    //Save a new Image if it's correct
                    if (ImageUtils.CheckUploadedImageIsCorrect(imageFile, "png"))
                    {
                        ImageUtils.SaveImage(imageFile, Path.Combine(_env.WebRootPath, "images", "bodyexercises"), bodyExercise.ImageName);
                    }

                    return(RedirectToAction("Index"));
                }
            }

            ViewBag.Muscles            = ControllerUtils.CreateSelectMuscleItemList(_musclesService.FindMuscles(), bodyExerciseViewModel?.MuscleId ?? 0);
            ViewBag.ExerciseCategories = ControllerUtils.CreateSelectExerciseCategoryTypeItemList(bodyExerciseViewModel?.ExerciseCategoryType ?? 0);
            ViewBag.ExerciseUnitTypes  = ControllerUtils.CreateSelectExerciseUnitTypeItemList(bodyExerciseViewModel?.ExerciseUnitType ?? 0);

            return(View(bodyExerciseViewModel));
        }
        public UIPropertySelectContainer()
        {
            Add(SelectedLotName = new UILabel()
            {
                Size      = new Vector2(341, 25),
                Alignment = TextAlignment.Center | TextAlignment.Top,
                Caption   = "<no property selected>"
            });

            Add(Dropdown = new UIInboxDropdown()
            {
                Position = new Vector2(0, 25)
            });
            Dropdown.OnSearch += (query) =>
            {
                FindController <GenericSearchController>()?.SearchLots(query, false, (results) =>
                {
                    Dropdown.SetResults(results);
                });
            };
            Dropdown.OnSelect += SelectLot;;
            Add(Dropdown);

            var ctr = ControllerUtils.BindController <GenericSearchController>(this);
        }
        public async Task <IActionResult> GetUsers([FromQuery] RequestParams requestParams)
        {
            if (requestParams == null)
            {
                return(BadRequest());
            }

            var response = Enumerable.Empty <User>();

            if (requestParams.Ids != null)
            {
                response = await _userService.GetUsers(requestParams.Ids);
            }
            else
            {
                var users = await _userService.GetUsers(
                    requestParams.Filter,
                    requestParams.PageSize,
                    requestParams.PageNumber);

                response = users.Item1;
                ControllerUtils.AddContentRangeHeader(Request.HttpContext.Response, users.Item2);
            }

            return(Ok(response));
        }
Example #22
0
 public CollectionController(IUserRepository userRepo, ICollectionRepository collectionRepo, IProjectCollectionRepository projColRepo)
 {
     _userRepo       = userRepo;
     _collectionRepo = collectionRepo;
     _projColRepo    = projColRepo;
     _utils          = new ControllerUtils(_userRepo);
 }
 public IActionResult Create(string returnUrl = null)
 {
     ViewBag.Muscles            = ControllerUtils.CreateSelectMuscleItemList(_musclesService.FindMuscles(), 0);
     ViewBag.ExerciseCategories = ControllerUtils.CreateSelectExerciseCategoryTypeItemList(0);
     ViewBag.ExerciseUnitTypes  = ControllerUtils.CreateSelectExerciseUnitTypeItemList(0);
     return(View(new BodyExerciseViewModel()));
 }
        public IActionResult Create([FromBody] TrainingDayViewModel viewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (string.IsNullOrWhiteSpace(viewModel.UserId) || viewModel.Year == 0 || viewModel.WeekOfYear == 0 ||
                        viewModel.DayOfWeek < 0 || viewModel.DayOfWeek > 6 || SessionUserId != viewModel.UserId)
                    {
                        return(BadRequest());
                    }

                    //Verify trainingWeek exist
                    var trainingWeekKey = new TrainingWeekKey()
                    {
                        UserId     = viewModel.UserId,
                        Year       = viewModel.Year,
                        WeekOfYear = viewModel.WeekOfYear
                    };
                    var trainingWeekScenario = new TrainingWeekScenario()
                    {
                        ManageTrainingDay = false
                    };
                    var trainingWeek = _trainingWeeksService.GetTrainingWeek(trainingWeekKey, trainingWeekScenario);

                    if (trainingWeek == null)
                    {
                        return(BadRequest(new WebApiException(string.Format(Translation.P0_NOT_EXIST, Translation.TRAINING_WEEK))));
                    }

                    //Verify valid week of year
                    if (viewModel.WeekOfYear > 0 && viewModel.WeekOfYear <= 52)
                    {
                        var trainingDay = ControllerUtils.TransformViewModelToTrainingDay(viewModel);
                        trainingDay = _trainingDaysService.CreateTrainingDay(trainingDay);
                        if (trainingDay == null)
                        {
                            return(BadRequest(new WebApiException(string.Format(Translation.IMPOSSIBLE_TO_CREATE_P0, Translation.TRAINING_DAY))));
                        }
                        else
                        {
                            return(new OkObjectResult(trainingDay));
                        }
                    }
                    else
                    {
                        return(BadRequest());
                    }
                }
                else
                {
                    return(BadRequest(new WebApiException(ControllerUtils.GetModelStateError(ModelState))));
                }
            }
            catch (Exception exception)
            {
                return(BadRequest(new WebApiException("Error", exception)));
            }
        }
Example #25
0
        public EnrollView(string subjectId)
        {
            InitializeComponent();
            openFileDialog.Filter = NImages.GetOpenFileFilterString(true, true);
            string component = "Biometrics.FingerExtraction,Biometrics.FingerMatching,Devices.FingerScanners,Images.WSQ,Biometrics.FingerSegmentation,Biometrics.FingerQualityAssessmentBase";

            ControllerUtils.ObtainLicense(component);
        }
Example #26
0
        // ------------------------------------------
        //            List Documents
        // ------------------------------------------
        public void loadLinkedDocuments(Document document)
        {
            // Image list
            //
            ImageList imageList = ControllerUtils.GetImageList();

            // Binding
            tvLinkedDocuments.ImageList = imageList;

            // Clear nodes
            tvLinkedDocuments.Nodes.Clear();

            var docoList = ClientDocumentLinkList.ListRelatedDocuments(
                selectedClient.UID,
                documentSetUID,
                document.UID,
                cbxLinkType.Text);

            // Load document in the treeview
            //
            // docoList.ListInTree(tvLinkedDocuments);
            Document root = new Document();

            root.CUID       = document.CUID;
            root.RecordType = FCMConstant.RecordType.FOLDER;
            root.UID        = document.UID;
            // root.Read();

            // root = RepDocument.Read(false, document.UID);

            // Using Business Layer
            var documentReadRequest = new DocumentReadRequest();

            documentReadRequest.UID  = document.UID;
            documentReadRequest.CUID = "";
            documentReadRequest.retrieveVoidedDocuments = false;

            var docreadresp = BUSDocument.DocumentRead(documentReadRequest);

            if (docreadresp.response.ReturnCode == 0001)
            {
                // all good
            }
            else
            {
                MessageBox.Show(docreadresp.response.Message);
                return;
            }

            root = docreadresp.document;
            //



            ControllerUtils.ListInTree(tvLinkedDocuments, docoList, root);
            tvLinkedDocuments.ExpandAll();
        }
Example #27
0
        public HttpResponseMessage GetSalasDisponiveis([FromUri] int andarId, int tamanho)
        {
            List <Sala> salas = contexto.Salas
                                .AsNoTracking()
                                .Where(x => x.Andar.Id == andarId)
                                .ToList();

            return(Ok(salas.Where(x => ControllerUtils.SalaHasRackDisponivel(contexto, x.Id, tamanho))));
        }
Example #28
0
        public NeighPageController(UINeighPage view, IClientDataService dataService)
        {
            this.View        = view;
            this.DataService = dataService;
            this.Topic       = dataService.CreateTopicSubscription();

            ControllerUtils.BindController <RatingSummaryController>(this.View.MayorRatingBox1);
            ControllerUtils.BindController <RatingSummaryController>(this.View.MayorRatingBox2);
        }
Example #29
0
        /// <summary>
        /// Add role to user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddRoleToUser(object sender, DragEventArgs e)
        {
            // Get selected item in available tree
            //
            TreeNode tnRoleAvailableSelected = tvAvailableRoles.SelectedNode;

            if (tnRoleAvailableSelected == null)
            {
                return;
            }

            // Get destination node
            //
            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                Point    pt;
                TreeNode destinationNode;
                pt = tvUserList.PointToClient(new Point(e.X, e.Y));
                destinationNode = tvUserList.GetNodeAt(pt);
                if (destinationNode == null)
                {
                    return;
                }

                var user = new UserAccess();
                user = (UserAccess)destinationNode.Tag;

                if (tnRoleAvailableSelected != null)
                {
                    tnRoleAvailableSelected.Remove();

                    destinationNode.Nodes.Add(tnRoleAvailableSelected);

                    // Get role
                    //
                    SecurityRole roleNew = new SecurityRole();
                    roleNew = (SecurityRole)tnRoleAvailableSelected.Tag;


                    // Update database
                    //
                    SecurityUserRole newUserRole = new SecurityUserRole(HeaderInfo.Instance);
                    newUserRole.FK_Role   = roleNew.Role;
                    newUserRole.FK_UserID = user.UserID;
                    newUserRole.IsActive  = "Y";
                    newUserRole.IsVoid    = "N";
                    newUserRole.StartDate = System.DateTime.Today;

                    var response = newUserRole.Add();

                    // Show message
                    ControllerUtils.ShowFCMMessage(response.UniqueCode, Utils.UserID);

                    RefreshList();
                }
            }
        }
Example #30
0
        public HttpResponseMessage GetAndaresDisponiveis([FromUri] int edificacaoId, int tamanho)
        {
            List <Andar> andares = contexto.Andares
                                   .AsNoTracking()
                                   .Where(x => x.Edificacao.Id == edificacaoId)
                                   .ToList();

            return(Ok(andares.Where(x => ControllerUtils.AndarHasRackDisponivel(contexto, x.Id, tamanho))));
        }