/// <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)
         {
             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);
         }
         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);
         }
     }
 }
Пример #2
0
        void oper_Completed(object sender, EventArgs e)
        {
            InvokeOperation <bool> oper = sender as InvokeOperation <bool>;

            if (!oper.HasError)
            {
                GlobalStatus.Current.IsError = false;
                if (OrdersContext.Current.LastUpdate.AddMinutes(10) < DateTime.Now)
                {
                    GlobalStatus.Current.NeedRefresh = true;
                }
                if (oper.Value || GlobalStatus.Current.NeedRefresh)
                {
                    if (GlobalStatus.Current.CanRefresh)
                    {
                        OrdersContext.Current.RefreshOrders(true);
                    }
                    else
                    {
                        GlobalStatus.Current.NeedRefresh = true;
                    }
                }
            }
            else
            {
                GlobalStatus.Current.IsError = true;
                oper.MarkErrorAsHandled();
            }
        }
Пример #3
0
 private void OnCheckCompleted(InvokeOperation geted)
 {
     this.IsBusy = false;
     if (geted.HasError)
     {
         MessageErp.ErrorMessage(geted.Error.Message.GetErrMsg());
         geted.MarkErrorAsHandled();
         return;
     }
     this.LoadBill(this.CurrentIDCode);
 }
Пример #4
0
        void ReadEweResult_Completed(object sender, EventArgs e)
        {
            InvokeOperation <string> result = (InvokeOperation <string>)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }
            _eweDsNameReadCompleted(result.Value, ex);
        }
Пример #5
0
        void readUsersResult_Completed(object sender, EventArgs e)
        {
            InvokeOperation <List <UserDTO> > result = (InvokeOperation <List <UserDTO> >)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }
            _readAssociatedListCompleted(result.Value, ex);
        }
Пример #6
0
        void readResult_Completed(object sender, EventArgs e)
        {
            InvokeOperation <List <DatasourceDto> > result = (InvokeOperation <List <DatasourceDto> >)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }
            _readCompleted(result.Value, ex);
        }
Пример #7
0
        void updResult_Completed(object sender, EventArgs e)
        {
            InvokeOperation <bool> result = (InvokeOperation <bool>)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }
            _updCompleted(result.Value, ex);
        }
Пример #8
0
 protected virtual void OnDeleteCompleted(InvokeOperation geted)
 {
     this.IsBusy = false;
     if (geted.HasError)
     {
         MessageErp.ErrorMessage(geted.Error.Message.GetErrMsg());
         geted.MarkErrorAsHandled();
         return;
     }
     //MessageErp.InfoMessage(ErpUIText.Get("ERP_DeleteSucceed"));
     this.Drop();
 }
Пример #9
0
 /// <summary>
 /// Completion handler for a <see cref="LoginOperation"/>.
 /// If operation succeeds, it closes the window.
 /// If it has an error, it displays an <see cref="ErrorWindow"/> and marks the error as handled.
 /// If it was not canceled, but login failed, it must have been because credentials were incorrect so a validation error is added to notify the user.
 /// </summary>
 private void LoginOperation_Completed(InvokeOperation <bool> op)
 {
     if (op.Value)
     {
         this.parentWindow.DialogResult = true;
     }
     else if (op.HasError)
     {
         MessageBox.Show("Could not change password. Check the current password entered.");
         op.MarkErrorAsHandled();
     }
 }
Пример #10
0
 protected virtual void OnSaveCompleted(InvokeOperation <string> geted)
 {
     this.IsBusy = false;
     if (geted.HasError)
     {
         MessageErp.ErrorMessage(geted.Error.Message.GetErrMsg());
         geted.MarkErrorAsHandled();
         return;
     }
     //if (string.IsNullOrEmpty(this.CurrentIDCode))
     //    MessageErp.InfoMessage(ErpUIText.Get("ERP_SaveSucceed") + Environment.NewLine + geted.Value.ToString().Trim());
     this.OnSaveCompleted2(geted.Value);
 }
 private static void UpdateResults<T>(InvokeOperation<T> res, TextBlock textBox, string operation)
 {
     if (res.HasError)
     {
         res.MarkErrorAsHandled();
         textBox.Text = string.Format("{0} had error of type {1} with message '{2}'",
                 operation,
                 res.Error.GetType(),
                 res.Error.Message);
     }
     else
         textBox.Text = string.Format("{0} invoked successfully with result {1}", operation, res.Value);
 }
