Regent API Code Examples
...
Further examples showing how to interact with Student, Award and Documents. This is meant as an addendum to the main document found here:
...
language | c# |
---|
title | Get Student External Id by Student Id |
---|
linenumbers | true |
---|
...
Regent Award .Net API User Guide
Note: The examples below make use of the generic 'Student Portal' username and do not use a ClientId and Token. This is because the code below is example only. In practice the SecurityToken object should use a ClientId and Token as shown in the Regent Award .Net API User Guide. These two data attributes are provided by Regent after the client request to provision the web service end point is received.
Code Block |
---|
language | c# |
---|
title | Get Student External Id by Student Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<long> GetStudentIdAsync()
{
long studentid = -1;
string externalId1 = "63650";
GetStudentsRequest getStudentsRequest = new GetStudentsRequest();
getStudentsRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// this method is special in that you can build a dynamic set of filters. Here we want to find student internal Id
getStudentsRequest.filter = new Filter
{
Filters = new List<Filter>
{
new Filter {Field = "externalId1", Operator = "eq", Value = externalId1}
}.ToArray()
};
// here you cann add the additional conditions as sorting and the number of returning rows
getStudentsRequest.sortColumn
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<long> GetStudentIdAsync()
{
long studentid = -1;
string externalId1 = "63650";
GetStudentsRequest getStudentsRequest = new GetStudentsRequest();
getStudentsRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// this method is special in that you can build a dynamic set of filters. Here we want to find student internal Id
getStudentsRequest.filter = new Filter
{
Filters = new List<Filter>
{
new Filter {Field = "externalId1", Operator = "eq", Value = externalId1}
}.ToArray()
};
// here you cann add the additional conditions as sorting and the number of returning rows
getStudentsRequest.sortColumn = null;
getStudentsRequest.sortExpression = null;
getStudentsRequest.startRowIndex = 1; // start and end row indexes are required to provide
getStudentsRequest.endRowIndex = 1;
getStudentsResponse = await client.getStudentBasicInfoListAsync(getStudentsRequest);
if (!getStudentsResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentBasicInfoListAsync", getStudentsResponse.Message));
// expect you'll get 1 and only 1 record. Adjust for your needs.
if (getStudentsResponse.Records.Length != 1)
{
throw new ApplicationException(string.Format("Expected 1 student record but found {0} records", 0));
}
studentid = getStudentsResponse.Records[0].Id;
return studentid;
} |
Code Block |
---|
language | c# |
---|
title | Get Document Name by Student External Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
async Task<string> GetStudentDocument()
{
string documentName = "";
string externalId1 = "63650";
GetStudentDocumentsLoadStudentListRequest getStudentDocumentsRequest = new GetStudentDocumentsLoadStudentListRequest();
getStudentDocumentsRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// here you cann add the different conditions as sorting and the number of returning rows
getStudentDocumentsRequest.IOProcessId = 30; // required
getStudentDocumentsRequest.sortColumn = null;
getStudentDocumentsRequest.sortType = null;
getStudentDocumentsRequest.filterCondition = "ExternalId1 = " + externalId1; // here you can provide filtering conditions
getStudentDocumentsRequest.startRowIndex = 1; // start and end row indexes are required to provide
getStudentDocumentsRequest.endRowIndex = 1;
GetStudentDocumentsLoadStudentListResponse getStudentsDocumentsResponse = await client.getStudentDocumentsLoadStudentListAsync(getStudentDocumentsRequest);
if (!getStudentsDocumentsResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentDocumentsLoadStudentListAsync", getStudentsDocumentsResponse.Message));
documentName = getStudentsDocumentsResponse.Records[0].DocumentName;
return documentName;
} |
Code Block |
---|
language | c# |
---|
title | Get Task Description by Student Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<string> GetStudentTask()
{
string taskDescription = "";
long studentId = 11313;
GetStudentTaskListRequest getStudentTaskRequest = new GetStudentTaskListRequest();
getStudentTaskRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// here you cann add the different conditions as sorting and the number of returning rows
getStudentTaskRequest.StudentId = studentId; // required
getStudentTaskRequest.sortColumn = null;
getStudentTaskRequest.sortType = null;
getStudentTaskRequest.startRowIndex = 1; // start and end row indexes are required to provide
getStudentTaskRequest.endRowIndex = 1;
GetStudentTaskListResponse getStudentsTaskResponse = await client.getStudentTaskListAsync(getStudentTaskRequest);
if (!getStudentsTaskResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentTaskListAsync", getStudentsTaskResponse.Message));
taskDescription = getStudentsTaskResponse.Records[0].Description;
return taskDescription;
} |
Code Block |
---|
language | c# |
---|
title | Get Student Activity Log Description by Student Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<string> GetStudentActivity()
{
string studentActivityDescription = "";
long studentId = 11313;
GetActivityListRequest getActivityListRequest = new GetActivityListRequest();
getActivityListRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// here you cann add the different conditions as sorting and the number of returning rows
//getActivityListRequest.filterCondition = "StudentId = " + studentId; // you can add additional filtering here
getActivityListRequest.StudentId = studentId; // required
getActivityListRequest.sortColumn = null;
getActivityListRequest.sortExpression = null;
getActivityListRequest.startRowIndex = 1; // start and end row indexes are required to provide
getActivityListRequest.endRowIndex = 1;
GetActivityListResponse getActivityListResponse = await client.getActivityListAsync(getActivityListRequest);
if (!getActivityListResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getActivityListAsync", getActivityListResponse.Message));
studentActivityDescription = getActivityListResponse.Records[0].description;
return studentActivityDescription;
} |
Code Block |
---|
language | c# |
---|
title | Get Program Name by Student Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<string> GetActiveCourseEnrollmentProgramForStudent()
{
string programName = "";
long studentId = 11313;
GetActiveCourseEnrollmentProgramForStudentRequest getActiveCourseEnrollmentProgramForStudentReques = new GetActiveCourseEnrollmentProgramForStudentRequest();
getActiveCourseEnrollmentProgramForStudentReques.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// it's the only awailable filtering condition here
getActiveCourseEnrollmentProgramForStudentReques.StudentId = studentId; // required
GetCourseEnrollmentProgramResponse getCourseEnrollmentProgramResponse = await client.getActiveCourseEnrollmentProgramForStudentAsync(getActiveCourseEnrollmentProgramForStudentReques);
if (!getCourseEnrollmentProgramResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getActiveCourseEnrollmentProgramForStudentAsync", getCourseEnrollmentProgramResponse.Message));
programName = getCourseEnrollmentProgramResponse.Record.ProgramName;
return programName;
} |
Code Block |
---|
language | c# |
---|
title | Get Course Name by Student Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<string> GetCourseDataList()
{
string courseName = "";
long studentId = 11313;
GetCourseDataListRequest getCourseDataListRequest = new GetCourseDataListRequest();
getCourseDataListRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// here you cann add the different conditions as sorting and the number of returning rows
getCourseDataListRequest.StudentId = studentId;
//getCourseDataListRequest.filterCondition = "StudentId = " + studentId; // you can add additional filtering here
getCourseDataListRequest.sortExpression = null;
getCourseDataListRequest.startRowIndex = 1; // start and end row indexes are required to provide
getCourseDataListRequest.endRowIndex = 1;
GetCourseDataListResponse getCourseDataListResponse = await client.getCourseDataListAsync(getCourseDataListRequest);
if (!getCourseDataListResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getCourseDataListAsync", getCourseDataListResponse.Message));
courseName = getCourseDataListResponse.Records[0].courseName;
return courseName;
} |
Code Block |
---|
language | c# |
---|
title | Get Accepted Amount by Amount |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<double?> GetAwards()
{
double? acceptedAmount;
int amount = 10000;
GetAwardsRequest getAwardsRequest = new GetAwardsRequest();
getAwardsRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// here you cann add the different conditions as sorting and the number of returning rows
getAwardsRequest.filterCondition = "amount > " + amount.ToString();
getAwardsRequest.FundId = 59; //required
getAwardsRequest.sortExpression = null;
getStudentsRequestgetAwardsRequest.sortExpressionsortColumn = null;
getStudentsRequestgetAwardsRequest.startRowIndex = 1; // start and end row indexes are required to provide
getStudentsRequestgetAwardsRequest.endRowIndex = 1;
GetAwardsResponse getAwardsResponse getStudentsResponse = await client.getStudentBasicInfoListAsyncgetAwardsAsync(getStudentsRequestgetAwardsRequest);
if (!getStudentsResponsegetAwardsResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentBasicInfoListAsyncgetAwardsAsync", getStudentsResponsegetAwardsResponse.Message));
// expect you'll get 1 and only 1 record. Adjust for your needs.
if (getStudentsResponsegetAwardsResponse.Records.Length != 1)
{
throw new ApplicationException(string.Format("Expected 1 student record but found {0} records", 0));
}
studentidacceptedAmount = getStudentsResponsegetAwardsResponse.Records[0].IdacceptedAmount;
return studentidacceptedAmount;
} |
Code Block |
---|
language | c# |
---|
title | Get Document Name by Student External IdDocuments by Status Code |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<string>Task<GetStudentDocumentsLoadStudentListResponse> GetStudentDocumentGetStudentDocumentsByStatusCode(string statusCode)
{
string documentName
= "";
string externalId1 = "63650";
GetStudentDocumentsLoadStudentListRequest getStudentDocumentsRequest = new GetStudentDocumentsLoadStudentListRequest();
getStudentDocumentsRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// here you cann add the different conditions as sorting and the number of returning rows
getStudentDocumentsRequest.IOProcessId = 30; // required
getStudentDocumentsRequest.sortColumn = null;
getStudentDocumentsRequest.sortType = null;
getStudentDocumentsRequest.filterCondition = "ExternalId1DocumentStatus = '" + externalId1 statusCode + "'"; // here you can provide filtering conditions
getStudentDocumentsRequest.startRowIndex = 1; // start and end row indexes are required to provide
getStudentDocumentsRequest.endRowIndex = 110;
GetStudentDocumentsLoadStudentListResponse getStudentsDocumentsResponse = await client.getStudentDocumentsLoadStudentListAsync(getStudentDocumentsRequest);
if (!getStudentsDocumentsResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentDocumentsLoadStudentListAsync", getStudentsDocumentsResponse.Message));
return documentName = getStudentsDocumentsResponse.Records[0].DocumentName;
return documentName;
} |
Code Block |
---|
language | c# |
---|
title | Get Task Description by Student Sum of Disbursements by Award Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<string>Task<double?> GetStudentTaskGetDisbursementAmountForAward()
{
stringdouble amount;
taskDescription = "";
long studentIdawardId = 11313283;
GetStudentTaskListRequestGetAwardDisbursementsRequest getStudentTaskRequestgetAwardDisbursementsRequest = new GetStudentTaskListRequestGetAwardDisbursementsRequest();
getStudentTaskRequestgetAwardDisbursementsRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// here you cann add the different conditions as sorting and the number of returning rows
getStudentTaskRequest.StudentIdgetAwardDisbursementsRequest.filterCondition = "awardId = studentId;" //+ requiredawardId;
getStudentTaskRequestgetAwardDisbursementsRequest.sortColumnsortExpression = null;
getStudentTaskRequestgetAwardDisbursementsRequest.sortTypesortColumn = null;
getStudentTaskRequestgetAwardDisbursementsRequest.startRowIndex = 1; // start and end row indexes are required to provide
getStudentTaskRequestgetAwardDisbursementsRequest.endRowIndex = 1100;
GetStudentTaskListResponseGetAwardDisbursementsResponse getStudentsTaskResponsegetAwardDisbursementsResponse = await client.getStudentTaskListAsyncgetAwardDisbursementsAsync(getStudentTaskRequestgetAwardDisbursementsRequest);
if (!getStudentsTaskResponsegetAwardDisbursementsResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentTaskListAsyncgetAwardsAsync", getStudentsTaskResponsegetAwardDisbursementsResponse.Message));
taskDescription = getStudentsTaskResponse.Records[0].Description;
return taskDescription;
} |
Code Block |
---|
language | c# |
---|
title | Get Student Activity Log Description by Student Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Genericamount = getAwardDisbursementsResponse.Records.AsEnumerable().Select(x => x.amount).Sum();
return amount;
} |
Code Block |
---|
language | c# |
---|
title | Create Document File Attachment |
---|
linenumbers | true |
---|
|
/* IMPORTANT!
** For using this example you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/
using System;
using System.Data;
using System.LinqIO;
using System.Threading.TasksYourServiceReferenceHere;
usingnamespace YourServiceReferenceHere;ConsoleApp2
{
public SecurityToken GetAuth() {class Program
SecurityToken securityToken{
= new SecurityToken() { public static SecurityToken GetAuth()
Username = "Student Portal", {
UserId = -2, SecurityToken securityToken = new SecurityToken()
DashboardAdmin = true }; {
return securityToken; } public async Task<string> GetStudentActivity() { string studentActivityDescriptionUsername = "Student Portal";,
long studentId = 11313; GetActivityListRequest getActivityListRequestUserId = new GetActivityListRequest();-2,
getActivityListRequest.SecurityToken = GetAuth(); RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();DashboardAdmin = true
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc"); // here you};
cann
add the different conditions as sorting and the number of returning rows return securityToken;
//getActivityListRequest.filterCondition = "StudentId = " + studentId;}
// you can add additional filtering here static void getActivityListRequest.StudentId = studentId; // requiredMain(string[] args)
getActivityListRequest.sortColumn{
= null; getActivityListRequest.sortExpression = null; string getActivityListRequest.startRowIndexfilePath = 1"C:\\Users\\katie.macpherson\\Downloads\\test.txt";
// start and end row indexes are required to provide int getActivityListRequest.endRowIndexdocumentRequirementId = 1123456;
GetActivityListResponse getActivityListResponse = await client.getActivityListAsync(getActivityListRequest); int studentId = 4996;
if (!getActivityListResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getActivityListAsync", getActivityListResponse.Message)CreateDocumentFileAttachment(documentRequirementId, filePath, mimeType, studentId);
}
studentActivityDescription = getActivityListResponse.Records[0].description; return studentActivityDescription;
} |
Code Block |
---|
language | c# |
---|
title | Get Program Name by Student Id |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{
SecurityToken securityTokenstatic void CreateDocumentFileAttachment(int documentRequirementId, string filePath, string mimeType, int studentId)
{
using (var client = new SecurityTokenRegentEnterpriseServiceClient())
{ {
Username = "Student Portal",
UserId = -2, var file = new FileInfo(filePath);
DashboardAdmin = true }; return securityToken; } var publicrecord async= Task<string>new GetActiveCourseEnrollmentProgramForStudentDocumentRequirementFileAttachment()
{ string programName = ""; long{
studentId = 11313; GetActiveCourseEnrollmentProgramForStudentRequest getActiveCourseEnrollmentProgramForStudentReques = new GetActiveCourseEnrollmentProgramForStudentRequest(); getActiveCourseEnrollmentProgramForStudentReques.SecurityToken = GetAuth(); DocumentRequirementId = documentRequirementId,
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc"); // it'sDocumentRequirementIdSpecified the= onlytrue,
awailable filtering condition here getActiveCourseEnrollmentProgramForStudentReques.StudentId = studentId; // required GetCourseEnrollmentProgramResponse getCourseEnrollmentProgramResponseFileName = await client.getActiveCourseEnrollmentProgramForStudentAsync(getActiveCourseEnrollmentProgramForStudentReques);file.Name,
if (!getCourseEnrollmentProgramResponse.Success) throw new ApplicationException(string.Format("Error calling {0}:{1}", "getActiveCourseEnrollmentProgramForStudentAsync", getCourseEnrollmentProgramResponse.Message)); FileSize = file.Length,
programName = getCourseEnrollmentProgramResponse.Record.ProgramName; return programName; } |
Code Block |
---|
language | c# |
---|
title | Get Course Name by Student Id |
---|
linenumbers | true |
---|
|
using System; using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{ FileSizeSpecified = true,
SecurityToken securityToken = new SecurityToken() MimeType = mimeType, { Username = "Student Portal",
UserId = -2, DashboardAdmin = true };StoredFile = File.ReadAllBytes(file.FullName), return securityToken; } public async Task<string> GetCourseDataList() { string courseName = ""; long studentId = 11313; GetCourseDataListRequest getCourseDataListRequest = new GetCourseDataListRequest();
getCourseDataListRequest.SecurityToken = GetAuth(); RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient(); client.Endpoint.AddressisFileExists = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc"); false,
// here you cann add the different conditions as sorting andisFileExistsSpecified the= numbertrue,
of returning rows getCourseDataListRequest.StudentId = studentId; //getCourseDataListRequest.filterCondition = "StudentId = " + studentId;CreatedOn // you can add additional filtering here= DateTime.Now,
getCourseDataListRequest.sortExpression = null; getCourseDataListRequest.startRowIndex = 1; // startCreatedOnSpecified and= endtrue,
row indexes are required to provide getCourseDataListRequest.endRowIndex = 1; GetCourseDataListResponse getCourseDataListResponseModifiedOn = await client.getCourseDataListAsync(getCourseDataListRequest);DateTime.Now,
if (!getCourseDataListResponse.Success) throw new ApplicationException(string.Format("Error calling {0}:{1}", "getCourseDataListAsync", getCourseDataListResponse.Message)); ModifiedOnSpecified = true, courseName = getCourseDataListResponse.Records[0].courseName;
return courseName;
} |
Code Block |
---|
language | c# |
---|
title | Get Accepted Amount by Amount |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{ };
SecurityTokenvar securityTokencreateDocumentAttachmentRequest = new UpdateDocumentRequirementFileAttachmentRequest
SecurityToken() { Username = "Student{
Portal", UserId = -2, DashboardAdminRecord = record,
true }; return securityToken; } public async Task<double?> GetAwards()
{
StudentId = studentId,
double? acceptedAmount; int amount = 10000; GetAwardsRequest getAwardsRequestStudentIdSpecified = new GetAwardsRequest();true,
getAwardsRequest.SecurityToken = GetAuth(); RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient(); SecurityToken client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");GetAuth(),
// here you cann add the different};
conditions as sorting and the number of returning rows getAwardsRequest.filterCondition = "amount >var "response += amountclient.ToStringcreateDocumentRequirementFileAttachment(createDocumentAttachmentRequest);
getAwardsRequest.FundId = 59; //required getAwardsRequest.sortExpression = null; if (response.ErrorYN)
getAwardsRequest.sortColumn = null; getAwardsRequest.startRowIndex = 1; // start and end row{
indexes are required to provide getAwardsRequest.endRowIndex = 1; GetAwardsResponse getAwardsResponse =throw awaitnew client.getAwardsAsync(getAwardsRequestException(response.Message);
if (!getAwardsResponse.Success) }
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getAwardsAsync", getAwardsResponse.Message)); }
// expect you'll get 1 and}
only 1 record. Adjust for your needs.
if (getAwardsResponse.Records.Length != 1)
{
throw new ApplicationException(string.Format("Expected 1 student record but found {0} records", 0));
}
acceptedAmount = getAwardsResponse.Records[0].acceptedAmount;
return acceptedAmount;
} |
Code Block |
---|
language | c# |
---|
title | Get Documents by Status Code |
---|
linenumbers | true |
---|
|
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using YourServiceReferenceHere;
public SecurityToken GetAuth()
{ }
} |
Code Block |
---|
language | c# |
---|
title | Update Document File Attachment |
---|
linenumbers | true |
---|
|
/* IMPORTANT!
** For using this example you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/
using System;
using System.Data;
using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{
class Program
{
public static SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{ {
Username = "Student Portal", UserIdUsername = -2 "Student Portal",
DashboardAdmin = true }; UserId = -2,
return securityToken; } public async Task<GetStudentDocumentsLoadStudentListResponse> GetStudentDocumentsByStatusCode(string statusCode) { DashboardAdmin = true
GetStudentDocumentsLoadStudentListRequest getStudentDocumentsRequest = new GetStudentDocumentsLoadStudentListRequest(); getStudentDocumentsRequest.SecurityToken = GetAuth() };
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");return securityToken;
// here you}
cann add the different conditions as sorting and thestatic number of returning rowsvoid Main(string[] args)
getStudentDocumentsRequest.IOProcessId = 30; //{
required getStudentDocumentsRequest.sortColumn = null; getStudentDocumentsRequest.sortTypeint documentRequirementFileAttachmentId= null/*ID here*/;
getStudentDocumentsRequest.filterCondition = "DocumentStatus = '" + statusCode +UpdateDocumentFileAttachment(documentRequirementFileAttachmentId, "'test comment"); // hereYou you can provideupdate filteringonly conditionsa comment
getStudentDocumentsRequest.startRowIndex = 1; // start and end row}
indexes are required to provide static getStudentDocumentsRequest.endRowIndex = 10;
void UpdateDocumentFileAttachment(int documentRequirementFileAttachmentId, string comment)
GetStudentDocumentsLoadStudentListResponse getStudentsDocumentsResponse = await client.getStudentDocumentsLoadStudentListAsync(getStudentDocumentsRequest); {
if (!getStudentsDocumentsResponse.Success) using (var client throw= new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentDocumentsLoadStudentListAsync", getStudentsDocumentsResponse.Message));RegentEnterpriseServiceClient())
{
return getStudentsDocumentsResponse; } |
Code Block |
---|
language | c# |
---|
title | Get Sum of Disbursements by Award Id |
---|
linenumbers | true |
---|
|
using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Threading.Tasks; using YourServiceReferenceHere; var record public= SecurityTokennew GetAuthDocumentRequirementFileAttachment()
{ SecurityToken securityToken = new SecurityToken() {
Username = "Student Portal", UserIdId = -2,documentRequirementFileAttachmentId,
DashboardAdmin IdSpecified = true,
}; return securityToken; }Comments = publiccomment,
async Task<double?> GetDisbursementAmountForAward() { double amount; long awardIdModifiedBy = 283;-168,
GetAwardDisbursementsRequest getAwardDisbursementsRequest = new GetAwardDisbursementsRequest(); getAwardDisbursementsRequest.SecurityToken = GetAuth(); RegentEnterpriseServiceClientModifiedBySpecified client= =true,
new RegentEnterpriseServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc"); // here you cann add theModifiedOn different conditions as sorting and the number of returning rows= DateTime.Now,
getAwardDisbursementsRequest.filterCondition = "awardId = " + awardId; ModifiedOnSpecified = true
getAwardDisbursementsRequest.sortExpression = null; getAwardDisbursementsRequest.sortColumn = null; getAwardDisbursementsRequest.startRowIndex = 1};
// start and end row indexes are required to provide var getAwardDisbursementsRequest.endRowIndexupdateDocumentAttachmentRequest = new 100;UpdateDocumentRequirementFileAttachmentRequest
GetAwardDisbursementsResponse getAwardDisbursementsResponse = await client.getAwardDisbursementsAsync(getAwardDisbursementsRequest); if (!getAwardDisbursementsResponse.Success){
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getAwardsAsync", getAwardDisbursementsResponse.Message)); Record = record,
amount = getAwardDisbursementsResponse.Records.AsEnumerable().Select(x => x.amount).Sum(); return amount; } |
Code Block |
---|
language | c# |
---|
title | Create Document File Attachment |
---|
linenumbers | true |
---|
|
/* IMPORTANT! ** For using this exampleSecurityToken you= needGetAuth()
to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/ using System;
using System.Data;
using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{
class Program};
var response = client.updateDocumentRequirementFileAttachment(updateDocumentAttachmentRequest);
{ public static SecurityTokenif GetAuth(response.ErrorYN)
{ {
SecurityToken securityToken = new SecurityToken() throw {
new Exception(response.Message);
Username =}
"Student Portal", }
UserId = -2, }
}
} |
Code Block |
---|
language | c# |
---|
title | Delete Document File Attachment |
---|
linenumbers | true |
---|
|
/* IMPORTANT!
** For using this example you need to uncheck the "Allow generation DashboardAdminof =asynchronous trueoperation" option in advanced Service Reference settings*/
using }System;
using System.Data;
using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{
return securityToken;class Program
{
} public static voidSecurityToken MainGetAuth(string[] args)
{
stringSecurityToken filePathsecurityToken = /*File path here*/;new SecurityToken()
{
int documentRequirementId = /*ID here*/; string mimeTypeUsername = "text/plain";//Example
CreateDocumentFileAttachment(documentRequirementId, filePath, mimeType);
Student Portal",
} UserId static= void CreateDocumentFileAttachment(int documentRequirementId, string filePath, string mimeType)-2,
{ DashboardAdmin = true
using (var client = new RegentEnterpriseServiceClient())};
{return securityToken;
}
var file =static newvoid FileInfo(filePath);Main(string[] args)
{
var recordint documentRequirementFileAttachmentId= new DocumentRequirementFileAttachment() /*ID here*/;
DeleteDocumentFileAttachment(documentRequirementFileAttachmentId);
{ }
static void DeleteDocumentFileAttachment(int documentRequirementFileAttachmentId)
DocumentRequirementId = documentRequirementId,{
using (var client = new RegentEnterpriseServiceClient())
DocumentRequirementIdSpecified = true, {
FileName = file.Name, var record = new DocumentRequirementFileAttachment()
FileSize = file.Length,{
FileSizeSpecifiedId = truedocumentRequirementFileAttachmentId,
MimeTypeIdSpecified = mimeTypetrue,
StoredFileNameDeletedBy = $"{Guid.NewGuid()}.{Path.GetExtension(filePath)}"168,
StoredFileDeletedBySpecified = File.ReadAllBytes(file.FullName)true,
CreatedByDeletedOn = -168DateTime.Now,
CreatedBySpecifiedDeletedOnSpecified = true,
isFileExistsDocumentRequirementId = false104128,
isFileExistsSpecifiedDocumentRequirementIdSpecified = true,
CreatedOn = DateTime.Now,
};
var CreatedOnSpecifieddeleteDocumentAttachmentRequest = true,new UpdateDocumentRequirementFileAttachmentRequest
{
ModifiedOn = DateTime.Now, Record = record,
ModifiedOnSpecified = true, SecurityToken = GetAuth()
ModifiedBy = -168, };
ModifiedBySpecified = true, var response = client.deleteDocumentRequirementFileAttachment(deleteDocumentAttachmentRequest);
}; if (response.ErrorYN)
var createDocumentAttachmentRequest = new UpdateDocumentRequirementFileAttachmentRequest {
{ throw new Exception(response.Message);
Record = record, }
}
SecurityToken = GetAuth(), }
}
} |
Code Block |
---|
language | c# |
---|
title | Get Login List |
---|
linenumbers | true |
---|
|
/* IMPORTANT!
** For using this example you need to uncheck };the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/
using System;
using System.Data;
var response = client.createDocumentRequirementFileAttachment(createDocumentAttachmentRequest)using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{
class Program
{
if (response.ErrorYN) public static SecurityToken GetAuth()
{
SecurityToken securityToken throw = new ExceptionSecurityToken(response.Message);
} {
} } } } |
Code Block |
---|
language | c# |
---|
title | Update Document File Attachment |
---|
linenumbers | true |
---|
|
/* IMPORTANT! ** ForUsername using= this example you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/
using System;
using System.Data;
using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{"Student Portal",
UserId = -2,
class Program DashboardAdmin = true
{ public static SecurityToken GetAuth()};
{ return securityToken;
SecurityToken securityToken =}
new SecurityToken() static void Main(string[] args)
{ {
Username = "Student Portal",
DataTable loginList = new DataTable();
UserIdloginList = -2,GetLoginList();
}
DashboardAdmin =static trueDataTable GetLoginList()
{
}; DataTable login = return securityTokennew DataTable();
} login.Columns.Add("LoginId", typeof(long));
static void Main(string[] args) {
login.Columns.Add("Username", typeof(string));
int documentRequirementFileAttachmentId= /*ID here*/ login.Columns.Add("Email", typeof(string));
UpdateDocumentFileAttachment(documentRequirementFileAttachmentId, "test comment"login.Columns.Add("FirstName", typeof(string));
// You can update only a comment login.Columns.Add("LastName", typeof(string));
} static void UpdateDocumentFileAttachment(int documentRequirementFileAttachmentId, string comment)
{ login.Columns.Add("IsActive", typeof(bool));
using (var client = new RegentEnterpriseServiceClient())
{
var recordgetLoginListRequest = new DocumentRequirementFileAttachmentGetLoginListRequest()
{
IdstartRowIndex = documentRequirementFileAttachmentId0,
IdSpecifiedstartRowIndexSpecified = true,
CommentsendRowIndex = comment100000,
ModifiedByendRowIndexSpecified = -168true,
ModifiedBySpecifiedSecurityToken = true,GetAuth()
};
ModifiedOnvar records = DateTime.Now,client.getLoginList(getLoginListRequest).Records;
foreach(var record in records)
{
ModifiedOnSpecified = true DataRow row = };login.NewRow();
var updateDocumentAttachmentRequest row["LoginId"] = newrecord.LoginId;
UpdateDocumentRequirementFileAttachmentRequest { row["Username"] = record.Username;
Record = record, row["Email"] = record.Email;
SecurityToken = GetAuth() row["FirstName"] = record.FirstName;
}; row["LastName"] = record.LastName;
var response = client.updateDocumentRequirementFileAttachment(updateDocumentAttachmentRequest); row["IsActive"] = record.IsActive;
if (response.ErrorYN) {login.Rows.Add(row);
}
throw new Exception(response.Message); }
} return login;
}
}
}
} |
Code Block |
---|
language | c# |
---|
title | Delete Document File AttachmentCreate DocumentRequirement by StudentId |
---|
linenumbers | true |
---|
|
/* IMPORTANT!
** For using this example you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/
using System;
using System.Data;
using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{
class Program
{
public static SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
,
return securityToken; } UserId = -2,
static void Main(string[] args) {DashboardAdmin = true
int documentRequirementFileAttachmentId= /*ID here*/; };
return DeleteDocumentFileAttachment(documentRequirementFileAttachmentId)securityToken;
}
static void DeleteDocumentFileAttachmentMain(intstring[] documentRequirementFileAttachmentIdargs)
{
using (var client = new RegentEnterpriseServiceClient())CreateStudentDocumentRequirement(/*documentId*/, /*studentId*/);
}
{ static void CreateStudentDocumentRequirement(Int64 documentId, var record = new DocumentRequirementFileAttachment()
Int64 studentId)
{
{ using (var client = new RegentEnterpriseServiceClient())
Id = documentRequirementFileAttachmentId, {
var record IdSpecified = true,new DocumentRequirement()
{
DeletedBy = 168, // All fields below are DeletedBySpecifiedrequired
= true, documentId DeletedOn = DateTime.NowdocumentId,
DeletedOnSpecifieddocumentIdSpecified = true,
DocumentRequirementIdstudentId = 104128studentId,
DocumentRequirementIdSpecifiedstudentIdSpecified = true,
}; ActivitySourceTypeCode = "SYSTEMACTION",
var deleteDocumentAttachmentRequest = new UpdateDocumentRequirementFileAttachmentRequest ActivityLogEntryTypeCode = "QARelated",
{ Record = recordcreatedDate = DateTime.Now,
SecurityToken = GetAuth()
createdDateSpecified = true,
}; CreatedBy = 1,
var response = client.deleteDocumentRequirementFileAttachment(deleteDocumentAttachmentRequest); CreatedBySpecified = true,
if (response.ErrorYN) reviewedDate {= DateTime.UtcNow,
throw new Exception(response.Message);
reviewedDateSpecified = true,
} receivedDate = DateTime.UtcNow,
} } } } |
Code Block |
---|
language | c# |
---|
title | Get Login List |
---|
linenumbers | true |
---|
|
/* IMPORTANT! ** For usingreceivedDateSpecified this= exampletrue,
you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/ using System; using System.Data;
using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{EditLockTimestamp = DateTime.UtcNow,
class Program { EditLockTimestampSpecified = true,
public static SecurityToken GetAuth() { Files = new DocumentRequirementFileAttachment[] { }
SecurityToken securityToken = new SecurityToken() };
{ var UsernamecreateDRReques = "Student Portal",new UpdateDocumentRequirementRequest
UserId{
= -2, DashboardAdmin = trueRecord = record,
}; SecurityToken = GetAuth()
return securityToken; } };
static void Main(string[] args) { var response = client.createDocumentRequirement(createDRReques);
DataTable loginList = new DataTable(); if (response.ErrorYN)
loginList = GetLoginList(); {
} static DataTable GetLoginList() throw {new Exception(response.Message);
DataTable login = new DataTable();}
login.Columns.Add("LoginId", typeof(long));}
}
login.Columns.Add("Username", typeof(string));
login.Columns.Add("Email", typeof(string));
login.Columns.Add("FirstName", typeof(string));
login.Columns.Add("LastName", typeof(string));
}
} |
Code Block |
---|
language | c# |
---|
title | Download Document Requirement File Attachment (using documentRequirementFileAttachmentId) |
---|
linenumbers | true |
---|
|
/* IMPORTANT!
** For using this example you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/
using System;
using System.Data;
using System.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{
class Program
{
public login.Columns.Add("IsActive", typeof(bool));static SecurityToken GetAuth()
{
using (varSecurityToken clientsecurityToken = new RegentEnterpriseServiceClientSecurityToken())
{
varUsername getLoginListRequest = new GetLoginListRequest()"Student Portal",
{UserId = -2,
DashboardAdmin = startRowIndextrue
= 0, };
startRowIndexSpecified = true, return securityToken;
}
endRowIndexstatic = 100000,
void Main(string[] args)
{
endRowIndexSpecified = true,
GetFileFromDocumentRequirementFileAttachmentById(/*documentRequirementIdFileAttachmentId*/, /*Target folder path*/);
}
static void GetFileFromDocumentRequirementFileAttachmentById(int documentRequirementIdFileAttachmentId, string targetFolder)
SecurityToken = GetAuth() {
}; using (var client = new RegentEnterpriseServiceClient())
var records = client.getLoginList(getLoginListRequest).Records; {
var foreach(varrequest record= innew records)GetDocumentRequirementFileAttachmentRequest
{
DataRow rowSecurityToken = login.NewRowGetAuth();,
row["LoginId"]Id = record.LoginId;documentRequirementIdFileAttachmentId,
row["Username"] = record.Username;
IdSpecified = true,
row["Email"] = record.Email};
var row["FirstName"] = record.FirstNamerecord = client.getDocumentRequirementFileAttachment(request).Record;
row["LastName"] = record.LastName; if (record.StoredFile.Length > 0)
row["IsActive"] = record.IsActive; {
login.Rows.Add(row); File.WriteAllBytes(Path.Combine(targetFolder, record.FileName), record.StoredFile);
} }
return login;}
}
}
} |