How to compare arrays and datagridview through loops?

0

Good afternoon guys

I have 7 textboxes that I did this way

long[] Jornada;
Jornada = new long[7];

           Jornada[0] = TimeSpan.Parse(textboxjornadaseg.Text.ToString()).Ticks;
           Jornada[1]= TimeSpan.Parse(textboxjornadater.Text.ToString()).Ticks;
           Jornada[2] = TimeSpan.Parse(textboxjornadaqua.Text.ToString()).Ticks;
           Jornada[3] = TimeSpan.Parse(textboxjornadaqui.Text.ToString()).Ticks;
           Jornada[4] = TimeSpan.Parse(textboxjornadasex.Text.ToString()).Ticks;
           Jornada[5] = TimeSpan.Parse(textboxjornadasab.Text.ToString()).Ticks;
           Jornada[6] = TimeSpan.Parse(textboxjornadadom.Text.ToString()).Ticks;

Each day is a maskedtexbox for the total contractual day of the day, I have a calculate button in which it fills a line and throws that content into a grid cell.

What I did: I put a FOR for it to get the 7 conditions and put it in a variable: Day [i]

 for (long i = 0; i < 1; i++)

           {

            IdentificaHoraExtra = HorasDoDia + HorasDaNoite > Jornada[i]; //verifica se há horas extras
            ResultadoHE = IdentificaHoraExtra ? (HorasDoDia + HorasDaNoite) - Jornada[i] : (new TimeSpan(0).Ticks)
            }

When clicking, it generates a row in the datagridview, this Journey [i] is a contractual day field.

What I want to do: on the grid it has a column called "day", there it picks the day of the week: "Monday" / "Tuesday" / and there goes, each insertion in the line he adds the next day, I wanted to figure out a way in which he would compare the day's cell with the corresponding vector and return the vector's ID equal to the day's position on the line.

For example: in the datagridview a cell appeared written "second" / second it takes Jornada [0], on Tuesday it picks up the Jornada

Does anyone have any suggestions on how I compare the index of the cell that appears on the day with the index I created in the array?

Edit will put prints for easier viewing

Inthefirstimageaboveintheworkingdayfielditreturnsthevaluesofthetextbox.

In this second image in the left side textbox are the values that are entered in dategridview

In the field of journey was to show the value of the sixth that is 08:00 only he picks up the second every time I would like to have a way of identifying the content of the day for each value in these textbox.

    
asked by anonymous 27.07.2018 / 18:12

0 answers