Пример #12
0
 private void CopyDialPlanComplete(InvokeOperation io)
 {
     if (io.HasError)
     {
         LogActivityMessage_External(MessageLevelsEnum.Error, "There was an error copying the dial plan. " + io.Error.Message);
         io.MarkErrorAsHandled();
     }
     else
     {
         LogActivityMessage_External(MessageLevelsEnum.Info, "The dial plan copy was successful.");
         m_dialPlansPanel.RefreshAsync();
     }
 }
        private void UpdateCustomerPasswordComplete(InvokeOperation io)
        {
            if (io.HasError)
            {
                UIHelper.SetText(m_statusTextBlock, io.Error.Message);
                io.MarkErrorAsHandled();
            }
            else
            {
                UIHelper.SetText(m_statusTextBlock, "Password successfully updated.");
            }

            SetUpdateButtonsEnabled(true);
        }
Пример #14
0
        void readAllResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <List <OrganizationDto> > result = (InvokeOperation <List <OrganizationDto> >)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }

            this.AllOrganizations = result.Value;
            _readAllCompleted(AllOrganizations, ex);
        }
Пример #15
0
 protected virtual void OnEditCompleted(InvokeOperation geted)
 {
     this.IsBusy = false;
     if (geted.HasError)
     {
         MessageErp.ErrorMessage(geted.Error.Message.GetErrMsg());
         geted.MarkErrorAsHandled();
         return;
     }
     if (!string.IsNullOrEmpty(this.CurrentIDCode))
     {
         this.LoadBill(this.CurrentIDCode);
     }
 }
Пример #16
0
        void freqTableResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <DatatableBag> result =
                (InvokeOperation <DatatableBag>)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }
            DatatableBag returnedData = ((InvokeOperation <DatatableBag>)sender).Value;

            _freqCompleted(returnedData, ex);
        }
Пример #17
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 operation)
 {
     if (!operation.IsCanceled)
     {
         if (operation.HasError)
         {
             ErrorWindow.CreateNew(operation.Error);
             operation.MarkErrorAsHandled();
         }
         else
         {
             this.parentWindow.Close();
         }
     }
 }
Пример #18
0
        void canvasSnapshotResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <string> result = (InvokeOperation <string>)sender;

            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }
            string snapshotGuid = ((InvokeOperation <string>)sender).Value;

            _completed2(snapshotGuid, ex);
        }
Пример #19
0
        void cssLoadResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <List <CanvasShareStatusDto> > result = (InvokeOperation <List <CanvasShareStatusDto> >)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }

            List <CanvasShareStatusDto> returnedData = ((InvokeOperation <List <CanvasShareStatusDto> >)sender).Value;

            _cssLoadCompleted(returnedData, ex);
        }
Пример #20
0
        /// <summary>
        /// Used by Silverlight client applications to verify that a service operation with
        /// a return value completed successfully.
        /// </summary>
        /// <typeparam name="TResult">The operation result type.</typeparam>
        /// <param name="operation">The service operation context.</param>
        /// <remarks>
        /// <para>
        /// This method returns if the operation was completed successfully without error,
        /// or throws a <see cref="CancelException" /> if the operation was cancelled.
        /// Otherwise, the method unmarshals and throws an encoded exception if possible,
        /// and if that's not possible, a <see cref="RemoteException" /> will be thrown.
        /// </para>
        /// <note>
        /// This method is available only on Silverlight clients.  An <see cref="InvalidOperationException" />
        /// will be thrown if called within an RIA service.
        /// </note>
        /// </remarks>
        /// <exception cref="InvalidOperationException">Thrown if called by an RIA service.</exception>
        public static void Check <TResult>(InvokeOperation <TResult> operation)
        {
            if (operation.IsCanceled)
            {
                throw new CancelException();
            }

            if (!operation.HasError)
            {
                return;
            }

            operation.MarkErrorAsHandled();
            Check(operation.Error, GetFaultDetails(operation.ValidationErrors));
        }
Пример #21
0
        /// <summary>
        /// If a class needs the timezones and the list is not already populated they will call the RIA method to populate the list.
        /// </summary>
        public static void GetTimeZonesCompleted(InvokeOperation<IEnumerable<string>> op)
        {
            if (op.HasError)
            {
                op.MarkErrorAsHandled();
            }
            else
            {
                TimeZones = op.Value.ToList();

                if (op.UserState != null && op.UserState is Action)
                {
                    ((Action)op.UserState)();
                }
            }
        }
