Пример #1
0
        public profileForm LoadProfile(uid uid)
        {
            profileForm profForm = new profileForm();

            profForm.fields = new formField[1];

            formField usernameField = new formField();

            usernameField.name       = "username";
            usernameField.mandatory  = true;
            usernameField.@readonly  = true;
            usernameField.searchable = true;
            usernameField.hidden     = false;
            usernameField.type       = "STRING";
            usernameField.sequence   = 1;

            switch (uid.account_id)
            {
            case "1":
                usernameField.value = "test";
                break;

            case "2":
                usernameField.value = "test1";
                break;

            default:
                usernameField.value = "";
                break;
            }

            profForm.fields[0] = usernameField;

            return(profForm);
        }
Пример #2
0
        public override void Refresh()
        {
            if ((string.IsNullOrEmpty(this.TaxNumber) && !requestedTaxNumber) || form == null)
            {
                form = WsdlRepository.LoadProfile(StationRepository.GetUid(this));
                if (form != null && form.fields != null)
                {
                    foreach (var formField in form.fields)
                    {
                        if (formField.name == "tax_number")
                        {
                            TaxNumber = formField.value;
                        }
                    }
                }
                requestedTaxNumber = true;
            }

            decimal reserved = 0;
            decimal factor;

            Cashpool      = WsdlRepository.GetBalance(StationRepository.GetUid(this), out reserved, out factor) - reserved;
            AvailableCash = Cashpool - TicketHandler.Stake;

            _userConfidenceFactor = factor;
        }
Пример #3
0
 private void ChangeUserProfileForm()
 {
     if (EditUserId != null)
     {
         profileForm form = WsdlRepository.LoadProfile(StationRepository.GetUid(new LoggedInUser(EditUserId.AccountId, null, 0, 0, 0, 0)));
         ChangeUserProfileFields = InitFields(form.fields);
         if (EditUser != null)
         {
             EditUser.IsVerified = form.fields.Where(x => x.name == "verified").Select(x => x.value).FirstOrDefault() == "1";
         }
     }
 }
Пример #4
0
        public void CancelEditingProfile(long obj)
        {
            IsEnabledForEditing = false;
            Mediator.SendMessage(MsgTag.HideKeyboard, MsgTag.HideKeyboard);
            foreach (var field in ChangeUserProfileFields)
            {
                field.IsEnabled = false;
            }
            profileForm form = WsdlRepository.LoadProfile(StationRepository.GetUid(new LoggedInUser(EditUserId.AccountId, null, 0)));

            ChangeUserProfileFields = InitFields(form.fields);
        }
Пример #5
0
        private void PleaseWaitCancelEditingProfile()
        {
            IsEnabledForEditing = false;
            Mediator.SendMessage(MsgTag.HideKeyboard, MsgTag.HideKeyboard);
            foreach (var field in ChangeUserProfileFields)
            {
                field.IsEnabled       = false;
                field.EmptyValidation = field.IsEnabled;
            }
            profileForm form = WsdlRepository.LoadProfile(StationRepository.GetUid(new LoggedInUser(EditUserId.AccountId, null, 0, 0, 0, 0)));

            ChangeUserProfileFields = InitFields(form.fields);
        }
Пример #6
0
 private void ChangeUserProfileForm()
 {
     if (ChangeTracker.CurrentUser is LoggedInUser)
     {
         profileForm form = WsdlRepository.LoadProfile(StationRepository.GetUid(ChangeTracker.CurrentUser));
         if (form != null)
         {
             var fields = InitFields(form.fields);
             ChangeUserProfileFields = fields;
             OnChangeUserProfile();
         }
     }
 }
Пример #7
0
        private void OnCancelEditingProfile()
        {
            IsEnabledForEditing = false;
            Mediator.SendMessage(MsgTag.HideKeyboard, MsgTag.HideKeyboard);
            foreach (var field in ChangeUserProfileFields)
            {
                field.IsEnabled       = false;
                field.EmptyValidation = field.IsEnabled;
            }
            profileForm form = WsdlRepository.LoadProfile(StationRepository.GetUid(ChangeTracker.CurrentUser));

            ChangeUserProfileFields = InitFields(form.fields);
        }
