public List<ClassModel> GetClasses(List<int> classIds = null, List<int> programIds = null, List<int> locationIds = null, List<int> sessionTypeIds = null, List<long> staffIds = null, int? pageIndex = null, int? pageSize = null, List<string> fields = null)
        {
            var classes = new List<ClassModel>();

            var classRequest = new GetClassesRequest
            {
                SourceCredentials = GetSourceCredentialsObject(),
                CurrentPageIndex = pageIndex,
                PageSize = pageSize,
            };

            if (classIds != null && classIds.Count > 0)
                classRequest.ClassIDs = classIds.ToArray();

            if (programIds != null && programIds.Count > 0)
                classRequest.ProgramIDs = programIds.ToArray();

            if (locationIds != null && locationIds.Count > 0)
                classRequest.LocationIDs = locationIds.ToArray();

            if (sessionTypeIds != null && sessionTypeIds.Count > 0)
                classRequest.SessionTypeIDs = sessionTypeIds.ToArray();

            if (staffIds != null && staffIds.Count > 0)
                classRequest.StaffIDs = staffIds.ToArray();

            if (fields != null && fields.Count > 0)
                classRequest.Fields = fields.ToArray();

            GetClassesResult classResult = _classService.GetClasses(classRequest);
            if (classResult != null)
            {
                foreach (var classData in classResult.Classes)
                {
                    string json = JsonConvert.SerializeObject(classData);

                    var model = DTOMapper.GetClassModel(json);
                    if (model != null)
                        classes.Add(model);
                }
            }

            return classes;
        }
Exemplo n.º 2
0
 /// <remarks/>
 public void GetClassesAsync(GetClassesRequest Request) {
     this.GetClassesAsync(Request, null);
 }
Exemplo n.º 3
0
 /// <remarks/>
 public void GetClassesAsync(GetClassesRequest Request, object userState) {
     if ((this.GetClassesOperationCompleted == null)) {
         this.GetClassesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetClassesOperationCompleted);
     }
     this.InvokeAsync("GetClasses", new object[] {
                 Request}, this.GetClassesOperationCompleted, userState);
 }
Exemplo n.º 4
0
 public GetClassesResult GetClasses(GetClassesRequest Request) {
     object[] results = this.Invoke("GetClasses", new object[] {
                 Request});
     return ((GetClassesResult)(results[0]));
 }