Пример #22
0
        void loadResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <CanvasDto> result =
                (InvokeOperation <CanvasDto>)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }

            CanvasDto returnedData = ((InvokeOperation <CanvasDto>)sender).Value;

            _loadCompleted(returnedData, ex);
        }
Пример #23
0
        void sendEmailResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <bool> result =
                (InvokeOperation <bool>)sender;
            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }

            bool returnedData = ((InvokeOperation <bool>)sender).Value;

            _sendEmailCompleted(returnedData, ex);
        }
Пример #24
0
        void datasouceRecordCountResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <long> result = (InvokeOperation <long>)sender;

            if (result.HasError)
            {
                ex = result.Error;
                result.MarkErrorAsHandled();
            }
            //else
            //{
            long returnedData = ((InvokeOperation <long>)sender).Value;

            _recordCountCompleted(returnedData, ex);
            //}
        }
Пример #25
0
        void Results4_Completed(object sender, EventArgs e)
        {
            InvokeOperation <string> result = (InvokeOperation <string>)sender;

            if (result.HasError)
            {
                ex = result.Error;
                result.MarkErrorAsHandled();
            }
            //else
            //{
            string returnedData = ((InvokeOperation <string>)sender).Value;

            _completed4(returnedData, ex);
            //}
        }
Пример #26
0
        /// <summary>
        /// If a class needs the timezones and the list is not already populated they will call the RIA method to populate the list.
        /// </summary>
        public static void GetTimeZonesCompleted(InvokeOperation <IEnumerable <string> > op)
        {
            if (op.HasError)
            {
                op.MarkErrorAsHandled();
            }
            else
            {
                TimeZones = op.Value.ToList();

                if (op.UserState != null && op.UserState is Action)
                {
                    ((Action)op.UserState)();
                }
            }
        }
Пример #27
0
        void freqDataResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <List <FrequencyResultData> > result = (InvokeOperation <List <FrequencyResultData> >)sender;

            if (result.HasError)
            {
                ex = result.Error;
                result.MarkErrorAsHandled();
            }
            //else
            //{
            List <FrequencyResultData> returnedData = ((InvokeOperation <List <FrequencyResultData> >)sender).Value;

            _frequencyResultsCompleted(returnedData, null);
            //}
        }
Пример #28
0
        void freqColumnResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <List <EwavColumn> > result = (InvokeOperation <List <EwavColumn> >)sender;

            if (result.HasError)
            {
                ex = result.Error;
                result.MarkErrorAsHandled();
            }
            //else
            //{
            List <EwavColumn> returnedData = ((InvokeOperation <List <EwavColumn> >)sender).Value;

            _completed(returnedData, null);
            //}
        }
Пример #29
0
        void sctrCtxRegResults_Completed(object sender, EventArgs e)
        {
            InvokeOperation <LinRegressionResults> result = (InvokeOperation <LinRegressionResults>)sender;

            if (result.HasError)
            {
                ex = result.Error;
                result.MarkErrorAsHandled();
            }
            //else
            //{
            LinRegressionResults returnedData = ((InvokeOperation <LinRegressionResults>)sender).Value;

            _rresultsCompleted(returnedData, null);
            //}
        }
Пример #30
0
        void resultSet_Completed(object sender, EventArgs e)
        {
            InvokeOperation <TwoxTwoAndMxNResultsSet> result = (InvokeOperation <TwoxTwoAndMxNResultsSet>)sender;

            if (result.HasError)
            {
                ex = result.Error;
                result.MarkErrorAsHandled();
            }
            //else
            //{
            TwoxTwoAndMxNResultsSet returnedData = ((InvokeOperation <TwoxTwoAndMxNResultsSet>)sender).Value;

            _setupCompleted(returnedData, null);
            //}
        }
Пример #31
0
        void lineListResutls_Completed(object sender, EventArgs e)
        {
            InvokeOperation <List <DatatableBag> > result =
                (InvokeOperation <List <DatatableBag> >)sender;

            Exception ex = null;

            if (result.HasError)
            {
                result.MarkErrorAsHandled();
                ex = result.Error;
            }
            List <DatatableBag> returnedData = ((InvokeOperation <List <DatatableBag> >)sender).Value;

            _completed(returnedData, ex);
        }
