Ejemplo n.º 1
0
        public void CancelUpdateActivity()
        {
            if (SelectedActivity != null && SelectedActivity.IsDirty)
            {
                SelectedActivity.RejectChanges();
            }

            DetailsDialogEnabled = false;
        }
        private void RefreshExtractDropDown()
        {
            this.activityMembersToolStripMenuItem.DropDown = GetExtractableMembers(SelectedActivity, OnExtractItemClicked, true, true);
            this.activityMembersToolStripMenuItem.Text     = SelectedActivity.GetType().Name;
            this.workflowMembersToolStripMenuItem.DropDown = GetExtractableMembers(RootActivity, OnExtractItemClicked, true, false);
            //Only display both activity and workflow members if this is not the root activity; otherwise only display the activity members
            this.workflowMembersToolStripMenuItem.Visible = (SelectedActivity != RootActivity);

            ActivityTrackPoint trackPoint = profileManager.GetTrackPointForActivity(SelectedActivity);

            if (trackPoint != null)
            {
                foreach (TrackingExtract te in trackPoint.Extracts)
                {
                    if (this.extractDropDown.DropDownItems.ContainsKey(te.Member))
                    {
                        ((ToolStripButton)this.extractDropDown.DropDownItems[te.Member]).Checked = true;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void UpdateActivity()
        {
            try
            {
                if (_appEnvironment.ServiceConnector == null)
                {
                    throw new NullReferenceException($"Null reference of { nameof(_appEnvironment.ServiceConnector) }");
                }

                if (SelectedActivity != null)
                {
                    var activityToUpdate = new ActivityDto()
                    {
                        Id               = SelectedActivity.Id,
                        ProfileId        = SelectedActivity.ProfileId,
                        IsStarted        = SelectedActivity.IsStarted,
                        BeginTime        = (Int64)DateTimeHelpers.ConvertToUnixTimestamp(SelectedActivity.BeginTime.ToUniversalTime()),
                        CreatedAt        = (Int64)DateTimeHelpers.ConvertToUnixTimestamp(SelectedActivity.CreatedAt.ToUniversalTime()),
                        PlannedBeginTime = (Int64)DateTimeHelpers.ConvertToUnixTimestamp(SelectedActivity.PlannedBeginTime.ToUniversalTime()),
                        Description      = SelectedActivity.Description,
                        Category         = SelectedActivity.Category,
                        ActualDuration   = SelectedActivity.DurationSeconds,
                    };

                    foreach (var interval in SelectedActivity.WorkIntervals)
                    {
                        activityToUpdate.WorkIntervals.Add(new WorkIntervalDto()
                        {
                            Begin = (Int64)DateTimeHelpers.ConvertToUnixTimestamp(interval.Begin.ToUniversalTime()),
                            End   = (Int64)DateTimeHelpers.ConvertToUnixTimestamp(interval.End.ToUniversalTime())
                        });
                    }

                    var response = _appEnvironment.ServiceConnector.Post <ActivityDto, SuccessMsgDto, ErrorMsgDto>(new Request <ActivityDto>
                    {
                        AuthToken   = new KeyValuePair <string, string>("session_token", SessionStorage.Instance.SessionId),
                        UrlSegments = new Dictionary <string, string>()
                        {
                            { "id", SelectedActivity.Id }
                        },
                        Body   = activityToUpdate,
                        OpName = OperationType.UpdateActvity
                    });

                    if (response.SuccessBody != null)
                    {
                    }
                }
            }
            catch (ApplicationException e)
            {
                Logger.Log.Debug(e.Message);
            }
            catch (Exception e)
            {
                Logger.Log.Debug(e.Message);
            }
            finally
            {
                if (SelectedActivity != null && SelectedActivity.IsDirty)
                {
                    SelectedActivity.AcceptChanges();
                }

                DetailsDialogEnabled = false;
            }
        }
        private void RefreshToolStrip()
        {
            if (SelectedActivity == null)
            {
                this.toolStrip1.Enabled = false;
                return;
            }

            this.toolStrip1.Enabled        = true;
            trackButton.Visible            = true;
            workflowEventsDropDown.Visible = false;
            trackButton.Checked            = profileManager.IsTracked(SelectedActivity);
            matchDerivedTypes.Checked      = profileManager.MatchesDerivedTypes(selectedActivityValue);
            conditionsDropDown.Visible     = matchDerivedTypes.Visible = eventsSeparator.Visible = eventsDropDown.Visible = annotateButton.Visible = extractDropDown.Visible = trackButton.Checked;

            conditionMemberDropDown.DropDown      = GetExtractableMembers(SelectedActivity, OnConditionMemberClicked, false);
            conditionMemberDropDown.DropDown.Text = "Choose member...";

            trackButton.Text = SelectedActivity == null ? "Track" : string.Format("Track {0}", SelectedActivity.GetType().Name);

            if (SelectedActivity == RootActivity)
            {
                workflowEventsDropDown.Visible = true;
                RefreshWorkflowEvents();
            }
        }