Esempio n. 1
0
            public override async Task <Unit> Handle(OMWAddAction aAction, CancellationToken aCancellationToken)
            {
                try
                {
                    await lockit.WaitAsync();

                    var rq = new W98220WC.Request();
                    rq.Set(W98220WC.Fields.OMWPRJID, aAction.Id);
                    rq.Set(W98220WC.Fields.OMWDESC, aAction.Description);
                    rq.Set(W98220WC.Fields.OMWTYP, aAction.Type);
                    rq.Set(W98220WC.Fields.OMWSV, aAction.Severity);
                    rq.Set(W98220WC.Fields.SYR, aAction.Code);
                    rq.Set(W98220WC.Fields.SRCRLS, aAction.Release);
                    rq.Ok();
                    State.OMWProjectForm = await E1.RequestAsync <W98220WC.Response>(rq);
                }
                catch (AIS.HttpWebException e)
                {
                    State.ErrorMessage = e.ErrorResponse.message ?? e.Message;
                }
                catch (Exception e)
                {
                    State.ErrorMessage = e.Message;
                }
                finally
                {
                    lockit.Release();
                }
                var handler = State.Changed;

                handler?.Invoke(State, null);

                return(Unit.Value);
            }
Esempio n. 2
0
            public override async Task <Unit> Handle(JiraIssueTransitionAction aAction, CancellationToken aCancellationToken)
            {
                try
                {
                    await lockit.WaitAsync();

                    var ndx = State.JiraIssues.FindIndex(i => i.id.Equals(aAction.IssueIdOrKey));
                    var key = State.JiraIssues[ndx].key;
                    await Jira.TransitionIssue(aAction.IssueIdOrKey, aAction.TransitionId);

                    if (!string.IsNullOrEmpty(aAction.Comment))
                    {
                        await Jira.AddComment(aAction.IssueIdOrKey, aAction.Comment.Split('\n'));
                    }
                    State.JiraIssues[ndx] = await Jira.GetIssue(aAction.IssueIdOrKey);

                    if (State.JiraIssues[ndx].fields.status.id.Equals(State.JiraTriggerOMW) &&
                        !State.OMWProjects.Contains(new F98220.Row {
                        F98220_OMWPRJID = key
                    }))
                    {
                        var rq = new W98220WC.Request();
                        rq.Set(W98220WC.Fields.OMWPRJID, key);
                        rq.Set(W98220WC.Fields.OMWDESC, State.JiraIssues[ndx].fields.summary);
                        rq.Set(W98220WC.Fields.OMWTYP, "01");
                        rq.Set(W98220WC.Fields.OMWSV, "01");
                        rq.Set(W98220WC.Fields.SYR, "55");
                        rq.Set(W98220WC.Fields.SRCRLS, "E920");
                        rq.Ok();
                        await E1.RequestAsync <W98220WC.Response>(rq);

                        var omw = await E1.RequestAsync <F98220.Response>(new F98220.Request());

                        State.OMWProjects = new List <F98220.Row>(omw.fs_DATABROWSE_F98220.data.gridData.rowset);
                    }
                }
                finally
                {
                    lockit.Release();
                }

                var handler = State.Changed;

                handler?.Invoke(State, null);

                return(Unit.Value);
            }