Skip to content

Commit 3d826ff

Browse files
committed
fixed comments and issues
1 parent e1fb299 commit 3d826ff

File tree

6 files changed

+88
-93
lines changed

6 files changed

+88
-93
lines changed

launcher-csharp/Common/IRequestItemsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public interface IRequestItemsService
3636

3737
public string WorkflowId { get; set; }
3838

39-
public bool WorkflowPublished { get; set; }
39+
public bool IsWorkflowPublished { get; set; }
4040

4141
public string InstanceId { get; set; }
4242

launcher-csharp/Common/RequestItemsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public string WorkflowId
154154
set => this.cache.Set(this.GetKey("WorkflowId"), value);
155155
}
156156

157-
public bool WorkflowPublished
157+
public bool IsWorkflowPublished
158158
{
159159
get => this.cache.Get<bool>(this.GetKey("WorkflowPublished"));
160160
set => this.cache.Set(this.GetKey("WorkflowPublished"), value);

launcher-csharp/Maestro/Controllers/CancelWorkflow.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public CancelWorkflow(
2929
: base(config, launcherTexts, requestItemsService)
3030
{
3131
this.configuration = configuration;
32-
CodeExampleText = GetExampleText(EgName, ExamplesApiType.Maestro);
33-
ViewBag.title = CodeExampleText.ExampleName;
32+
this.CodeExampleText = this.GetExampleText(this.EgName, ExamplesApiType.Maestro);
33+
this.ViewBag.title = this.CodeExampleText.ExampleName;
3434
}
3535

3636
public override string EgName => "mae002";
@@ -42,35 +42,35 @@ public override IActionResult Get()
4242
try
4343
{
4444
var actionResult = base.Get();
45-
if (RequestItemsService.EgName == EgName)
45+
if (this.RequestItemsService.EgName == this.EgName)
4646
{
4747
return actionResult;
4848
}
4949

50-
var accessToken = RequestItemsService.User.AccessToken;
51-
var accountId = RequestItemsService.Session.AccountId;
52-
var docuSignClient = new DocuSignClient(RequestItemsService.Session.MaestroManageApiBasePath);
50+
var accessToken = this.RequestItemsService.User.AccessToken;
51+
var accountId = this.RequestItemsService.Session.AccountId;
52+
var docuSignClient = new DocuSignClient(this.RequestItemsService.Session.MaestroManageApiBasePath);
5353
docuSignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
5454
bool isInProgressStatus = false;
55-
if(RequestItemsService.InstanceId != null)
55+
if (this.RequestItemsService.InstanceId != null)
5656
{
57-
var instance = GetWorkflowService.GetWorkFlowInstance(docuSignClient, accountId, RequestItemsService.WorkflowId, RequestItemsService.InstanceId);
57+
var instance = GetWorkflowService.GetWorkFlowInstance(docuSignClient, accountId, this.RequestItemsService.WorkflowId, this.RequestItemsService.InstanceId);
5858
isInProgressStatus = instance.InstanceState == WorkflowInstance.WorkflowInstanceState.InProgress;
5959
}
6060

61-
ViewBag.WorkflowId = RequestItemsService.WorkflowId;
62-
ViewBag.InstanceId = RequestItemsService.InstanceId;
63-
ViewBag.IsInProgressStatus = isInProgressStatus;
61+
this.ViewBag.WorkflowId = this.RequestItemsService.WorkflowId;
62+
this.ViewBag.InstanceId = this.RequestItemsService.InstanceId;
63+
this.ViewBag.IsInProgressStatus = isInProgressStatus;
6464

65-
return View("mae002");
65+
return this.View("mae002");
6666
}
6767
catch (ApiException apiException)
6868
{
69-
ViewBag.errorCode = apiException.ErrorCode;
70-
ViewBag.errorMessage = apiException.Message;
71-
ViewBag.SupportingTexts = LauncherTexts.ManifestStructure.SupportingTexts;
69+
this.ViewBag.errorCode = apiException.ErrorCode;
70+
this.ViewBag.errorMessage = apiException.Message;
71+
this.ViewBag.SupportingTexts = this.LauncherTexts.ManifestStructure.SupportingTexts;
7272

73-
return View("Error");
73+
return this.View("Error");
7474
}
7575
}
7676

@@ -82,25 +82,25 @@ public ActionResult CancelFlow()
8282
{
8383
try
8484
{
85-
var accessToken = RequestItemsService.User.AccessToken;
86-
var accountId = RequestItemsService.Session.AccountId;
87-
var docuSignClient = new DocuSignClient(RequestItemsService.Session.MaestroManageApiBasePath);
85+
var accessToken = this.RequestItemsService.User.AccessToken;
86+
var accountId = this.RequestItemsService.Session.AccountId;
87+
var docuSignClient = new DocuSignClient(this.RequestItemsService.Session.MaestroManageApiBasePath);
8888
docuSignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
89-
var result = CancelWorkflowService.CancelWorkflow(docuSignClient, accountId, RequestItemsService.InstanceId);
89+
var result = CancelWorkflowService.CancelWorkflow(docuSignClient, accountId, this.RequestItemsService.InstanceId);
9090

91-
ViewBag.h1 = CodeExampleText.ExampleName;
92-
ViewBag.message = string.Format(CodeExampleText.ResultsPageText, RequestItemsService.InstanceId);
93-
ViewBag.Locals.Json = JsonConvert.SerializeObject(result, Formatting.Indented);
91+
this.ViewBag.h1 = this.CodeExampleText.ExampleName;
92+
this.ViewBag.message = string.Format(this.CodeExampleText.ResultsPageText, this.RequestItemsService.InstanceId);
93+
this.ViewBag.Locals.Json = JsonConvert.SerializeObject(result, Formatting.Indented);
9494

95-
return View("example_done");
95+
return this.View("example_done");
9696
}
9797
catch (ApiException apiException)
9898
{
99-
ViewBag.errorCode = apiException.ErrorCode;
100-
ViewBag.errorMessage = apiException.Message;
101-
ViewBag.SupportingTexts = LauncherTexts.ManifestStructure.SupportingTexts;
99+
this.ViewBag.errorCode = apiException.ErrorCode;
100+
this.ViewBag.errorMessage = apiException.Message;
101+
this.ViewBag.SupportingTexts = this.LauncherTexts.ManifestStructure.SupportingTexts;
102102

103-
return View("Error");
103+
return this.View("Error");
104104
}
105105
}
106106
}

