本文整理汇总了C#中Schedule.FillUp方法的典型用法代码示例。如果您正苦于以下问题:C# Schedule.FillUp方法的具体用法?C# Schedule.FillUp怎么用?C# Schedule.FillUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schedule
的用法示例。
在下文中一共展示了Schedule.FillUp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createScheduleFromAgentsTxt
public Schedule createScheduleFromAgentsTxt()
{
var agents = JsonConvert.DeserializeObject<List<Agent>>(Resources.AgentsJson);
var start = new DateTime(2014, 7, 28);
var schedule = new Schedule(agents, start, start + new TimeSpan(28, 0, 0, 0));
schedule.FillUp();
return schedule;
}
示例2: Main
static void Main(string[] args)
{
try
{
ParseArgs(args);
if (!File.Exists(_agentFile))
{
throw new FileNotFoundException("Could not load file " + _agentFile);
}
var agents = JsonConvert.DeserializeObject<List<Agent>>(File.ReadAllText(DefaultAgentFile));
var schedule = new Schedule(agents, _start, _start + new TimeSpan(28, 0, 0, 0));
schedule.FillUp();
File.WriteAllText("Schedule.txt", schedule.ToString());
Process.Start("Schedule.txt");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
示例3: DontWorkTwoWeekendsInARow
public void DontWorkTwoWeekendsInARow()
{
var worksFirst = new Agent { Name = "WorksFirstWeekEnd" };
var agents = new[] {worksFirst,
new Agent{Name="WorksLastWeekEnd"}};
//Starts on a Sunday.
var start = new DateTime(2014, 9, 7);
var end = start.AddDays(8);
var schedule = new Schedule(agents, start, end);
schedule[start].Primary = worksFirst;
schedule.FillUp();
var someoneAssigned = false;
for (int i = schedule.Count() - 3; i < schedule.Count(); i++)
{
if (schedule[i].Primary != null)
{
someoneAssigned = true;
Assert.AreNotEqual(worksFirst, schedule[i].Primary, "Someone was assigned 2 weekends in a row.");
}
}
Assert.IsTrue(someoneAssigned, "No one was assigned the second weekend");
}
示例4: GenerateScheduleButton_Click
private void GenerateScheduleButton_Click(object sender, RoutedEventArgs e)
{
var statDays = StatDaysCalendar.SelectedDates.ToList<DateTime>();
var schedule = new Schedule(Agents, ScheduleStartDatePicker.SelectedDate.Value , 28, statDays);
schedule.FillUp();
var filename = System.IO.Path.GetRandomFileName() + ".txt";
File.WriteAllText(filename, schedule.ToString());
Process.Start(filename);
((IOcsaWinApp)App.Current).ClearAgentPoints();
}
示例5: StatDaysAreWorth2Points
public void StatDaysAreWorth2Points()
{
//Makes sure lolwut gets assigned by giving the other guy point reduction.
var agents = new List<Agent> { new Agent { Name = "lolwut" },
new Agent{Name="other guy", PointReduction = 2}};
var start = new DateTime(2014, 9, 22);
var statDay = new List<DateTime> { start };
var schedule = new Schedule(agents, start, 2, statDay);
schedule.FillUp();
Assert.AreEqual(2, agents[0].TotalPrimaryPoints, "Agent should have received 2 point for working on a stat day");
Assert.AreEqual(1, schedule[1].PointValue, "Second schedule day should be worth 1 point");
}