Regent API Code Examples
Further examples showing how to interact with Student, Award and Documents. Student, Award and Documents. This is meant as an addendum to the main document found here: 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;
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;
getAwardsRequest.sortColumn = null;
getAwardsRequest.startRowIndex = 1; // start and end row indexes are required to provide
getAwardsRequest.endRowIndex = 1;
GetAwardsResponse getAwardsResponse = await client.getAwardsAsync(getAwardsRequest);
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()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
DashboardAdmin = true
};
return securityToken;
}
public async Task<GetStudentDocumentsLoadStudentListResponse> GetStudentDocumentsByStatusCode(string statusCode)
{
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 = "DocumentStatus = '" + statusCode + "'"; // here you can provide filtering conditions
getStudentDocumentsRequest.startRowIndex = 1; // start and end row indexes are required to provide
getStudentDocumentsRequest.endRowIndex = 10;
GetStudentDocumentsLoadStudentListResponse getStudentsDocumentsResponse = await client.getStudentDocumentsLoadStudentListAsync(getStudentDocumentsRequest);
if (!getStudentsDocumentsResponse.Success)
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentDocumentsLoadStudentListAsync", getStudentsDocumentsResponse.Message));
return getStudentsDocumentsResponse;
} |
Code Block |
---|
language | c# |
---|
title | Get Student External Id 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<long> GetStudentIdAsync()
{
long studentid = -1;
string externalId1 = "63650";
GetStudentsRequest getStudentsRequest = new GetStudentsRequest();
getStudentsRequest.SecurityToken = GetAuth();
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();
}
public async Task<double?> GetDisbursementAmountForAward()
{
double amount;
long awardId = 283;
GetAwardDisbursementsRequest getAwardDisbursementsRequest = new GetAwardDisbursementsRequest();
getAwardDisbursementsRequest.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
getAwardDisbursementsRequest.filterCondition = "awardId = " + awardId;
getAwardDisbursementsRequest.sortExpression = null;
clientgetAwardDisbursementsRequest.Endpoint.AddresssortColumn = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");null;
getAwardDisbursementsRequest.startRowIndex = 1; // thisstart methodand isend specialrow inindexes thatare yourequired canto buildprovide
a dynamic set of filtersgetAwardDisbursementsRequest.endRowIndex Here= we100;
want
to
find student internal Id GetAwardDisbursementsResponse getAwardDisbursementsResponse = await getStudentsRequest.filter = new Filter
client.getAwardDisbursementsAsync(getAwardDisbursementsRequest);
{ if (!getAwardDisbursementsResponse.Success)
Filters = new List<Filter>throw new ApplicationException(string.Format("Error calling {0}:{1}", "getAwardsAsync", getAwardDisbursementsResponse.Message));
{
amount = getAwardDisbursementsResponse.Records.AsEnumerable().Select(x => 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;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.IO;
using YourServiceReferenceHere;
namespace ConsoleApp2
{
class Program
{
public static SecurityToken GetAuth()
{
SecurityToken getStudentsResponsesecurityToken = awaitnew client.getStudentBasicInfoListAsyncSecurityToken(getStudentsRequest);
if (!getStudentsResponse.Success) {
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentBasicInfoListAsync", getStudentsResponse.Message)); Username = // expect you'll get 1 and only 1 record. Adjust for your needs."Student Portal",
if (getStudentsResponse.Records.Length != 1) UserId = -2,
{ throwDashboardAdmin new ApplicationException(string.Format("Expected 1 student record but found {0} records", 0));= true
};
studentid = getStudentsResponse.Records[0].Id; return studentidsecurityToken;
} |
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()
{
}
static void Main(string[] args)
SecurityToken securityToken = new{
SecurityToken() { string filePath Username = "Student Portal","C:\\Users\\katie.macpherson\\Downloads\\test.txt";
int UserIddocumentRequirementId = -2, 123456;
int DashboardAdminstudentId = true 4996;
}; CreateDocumentFileAttachment(documentRequirementId, filePath, returnmimeType, securityTokenstudentId);
}
async Task<string> GetStudentDocument() { }
string documentName = ""; static void CreateDocumentFileAttachment(int documentRequirementId, string externalId1filePath, = "63650";
string mimeType, int studentId)
GetStudentDocumentsLoadStudentListRequest getStudentDocumentsRequest = new GetStudentDocumentsLoadStudentListRequest(); {
getStudentDocumentsRequest.SecurityToken = GetAuth(); RegentEnterpriseServiceClient client = newusing RegentEnterpriseServiceClient();
client.Endpoint.Addressvar client = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");
// here you cann add the different conditions as sorting and the number of returning rowsRegentEnterpriseServiceClient())
{
getStudentDocumentsRequest.IOProcessId = 30; // required var getStudentDocumentsRequest.sortColumnfile = nullnew FileInfo(filePath);
getStudentDocumentsRequest.sortType = null;
getStudentDocumentsRequest.filterCondition = "ExternalId1 = " + externalId1; // here youvar canrecord provide= filteringnew conditionsDocumentRequirementFileAttachment()
getStudentDocumentsRequest.startRowIndex = 1; // start and end row indexes are required to provide{
getStudentDocumentsRequest.endRowIndex = 1; GetStudentDocumentsLoadStudentListResponse getStudentsDocumentsResponse = await client.getStudentDocumentsLoadStudentListAsync(getStudentDocumentsRequest); DocumentRequirementId = documentRequirementId,
if (!getStudentsDocumentsResponse.Success) throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentDocumentsLoadStudentListAsync", getStudentsDocumentsResponse.Message)); DocumentRequirementIdSpecified = true,
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;FileName = file.Name,
public SecurityToken GetAuth() { SecurityToken securityToken = new SecurityToken() FileSize = {file.Length,
Username = "Student Portal", UserIdFileSizeSpecified = -2true,
DashboardAdmin = true }; MimeType = mimeType, return securityToken; } public async Task<string> GetStudentTask() { string taskDescription = "";
long studentId = 11313; GetStudentTaskListRequest getStudentTaskRequest = new GetStudentTaskListRequest(); getStudentTaskRequest.SecurityTokenStoredFile = GetAuth();File.ReadAllBytes(file.FullName), 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.sortTypeisFileExists = null;false,
getStudentTaskRequest.startRowIndex = 1; // start and end row indexes are required to provide getStudentTaskRequest.endRowIndexisFileExistsSpecified = 1;true,
GetStudentTaskListResponse getStudentsTaskResponse = await client.getStudentTaskListAsync(getStudentTaskRequest); if (!getStudentsTaskResponse.Success) CreatedOn = DateTime.Now,
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentTaskListAsync", getStudentsTaskResponse.Message)); taskDescriptionCreatedOnSpecified = getStudentsTaskResponse.Records[0].Description; true,
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()
{ ModifiedOn = DateTime.Now,
SecurityToken securityToken = new SecurityToken() { ModifiedOnSpecified = true, Username = "Student Portal", UserId =
-2, DashboardAdmin = true };
return securityToken;
} public async Task<string>var GetStudentActivity()createDocumentAttachmentRequest {= new UpdateDocumentRequirementFileAttachmentRequest
string studentActivityDescription = ""; long studentId = 11313; {
GetActivityListRequest getActivityListRequest = new GetActivityListRequest(); getActivityListRequest.SecurityToken = GetAuth(); RegentEnterpriseServiceClient clientRecord = new RegentEnterpriseServiceClient();record,
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc"); // here you cann add theStudentId different= conditionsstudentId,
as sorting and the number of returning rows //getActivityListRequest.filterCondition = "StudentId = " + studentId; // youStudentIdSpecified can= addtrue,
additional filtering here getActivityListRequest.StudentId = studentId; // required getActivityListRequest.sortColumn = null; SecurityToken = getActivityListRequest.sortExpression = null;GetAuth(),
getActivityListRequest.startRowIndex = 1; // start and end row indexes are};
required to provide getActivityListRequest.endRowIndex = 1; GetActivityListResponsevar getActivityListResponseresponse = await client.getActivityListAsynccreateDocumentRequirementFileAttachment(getActivityListRequestcreateDocumentAttachmentRequest);
if (!getActivityListResponse.Success) throw new ApplicationException(string.Format("Error calling {0}:{1}", "getActivityListAsync", getActivityListResponse.Message)); if (response.ErrorYN)
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; publicthrow SecurityTokennew GetAuthException(response.Message);
{ 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) }
} |
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",
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getActiveCourseEnrollmentProgramForStudentAsync", getCourseEnrollmentProgramResponse.Message)); UserId = -2,
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()
{ DashboardAdmin = true
};
SecurityToken securityToken = new SecurityToken() return {securityToken;
Username}
= "Student Portal", static void UserId = -2,Main(string[] args)
{
DashboardAdmin = true }; int documentRequirementFileAttachmentId= return securityToken/*ID here*/;
}
public async Task<string> GetCourseDataList() { string courseName =UpdateDocumentFileAttachment(documentRequirementFileAttachmentId, "test comment"); // You long studentId = 11313;
can update only a comment
GetCourseDataListRequest getCourseDataListRequest = new GetCourseDataListRequest(); }
getCourseDataListRequest.SecurityToken = GetAuth(); static RegentEnterpriseServiceClientvoid client = new RegentEnterpriseServiceClient();UpdateDocumentFileAttachment(int documentRequirementFileAttachmentId, string comment)
client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc"); {
// here you cann add the different conditions as sortingusing and(var theclient number= of returning rowsnew RegentEnterpriseServiceClient())
getCourseDataListRequest.StudentId = studentId; //getCourseDataListRequest.filterCondition{
= "StudentId = " + studentId; // you can add additional filtering here var getCourseDataListRequest.sortExpressionrecord = null;new DocumentRequirementFileAttachment()
getCourseDataListRequest.startRowIndex = 1; // start and end row indexes are required to provide{
getCourseDataListRequest.endRowIndex = 1; GetCourseDataListResponse getCourseDataListResponse = await client.getCourseDataListAsync(getCourseDataListRequest); Id = documentRequirementFileAttachmentId,
if (!getCourseDataListResponse.Success) throw new ApplicationException(string.Format("Error calling {0}:{1}", "getCourseDataListAsync", getCourseDataListResponse.Message)); IdSpecified = 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;Comments = comment,
public SecurityToken GetAuth() { SecurityToken securityToken = new SecurityToken() ModifiedBy = {-168,
Username = "Student Portal", UserIdModifiedBySpecified = -2true,
DashboardAdmin = true }; ModifiedOn return securityToken;
}= DateTime.Now,
public async Task<double?> GetAwards() { double? acceptedAmount; int amountModifiedOnSpecified = true
10000; GetAwardsRequest getAwardsRequest = new GetAwardsRequest(); getAwardsRequest.SecurityToken = GetAuth()};
RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient(); client.Endpoint.Address =var new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc");updateDocumentAttachmentRequest = new UpdateDocumentRequirementFileAttachmentRequest
// here you cann add the different conditions as sorting and{
the number of returning rows getAwardsRequest.filterCondition = "amount > " + amount.ToString(); getAwardsRequest.FundIdRecord = 59; //required record,
getAwardsRequest.sortExpression = null; getAwardsRequest.sortColumnSecurityToken = null; GetAuth()
getAwardsRequest.startRowIndex = 1; // start and end row indexes are};
required to provide getAwardsRequest.endRowIndex = 1; GetAwardsResponsevar getAwardsResponseresponse = await client.getAwardsAsyncupdateDocumentRequirementFileAttachment(getAwardsRequestupdateDocumentAttachmentRequest);
if (!getAwardsResponse.Success) throw newif ApplicationException(string.Format("Error calling {0}:{1}", "getAwardsAsync", getAwardsResponse.Message));response.ErrorYN)
// expect you'll get 1 and{
only 1 record. Adjust for your needs. if (getAwardsResponse.Records.Length != 1) { throw new Exception(response.Message);
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 CodeDelete Document File Attachment |
---|
linenumbers | true |
---|
| using System; |
/* IMPORTANT!
** For using this example you need to uncheck the "Allow generation of asynchronous operation" option in advanced Service Reference settings*/
using System.Collections.Generic;
using System.Data;
using System.LinqIO;
using System.Threading.Tasks;
using YourServiceReferenceHere;YourServiceReferenceHere;
namespace ConsoleApp2
{
class Program
{
public static SecurityToken GetAuth()
{
SecurityToken securityToken = new SecurityToken()
{
Username = "Student Portal",
UserId = -2,
UserId = -2, DashboardAdmin = true
}; return securityToken};
}
public async Task<GetStudentDocumentsLoadStudentListResponse> GetStudentDocumentsByStatusCode(string statusCode) { return securityToken;
GetStudentDocumentsLoadStudentListRequest getStudentDocumentsRequest = new GetStudentDocumentsLoadStudentListRequest(); }
getStudentDocumentsRequest.SecurityToken = GetAuth(); static void RegentEnterpriseServiceClient client = new RegentEnterpriseServiceClient();Main(string[] args)
client.Endpoint.Address ={
new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc"); // here you cann add theint different conditions as sorting and the number of returning rowsdocumentRequirementFileAttachmentId= /*ID here*/;
getStudentDocumentsRequest.IOProcessId = 30DeleteDocumentFileAttachment(documentRequirementFileAttachmentId);
//
required getStudentDocumentsRequest.sortColumn = null; }
getStudentDocumentsRequest.sortType = null; static getStudentDocumentsRequest.filterCondition = "DocumentStatus = '" + statusCode + "'"; // here you can provide filtering conditionsvoid DeleteDocumentFileAttachment(int documentRequirementFileAttachmentId)
{
getStudentDocumentsRequest.startRowIndex = 1; //using start(var andclient end= row indexes are required to providenew RegentEnterpriseServiceClient())
getStudentDocumentsRequest.endRowIndex = 10; {
GetStudentDocumentsLoadStudentListResponse getStudentsDocumentsResponse = await client.getStudentDocumentsLoadStudentListAsync(getStudentDocumentsRequest); if (!getStudentsDocumentsResponse.Success) var record = new DocumentRequirementFileAttachment()
throw new ApplicationException(string.Format("Error calling {0}:{1}", "getStudentDocumentsLoadStudentListAsync", getStudentsDocumentsResponse.Message)); {
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; public SecurityToken GetAuth() {Id = documentRequirementFileAttachmentId,
SecurityToken securityToken = new SecurityToken() { UsernameIdSpecified = "Student Portal",true,
UserId = -2, DashboardAdminDeletedBy = true168,
}; return securityToken; } public async Task<double?> GetDisbursementAmountForAward() { DeletedBySpecified = true,
double amount; long awardId = 283; GetAwardDisbursementsRequest getAwardDisbursementsRequestDeletedOn = new GetAwardDisbursementsRequest();DateTime.Now,
getAwardDisbursementsRequest.SecurityToken = GetAuth(); RegentEnterpriseServiceClient clientDeletedOnSpecified = true,
new RegentEnterpriseServiceClient(); client.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://regentremwsqa9.regenteducation.local/RegentEnterpriseWebService.svc"); // here youDocumentRequirementId cann= add104128,
the different conditions as sorting and the number of returning rows getAwardDisbursementsRequest.filterCondition = "awardId = " +DocumentRequirementIdSpecified awardId;= true,
getAwardDisbursementsRequest.sortExpression = null; getAwardDisbursementsRequest.sortColumn = null; };
getAwardDisbursementsRequest.startRowIndex = 1; // start and end row indexes are required to provide var getAwardDisbursementsRequest.endRowIndexdeleteDocumentAttachmentRequest = 100;new 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 { classvar Programresponse = client.deleteDocumentRequirementFileAttachment(deleteDocumentAttachmentRequest);
{ public static SecurityToken GetAuth() if (response.ErrorYN)
{ {
SecurityToken securityToken = new SecurityToken() { throw new Exception(response.Message);
Username = "Student Portal", }
}
UserId = -2, }
}
} |
Code Block |
---|
language | c# |
---|
title | Get Login List |
---|
linenumbers | true |
---|
|
/* IMPORTANT!
** For using this example you need to DashboardAdminuncheck =the true"Allow generation of asynchronous operation" 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)
{
varDataTable recordloginList = new DocumentRequirementFileAttachmentDataTable();
loginList = GetLoginList();
{ }
static DataTable GetLoginList()
DocumentRequirementId = documentRequirementId, {
DataTable login = new DataTable();
DocumentRequirementIdSpecified = true, login.Columns.Add("LoginId", typeof(long));
FileName = file.Name,
login.Columns.Add("Username", typeof(string));
login.Columns.Add("Email", typeof(string));
FileSize = file.Length, login.Columns.Add("FirstName", typeof(string));
login.Columns.Add("LastName", typeof(string));
FileSizeSpecified = true, login.Columns.Add("IsActive", typeof(bool));
MimeType = mimeType, using (var client = new RegentEnterpriseServiceClient())
StoredFileName = $"{Guid.NewGuid()}.{Path.GetExtension(filePath)}",
var getLoginListRequest = StoredFile = File.ReadAllBytes(file.FullName),new GetLoginListRequest()
{
CreatedBy = -168, CreatedBySpecifiedstartRowIndex = true0,
isFileExistsstartRowIndexSpecified = falsetrue,
isFileExistsSpecifiedendRowIndex = true100000,
CreatedOnendRowIndexSpecified = DateTime.Nowtrue,
CreatedOnSpecifiedSecurityToken = true,GetAuth()
ModifiedOn = DateTime.Now, };
ModifiedOnSpecifiedvar records = true,client.getLoginList(getLoginListRequest).Records;
foreach(var record in ModifiedByrecords)
= -168, {
ModifiedBySpecified = true, DataRow row }= login.NewRow();
var createDocumentAttachmentRequest = new UpdateDocumentRequirementFileAttachmentRequest
row["LoginId"] = record.LoginId;
{ row["Username"] = record.Username;
Record = record, row["Email"] = record.Email;
SecurityToken = GetAuth(), row["FirstName"] = record.FirstName;
}; row["LastName"] = record.LastName;
var response = client.createDocumentRequirementFileAttachment(createDocumentAttachmentRequest); row["IsActive"] = if (response.ErrorYN)record.IsActive;
{ login.Rows.Add(row);
throw new Exception(response.Message);}
}
} return login;
} }
} }
} |
Code Block |
---|
language | c# |
---|
title | Update 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;
}
static void Main(string[] args)
{
int documentRequirementFileAttachmentId= /*ID here*/;CreateStudentDocumentRequirement(/*documentId*/, /*studentId*/);
}
static UpdateDocumentFileAttachment(documentRequirementFileAttachmentIdvoid CreateStudentDocumentRequirement(Int64 documentId, "testInt64 comment"studentId);
// You can update only a comment {
} using (var client = static void UpdateDocumentFileAttachment(int documentRequirementFileAttachmentId, string comment)new RegentEnterpriseServiceClient())
{
using (var clientrecord = new RegentEnterpriseServiceClientDocumentRequirement())
{
var record = new DocumentRequirementFileAttachment() // All fields below are required
documentId = {documentId,
IddocumentIdSpecified = documentRequirementFileAttachmentIdtrue,
IdSpecifiedstudentId = truestudentId,
CommentsstudentIdSpecified = commenttrue,
ModifiedByActivitySourceTypeCode = -168"SYSTEMACTION",
ModifiedBySpecifiedActivityLogEntryTypeCode = true"QARelated",
ModifiedOncreatedDate = DateTime.Now,
ModifiedOnSpecifiedcreatedDateSpecified = true,
}; CreatedBy = 1,
var updateDocumentAttachmentRequest = new UpdateDocumentRequirementFileAttachmentRequest CreatedBySpecified = true,
{ RecordreviewedDate = recordDateTime.UtcNow,
SecurityTokenreviewedDateSpecified = GetAuth()true,
}; receivedDate = DateTime.UtcNow,
var response = client.updateDocumentRequirementFileAttachment(updateDocumentAttachmentRequest); receivedDateSpecified = true,
if (response.ErrorYN) EditLockTimestamp = DateTime.UtcNow,
{ EditLockTimestampSpecified = true,
throw new Exception(response.Message); }Files = new DocumentRequirementFileAttachment[] { }
} };
}
} |
Code Block |
---|
language | c# |
---|
title | Delete 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 var createDRReques = new UpdateDocumentRequirementRequest
{
class Program { public static SecurityTokenRecord GetAuth()= record,
{ SecurityToken securityToken = new SecurityTokenGetAuth()
{ };
Username = "Student Portal", var response = client.createDocumentRequirement(createDRReques);
UserId = -2, if (response.ErrorYN)
DashboardAdmin = true {
}; throw new Exception(response.Message);
return securityToken; } }
static void Main(string[] args) }
{ }
int documentRequirementFileAttachmentId= /*ID here*/;
DeleteDocumentFileAttachment(documentRequirementFileAttachmentId);
}
static void DeleteDocumentFileAttachment(int documentRequirementFileAttachmentId)
}
} |
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 static SecurityToken using (var client = new RegentEnterpriseServiceClient())GetAuth()
{
{ SecurityToken securityToken = new SecurityToken()
var record = new DocumentRequirementFileAttachment() {
{ Username = "Student Portal",
Id = documentRequirementFileAttachmentId, UserId = -2,
IdSpecifiedDashboardAdmin = true,
};
DeletedBy = 168, return securityToken;
}
DeletedBySpecified = true,static void Main(string[] args)
{
DeletedOn = DateTime.Now, GetFileFromDocumentRequirementFileAttachmentById(/*documentRequirementIdFileAttachmentId*/, /*Target folder path*/);
}
static void GetFileFromDocumentRequirementFileAttachmentById(int documentRequirementIdFileAttachmentId, string targetFolder)
DeletedOnSpecified = true, {
using (var DocumentRequirementIdclient = 104128,
new RegentEnterpriseServiceClient())
{
DocumentRequirementIdSpecified = true, var request = new GetDocumentRequirementFileAttachmentRequest
}; {
var deleteDocumentAttachmentRequest = new UpdateDocumentRequirementFileAttachmentRequest SecurityToken = GetAuth(),
{ RecordId = recorddocumentRequirementIdFileAttachmentId,
SecurityTokenIdSpecified = GetAuth()true,
};
var responserecord = client.deleteDocumentRequirementFileAttachmentgetDocumentRequirementFileAttachment(deleteDocumentAttachmentRequestrequest).Record;
if (response.ErrorYNrecord.StoredFile.Length > 0)
{
throw new Exception(response.MessageFile.WriteAllBytes(Path.Combine(targetFolder, record.FileName), record.StoredFile);
}
}
}
}
} |