launcher-csharp/Maestro/Controllers/GetWorkflow.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public GetWorkflow(
3030
: base(config, launcherTexts, requestItemsService)
3131
{
3232
this.configuration = configuration;
33-
CodeExampleText = GetExampleText(EgName, ExamplesApiType.Maestro);
34-
ViewBag.title = CodeExampleText.ExampleName;
33+
this.CodeExampleText = this.GetExampleText(this.EgName, ExamplesApiType.Maestro);
34+
this.ViewBag.title = this.CodeExampleText.ExampleName;
3535
}
3636

3737
public override string EgName => "mae003";
@@ -43,23 +43,23 @@ public override IActionResult Get()
4343
try
4444
{
4545
var actionResult = base.Get();
46-
if (RequestItemsService.EgName == EgName)
46+
if (this.RequestItemsService.EgName == this.EgName)
4747
{
4848
return actionResult;
4949
}
5050

51-
ViewBag.WorkflowId = RequestItemsService.WorkflowId;
52-
ViewBag.InstanceId = RequestItemsService.InstanceId;
51+
this.ViewBag.WorkflowId = this.RequestItemsService.WorkflowId;
52+
this.ViewBag.InstanceId = this.RequestItemsService.InstanceId;
5353

54-
return View("mae003");
54+
return this.View("mae003");
5555
}
5656
catch (ApiException apiException)
5757
{
58-
ViewBag.errorCode = apiException.ErrorCode;
59-
ViewBag.errorMessage = apiException.Message;
60-
ViewBag.SupportingTexts = LauncherTexts.ManifestStructure.SupportingTexts;
58+
this.ViewBag.errorCode = apiException.ErrorCode;
59+
this.ViewBag.errorMessage = apiException.Message;
60+
this.ViewBag.SupportingTexts = this.LauncherTexts.ManifestStructure.SupportingTexts;
6161

62-
return View("Error");
62+
return this.View("Error");
6363
}
6464
}
6565

