This code is for summary report for peak hours. it froze my application for 10 seconds and get back. how to stop frozing
else if (reportType == "Peak Hour")
{
// VARIABLES
DateTime time = Convert.ToDateTime("12:00 AM");
string counterTime;
// DateTime sextime = Convert.ToDateTime(time.ToString("hh:00 tt"));
// 1st LOOPING
while (true)
{
counterTime = time.ToString("hh:00 tt");
time = time + TimeSpan.FromMinutes(1);
if ("12:00 AM" == time.ToString("hh:mm tt"))
{
break;
}
foreach (DateTime day in EachDay(dateTimePickerFrom.Value, dateTimePickerTo.Value))
{
foreach (DataGridViewRow row in dataGridViewTrip.Rows)
{
// CONVERT STRING TO DATE
if (row.Cells[0].Value.ToString() == day.ToString("yyyy-MM-dd"))
{
if (row.Cells[1].Value.ToString() == time.ToString("hh:mm tt"))
{
totalpassengerDaily = int.Parse(row.Cells[4].Value.ToString()) + totalpassengerDaily;
totalCommission = Decimal.Parse(row.Cells[8].Value.ToString()) + totalCommission;
}
}
}
}
if (counterTime != time.ToString("hh:00 tt"))
{
if (totalpassengerDaily > 0 || totalCommission > 0)
{
// INSERT TO CHART
chartDaily.Series["Passengers"].Points.AddXY(counterTime, totalpassengerDaily);
chartDaily.Series["Commission"].Points.AddXY(counterTime, totalCommission);
// ADDING TO DATAGRID
DataRow row = summaryReport.NewRow();
row["Date"] = counterTime;
row["Passenger"] = totalpassengerDaily;
row["Commission"] = totalCommission;
summaryReport.Rows.Add(row);
// RESET
totalpassengerDaily = 0;
totalCommission = 0;
}
}
// dito
}
totalpassengerDaily = 0;
totalCommission = 0;
froms = dateTimePickerFrom.Value.ToString("dd MMMM yyyy");
tos = dateTimePickerTo.Value.ToString("dd MMMM yyyy");
// reportType = "Peak Hour \n From:" + dateTimePickerFrom.Value.ToString("dd-MMMM-yyyy") + " To:" + dateTimePickerTo.Value.ToString("dd-MMMM-yyyy");
}
it also effect some controls from the form like the all the border in buttons.
This course aims to teach everyone the basics of programming computers using Python. We cover the basics of how one constructs a program from a series of simple instructions in Python. The course has no pre-requisites and avoids all but the simplest mathematics. Anyone with moderate computer experience should be able to master the materials in this course. This course will cover Chapters 1-5 of the textbook “Python for Everybody”. Once a student completes this course, they will be ready to take more advanced programming courses. This course covers Python 3.