Пример #1
0
 public ShiftTable(ShiftTable other)
 {
     this.shiftTable = new List<Shift>();
     foreach (Shift sh in other.GetAllShifts())
     {
         this.shiftTable.Add(sh);
     }
 }
Пример #2
0
 protected void GenerateScheduleButton_Click(object sender, EventArgs e)
 {
     GT = new GenerateTable(shiftOptionsTable, weeklyShiftTable);
     weeklyShiftTable = GT.GenerateSchedule();
     setNames();
     foreach (Shift sh in weeklyShiftTable.GetAllShifts())
     {
         string day = sh.getDay().Trim();
         string begin = sh.getBegin_Time().Trim();
         string name = sh.getName().Trim();
         int index = 0;
         switch (day)
         {
             case "Sunday":
                 index = 1;
                 break;
             case "Monday":
                 index = 2;
                 break;
             case "Tusday":
                 index = 3;
                 break;
             case "Wednsday":
                 index = 4;
                 break;
             case "Thursday":
                 index = 5;
                 break;
             case "Friday":
                 index = 6;
                 break;
             case "Saturday":
                 index = 7;
                 break;
         }
         int j;
         int k;
         bool found = false;
         for (j = 0; j < WeeklyScheduleGrid.Rows.Count; j++)
         {
             if (WeeklyScheduleGrid.Rows[j].Cells[0].Text.Split('-')[0].Trim().Equals(begin))
             {
                 while (WeeklyScheduleGrid.Rows[j].Cells[0].Text.Split('-')[0].Trim().Equals(begin) && j < WeeklyScheduleGrid.Rows.Count-1)
                 {
                     if (!selectedIndexes[j, index])
                     {
                         found = true;
                         break;
                     }
                     j++;
                 }
                 break;
             }
         }
         if (found)
         {
             for (k = 0;
                  k < ((DropDownList)WeeklyScheduleGrid.Rows[j].Cells[index].Controls[0]).Items.Count;
                  k++)
             {
                 if (!((DropDownList)WeeklyScheduleGrid.Rows[j].Cells[index].Controls[0]).Items[k].Text.Trim().Equals(name)) continue;
                 ((DropDownList)WeeklyScheduleGrid.Rows[j].Cells[index].Controls[0]).SelectedIndex = k;
                 ((DropDownList)WeeklyScheduleGrid.Rows[j].Cells[index].Controls[0]).ForeColor = System.Drawing.Color.DeepPink;
                 selectedIndexes[j, index] = true;
                 break;
             }
         }
     }
 }