public void CreateMeetingLabelItem_InputValidate_Success()
        {
            var createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            var result = createMeetingLabelItemValidation.InputValidate("test");

            Assert.IsTrue(result.IsSuccessed);
            Assert.IsFalse(result.HasError);
        }
        public void CreateMeetingLabelItem_InputValidate_Failure_BlankItemName()
        {
            var createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            var result = createMeetingLabelItemValidation.InputValidate("");

            Assert.IsFalse(result.IsSuccessed);
            Assert.IsTrue(result.HasError);
            Assert.IsTrue(result.BlankItemName);
        }
Пример #3
0
        public MeetingLabelItemDataCreatePageViewModel(INavigationService navigationService) : base(navigationService)
        {
            _restService     = new RestService();
            _operateDateTime = new OperateDateTime();

            _createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            _tokenCheckValidation             = new TokenCheckValidation(_restService);
            _applicationProperties            = new ApplicationProperties();
            _meetingLabelItemDatas            = new ObservableCollection <MeetingLabelItemData>();
            _createMeetingLabelItemParam      = new CreateMeetingLabelItemParam();

            _additionalMeetingLabelItemDatas = new List <MeetingLabelItemData>();

            //会議の各ラベルに項目(Item)を追加するコマンド
            CreateMeetingLabelItemCommand = new DelegateCommand(async() =>
            {
                //項目入力値のバリデーション
                CreateMeetingLabelItemParam = _createMeetingLabelItemValidation.InputValidate(InputLabelItemName);
                if (CreateMeetingLabelItemParam.HasError == true)
                {
                    return;
                }



                //uid取得の際のtoken情報照合
                TokenCheckParam = await _tokenCheckValidation.Validate(_applicationProperties.GetFromProperties <TokenData>("token"));

                var inputUid = 0;

                if (TokenCheckParam.HasError == true)
                {
                    return;
                }
                else
                {
                    //token情報照合に成功したらuid取得
                    GetUserParam = await _restService.GetUserDataAsync(UserConstants.OpenUserEndPoint, _applicationProperties.GetFromProperties <string>("userId"));

                    if (GetUserParam.HasError == true)
                    {
                        return;
                    }
                    else
                    {
                        //userDataの取得に成功したらuidを代入
                        var userData = GetUserParam.User;
                        inputUid     = userData.Id;
                    }
                }
                var meetingLabelItemData = new MeetingLabelItemData(TargetMeetingLabel.Id, inputUid, InputLabelItemName);
                MeetingLabelItemDatas.Add(meetingLabelItemData);
                AdditionalMeetingLabelItemDatas.Add(meetingLabelItemData);

                InputLabelItemName = "";
            });
        }
        public void CreateMeetingLabelItem_AddValidate_Failure_NoExistItem()
        {
            var createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            var testMeetingLabelItemDatas        = new List <MeetingLabelItemData>();

            var result = createMeetingLabelItemValidation.AddValidate(testMeetingLabelItemDatas);

            Assert.IsFalse(result.IsSuccessed);
            Assert.IsTrue(result.HasError);
            Assert.IsTrue(result.NoExistItem);
        }
        public void CreateMeetingLabelItem_AddValidate_Success()
        {
            var createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();

            var testMeetingLabelItemDatas = new List <MeetingLabelItemData>();
            var testMeetingLabelItemData  = new MeetingLabelItemData(1, 2, "test");

            testMeetingLabelItemDatas.Add(testMeetingLabelItemData);

            var result = createMeetingLabelItemValidation.AddValidate(testMeetingLabelItemDatas);

            Assert.IsTrue(result.IsSuccessed);
            Assert.IsFalse(result.HasError);
        }