Пример #32
0
 private void AccountSignupOperation_Completed(InvokeOperation<CreateAccountStatus> operation)
 {
     if (!operation.IsCanceled)
     {
         if (operation.HasError)
         {
             ErrorWindow.CreateNew(operation.Error);
             operation.MarkErrorAsHandled();
         }
         else if (operation.Value == CreateAccountStatus.Success)
         {
             MessageBox.Show("Success!");
         }
         else
         {
             MessageBox.Show("Failure! " + operation.Value.ToString());
         }
     }
 }
Пример #33
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)
         {
             ErrorWindow.CreateNew(operation.Error);
             operation.MarkErrorAsHandled();
         }
         else if (operation.Value == CreateUserStatus.Success)
         {
             this.DialogResult = true;
         }
         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);
         }
     }
 }
Пример #34
0
 /// <summary>
 /// Completion handler for a <see cref="LoginOperation"/>.
 /// If operation succeeds, it closes the window.
 /// If it has an error, it displays an <see cref="ErrorWindow"/> and marks the error as handled.
 /// If it was not canceled, but login failed, it must have been because credentials were incorrect so a validation error is added to notify the user.
 /// </summary>
 private void LoginOperation_Completed(InvokeOperation<bool> op)
 {
     if (op.Value)
     {
         this.parentWindow.DialogResult = true;
     }
     else if (op.HasError)
     {
         MessageBox.Show("Could not change password. Check the current password entered.");
         op.MarkErrorAsHandled();
     }
 }
Пример #35
0
        private void IsAliveComplete(InvokeOperation<bool> op)
        {
            if (op.HasError)
            {
                m_persistorStatusMessage = op.Error.Message;
                m_persistorStatus = ServiceConnectionStatesEnum.Error;
                op.MarkErrorAsHandled();
            }
            else
            {
                m_persistorStatusMessage = null;
                m_persistorStatus = ServiceConnectionStatesEnum.Ok;

            }

            m_provisioningInitialisationInProgress = false;
            UpdateAppStatus();
        }
        private void ChangeSIPDialPlanComplete(InvokeOperation io)
        {
            if (io.HasError)
            {
                LogActivityMessage_External(MessageLevelsEnum.Error, "There was an error changing the dial plan name. " + io.Error.Message);
                io.MarkErrorAsHandled();
                UIHelper.SetIsEnabled(_saveButton, true);
                UIHelper.SetIsEnabled(_dialPlanNameTextBox, IsEnabled);
            }
            else
            {
                string newName = (string)io.UserState;

                LogActivityMessage_External(MessageLevelsEnum.Info, "The dial plan name was successfully changed to " + newName + ".");

                UIHelper.SetText(_dialPlanNameTextBox, newName);
                UIHelper.SetText(m_dialPlanName, newName);
                UIHelper.SetVisibility(_dialPlanNameTextBox, System.Windows.Visibility.Collapsed);
                UIHelper.SetVisibility(m_dialPlanName, System.Windows.Visibility.Visible);
                UIHelper.SetVisibility(_changeButton, System.Windows.Visibility.Visible);
                UIHelper.SetVisibility(_saveButton, System.Windows.Visibility.Collapsed);
            }
        }
Пример #37
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 operation)
 {
     if (!operation.IsCanceled)
     {
         if (operation.HasError)
         {
             ErrorWindow.CreateNew(operation.Error);
             operation.MarkErrorAsHandled();
         }
         else
         {
             this.parentWindow.Close();
         }
     }
 }
        private void UpdateCustomerPasswordComplete(InvokeOperation io)
        {
            if (io.HasError)
            {
                UIHelper.SetText(m_statusTextBlock, io.Error.Message);
                io.MarkErrorAsHandled();
            }
            else
            {
                UIHelper.SetText(m_statusTextBlock, "Password successfully updated.");
            }

            SetUpdateButtonsEnabled(true);
        }
Пример #39
0
 private void CopyDialPlanComplete(InvokeOperation io)
 {
     if (io.HasError)
     {
         LogActivityMessage_External(MessageLevelsEnum.Error, "There was an error copying the dial plan. " + io.Error.Message);
         io.MarkErrorAsHandled();
     }
     else
     {
         LogActivityMessage_External(MessageLevelsEnum.Info, "The dial plan copy was successful.");
         m_dialPlansPanel.RefreshAsync();
     }
 }
Пример #40
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)
         {
             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);
         }
         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);
         }
     }
 }
Пример #41
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);
                }
            }
        }