guides:sample_submitterrequest_snippet
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| guides:sample_submitterrequest_snippet [2022/11/09 23:39] – created brett.zamora | guides:sample_submitterrequest_snippet [2024/01/12 19:25] (current) – brett.zamora | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| <code C#> | <code C#> | ||
| - | private void btnNewSubmitterRequest_Click(object sender, RoutedEventArgs e) | + | private void createNewSubmitterRequest() |
| { | { | ||
| - | // New Submtter Request Workflow: | + | string strNewRequestID = " |
| - | // Create New Submitter Request - Request ID is retured. | + | |
| - | // Send the MOU PDF document associated with the Request ID. | + | |
| - | // If Submitter Type is 'Other (32) send the COI PDF document associated with the Request ID. | + | |
| - | createNewSubmitterRequest(); // If successfull the tbRequestID.Text field will have the new Request ID. | + | RestClient client = null; |
| + | RestRequest request = null; | ||
| + | IRestResponse response = null; | ||
| - | sendPDFFile("MOU"); | + | string strURL = "https://" |
| - | if (tbSubmitterTypeValue.Text == " | + | // Password has to be hashed. |
| - | { | + | // New convention uses a Salt value from the user record |
| - | sendPDFFile("COI"); | + | |
| - | } | + | string strSalt = GetSalt(tbUserName.Text); |
| + | string strPassword = tbPassword.Password.ToString(); | ||
| + | |||
| + | string strHashedPassword = HashPassword(strPassword, | ||
| + | |||
| + | string strParms = " | ||
| + | strParms += tbUserName.Text; | ||
| + | strParms += " | ||
| + | strParms += strHashedPassword; | ||
| + | strParms += " | ||
| + | |||
| + | client = new RestClient(strURL); | ||
| + | request = new RestRequest(Method.POST); | ||
| + | |||
| + | request.AddHeader(" | ||
| + | request.AddHeader(" | ||
| + | |||
| + | request.AddParameter(" | ||
| + | response = client.Execute(request); | ||
| + | |||
| + | if (response.IsSuccessful) | ||
| + | { | ||
| + | var jsonResult1 = JsonConvert.DeserializeObject< | ||
| + | string token = jsonResult1.access_token; | ||
| + | |||
| + | strURL = null; | ||
| + | client = null; | ||
| + | request = null; | ||
| + | response = null; | ||
| + | |||
| + | // Note: Be sure to escape your PrimaryName, | ||
| + | |||
| + | strURL = " | ||
| + | |||
| + | if (tbRequestID.Text == "" | ||
| + | { | ||
| + | strURL = strURL + "?" | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | strURL = strURL + "?" | ||
| + | } | ||
| + | |||
| + | strURL = strURL + "&" | ||
| + | strURL = strURL + "&" | ||
| + | strURL = strURL + "&" | ||
| + | strURL = strURL + "&" | ||
| + | strURL = strURL + "&" | ||
| + | strURL = strURL + "&" | ||
| + | strURL = strURL + "&" | ||
| + | strURL = strURL + "&" | ||
| + | |||
| + | // The following 2 properties have been added since the original release of the web service | ||
| + | // If customers using the web service do not include these properties, their service call may not complete. | ||
| + | |||
| + | | ||
| + | { | ||
| + | | ||
| + | strURL = strURL + "&" | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | strURL = strURL + "&" | ||
| + | strURL = strURL + "&" | ||
| + | } | ||
| + | |||
| + | client = new RestClient(strURL); | ||
| + | request = new RestRequest(Method.POST); | ||
| + | |||
| + | request.AddHeader("Cache-Control", | ||
| + | | ||
| + | request.AddHeader(" | ||
| + | // | ||
| + | response = client.Execute(request); | ||
| + | |||
| + | if (response.IsSuccessful) | ||
| + | { | ||
| + | var jsonResult2 = JsonConvert.DeserializeObject< | ||
| + | |||
| + | strNewRequestID = jsonResult2.result; | ||
| + | tbRequestID.Text = strNewRequestID; | ||
| + | | ||
| + | } | ||
| + | |||
| + | return; | ||
| } | } | ||
| </ | </ | ||
guides/sample_submitterrequest_snippet.1668037193.txt.gz · Last modified: by brett.zamora