Пример #6
0
        public MeetingAttendPageViewModel(INavigationService navigationService) : base(navigationService)
        {
            _navigationService     = navigationService;
            _restService           = new RestService();
            _operateDateTime       = new OperateDateTime();
            _applicationProperties = new ApplicationProperties();

            _createMeetingLabelItemParam = new CreateMeetingLabelItemParam();
            _attendMeetingParam          = new AttendMeetingParam();
            _deleteMeetingLabelItemParam = new DeleteMeetingLabelItemParam();

            _createMeetingLabelItemValidation = new CreateMeetingLabelItemValidation();
            _tokenCheckValidation             = new TokenCheckValidation(_restService);
            _attendMeetingValidation          = new AttendMeetingValidation();


            //ラベルに関する項目を追加するページへ遷移するコマンド
            NavigateMeetingLabelItemDataCreatePage = new DelegateCommand <object>((meetingLabelData) =>
            {
                var targetMeetingLabelData = (MeetingLabelData)(meetingLabelData);

                var p = new NavigationParameters
                {
                    { "meetingLabelData", targetMeetingLabelData },
                };
                _navigationService.NavigateAsync("MeetingLabelItemDataCreatePage", p);
            });


            //会議に入室するコマンド
            EnterMeetingCommand = new DelegateCommand(async() =>
            {
                //バリデーション
                AttendMeetingParam = _attendMeetingValidation.ButtonPushedValidate(new List <MeetingLabelData>(TargetMeetingLabels));


                if (AttendMeetingParam.IsSuccessed == true)
                {
                    GetUserParam = await _restService.GetUserDataAsync(UserConstants.OpenUserEndPoint, _applicationProperties.GetFromProperties <string>("userId"));

                    var mid = GetMeetingParam.MeetingData.Id;
                    var uid = GetUserParam.User.Id;

                    //ParticipantDBに既にユーザーが居ないかチェック
                    CheckParticipantParam = await _restService.CheckParticipantDataAsync(MeetingConstants.OPENMeetingParticipantEndPoint, uid, mid);

                    //ユーザーが既にParticipantDBに存在していた場合
                    if (CheckParticipantParam.IsSuccessed == true)
                    {
                        //会議参加済みかつisDeletedがfalseの場合は最終更新時刻のみ更新し遷移する
                        if (CheckParticipantParam.Participant.isDeleted == false)
                        {
                            var operateDateTime = new OperateDateTime();
                            CheckParticipantParam.Participant.LastUpdateTime = operateDateTime.CurrentDateTime;
                            var updateParticipant = CheckParticipantParam.Participant;
                            await _restService.UpdateParticipantDataAsync(MeetingConstants.OPENMeetingParticipantEndPoint, updateParticipant);

                            var p = new NavigationParameters
                            {
                                { "mid", GetMeetingParam.MeetingData.Id }
                            };
                            await _navigationService.NavigateAsync("MeetingExecuteTopPage", p);
                        }
                        else
                        //参加済みかつ論理削除済みの場合はisDeletedをtrue→falseにして再入室
                        {
                            var operateDateTime = new OperateDateTime();
                            CheckParticipantParam.Participant.isDeleted      = false;
                            CheckParticipantParam.Participant.LastUpdateTime = operateDateTime.CurrentDateTime;
                            var updateParticipant = CheckParticipantParam.Participant;

                            await _restService.UpdateParticipantDataAsync(MeetingConstants.OPENMeetingParticipantEndPoint, updateParticipant);

                            var p = new NavigationParameters
                            {
                                { "mid", GetMeetingParam.MeetingData.Id }
                            };
                            await _navigationService.NavigateAsync("MeetingExecuteTopPage", p);
                        }
                    }
                    //ParticipantDBに該当者が居なければ追加
                    else
                    {
                        CreateParticipateParam = await _restService.CreateParticipateDataAsync(MeetingConstants.OPENMeetingParticipantEndPoint, uid, mid);

                        if (CreateParticipateParam.IsSuccessed == true)
                        {
                            var p = new NavigationParameters
                            {
                                { "mid", GetMeetingParam.MeetingData.Id }
                            };
                            await _navigationService.NavigateAsync("MeetingExecuteTopPage", p);
                        }
                    }
                }
            });

            //会議入室画面から退室するコマンド
            ExitMeetingCommand = new DelegateCommand(async() =>
            {
                //TargetMeetingLabelsが所持しているItemsを削除する
                foreach (MeetingLabelData l in TargetMeetingLabels)
                {
                    foreach (MeetingLabelItemData i in l.MeetingLabelItemDatas)
                    {
                        DeleteMeetingLabelItemParam = await _restService.DeleteMeetingLabelItemDataAsync(MeetingConstants.OPENMeetingLabelItemEndPoint, i.Id);
                    }
                }

                await _navigationService.NavigateAsync("/NavigationPage/MeetingDataTopPage");
            });
        }