private void BuildCrewVeiw(string crewFileName) { CrewListParser crewListParser = new CrewListParser(crewFileName); DataTable crewTable = crewListParser.Read(); //to-do if (crewTable.Rows == null) { return; } crew.Clear(); for (int i = 0; i < crewTable.Rows.Count; i++) { AppointmentGroup ag = new AppointmentGroup(); ag.GroupTitle = crewTable.Rows[i].ItemArray[0].ToString(); ag.GroupId = i; if (i == 2) { Appointment ap = new Appointment() { Title = "test", GroupId = i, StartTime = DateTime.Now, EndTime = DateTime.Now.AddHours(1), Percent = 0.7f, Tooltip = "test" }; ag.Add(ap); } crew.Add(ag); } this.rosterGanttControl1.StartTime = _startTime; if (_totalHour > 1) { this.rosterGanttControl1.TotalHour = _totalHour; } this.rosterGanttControl1.Invalidate(); }
private void BuildCrewVeiw(string crewFileName) { CrewListParser crewListParser = new CrewListParser(crewFileName); DataTable crewTable = crewListParser.Read(); //to-do if (crewTable.Rows == null) { return; } crew.Clear(); for (int i = 0; i < crewTable.Rows.Count; i++) { AppointmentGroup ag = new AppointmentGroup(); ag.GroupTitle = crewTable.Rows[i].ItemArray[0].ToString(); ag.GroupId = i; if (i == 2) { Appointment ap = new Appointment() { Title = "test", GroupId = i, StartTime = DateTime.Now, EndTime = DateTime.Now.AddHours(1), Percent = 0.7f, Tooltip = "test" }; ag.Add(ap); } crew.Add(ag); } this.rosterGanttControl1.StartTime = _startTime; if (_totalHour > 1) this.rosterGanttControl1.TotalHour = _totalHour; this.rosterGanttControl1.Invalidate(); }
private void BuildPairingView(string pairingFileName) { PairingListParser pairingListParser = new PairingListParser(pairingFileName); DataTable pairingTable = pairingListParser.Read(); //to-do if (pairingTable.Rows == null) { return; } string formatString = "yyyyMMddHHmmss"; DateTime startTime = DateTime.Now; DateTime endTime = DateTime.Now; List <DateTime> startTimeList = new List <DateTime>(); List <DateTime> endTimeList = new List <DateTime>(); bool newAppGroup = true; pairing.Clear(); int i = 0; foreach (DataRow dr in pairingTable.Rows) { startTime = DateTime.ParseExact(dr.ItemArray[4].ToString(), formatString, null); endTime = DateTime.ParseExact(dr.ItemArray[5].ToString(), formatString, null); startTimeList.Add(startTime); endTimeList.Add(endTime); //ag2.WorkTimes.Add(new TimeRange() { startTime = DateTime.Today.AddHours(9), endTime = DateTime.Today.AddHours(15) }); //ag2.WorkTimes.Add(new TimeRange() { startTime = DateTime.Today.AddHours(17), endTime = DateTime.Today.AddHours(18) }); foreach (AppointmentGroup _ag in pairing) { var confs = _ag.Where(a => (this.IsTimeCrossing(startTime, endTime, a.StartTime, a.EndTime))); if (confs.Count() == 0) { Appointment ap = new Appointment() { Title = dr.ItemArray[0].ToString(), GroupId = _ag.GroupId, StartTime = startTime, EndTime = endTime, Percent = 0.7f, Tooltip = dr.ItemArray[1].ToString() + " " + "Flight Time " + dr.ItemArray[6] }; _ag.Add(ap); newAppGroup = false; break; } } if (newAppGroup) { AppointmentGroup ag = new AppointmentGroup(); ag.GroupTitle = "Pairing"; ag.GroupId = i++; Appointment ap = new Appointment() { Title = dr.ItemArray[0].ToString(), GroupId = ag.GroupId, StartTime = startTime, EndTime = endTime, Percent = 0.7f, Tooltip = dr.ItemArray[1].ToString() + " " + "Flight Time " + dr.ItemArray[6] }; ag.Add(ap); pairing.Add(ag); } } TimeRange(startTimeList, endTimeList); this.rosterGanttControl2.StartTime = _startTime; if (_totalHour > 1) { this.rosterGanttControl2.TotalHour = _totalHour; } this.rosterGanttControl2.Invalidate(); }
private void BuildPairingView(string pairingFileName) { PairingListParser pairingListParser = new PairingListParser(pairingFileName); DataTable pairingTable = pairingListParser.Read(); //to-do if (pairingTable.Rows == null) { return; } string formatString = "yyyyMMddHHmmss"; DateTime startTime = DateTime.Now; DateTime endTime = DateTime.Now; List<DateTime> startTimeList = new List<DateTime>(); List<DateTime> endTimeList = new List<DateTime>(); bool newAppGroup = true; pairing.Clear(); int i = 0; foreach (DataRow dr in pairingTable.Rows) { startTime = DateTime.ParseExact(dr.ItemArray[4].ToString(), formatString, null); endTime = DateTime.ParseExact(dr.ItemArray[5].ToString(), formatString, null); startTimeList.Add(startTime); endTimeList.Add(endTime); //ag2.WorkTimes.Add(new TimeRange() { startTime = DateTime.Today.AddHours(9), endTime = DateTime.Today.AddHours(15) }); //ag2.WorkTimes.Add(new TimeRange() { startTime = DateTime.Today.AddHours(17), endTime = DateTime.Today.AddHours(18) }); foreach (AppointmentGroup _ag in pairing) { var confs = _ag.Where(a => (this.IsTimeCrossing(startTime, endTime, a.StartTime, a.EndTime))); if (confs.Count() == 0) { Appointment ap = new Appointment() { Title = dr.ItemArray[0].ToString(), GroupId = _ag.GroupId, StartTime = startTime, EndTime = endTime, Percent = 0.7f, Tooltip = dr.ItemArray[1].ToString() + " " + "Flight Time " + dr.ItemArray[6] }; _ag.Add(ap); newAppGroup = false; break; } } if (newAppGroup) { AppointmentGroup ag = new AppointmentGroup(); ag.GroupTitle = "Pairing"; ag.GroupId = i++; Appointment ap = new Appointment() { Title = dr.ItemArray[0].ToString(), GroupId = ag.GroupId, StartTime = startTime, EndTime = endTime, Percent = 0.7f, Tooltip = dr.ItemArray[1].ToString() + " " + "Flight Time " + dr.ItemArray[6] }; ag.Add(ap); pairing.Add(ag); } } TimeRange(startTimeList, endTimeList); this.rosterGanttControl2.StartTime = _startTime; if (_totalHour > 1) this.rosterGanttControl2.TotalHour = _totalHour; this.rosterGanttControl2.Invalidate(); }