I have some meanings.
DateTime date=04/03/2015(date) Total Woring days=6 (total) Rotation Days=2 (rotationday) Shift Group=S1(this group contain two shift id 1 and 2)
I want to start a shift for 6 days. but every 2 days Shift id 1 rotates to switch id 2 and again after a two-day shift id 2 rotates to shift id 1 and so on ... My output should look like
04/03/2015=1 05/03/2015=1 06/03/2015=2 07/03/2015=2 08/03/2015=1 09/03/2015=1
I get shift id through foreach loop. I tried as below, but did not get the proper result. Please help me solve this problem.
SqlCommand cmd2 = new SqlCommand("select ShiftID from ShiftGroup where ShiftName='" + ide + "'", conn2); SqlDataAdapter sda2 = new SqlDataAdapter(cmd2); DataSet ds4 = new DataSet(); var rows2 = ds4.Tables[0].Rows; if (ds4.Tables[0].Rows.Count > 0) { foreach (DataRow row2 in rows2) { string shiftname = Convert.ToString(row2["ShiftID"]); DateTime date=04/03/2015(date) Total Woring days=6 (total) Rotation Days=2 (rotationday) DateTime rotation= date.AddDays(rotationday);
Iโve been stuck with this from the last day, someone helps me. No need to consider my for loop, kindly provide a for loop that generates the above output
source share