@@ -71,25 +71,25 @@ public ActionResult GetFlow()
7171
{
7272
try
7373
{
74-
var accessToken = RequestItemsService.User.AccessToken;
75-
var accountId = RequestItemsService.Session.AccountId;
76-
var docuSignClient = new DocuSignClient(RequestItemsService.Session.MaestroManageApiBasePath);
74+
var accessToken = this.RequestItemsService.User.AccessToken;
75+
var accountId = this.RequestItemsService.Session.AccountId;
76+
var docuSignClient = new DocuSignClient(this.RequestItemsService.Session.MaestroManageApiBasePath);
7777
docuSignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
78-
var result = GetWorkflowService.GetWorkFlowInstance(docuSignClient, accountId, RequestItemsService.WorkflowId, RequestItemsService.InstanceId);
78+
var result = GetWorkflowService.GetWorkFlowInstance(docuSignClient, accountId, this.RequestItemsService.WorkflowId, this.RequestItemsService.InstanceId);
7979

80-
ViewBag.h1 = CodeExampleText.ExampleName;
81-
ViewBag.message = string.Format(CodeExampleText.ResultsPageText, result.InstanceState);
82-
ViewBag.Locals.Json = JsonConvert.SerializeObject(result, Formatting.Indented);
80+
this.ViewBag.h1 = this.CodeExampleText.ExampleName;
81+
this.ViewBag.message = string.Format(this.CodeExampleText.ResultsPageText, result.InstanceState);
82+
this.ViewBag.Locals.Json = JsonConvert.SerializeObject(result, Formatting.Indented);
8383

84-
return View("example_done");
84+
return this.View("example_done");
8585
}
8686
catch (ApiException apiException)
8787
{
88-
ViewBag.errorCode = apiException.ErrorCode;
89-
ViewBag.errorMessage = apiException.Message;
90-
ViewBag.SupportingTexts = LauncherTexts.ManifestStructure.SupportingTexts;
88+
this.ViewBag.errorCode = apiException.ErrorCode;
89+
this.ViewBag.errorMessage = apiException.Message;
90+
this.ViewBag.SupportingTexts = this.LauncherTexts.ManifestStructure.SupportingTexts;
9191

92-
return View("Error");
92+
return this.View("Error");
9393
}
9494
}
9595
}

launcher-csharp/Maestro/Controllers/TriggerWorkflow.cs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public TriggerWorkflow(
3030
: base(config, launcherTexts, requestItemsService)
3131
{
3232
this.configuration = configuration;
33-
CodeExampleText = GetExampleText(EgName, ExamplesApiType.Maestro);
34-
ViewBag.title = CodeExampleText.ExampleName;
33+
this.CodeExampleText = this.GetExampleText(this.EgName, ExamplesApiType.Maestro);
34+
this.ViewBag.title = this.CodeExampleText.ExampleName;
3535
}
3636

3737
public override string EgName => "mae001";
@@ -43,35 +43,35 @@ public override IActionResult Get()
4343
try
4444
{
4545
var actionResult = base.Get();
46-
if (RequestItemsService.EgName == EgName)
46+
if (this.RequestItemsService.EgName == this.EgName)
4747
{
4848
return actionResult;
4949
}
5050

51-
RequestItemsService.WorkflowId = configuration["DocuSign:WorkflowId"];
52-
var accessToken = RequestItemsService.User.AccessToken;
53-
var accountId = RequestItemsService.Session.AccountId;
51+
this.RequestItemsService.WorkflowId = this.configuration["DocuSign:WorkflowId"];
52+
var accessToken = this.RequestItemsService.User.AccessToken;
53+
var accountId = this.RequestItemsService.Session.AccountId;
5454

55-
if (!RequestItemsService.WorkflowPublished)
55+
if (!this.RequestItemsService.IsWorkflowPublished)
5656
{
57-
var docuSignClient = new DocuSignClient(RequestItemsService.Session.MaestroManageApiBasePath);
57+
var docuSignClient = new DocuSignClient(this.RequestItemsService.Session.MaestroManageApiBasePath);
5858
docuSignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
59-
TriggerWorkflowService.PublishWorkFlow(docuSignClient, accountId, RequestItemsService.WorkflowId);
60-
RequestItemsService.WorkflowPublished = true;
59+
TriggerWorkflowService.PublishWorkFlow(docuSignClient, accountId, this.RequestItemsService.WorkflowId);
60+
this.RequestItemsService.IsWorkflowPublished = true;
6161
}
6262

63-
ViewBag.Config = Config;
63+
this.ViewBag.Config = this.Config;
6464
var workflowTriggerModel = new WorkflowTriggerModel();
6565

66-
return View("mae001", workflowTriggerModel);
66+
return this.View("mae001", workflowTriggerModel);
6767
}
6868
catch (ApiException apiException)
6969
{
70-
ViewBag.errorCode = apiException.ErrorCode;
71-
ViewBag.errorMessage = apiException.Message;
72-
ViewBag.SupportingTexts = LauncherTexts.ManifestStructure.SupportingTexts;
70+
this.ViewBag.errorCode = apiException.ErrorCode;
71+
this.ViewBag.errorMessage = apiException.Message;
72+
this.ViewBag.SupportingTexts = this.LauncherTexts.ManifestStructure.SupportingTexts;
7373

74-
return View("Error");
74+
return this.View("Error");
7575
}
7676
}
7777

