Live, good night
I'm working on a C # solution, in which I have to develop a schedule and I plan to show the events (if any) at a certain point, as well as show the following 7 days, even if they do not have marked events. >
I developed a method, which given a certain date (int dia, int mes, int ano)
actually returns me every day of the indicated month but in fact I need something that returns me for example:
If we are 1 of some month - The program must return from day 1 to day 7
If we are for example a 10 - The program should return from 10 to 17
Therefore always a sequence of 7 Days. Here is the method I have at the moment:
public string ShowWeekendEvents(int Day, int Month, int Year)
{
string aux = "";
for (int i=0; i<totalEventos; i++)
{
if(ev[i].DayMonthYear.Day>=Day&&ev[i].DayMonthYear.Month==Month&&ev[i].DayMonthYear.Year==Year)
{
Console.WriteLine("----------------------------------------------------------");
Console.WriteLine("{0}-{1}-{2} {3}-{4} ", ev[i].DayMonthYear.Day, ev[i].DayMonthYear.Month, ev[i].DayMonthYear.Year, ev[i].HoraInicial, ev[i].MinInicial);
Console.WriteLine();
aux = "Evento: " + ev[i].Events.ToString() + "\n";
Console.WriteLine("Data de inicio: {0}/{1}/{2}", ev[i].DayMonthYear.Day, ev[i].DayMonthYear.Month, ev[i].DayMonthYear.Year);
Console.WriteLine();
Console.WriteLine("Data Final: {0}/{1}/{2}", ev[i].FinalDayMonthYear.Day, ev[i].FinalDayMonthYear.Month, ev[i].FinalDayMonthYear.Year);
aux += "Hora Inicio:" + ev[i].HoraInicial.ToString() + "h " + ev[i].MinInicial.ToString() + "Min" + "\n";
Console.WriteLine();
aux += "Hora Final:" + ev[i].HoraFinal.ToString() + "h " + ev[i].MinFinal.ToString() + "Min \n";
Console.WriteLine(aux);
Console.WriteLine("-----------------------------------------------------------");
if (ev[i].DayMonthYear.Day >= Day)
if (ev[i].DayMonthYear.Day > 7)
break;
else if (Day == 8 && ev[i].DayMonthYear.Day > 13)
break;
}
//during 7 days
}
/*
else if (ev[i].DayMonthYear.Day != Day && ev[i].DayMonthYear.Month == Month && ev[i].DayMonthYear.Year == Year)
{
while (j < week-1)
{
Console.WriteLine("----------------------------------------------------------");
Console.WriteLine("{0}-{1}-{2} {3}-{4} ", ev[i].DayMonthYear.Day, ev[i].DayMonthYear.Month, ev[i].DayMonthYear.Year, ev[i].HoraInicial, ev[i].MinInicial);
Console.WriteLine();
aux = "Evento: " + ev[i].Events.ToString() + "\n";
Console.WriteLine("Data de inicio: {0}/{1}/{2}", ev[i].DayMonthYear.Day, ev[i].DayMonthYear.Month, ev[i].DayMonthYear.Year);
Console.WriteLine();
Console.WriteLine("Data Final: {0}/{1}/{2}", ev[i].FinalDayMonthYear.Day, ev[i].FinalDayMonthYear.Month, ev[i].FinalDayMonthYear.Year);
aux += "Hora Inicio:" + ev[i].HoraInicial.ToString() + "h " + ev[i].MinInicial.ToString() + "Min" + "\n";
Console.WriteLine();
aux += "Hora Final:" + ev[i].HoraFinal.ToString() + "h " + ev[i].MinFinal.ToString() + "Min \n";
Console.WriteLine(aux);
Console.WriteLine("-------------------------------------------");
}
}
* */
return aux;
}
However I am quite confused and I am not getting the program to pass to the user what is actually intended. Can you help me rephrase the code?
Thank you in advance.