/// <summary>Copies over our values from the form into an Incident object.</summary>
        /// <returns>A new RemoteIncident, or Null if error.</returns>
        private RemoteTask save_GetFromFields()
        {
            const string METHOD = CLASS + "save_GetFromFields()";

            RemoteTask retTask = null;

            try
            {
                retTask = new RemoteTask();

                //Standard fields..
                retTask.TaskId          = this._Task.TaskId;
                retTask.ProjectId       = this._Task.ProjectId;
                retTask.ConcurrencyDate = this._Task.ConcurrencyDate;
                retTask.CreationDate    = this._Task.CreationDate.ToUniversalTime();
                retTask.LastUpdateDate  = this._Task.LastUpdateDate.ToUniversalTime();
                retTask.RequirementId   = this._Task.RequirementId;
                retTask.Name            = this.cntrlTaskName.Text.Trim();
                retTask.TaskPriorityId  = ((TaskPriority)this.cntrlPriority.SelectedValue).PriorityId;
                retTask.CreatorId       = ((RemoteUser)this.cntrlDetectedBy.SelectedItem).UserId;
                retTask.OwnerId         = ((RemoteUser)this.cntrlOwnedBy.SelectedItem).UserId;
                retTask.ReleaseId       = ((RemoteRelease)this.cntrlDetectedIn.SelectedItem).ReleaseId;
                if (this._isDescChanged)
                {
                    retTask.Description = this.cntrlDescription.HTMLText;
                }
                else
                {
                    retTask.Description = this._Task.Description;
                }
                if (this.cntrlStartDate.SelectedDate.HasValue)
                {
                    retTask.StartDate = this.cntrlStartDate.SelectedDate.Value.ToUniversalTime();
                }
                if (this.cntrlEndDate.SelectedDate.HasValue)
                {
                    retTask.EndDate = this.cntrlEndDate.SelectedDate.Value.ToUniversalTime();
                }
                retTask.TaskStatusId    = ((TaskStatus)this.cntrlStatus.SelectedValue).StatusId.Value;
                retTask.EstimatedEffort = StaticFuncs.GetMinutesFromValues(this.cntrlEstEffortH.Text, this.cntrlEstEffortM.Text);
                retTask.ActualEffort    = StaticFuncs.GetMinutesFromValues(this.cntrlActEffortH.Text, this.cntrlActEffortM.Text);
                retTask.RemainingEffort = StaticFuncs.GetMinutesFromValues(this.cntrlRemEffortH.Text, this.cntrlRemEffortM.Text);

                //Custom fields..
                retTask.CustomProperties = this.cntCustomProps.GetCustomProperties();
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, "save_GetFromFields()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }

            //Return
            return(retTask);
        }
Exemplo n.º 2
0
        /// <summary>Copies over our values from the form into an Incident object.</summary>
        /// <returns>A new RemoteIncident, or Null if error.</returns>
        private RemoteRequirement save_GetFromFields()
        {
            const string METHOD = CLASS + "save_GetFromFields()";

            RemoteRequirement retRequirement = null;

            try
            {
                retRequirement = new RemoteRequirement();

                //Standard fields..
                retRequirement.ConcurrencyDate      = this._Requirement.ConcurrencyDate;
                retRequirement.CoverageCountBlocked = this._Requirement.CoverageCountBlocked;
                retRequirement.CoverageCountCaution = this._Requirement.CoverageCountCaution;
                retRequirement.CoverageCountFailed  = this._Requirement.CoverageCountFailed;
                retRequirement.CoverageCountPassed  = this._Requirement.CoverageCountPassed;
                retRequirement.CoverageCountTotal   = this._Requirement.CoverageCountTotal;
                retRequirement.CreationDate         = this._Requirement.CreationDate.ToUniversalTime();
                retRequirement.IndentLevel          = this._Requirement.IndentLevel;
                retRequirement.LastUpdateDate       = this._Requirement.LastUpdateDate.ToUniversalTime();
                retRequirement.ProjectId            = this._Requirement.ProjectId;
                retRequirement.RequirementId        = this._Requirement.RequirementId;
                retRequirement.Summary             = this._Requirement.Summary;
                retRequirement.TaskActualEffort    = this._Requirement.TaskActualEffort;
                retRequirement.TaskCount           = this._Requirement.TaskCount;
                retRequirement.TaskEstimatedEffort = this._Requirement.TaskEstimatedEffort;
                retRequirement.AuthorId            = ((RemoteUser)this.cntrlCreatedBy.SelectedItem).UserId;
                if (this._isDescChanged)
                {
                    retRequirement.Description = this.cntrlDescription.HTMLText;
                }
                else
                {
                    retRequirement.Description = this._Requirement.Description;
                }
                retRequirement.ImportanceId  = ((RequirementPriority)this.cntrlImportance.SelectedItem).PriorityId;
                retRequirement.Name          = this.cntrlName.Text.Trim();
                retRequirement.OwnerId       = ((RemoteUser)this.cntrlOwnedBy.SelectedItem).UserId;
                retRequirement.PlannedEffort = StaticFuncs.GetMinutesFromValues(this.cntrlPlnEffortH.Text, this.cntrlPlnEffortM.Text);
                retRequirement.ReleaseId     = ((RemoteRelease)this.cntrlRelease.SelectedItem).ReleaseId;
                retRequirement.StatusId      = ((RequirementStatus)this.cntrlStatus.SelectedItem).StatusId;

                //Custom Properties
                retRequirement.CustomProperties = this.cntCustomProps.GetCustomProperties();
            }
            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);
                retRequirement = null;
            }

            //Return
            return(retRequirement);
        }
        /// <summary>Copies over our values from the form into an Incident object.</summary>
        /// <returns>A new RemoteIncident, or Null if error.</returns>
        private RemoteIncident save_GetFromFields()
        {
            const string METHOD = CLASS + "save_GetFromFields()";

            RemoteIncident retIncident = null;

            try
            {
                retIncident = new RemoteIncident();

                //*Fixed fields..
                retIncident.IncidentId = this._Incident.IncidentId;
                retIncident.ProjectId  = this._Incident.ProjectId;
                if (this._Incident.CreationDate.HasValue)
                {
                    retIncident.CreationDate = this._Incident.CreationDate.Value.ToUniversalTime();
                }
                retIncident.LastUpdateDate  = this._Incident.LastUpdateDate.ToUniversalTime();
                retIncident.ConcurrencyDate = this._Incident.ConcurrencyDate;

                //*Standard fields..
                retIncident.Name              = this.cntrlIncidentName.Text.Trim();
                retIncident.IncidentTypeId    = ((RemoteIncidentType)this.cntrlType.SelectedItem).IncidentTypeId;
                retIncident.IncidentStatusId  = ((this._IncSelectedStatus.HasValue) ? this._IncSelectedStatus.Value : this._IncCurrentStatus.Value);
                retIncident.OpenerId          = ((RemoteUser)this.cntrlDetectedBy.SelectedItem).UserId;
                retIncident.OwnerId           = ((RemoteUser)this.cntrlOwnedBy.SelectedItem).UserId;
                retIncident.PriorityId        = ((RemoteIncidentPriority)this.cntrlPriority.SelectedItem).PriorityId;
                retIncident.SeverityId        = ((RemoteIncidentSeverity)this.cntrlSeverity.SelectedItem).SeverityId;
                retIncident.DetectedReleaseId = ((RemoteRelease)this.cntrlDetectedIn.SelectedItem).ReleaseId;
                retIncident.ResolvedReleaseId = ((RemoteRelease)this.cntrlResolvedIn.SelectedItem).ReleaseId;
                retIncident.VerifiedReleaseId = ((RemoteRelease)this.cntrlVerifiedIn.SelectedItem).ReleaseId;
                if (this._isDescChanged)
                {
                    retIncident.Description = this.cntrlDescription.HTMLText;
                }
                else
                {
                    retIncident.Description = this._Incident.Description;
                }

                //*Schedule fields..
                if (this.cntrlStartDate.SelectedDate.HasValue)
                {
                    retIncident.StartDate = this.cntrlStartDate.SelectedDate.Value.ToUniversalTime();
                }
                if (this.cntrlEndDate.SelectedDate.HasValue)
                {
                    retIncident.ClosedDate = this.cntrlEndDate.SelectedDate.Value.ToUniversalTime();
                }
                retIncident.EstimatedEffort = StaticFuncs.GetMinutesFromValues(this.cntrlEstEffortH.Text, this.cntrlEstEffortM.Text);
                retIncident.ActualEffort    = StaticFuncs.GetMinutesFromValues(this.cntrlActEffortH.Text, this.cntrlActEffortM.Text);
                retIncident.RemainingEffort = StaticFuncs.GetMinutesFromValues(this.cntrlRemEffortH.Text, this.cntrlRemEffortM.Text);

                //Custom Properties
                retIncident.CustomProperties = this.cntCustomProps.GetCustomProperties();
            }
            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);
                retIncident = null;
            }

            //Return
            return(retIncident);
        }