@@ -83,31 +83,31 @@ public ActionResult SubmitForm(WorkflowTriggerModel model)
8383
{
8484
try
8585
{
86-
var accessToken = RequestItemsService.User.AccessToken;
87-
var accountId = RequestItemsService.Session.AccountId;
88-
var docuSignManageClient = new DocuSignClient(RequestItemsService.Session.MaestroManageApiBasePath);
86+
var accessToken = this.RequestItemsService.User.AccessToken;
87+
var accountId = this.RequestItemsService.Session.AccountId;
88+
var docuSignManageClient = new DocuSignClient(this.RequestItemsService.Session.MaestroManageApiBasePath);
8989
docuSignManageClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
90-
var workflow = TriggerWorkflowService.GetWorkFlowDefinition(docuSignManageClient, accountId, RequestItemsService.WorkflowId);
90+
var workflow = TriggerWorkflowService.GetWorkFlowDefinition(docuSignManageClient, accountId, this.RequestItemsService.WorkflowId);
9191

92-
var docuSignAuthClient = new DocuSignClient(RequestItemsService.Session.MaestroAuthApiBasePath);
92+
var docuSignAuthClient = new DocuSignClient(this.RequestItemsService.Session.MaestroAuthApiBasePath);
9393
docuSignAuthClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
9494
var result = TriggerWorkflowService.TriggerWorkflow(docuSignAuthClient, accountId, new Uri(workflow.TriggerUrl), model);
9595

96-
RequestItemsService.InstanceId = result.InstanceId;
96+
this.RequestItemsService.InstanceId = result.InstanceId;
9797

98-
ViewBag.h1 = CodeExampleText.ExampleName;
99-
ViewBag.message = CodeExampleText.ResultsPageText;
100-
ViewBag.Locals.Json = JsonConvert.SerializeObject(result, Formatting.Indented);
98+
this.ViewBag.h1 = this.CodeExampleText.ExampleName;
99+
this.ViewBag.message = this.CodeExampleText.ResultsPageText;
100+
this.ViewBag.Locals.Json = JsonConvert.SerializeObject(result, Formatting.Indented);
101101

102-
return View("example_done");
102+
return this.View("example_done");
103103
}
104104
catch (ApiException apiException)
105105
{
106-
ViewBag.errorCode = apiException.ErrorCode;
107-
ViewBag.errorMessage = apiException.Message;
108-
ViewBag.SupportingTexts = LauncherTexts.ManifestStructure.SupportingTexts;
106+
this.ViewBag.errorCode = apiException.ErrorCode;
107+
this.ViewBag.errorMessage = apiException.Message;
108+
this.ViewBag.SupportingTexts = this.LauncherTexts.ManifestStructure.SupportingTexts;
109109

110-
return View("Error");
110+
return this.View("Error");
111111
}
112112
}
113113
}

launcher-csharp/Maestro/Examples/TriggerWorkflowService.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace DocuSign.WebForms.Examples
1111
using System;
1212
using System.Collections.Generic;
1313
using System.Linq;
14+
using System.Web;
15+
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
1416

1517
public static class TriggerWorkflowService
1618
{
@@ -42,24 +44,17 @@ public static TriggerWorkflowViaPostResponse TriggerWorkflow(DocuSignClient docu
4244
signerEmail = model.SignerEmail,
4345
signerName = model.SignerName,
4446
ccEmail = model.CCEmail,
45-
ccName = model.CCName
46-
}
47+
ccName = model.CCName,
48+
},
4749
};
4850

49-
var uriParameters = ExtractUriParameters(triggerUrl);
51+
var uriParameters = HttpUtility.ParseQueryString(triggerUrl.Query);
5052
var options = new WorkflowTriggerApi.TriggerWorkflowOptions
5153
{
5254
mtid = uriParameters["mtid"],
53-
mtsec = uriParameters["mtsec"]
55+
mtsec = uriParameters["mtsec"],
5456
};
5557
return maestroApi.TriggerWorkflow(accountId, payload, options);
5658
}
57-
58-
private static Dictionary<string,string> ExtractUriParameters(Uri triggerUrl)
59-
{
60-
var query = triggerUrl.Query.Replace("?", "");
61-
return query.Split('&').Select(q => q.Split('='))
62-
.ToDictionary(k => k[0], v => v[1]);
63-
}
6459
}
6560
}

0 commit comments

Comments
 (0)