Ramco Ramco

Ramco Ramco

  • 441
  • 3.4k
  • 522.7k

Improve the performance

Apr 1 2023 1:11 AM

Hi

  I have below code & it slows down the performance

for(each colum in loop)
BALSessionDeliveryParticipant bALSessionDeliveryParticipant = new BALSessionDeliveryParticipant();
List<View_SessionDeliveryParticipant_Detailed> objStudentList = bALSessionDeliveryParticipant.GetSessionDeliveryDetailsByCalendarID(colum.SessionDeliveryCalendarID);

BALStudents bALStudents = new BALStudents();
if (objStudentList != null)
{
    foreach (var colum1 in objStudentList)
    {
        StudentDetail objResult = bALStudents.GetStudentDetailByLoginID(Convert.ToInt32(colum1.StudentID));

        if (colum1.PresentInSession == true)
            htmlTable.Append("<span class='badge bg-success-400 mr-1'>" + objResult.Name + "</span>");
        else
        {

            if (colum1.OnBreak == false)
                htmlTable.Append("<span class='badge bg-danger mr-1'>" + objResult.Name + "</span>");
            else
                htmlTable.Append("<span class='badge bg-info mr-1'>" + objResult.Name + "</span>");
        }
    }
}

Thanks


Answers (2)