Exemple #1
0
        /// <summary>Hit when we're authenticated to the server.</summary>
        /// <param name="sender">ImportExportClient</param>
        /// <param name="e">Connection_Authenticate2CompletedEventArgs</param>
        private void clientSave_Connection_Authenticate2Completed(object sender, Connection_Authenticate2CompletedEventArgs e)
        {
            const string METHOD = CLASS + "clientSave_Connection_Authenticate2Completed()";

            Logger.LogTrace_EnterMethod(METHOD + "  " + this._clientNumSaving.ToString() + " clients running.");

            try
            {
                ImportExportClient client = (sender as ImportExportClient);
                this._clientNumSaving--;
                this.barSavingReq.Value++;

                if (!e.Cancelled)
                {
                    if (e.Error == null)
                    {
                        if (e.Result)
                        {
                            //Connect to the progect ID.
                            this._clientNumSaving++;
                            client.Connection_ConnectToProjectAsync(((SpiraProject)this._ArtifactDetails.ArtifactParentProject.ArtifactTag).ProjectID, this._clientNum++);
                        }
                        else
                        {
                            //TODO: Show Error.
                            //Cancel calls.
                            this._clientNumSaving++;
                            client.Connection_DisconnectAsync(this._clientNum++);
                        }
                    }
                    else
                    {
                        //TODO: Show Error.
                        //Cancel calls.
                        this._clientNumSaving++;
                        client.Connection_DisconnectAsync(this._clientNum++);
                    }
                }

                //See if it's okay to reload.
                this.save_CheckIfOkayToLoad();
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, METHOD);
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Logger.LogTrace_ExitMethod(METHOD + "  " + this._clientNumSaving.ToString() + " clients left.");
        }
Exemple #2
0
        /// <summary>Hit when we're finished adding a resolution.</summary>
        /// <param name="sender">ImportExportClient</param>
        /// <param name="e">Incident_AddResolutionsCompletedEventArgs</param>
        private void clientSave_Requirement_CreateCommentCompleted(object sender, Requirement_CreateCommentCompletedEventArgs e)
        {
            const string METHOD = CLASS + "clientSave_Requirement_CreateCommentCompleted()";

            Logger.LogTrace_EnterMethod(METHOD + "  " + this._clientNumSaving.ToString() + " clients running.");

            try
            {
                ImportExportClient client = (sender as ImportExportClient);
                this._clientNumSaving--;
                this.barSavingReq.Value++;

                if (!e.Cancelled)
                {
                    if (e.Error != null)
                    {
                        //Log message.
                        Logger.LogMessage(e.Error, "Adding Comment to Requirement");
                        //Display error that the item saved, but adding the new resolution didn't.
                        MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_AddCommentErrorMessage"), StaticFuncs.getCultureResource.GetString("app_General_UpdateError"), MessageBoxButton.OK, MessageBoxImage.Error);
                    }

                    //Regardless of what happens, we're disconnecting here.
                    this._clientNumSaving++;
                    client.Connection_DisconnectAsync(this._clientNum++);
                }

                //See if it's okay to reload.
                this.save_CheckIfOkayToLoad();
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, METHOD);
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }

            Logger.LogTrace(METHOD + "  " + this._clientNumSaving.ToString() + " clients left.");
        }