Пример #8
0
        private void DoLogin()
        {
            Validate(true);
            try
            {
                int sucess = PleaseWaitLogin();

                if (sucess == 1)
                {
                    HideWindow();
                    if (ChangeTracker.CurrentUser is OperatorUser)
                    {
                        WaitOverlayProvider.ShowWaitOverlay();

                        ChangeTracker.SelectedLive          = false;
                        ChangeTracker.SelectedResults       = false;
                        ChangeTracker.SelectedTicket        = false;
                        ChangeTracker.SelectedSports        = false;
                        ChangeTracker.SelectedVirtualSports = false;
                        MyRegionManager.NavigateUsingViewModel <UserManagementViewModel>(RegionNames.ContentRegion);
                    }
                    else if (ChangeTracker.CurrentUser is LoggedInUser)
                    {
                        WaitOverlayProvider.DisposeAll();

                        //check terms and conditions
                        profileForm form = WsdlRepository.LoadProfile(StationRepository.GetUid(ChangeTracker.CurrentUser));
                        if (form != null)
                        {
                            foreach (formField accountingField in form.fields)
                            {
                                if (accountingField.name == "terms_and_cond_version")
                                {
                                    string value = "";
                                    if (accountingField.value == null)
                                    {
                                        value = "1.0";
                                    }
                                    else
                                    {
                                        value = accountingField.value;
                                    }

                                    if (value != ChangeTracker.TermsAndConditionsVersion)
                                    {
                                        ChangeTracker.NewTermsAccepted = false;
                                        Mediator.SendMessage <bool>(false, MsgTag.AcceptNewTermsVersion);
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        WaitOverlayProvider.DisposeAll();
                    }
                }
                else if (sucess == 0)
                {
                    ShowError(TranslationProvider.Translate(MultistringTags.SERVER_ERROR) as string);
                }
                else if (sucess == 2) //passwordreminder
                {
                    QuestionWindowService.ShowMessage(TranslationProvider.Translate(MultistringTags.TERMINAL_PASSWORD_NOT_CHANGED).ToString(), null, null, DoChangePassword, CancelPasswordChange);
                }
                else if (sucess == 3) // forced reminder
                {
                    QuestionWindowService.ShowMessage(TranslationProvider.Translate(MultistringTags.TERMINAL_PASSWORD_NOT_CHANGED).ToString(), null, null, DoChangePasswordForced, CancelForcedPassChange);
                }
            }
            catch (FaultException <HubServiceException> exception)
            {
                WaitOverlayProvider.DisposeAll();
                switch (exception.Detail.code)
                {
                case 111:
                    OnPropertyChanged("PasswordMasked");
                    DoRaisePropertyChanged(new Tuple <string, string>("UserName", TranslationProvider.Translate(MultistringTags.SHOP_FORM_CHECK_USERNAME).ToString()));
                    UsernameLoginError = false;
                    break;

                case 112:
                    DoRaisePropertyChanged(new Tuple <string, string>("PasswordMasked", TranslationProvider.Translate(MultistringTags.INVALID_PASSWORD).ToString()));
                    PasswordLoginError = false;
                    break;

                case 113:
                    ShowError(TranslationProvider.Translate(MultistringTags.LOGIN_FRANCHISOR_INCORRECT).ToString());
                    PasswordLoginError = false;
                    break;

                case 114:
                    DoRaisePropertyChanged(new Tuple <string, string>("UserName", TranslationProvider.Translate(MultistringTags.USER_IS_NOT_VERIFIED).ToString()));
                    PasswordLoginError = false;
                    break;

                case 115:
                    ShowError(TranslationProvider.Translate(MultistringTags.CANNOT_LOGIN_TO_THIS_STATION).ToString());
                    PasswordLoginError = false;
                    break;

                case 116:
                    ShowError(TranslationProvider.Translate(MultistringTags.LOGIN_RESTRICTED).ToString());
                    PasswordLoginError = false;
                    break;

                case 117:
                    ShowError(TranslationProvider.Translate(MultistringTags.USER_INACTIVE).ToString());
                    PasswordLoginError = false;
                    break;

                case 118:
                    ShowError(TranslationProvider.Translate(MultistringTags.INVALIDLOCATION).ToString());
                    PasswordLoginError = false;
                    break;

                case 172:
                    PasswordLoginError = false;

                    string sTime     = "";
                    string sUsername = "";
                    if (exception.Detail.parameters != null)
                    {
                        //if (exception.Detail.parameters[2].name == "blockedUntil")
                        //{
                        //    sTime = exception.Detail.parameters[2].value;
                        //    long milliSeconds = Int64.Parse(sTime);
                        //    DateTime UTCBaseTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                        //    DateTime dt = UTCBaseTime.Add(new TimeSpan(milliSeconds * TimeSpan.TicksPerMillisecond)).ToLocalTime();
                        //    dt = LocalDateTime.Get(dt);
                        //    sTime = dt.ToString("dd.MM.yyyy HH:mm");
                        //    sUsername = exception.Detail.parameters[1].value;
                        //}
                        //else
                        //{
                        //    sTime = exception.Detail.parameters[1].value;
                        //    sUsername = exception.Detail.parameters[1].value;
                        //}

                        for (int i = 0; i < exception.Detail.parameters.Length; i++)
                        {
                            if (exception.Detail.parameters[i].name == "blockedUntil")
                            {
                                sTime = exception.Detail.parameters[i].value;
                                long     milliSeconds = Int64.Parse(sTime);
                                DateTime UTCBaseTime  = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                                DateTime dt           = UTCBaseTime.Add(new TimeSpan(milliSeconds * TimeSpan.TicksPerMillisecond)).ToLocalTime();
                                sTime = dt.ToString("dd.MM.yyyy HH:mm");
                            }

                            if (exception.Detail.parameters[i].name == "username")
                            {
                                sUsername = exception.Detail.parameters[i].value;
                            }
                        }
                    }
                    ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_USERNAME_BLOCKED, sUsername, sTime));

                    break;

                case 124:
                    ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_ADMIN_LOGIN_PROHIBITED).ToString());
                    PasswordLoginError = false;
                    break;

                default:     // 113, 114
                    ShowError(exception.Detail.message);
                    break;
                }
            }
        }