A stored procedure that shifts

The stored procedure, I will write a shift now assumption, there are now 3 teams and groups A, B, C, has three divisions, the early, middle, late
For example: this week the A class is an early, B class is class, C class is late next week, is A class is class, B class is the class, C class is an early next week, A class is the B class is late, early, C class is a class, per shift for 8 hours every Monday, automatic transfer class, a stored procedure to the how to write it

Started by Maggie at November 14, 2016 - 9:28 PM

First determine the system time, and then find out ABC data, determine what class, and then update frequency. Then write in the time job...

Posted by Ella at November 27, 2016 - 9:52 PM

If the actual only three classes of words, the most stupid way, put several order your list down to a table, in order to perform in turn, once a week, update the current marker

The A class early 1 (duty)
The B class (the class 1)
The C class 1 (the night)

On 0 A class()
The B class in early 0()
The C class late 0()

The A class late 0()
On 0 B class()
The C class in early 0()

Posted by Janet at December 12, 2016 - 10:14 PM

Can be directly used code can, need not be stored procedure.
public void GetDuty(int week)
{
int group=week%3;
swith(group)
{
case 0:Console.WriteLine("A class B class early shift, shift value, C class night");
       break;
case 1:Console.WriteLine("The A class shift value, B class C class, night shift, the early shift");
       break;
case 2:Console.WriteLine("The A class the night shift, B class C class early shift, shift value");
       break;
default:Console.WriteLine("Classes don't go wrong");
        break;
}
}

Posted by Tracy at December 23, 2016 - 10:44 PM

Feel shy, above the switch wrong

Posted by Tracy at December 25, 2016 - 10:54 PM