Exemple #3
0
        /// <summary>Hit when we're finished connecting to the project.</summary>
        /// <param name="sender">ImportExportClient</param>
        /// <param name="e">Connection_ConnectToProjectCompletedEventArgs</param>
        private void clientSave_Connection_ConnectToProjectCompleted(object sender, Connection_ConnectToProjectCompletedEventArgs e)
        {
            const string METHOD = CLASS + "clientSave_Connection_ConnectToProjectCompleted()";

            Logger.LogTrace_EnterMethod(METHOD + "  " + this._clientNumSaving.ToString() + " clients running.");

            try
            {
                ImportExportClient client = (sender as ImportExportClient);
                this._clientNumSaving--;
                this.barSavingReq.Value++;

                if (!e.Cancelled)
                {
                    if (e.Error == null)
                    {
                        if (e.Result)
                        {
                            //Get the new RemoteIncident
                            RemoteRequirement newRequirement = this.save_GetFromFields();

                            if (newRequirement != null)
                            {
                                //Fire off our update calls.
                                this._clientNumSaving++;
                                client.Requirement_UpdateAsync(newRequirement, this._clientNum++);
                            }
                            else
                            {
                                //TODO: Show Error.
                                //Cancel calls.
                                this._clientNumSaving++;
                                client.Connection_DisconnectAsync(this._clientNum++);
                            }
                        }
                        else
                        {
                            //TODO: Show Error.
                            //Cancel calls.
                            this._clientNumSaving++;
                            client.Connection_DisconnectAsync(this._clientNum++);
                        }
                    }
                    else
                    {
                        //TODO: Show Error.
                        //Cancel calls.
                        this._clientNumSaving++;
                        client.Connection_DisconnectAsync(this._clientNum++);
                    }
                }

                //See if it's okay to reload.
                this.save_CheckIfOkayToLoad();
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, METHOD);
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Logger.LogTrace_ExitMethod(METHOD + "  " + this._clientNumSaving.ToString() + " clients left.");
        }
Exemple #4
0
        /// <summary>Hit when we're finished updating the main information.</summary>
        /// <param name="sender">ImportExportClient</param>
        /// <param name="e">AsyncCompletedEventArgs</param>
        private void clientSave_Requirement_UpdateCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            const string METHOD = CLASS + "clientSave_Requirement_UpdateCompleted()";

            Logger.LogTrace_EnterMethod(METHOD + "  " + this._clientNumSaving.ToString() + " running.");
            try
            {
                ImportExportClient client = (sender as ImportExportClient);
                this._clientNumSaving--;
                this.barSavingReq.Value++;

                if (!e.Cancelled)
                {
                    if (e.Error == null)
                    {
                        //See if we need to add a resolution.
                        if (this._isResChanged)
                        {
                            //We need to save a resolution.
                            RemoteComment newRes = new RemoteComment();
                            newRes.CreationDate = DateTime.Now.ToUniversalTime();
                            newRes.UserId       = ((SpiraProject)this._ArtifactDetails.ArtifactParentProject.ArtifactTag).UserID;
                            newRes.ArtifactId   = this._ArtifactDetails.ArtifactId;
                            newRes.Text         = this.cntrlResolution.HTMLText;

                            this._clientNumSaving++;
                            client.Requirement_CreateCommentAsync(newRes, this._clientNum++);
                        }
                        else
                        {
                            //We're finished.
                            this.barSavingReq.Value++;
                            this._clientNumSaving++;
                            client.Connection_DisconnectAsync(this._clientNum++);
                        }
                    }
                    else
                    {
                        //Log error.
                        Logger.LogMessage(e.Error, "Saving Incident Changes to Database");

                        //If we get a concurrency error, get the current data.
                        if (e.Error is FaultException <ServiceFaultMessage> && ((FaultException <ServiceFaultMessage>)e.Error).Detail.Type == "DataAccessConcurrencyException")
                        {
                            client.Requirement_RetrieveByIdCompleted += new EventHandler <Requirement_RetrieveByIdCompletedEventArgs>(client_Requirement_RetrieveByIdCompleted);

                            //Fire it off.
                            this._clientNumSaving++;
                            client.Requirement_RetrieveByIdAsync(this._ArtifactDetails.ArtifactId, this._clientNum++);
                        }
                        else
                        {
                            //Display the error screen here.

                            //Cancel calls.
                            this._clientNumSaving++;
                            client.Connection_DisconnectAsync(this._clientNum++);
                        }
                    }
                }

                //See if it's okay to reload.
                this.save_CheckIfOkayToLoad();
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, METHOD);
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
            Logger.LogTrace_ExitMethod(METHOD + "  " + this._clientNumSaving.ToString() + " clients left.");
        }