Example #1
0
        public static FinancialSupportRequest RowToFinancialSupportRequest(IEnumerable <DataRow> rows)
        {
            DataRow row = rows.FirstOrDefault();
            FinancialSupportRequests financialSupportRequests = new FinancialSupportRequests();


            return(new FinancialSupportRequest()
            {
                ApprovedAmount = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.ApprovedAmount.FullName),
                branch = new Branch()
                {
                    Id = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.BranchId.FullName)
                },
                Id = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.Id.FullName),
                CurrentStatus = DataRowHelper.GetValue <RequestStatus>(row, Tables.FinancialSupportRequest.CurrentStatusId.FullName),
                Date = DataRowHelper.GetValue <DateTime>(row, Tables.FinancialSupportRequest.Date.FullName),
                Details = DataRowHelper.GetValue <string>(row, Tables.FinancialSupportRequest.Details.FullName),
                DigitalSignature = DataRowHelper.GetValue <Byte[]>(row, Tables.FinancialSupportRequest.DigitalSignature.FullName),
                IsApproved = DataRowHelper.GetValue <bool>(row, Tables.FinancialSupportRequest.IsApproved.FullName),
                Iscanceled = DataRowHelper.GetValue <bool>(row, Tables.FinancialSupportRequest.IsCanceled.FullName),
                NumberOfMonthsApproved = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.NumberOfMonthsApproved.FullName),
                Student = new Student()
                {
                    Id = DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.StudentId.FullName),
                }
            });
        }
 public static FinancialSupportRequests GetFinancialSupportRequests()
 {
     try
     {
         FinancialSupportRequests financialSupportRequests = FinancialSupportDataManager.GetFinancialSupports();
         return(financialSupportRequests);
     }
     catch (Exception ex)
     {
         _logger.Debug($"Failed to get financialSupportRequests");
         throw;
     }
 }
Example #3
0
        public static FinancialSupportRequests TableToFinancialSupport(DataTable table)
        {
            if (table == null)
            {
                return(null);
            }
            FinancialSupportRequests financialSupports = new FinancialSupportRequests();
            var studentList = table.AsEnumerable().GroupBy(row => DataRowHelper.GetValue <int>(row, Tables.FinancialSupportRequest.Id.FullName),
                                                           (key, group) => RowToFinancialSupportRequest(group));

            financialSupports.AddRange(studentList.ToList());
            return(financialSupports);
        }
 public HttpResponseMessage GetFinancialSupportRequests()
 {
     try
     {
         FinancialSupportRequests          financialSupportRequests    = FinancialSupportManager.GetFinancialSupportRequests();
         List <FinancialSupportRequestDto> financialSupportRequestsDto = Converters.Convert(financialSupportRequests);
         return(Request.CreateResponse(HttpStatusCode.OK));
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, $"Failed to load students"));
     }
 }
Example #5
0
 public static List <FinancialSupportRequestDto> Convert(FinancialSupportRequests financialSupportRequests)
 {
     if (financialSupportRequests != null)
     {
         List <FinancialSupportRequestDto> financialSupportRequestsDto = new List <FinancialSupportRequestDto>();
         foreach (FinancialSupportRequest financialSupportRequest in financialSupportRequests)
         {
             FinancialSupportRequestDto item = ConvertToDto(financialSupportRequest);
             financialSupportRequestsDto.Add(item);
         }
         return(financialSupportRequestsDto);
     }
     return(null);
 }