Exemplo n.º 1
0
        private void GenerateReportClick(object sender, RoutedEventArgs e)
        {
            var selectedMember = memberDataGrid.SelectedItem as Member;

            if (selectedMember == null)
            {
                var mess = new MessageWindow("Memnber is not selected");
                mess.Show();
                return;
            }

            var options = new HtmlPopupWindowOptions
            {
                Left = 0,
                Top = 0,
                Width = 930,
                Height = 800,
                Menubar = false,
                Toolbar = false,
                Directories = false,
                Status = false
            };

            var address = Application.Current.Host.Source.AbsoluteUri;
            var i = address.IndexOf("/ClientBin/", 1);
            var url = address.Substring(0, i);
            url = url + "/Reports.aspx?Report=Member&userId=" + selectedMember.UserID;

            if (true == HtmlPage.IsPopupWindowAllowed) HtmlPage.PopupWindow(new Uri(url), "new", options);
        }
Exemplo n.º 2
0
 private void OnCustomValidationError( object sender, EventArgs a )
 {
     var arg = (CustomValidationErrorEventArgs)a;
     if ( arg.HasError )
     {
         var mess = new MessageWindow( arg.ErrorMessage );
         mess.Show();
     }
     else
         DialogResult = true;
 }
 private void OnCustomValidationError(object sender, EventArgs a)
 {
     var arg = (CustomValidationErrorEventArgs)a;
     if (arg.HasError)
     {
         //MessageBox.Show("Rectify validation Errors", "Check validation errors", MessageBoxButton.OK);
         var mess = new MessageWindow(arg.ErrorMessage);
         mess.Show();
         //DialogResult = false;
     }
     else
         DialogResult = true;
 }
Exemplo n.º 4
0
        public void ShowDialog(string message)
        {
            var mess = new MessageWindow(message);
            mess.Show();
            //MessageBox.Show(message);
            //var th = new Thickness(5);

            //var window = new RadWindow
            //{
            //    Content = message,
            //    Header = "Info",
            //    WindowStartupLocation = WindowStartupLocation.CenterScreen,
            //    FontSize = 14,
            //    Padding = th
            //};

            //window.ShowDialog();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Completion handler for the registration operation. If there was an error, an
        /// <see cref="ErrorWindow"/> is displayed to the user. Otherwise, this triggers
        /// a login operation that will automatically log in the just registered user.
        /// </summary>
        private void RegistrationOperation_Completed(InvokeOperation<CreateUserStatus> operation)
        {
            if (!operation.IsCanceled)
            {
                if (operation.HasError)
                {
                    if ( operation.Error.Message.Contains( "SQL Server" ) )
                    {
                        var mess = new MessageWindow( "Cannot register new user, the database is not accessible. Please check configuration." );
                        mess.Show();
                    }
                    else
                    ErrorWindow.CreateNew(operation.Error);

                    operation.MarkErrorAsHandled();
                }
                else if (operation.Value == CreateUserStatus.Success)
                {
                    this.registrationData.CurrentOperation = WebContext.Current.Authentication.Login(this.registrationData.ToLoginParameters(), this.LoginOperation_Completed, null);
                    this.parentWindow.AddPendingOperation(this.registrationData.CurrentOperation);

                    //registrationData.

                }
                else if (operation.Value == CreateUserStatus.DuplicateUserName)
                {
                    this.registrationData.ValidationErrors.Add(new ValidationResult(ErrorResources.CreateUserStatusDuplicateUserName, new string[] { "UserName" }));
                }
                else if (operation.Value == CreateUserStatus.DuplicateEmail)
                {
                    this.registrationData.ValidationErrors.Add(new ValidationResult(ErrorResources.CreateUserStatusDuplicateEmail, new string[] { "Email" }));
                }
                else
                {
                    ErrorWindow.CreateNew(ErrorResources.ErrorWindowGenericError);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Completion handler for a <see cref="LoginOperation"/>. If operation succeeds,
        /// it closes the window. If it has an error, we show an <see cref="ErrorWindow"/>
        /// and mark the error as handled. If it was not canceled, but login failed, it must
        /// have been because credentials were incorrect so we add a validation error to
        /// to notify the user.
        /// </summary>
        private void LoginOperation_Completed(LoginOperation loginOperation)
        {
            if (loginOperation.LoginSuccess)
            {
                this.parentWindow.Close();
            }
            else if (loginOperation.HasError)
            {
                if (loginOperation.Error.Message.Contains("MembershipProvider"))
                {
                    var mess = new MessageWindow( "Please check database configuration, it is not accessible" );
                    mess.Show();
                }
                else
                    ErrorWindow.CreateNew( loginOperation.Error );

                loginOperation.MarkErrorAsHandled();
            }
            else if (!loginOperation.IsCanceled)
            {
                this.loginInfo.ValidationErrors.Add(new ValidationResult(ErrorResources.ErrorBadUserNameOrPassword, new string[] { "UserName", "Password" }));
            }
        }