public ExamOverviewTeacherDetailDialog(ExamOverviewTeacherController teacherController, CustomEvent @event) { TeacherController = teacherController; Event = @event; Exam = (Exam)Event.Tag; //Stop de gegevens van de geselecteerde exam in een nieuw object, zodat deze wel bewaard blijven. LocallyEditedExam = new Exam(Exam.Examnr, Exam.Questionnaire, Exam.Starttime, Exam.Endtime, Exam.Lecture); InitializeComponent(); UpdateView(); }
//Laad de calendar view public void Load() { //Eerst leegmaken View.clnExams.ClearCalendar(); //Exams ophalen List<Exam> exams = MasterController.DB.GetExamsByTeacher(((Teacher)MasterController.User).TeacherNr); foreach (Exam exam in exams) { double difference = (exam.Endtime - exam.Starttime).TotalHours; double differenceMinutes = (exam.Endtime - exam.Starttime).TotalMinutes; //Toevoegen als CustomEvent CustomEvent customEvent = new CustomEvent { Date = exam.Starttime, EventText = exam.Questionnaire.Name, EventFont = new Font("Verdana", 8, FontStyle.Regular), Enabled = true, EventColor = Color.FromArgb(0, 65, 150), EventTextColor = Color.White, EventLengthInHours = (float)difference, CustomToolTipText = "Vak: " + exam.Questionnaire.Subject.Name + "\nKlas: " + exam.Lecture.Class + "\n\nStart: " + exam.Starttime + "\nEind: " + exam.Endtime + "\nDuur: " + differenceMinutes + " minuten" + "\n\nGemaakt door: " + exam.Questionnaire.Author + "\nAfname door: " + exam.Lecture.Teacher, Tag = exam }; //Voeg toe aan kalender View.clnExams.AddEvent(customEvent); } }
public Form1() { InitializeComponent(); calendar1.CalendarDate = new DateTime(2012, 5, 2, 0, 0, 0); calendar1.CalendarView = CalendarViews.Month; calendar1.AllowEditingEvents = true; var groundhogEvent = new HolidayEvent { Date = new DateTime(2012, 2, 2), EventText = "Groundhog Day", RecurringFrequency = RecurringFrequencies.Yearly }; calendar1.AddEvent(groundhogEvent); var exerciseEvent = new CustomEvent { Date = DateTime.Now, RecurringFrequency = RecurringFrequencies.EveryMonWedFri, EventLengthInHours = 1, EventText = "Time for Exercise!" }; calendar1.AddEvent(exerciseEvent); var rehabEvent = new CustomEvent { Date = DateTime.Now, RecurringFrequency = RecurringFrequencies.Custom, EventText = "Rehab Therapy", Rank = 3, CustomRecurringFunction = RehabDays }; calendar1.AddEvent(rehabEvent); //var ce = new CustomEvent(); //ce.EventText = "My Event"; //ce.Date = new DateTime(2012, 4, 1); //ce.RecurringFrequency = RecurringFrequencies.Monthly; //ce.EventFont = new Font("Verdana", 12, FontStyle.Regular); //ce.ThisDayForwardOnly = true; //ce.Enabled = true; //calendar1.AddEvent(ce); //var ce2 = new HolidayEvent(); //ce2.EventText = "test"; //ce2.Date = new DateTime(2012, 4, 2); //ce2.RecurringFrequency = RecurringFrequencies.EveryMonWedFri; //ce2.Rank = 3; //calendar1.AddEvent(ce2); var ce = new CustomEvent(); ce.IgnoreTimeComponent = false; ce.EventText = "Interview"; ce.Date = new DateTime(2012, 5, 2, 15, 30, 0); ce.EventLengthInHours = 2f; ce.RecurringFrequency = RecurringFrequencies.None; ce.EventFont = new Font("Verdana", 12, FontStyle.Regular); ce.Enabled = true; calendar1.AddEvent(ce); var ce2 = new CustomEvent { IgnoreTimeComponent = false, EventText = "Dinner", Date = new DateTime(2012, 5, 15, 18, 0, 0), EventLengthInHours = 2f, RecurringFrequency = RecurringFrequencies.None, EventFont = new Font("Verdana", 12, FontStyle.Regular), Enabled = true, EventColor = Color.FromArgb(120, 255, 120), EventTextColor = Color.Black, ThisDayForwardOnly=true }; calendar1.AddEvent(ce2); }
/// <summary> /// 근무관련된 정보를 입력합니다. /// </summary> /// <param name="Text"> 근무 내용</param> /// <param name="Date"> 근무 시간</param> public void AddWork(String startTime, String endTime, String etc, DateTime Date) { bool existEvent = false; // 하루에 근무시간은 한번 있어야함. 이를 판단하기 위해 존재하는 변수 var ce = new CustomEvent(); ce.IgnoreTimeComponent = false; ce.startTime = startTime; ce.endTime = endTime; ce.etc = etc; ce.Date = Date; ce.EventLengthInHours = 2f; ce.RecurringFrequency = RecurringFrequencies.None; ce.EventFont = new Font("Verdana", 8, FontStyle.Regular); ce.Enabled = true; ce.TooltipEnabled = false; ce.EventColor = Color.FromArgb(255, 255, 255, 255); ce.EventTextColor = Color.Black; for(int i = 0;i < _events.Count; i++) { if (_events[i].Date.Year == _calendarDate.Year && _events[i].Date.Month == _calendarDate.Month && _events[i].Date.Day == Date.Day) { _events[i] = ce; existEvent = true; } } if (!existEvent) // 해당 날짜에 이벤트가 존재하면 추가하지 않는다. _events.Add(ce); }
public DateBox() { month = 0; date = 0; isSelected = false; size = new Rectangle(0, 0, 0, 0); WorkInfo = new CustomEvent(); }
private void CalendarMouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (_calendarView == CalendarViews.Month) { int num = _calendarEvents.Count; for (int i = 0; i < num; i++) { var z = _calendarEvents[i]; if (z.EventArea.Contains(e.X, e.Y) && !z.Event.ReadOnlyEvent) { _clickedEvent = z; _contextMenuStrip1.Show(this, e.Location); _eventTip.Visible = false; _eventTip.ShouldRender = false; break; } } } return; } if (e.Button == MouseButtons.Left) { if (_calendarView == CalendarViews.Month) { var newEvent = new CustomEvent(); int num = _calendarEvents.Count; int xBarrier = 189; int yBarrier = (int)(Math.Ceiling(547.0 / numWeeks)); Point editPoint = new Point(e.X-20, e.Y-75); bool run = true; bool run1 = true; bool run2 = true; int probableDay=-(int)(startWeekEnum)+1; for (int i=0; i<num; i++) { var z = _calendarEvents[i]; if (z.EventArea.Contains(e.X, e.Y) && !z.Event.ReadOnlyEvent) { _clickedEvent = z; _eventTip.Visible = false; _eventTip.ShouldRender = false; move = true; return; } } if (move) { move = false; while (run) { if (editPoint.X > xBarrier) { editPoint.X -= xBarrier; probableDay++; run1 = false; } if (editPoint.Y > yBarrier) { editPoint.Y -= yBarrier; probableDay += 7; run2 = false; } if (run1 && run2) { run = false; } run1 = true; run2 = true; } DateTime newDate = DateTime.Now; try { newDate = new DateTime(_calendarDate.Year, _calendarDate.Month, probableDay); } catch { if (probableDay>0) { try { newDate = new DateTime(_calendarDate.Year, _calendarDate.Month + 1, probableDay - DateTime.DaysInMonth(_calendarDate.Year, _calendarDate.Month)); } catch { newDate = new DateTime(_calendarDate.Year + 1, 1, probableDay - DateTime.DaysInMonth(_calendarDate.Year, _calendarDate.Month)); } } else { try { newDate = new DateTime(_calendarDate.Year, _calendarDate.Month - 1, DateTime.DaysInMonth(_calendarDate.Year, _calendarDate.Month-1) + probableDay); } catch { newDate = new DateTime(_calendarDate.Year - 1, 12, 31 + probableDay); } } } foreach (CustomEvent evnt in NetGlobals.customEvents) { if (evnt == _clickedEvent.Event) { newEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = newDate, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; invisEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; storeColor = evnt.EventColor; } } DateTime oldReleaseDate; if (newEvent.Date.DayOfWeek == 0 || (int)newEvent.Date.DayOfWeek == 6) { invisEvent.Enabled = true; MessageBox.Show("Error: This date falls on a weekend"); return; } using (StreamReader sr = new StreamReader(@"TEMPDATA•" + (NetGlobals.docCounter) + ".txt")) { while (!sr.EndOfStream) { string line = sr.ReadLine(); if (line.StartsWith(_clickedEvent.Event.Name + "•")) { individualData = line.Split('•'); } } oldReleaseDate = new DateTime(int.Parse(individualData[individualData.Length-2].Split('/')[2]), int.Parse(individualData[individualData.Length-2].Split('/')[0]), int.Parse(individualData[individualData.Length - 2].Split('/')[1])); daysLost = -int.Parse(individualData[individualData.Length - 1]); } if (_clickedEvent.Event.EventText == _clickedEvent.Event.Name + " Dev Est Comp Date") { DateTime dcDate = DateTime.Now; if (individualData[1] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } int store = int.Parse(individualData[3]); individualData[3] = (int.Parse(individualData[3]) + Comparison(_clickedEvent.Event.Date, newEvent.Date)).ToString(); if (int.Parse(individualData[3]) < 0) { invisEvent.Enabled = true; individualData[3] = store.ToString(); MessageBox.Show("This results in a negative duration (" + (int.Parse(individualData[3]) + Comparison(_clickedEvent.Event.Date, newEvent.Date)) + ") days long. Please try again."); return; } NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Dev Comp Date") { dcDate = evnt.Date; } }); if (dcDate == newEvent.Date) { newEvent.Enabled = false; } else { newEvent.Enabled = true; } NetGlobals.customEvents.Add(newEvent); individualData[1] = newEvent.Date.ToString("d",CultureInfo.InvariantCulture); _events.Clear(); _events.AddRange(NetGlobals.customEvents); Refresh(); saveTemp(); } else if (_clickedEvent.Event.EventText == _clickedEvent.Event.Name + " Release Date") { DateTime newRelDate = newEvent.Date; DateTime relDate = _clickedEvent.Event.Date; if (individualData[individualData.Length - 4] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } individualData[individualData.Length - 4] = newEvent.Date.ToString("d", CultureInfo.InvariantCulture); currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[individualData.Length - 2] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[individualData.Length - 1] = daysLost.ToString(); drawNewEvent = newEvent; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.EventText == _clickedEvent.Event.Name + " Dev Comp Date") { DateTime newDevDate = newEvent.Date; DateTime newRelDate = DateTime.Now; DateTime devECDate = DateTime.Now; DateTime relDate = DateTime.Now; DateTime cust1Date = DateTime.Now; DateTime cust2Date = DateTime.Now; DateTime cust3Date = DateTime.Now; DateTime cust4Date = DateTime.Now; DateTime cust5Date = DateTime.Now; DateTime cust6Date = DateTime.Now; IEvent cust1Event = null; IEvent cust2Event = null; IEvent cust3Event = null; IEvent cust4Event = null; IEvent cust5Event = null; IEvent cust6Event = null; IEvent relEvent = null; IEvent devECEvent = null; bool enabled; if (individualData[2] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } individualData[2] = newEvent.Date.ToString("d", CultureInfo.InvariantCulture); if (_clickedEvent.Event.NumberOfEvents == 0) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.EventText == _clickedEvent.Event.Name + " Dev Est Comp Date") { devECDate = evnt.Date; devECEvent = evnt; } }); if (newDevDate == devECDate) { enabled = false; } else { enabled = true; } newRelDate = AddBusinessDays(newDevDate, int.Parse(individualData[4])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[6] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[7] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(devECEvent); IEvent newDevECEvent = devECEvent; newDevECEvent.Enabled = enabled; NetGlobals.customEvents.Add(newDevECEvent); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 1) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.EventText == _clickedEvent.Event.Name + " Dev Est Comp Date") { devECDate = evnt.Date; devECEvent = evnt; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Event = evnt; cust1Date = evnt.Date; originalCust1Event = evnt; drawOldCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); if (newDevDate == devECDate) { enabled = false; } else { enabled = true; } cust1Date = AddBusinessDays(newDevDate, int.Parse(individualData[4])); individualData[7] = cust1Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust1Date, int.Parse(individualData[9])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[11] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[12] = daysLost.ToString(); drawNewEvent = newEvent; drawCust1Event.Date = cust1Date; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust1Event); NetGlobals.customEvents.Remove(devECEvent); IEvent newDevECEvent = devECEvent; newDevECEvent.Enabled = enabled; NetGlobals.customEvents.Add(newDevECEvent); IEvent newCust1Event = cust1Event; newCust1Event.Date = cust1Date; NetGlobals.customEvents.Add(newCust1Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 2) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.EventText == _clickedEvent.Event.Name + " Dev Est Comp Date") { devECDate = evnt.Date; devECEvent = evnt; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Event = evnt; cust1Date = evnt.Date; originalCust1Event = evnt; drawOldCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); if (newDevDate == devECDate) { enabled = false; } else { enabled = true; } cust1Date = AddBusinessDays(newDevDate, int.Parse(individualData[4])); individualData[7] = cust1Date.ToString("d", CultureInfo.InvariantCulture); cust2Date = AddBusinessDays(cust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust2Date, int.Parse(individualData[14])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[16] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[17] = daysLost.ToString(); drawNewEvent = newEvent; drawCust1Event.Date = cust1Date; drawCust2Event.Date = cust2Date; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(devECEvent); NetGlobals.customEvents.Remove(cust1Event); NetGlobals.customEvents.Remove(cust2Event); IEvent newDevECEvent = devECEvent; newDevECEvent.Enabled = enabled; NetGlobals.customEvents.Add(newDevECEvent); IEvent newCust1Event = cust1Event; newCust1Event.Date = cust1Date; NetGlobals.customEvents.Add(newCust1Event); IEvent newcust2Event = cust2Event; newcust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newcust2Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 3) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.EventText == _clickedEvent.Event.Name + " Dev Est Comp Date") { devECDate = evnt.Date; devECEvent = evnt; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Event = evnt; cust1Date = evnt.Date; originalCust1Event = evnt; drawOldCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); if (newDevDate == devECDate) { enabled = false; } else { enabled = true; } cust1Date = AddBusinessDays(newDevDate, int.Parse(individualData[4])); individualData[7] = cust1Date.ToString("d", CultureInfo.InvariantCulture); cust2Date = AddBusinessDays(cust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); cust3Date = AddBusinessDays(cust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust3Date, int.Parse(individualData[19])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[21] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[22] = daysLost.ToString(); drawNewEvent = newEvent; drawCust1Event.Date = cust1Date; drawCust2Event.Date = cust2Date; drawCust3Event.Date = cust3Date; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(devECEvent); NetGlobals.customEvents.Remove(cust1Event); NetGlobals.customEvents.Remove(cust2Event); NetGlobals.customEvents.Remove(cust3Event); IEvent newDevECEvent = devECEvent; newDevECEvent.Enabled = enabled; NetGlobals.customEvents.Add(newDevECEvent); IEvent newCust1Event = cust1Event; newCust1Event.Date = cust1Date; NetGlobals.customEvents.Add(newCust1Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 4) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.EventText == _clickedEvent.Event.Name + " Dev Est Comp Date") { devECDate = evnt.Date; devECEvent = evnt; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Event = evnt; cust1Date = evnt.Date; originalCust1Event = evnt; drawOldCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); if (newDevDate == devECDate) { enabled = false; } else { enabled = true; } cust1Date = AddBusinessDays(newDevDate, int.Parse(individualData[4])); individualData[7] = cust1Date.ToString("d", CultureInfo.InvariantCulture); cust2Date = AddBusinessDays(cust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); cust3Date = AddBusinessDays(cust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust4Date, int.Parse(individualData[24])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[26] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[27] = daysLost.ToString(); drawNewEvent = newEvent; drawCust1Event.Date = cust1Date; drawCust2Event.Date = cust2Date; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(devECEvent); NetGlobals.customEvents.Remove(cust1Event); NetGlobals.customEvents.Remove(cust2Event); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); IEvent newDevECEvent = devECEvent; newDevECEvent.Enabled = enabled; NetGlobals.customEvents.Add(newDevECEvent); IEvent newCust1Event = cust1Event; newCust1Event.Date = cust1Date; NetGlobals.customEvents.Add(newCust1Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 5) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.EventText == _clickedEvent.Event.Name + " Dev Est Comp Date") { devECDate = evnt.Date; devECEvent = evnt; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Event = evnt; cust1Date = evnt.Date; originalCust1Event = evnt; drawOldCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); if (newDevDate == devECDate) { enabled = false; } else { enabled = true; } cust1Date = AddBusinessDays(newDevDate, int.Parse(individualData[4])); individualData[7] = cust1Date.ToString("d", CultureInfo.InvariantCulture); cust2Date = AddBusinessDays(cust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); cust3Date = AddBusinessDays(cust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); cust5Date = AddBusinessDays(cust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust5Date, int.Parse(individualData[29])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[31] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[32] = daysLost.ToString(); drawNewEvent = newEvent; drawCust1Event.Date = cust1Date; drawCust2Event.Date = cust2Date; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; drawCust5Event.Date = cust5Date; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(devECEvent); NetGlobals.customEvents.Remove(cust1Event); NetGlobals.customEvents.Remove(cust2Event); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); NetGlobals.customEvents.Remove(cust5Event); IEvent newDevECEvent = devECEvent; newDevECEvent.Enabled = enabled; NetGlobals.customEvents.Add(newDevECEvent); IEvent newCust1Event = cust1Event; newCust1Event.Date = cust1Date; NetGlobals.customEvents.Add(newCust1Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 6) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.EventText == _clickedEvent.Event.Name + " Dev Est Comp Date") { devECDate = evnt.Date; devECEvent = evnt; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Event = evnt; cust1Date = evnt.Date; originalCust1Event = evnt; drawOldCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust1Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 7) { cust6Event = evnt; cust6Date = evnt.Date; originalCust6Event = evnt; drawOldCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); if (newDevDate == devECDate) { enabled = false; } else { enabled = true; } cust1Date = AddBusinessDays(newDevDate, int.Parse(individualData[4])); individualData[7] = cust1Date.ToString("d", CultureInfo.InvariantCulture); cust2Date = AddBusinessDays(cust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); cust3Date = AddBusinessDays(cust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); cust5Date = AddBusinessDays(cust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); cust6Date = AddBusinessDays(cust5Date, int.Parse(individualData[29])); individualData[32] = cust6Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust6Date, int.Parse(individualData[34])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[36] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[37] = daysLost.ToString(); drawNewEvent = newEvent; drawCust1Event.Date = cust1Date; drawCust2Event.Date = cust2Date; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; drawCust5Event.Date = cust5Date; drawCust6Event.Date = cust6Date; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(devECEvent); NetGlobals.customEvents.Remove(cust1Event); NetGlobals.customEvents.Remove(cust2Event); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); NetGlobals.customEvents.Remove(cust5Event); NetGlobals.customEvents.Remove(cust6Event); IEvent newDevECEvent = devECEvent; newDevECEvent.Enabled = enabled; NetGlobals.customEvents.Add(newDevECEvent); IEvent newCust1Event = cust1Event; newCust1Event.Date = cust1Date; NetGlobals.customEvents.Add(newCust1Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newCust6Event = cust6Event; newCust6Event.Date = cust6Date; NetGlobals.customEvents.Add(newCust6Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } } else if (_clickedEvent.Event.Order == 2) { DateTime newCust1Date = newEvent.Date; DateTime newRelDate = DateTime.Now; DateTime relDate = DateTime.Now; DateTime cust2Date = DateTime.Now; DateTime cust3Date = DateTime.Now; DateTime cust4Date = DateTime.Now; DateTime cust5Date = DateTime.Now; DateTime cust6Date = DateTime.Now; DateTime devCompDate = DateTime.Now; IEvent cust2Event = null; IEvent cust3Event = null; IEvent cust4Event = null; IEvent cust5Event = null; IEvent cust6Event = null; IEvent relEvent = null; string devName = ""; if (individualData[7] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } individualData[7] = newEvent.Date.ToString("d", CultureInfo.InvariantCulture); if (_clickedEvent.Event.NumberOfEvents == 1) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Dev Comp Date") { devCompDate = evnt.Date; devName = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } }); int storeInt = int.Parse(individualData[4]); individualData[4] = Comparison(newCust1Date, devCompDate).ToString(); if (int.Parse(individualData[4]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before "+ devName); individualData[4] = storeInt.ToString(); _clickedEvent = null; return; } newRelDate = AddBusinessDays(newCust1Date, int.Parse(individualData[9])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[11] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[12] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 2) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Dev Comp Date") { devCompDate = evnt.Date; devName = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[4]); individualData[4] = Comparison(newCust1Date, devCompDate).ToString(); if (int.Parse(individualData[4]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + devName); individualData[4] = storeInt.ToString(); _clickedEvent = null; return; } cust2Date = AddBusinessDays(newCust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust2Date, int.Parse(individualData[14])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[16] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[17] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust2Event.Date = cust2Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust2Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 3) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Dev Comp Date") { devCompDate = evnt.Date; devName = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[4]); individualData[4] = Comparison(newCust1Date, devCompDate).ToString(); if (int.Parse(individualData[4]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + devName); individualData[4] = storeInt.ToString(); _clickedEvent = null; return; } cust2Date = AddBusinessDays(newCust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); cust3Date = AddBusinessDays(cust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust3Date, int.Parse(individualData[19])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[21] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[22] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust2Event.Date = cust2Date; drawCust3Event.Date = cust3Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust2Event); NetGlobals.customEvents.Remove(cust3Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 4) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Dev Comp Date") { devCompDate = evnt.Date; devName = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[4]); individualData[4] = Comparison(newCust1Date, devCompDate).ToString(); if (int.Parse(individualData[4]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + devName); individualData[4] = storeInt.ToString(); _clickedEvent = null; return; } cust2Date = AddBusinessDays(newCust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); cust3Date = AddBusinessDays(cust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust4Date, int.Parse(individualData[24])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[26] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[27] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust2Event.Date = cust2Date; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust2Event); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 5) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Dev Comp Date") { devCompDate = evnt.Date; devName = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[4]); individualData[4] = Comparison(newCust1Date, devCompDate).ToString(); if (int.Parse(individualData[4]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + devName); individualData[4] = storeInt.ToString(); _clickedEvent = null; return; } cust2Date = AddBusinessDays(newCust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); cust3Date = AddBusinessDays(cust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); cust5Date = AddBusinessDays(cust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust5Date, int.Parse(individualData[29])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[31] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[32] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust2Event.Date = cust2Date; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; drawCust5Event.Date = cust5Date; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust2Event); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); NetGlobals.customEvents.Remove(cust5Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 6) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.EventText == _clickedEvent.Event.Name + " Dev Comp Date") { devCompDate = evnt.Date; devName = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Event = evnt; cust2Date = evnt.Date; originalCust2Event = evnt; drawOldCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust2Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 7) { cust6Event = evnt; cust6Date = evnt.Date; originalCust6Event = evnt; drawOldCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[4]); individualData[4] = Comparison(newCust1Date, devCompDate).ToString(); if (int.Parse(individualData[4]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + devName); individualData[4] = storeInt.ToString(); _clickedEvent = null; return; } cust2Date = AddBusinessDays(newCust1Date, int.Parse(individualData[9])); individualData[12] = cust2Date.ToString("d", CultureInfo.InvariantCulture); cust3Date = AddBusinessDays(cust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); cust5Date = AddBusinessDays(cust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); cust6Date = AddBusinessDays(cust5Date, int.Parse(individualData[29])); individualData[32] = cust6Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust6Date, int.Parse(individualData[34])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[36] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[37] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust2Event.Date = cust2Date; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; drawCust5Event.Date = cust5Date; drawCust6Event.Date = cust6Date; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust2Event); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); NetGlobals.customEvents.Remove(cust5Event); NetGlobals.customEvents.Remove(cust6Event); IEvent newCust2Event = cust2Event; newCust2Event.Date = cust2Date; NetGlobals.customEvents.Add(newCust2Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newCust6Event = cust6Event; newCust6Event.Date = cust6Date; NetGlobals.customEvents.Add(newCust6Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } } else if (_clickedEvent.Event.Order == 3) { DateTime newCust2Date = newEvent.Date; DateTime newRelDate = DateTime.Now; DateTime relDate = DateTime.Now; DateTime cust1Date = DateTime.Now; DateTime cust3Date = DateTime.Now; DateTime cust4Date = DateTime.Now; DateTime cust5Date = DateTime.Now; DateTime cust6Date = DateTime.Now; IEvent cust3Event = null; IEvent cust4Event = null; IEvent cust5Event = null; IEvent cust6Event = null; IEvent relEvent = null; string cust1Name = ""; if (individualData[12] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } individualData[12] = newEvent.Date.ToString("d", CultureInfo.InvariantCulture); if (_clickedEvent.Event.NumberOfEvents == 2) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Date = evnt.Date; cust1Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } }); int storeInt = int.Parse(individualData[9]); individualData[9] = Comparison(newCust2Date, cust1Date).ToString(); if (int.Parse(individualData[9]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust1Name); individualData[9] = storeInt.ToString(); _clickedEvent = null; return; } newRelDate = AddBusinessDays(newCust2Date, int.Parse(individualData[14])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[16] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[17] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 3) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Date = evnt.Date; cust1Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[9]); individualData[9] = Comparison(newCust2Date, cust1Date).ToString(); if (int.Parse(individualData[9]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust1Name); individualData[9] = storeInt.ToString(); _clickedEvent = null; return; } cust3Date = AddBusinessDays(newCust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust3Date, int.Parse(individualData[19])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[21] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[22] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust3Event.Date = cust3Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust3Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 4) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Date = evnt.Date; cust1Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[9]); individualData[9] = Comparison(newCust2Date, cust1Date).ToString(); if (int.Parse(individualData[9]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust1Name); individualData[9] = storeInt.ToString(); _clickedEvent = null; return; } cust3Date = AddBusinessDays(newCust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust4Date, int.Parse(individualData[24])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[26] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[27] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 5) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Date = evnt.Date; cust1Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[9]); individualData[9] = Comparison(newCust2Date, cust1Date).ToString(); if (int.Parse(individualData[9]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust1Name); individualData[9] = storeInt.ToString(); _clickedEvent = null; return; } cust3Date = AddBusinessDays(newCust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); cust5Date = AddBusinessDays(cust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust5Date, int.Parse(individualData[29])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[31] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[32] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; drawCust5Event.Date = cust5Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); NetGlobals.customEvents.Remove(cust5Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 6) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 2) { cust1Date = evnt.Date; cust1Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Event = evnt; cust3Date = evnt.Date; originalCust3Event = evnt; drawOldCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust3Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 7) { cust6Event = evnt; cust6Date = evnt.Date; originalCust6Event = evnt; drawOldCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[9]); individualData[9] = Comparison(newCust2Date, cust1Date).ToString(); if (int.Parse(individualData[9]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust1Name); individualData[9] = storeInt.ToString(); _clickedEvent = null; return; } cust3Date = AddBusinessDays(newCust2Date, int.Parse(individualData[14])); individualData[17] = cust3Date.ToString("d", CultureInfo.InvariantCulture); cust4Date = AddBusinessDays(cust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); cust5Date = AddBusinessDays(cust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); cust6Date = AddBusinessDays(cust5Date, int.Parse(individualData[29])); individualData[32] = cust6Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust6Date, int.Parse(individualData[34])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[36] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[37] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust3Event.Date = cust3Date; drawCust4Event.Date = cust4Date; drawCust5Event.Date = cust5Date; drawCust6Event.Date = cust6Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust3Event); NetGlobals.customEvents.Remove(cust4Event); NetGlobals.customEvents.Remove(cust5Event); NetGlobals.customEvents.Remove(cust6Event); IEvent newCust3Event = cust3Event; newCust3Event.Date = cust3Date; NetGlobals.customEvents.Add(newCust3Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newCust6Event = cust6Event; newCust6Event.Date = cust6Date; NetGlobals.customEvents.Add(newCust6Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } } else if (_clickedEvent.Event.Order == 4) { DateTime newCust3Date = newEvent.Date; DateTime newRelDate = DateTime.Now; DateTime relDate = DateTime.Now; DateTime cust2Date = DateTime.Now; DateTime cust4Date = DateTime.Now; DateTime cust5Date = DateTime.Now; DateTime cust6Date = DateTime.Now; IEvent cust4Event = null; IEvent cust5Event = null; IEvent cust6Event = null; IEvent relEvent = null; string cust2Name = ""; if (individualData[17] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } individualData[17] = newEvent.Date.ToString("d", CultureInfo.InvariantCulture); if (_clickedEvent.Event.NumberOfEvents == 3) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Date = evnt.Date; cust2Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } }); int storeInt = int.Parse(individualData[14]); individualData[14] = Comparison(newCust3Date, cust2Date).ToString(); if (int.Parse(individualData[14]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust2Name); individualData[14] = storeInt.ToString(); _clickedEvent = null; return; } newRelDate = AddBusinessDays(newCust3Date, int.Parse(individualData[19])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += Comparison(newRelDate, relDate); individualData[21] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[22] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 4) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Date = evnt.Date; cust2Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[14]); individualData[14] = Comparison(newCust3Date, cust2Date).ToString(); if (int.Parse(individualData[14]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust2Name); individualData[14] = storeInt.ToString(); _clickedEvent = null; return; } cust4Date = AddBusinessDays(newCust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust4Date, int.Parse(individualData[24])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[26] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[27] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust4Event.Date = cust4Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust4Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 5) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Date = evnt.Date; cust2Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[14]); individualData[14] = Comparison(newCust3Date, cust2Date).ToString(); if (int.Parse(individualData[14]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust2Name); individualData[14] = storeInt.ToString(); _clickedEvent = null; return; } cust4Date = AddBusinessDays(newCust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); cust5Date = AddBusinessDays(cust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust5Date, int.Parse(individualData[29])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[31] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[32] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust4Event.Date = cust4Date; drawCust5Event.Date = cust5Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust4Event); NetGlobals.customEvents.Remove(cust5Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } else if (_clickedEvent.Event.NumberOfEvents == 6) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 3) { cust2Date = evnt.Date; cust2Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Event = evnt; cust4Date = evnt.Date; originalCust4Event = evnt; drawOldCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust4Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 7) { cust6Event = evnt; cust6Date = evnt.Date; originalCust6Event = evnt; drawOldCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[14]); individualData[14] = Comparison(newCust3Date, cust2Date).ToString(); if (int.Parse(individualData[14]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust2Name); individualData[14] = storeInt.ToString(); _clickedEvent = null; return; } cust4Date = AddBusinessDays(newCust3Date, int.Parse(individualData[19])); individualData[22] = cust4Date.ToString("d", CultureInfo.InvariantCulture); cust5Date = AddBusinessDays(cust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); cust6Date = AddBusinessDays(cust5Date, int.Parse(individualData[29])); individualData[32] = cust6Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust6Date, int.Parse(individualData[34])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[36] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[37] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust4Event.Date = cust4Date; drawCust5Event.Date = cust5Date; drawCust6Event.Date = cust6Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust4Event); NetGlobals.customEvents.Remove(cust5Event); NetGlobals.customEvents.Remove(cust6Event); IEvent newCust4Event = cust4Event; newCust4Event.Date = cust4Date; NetGlobals.customEvents.Add(newCust4Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newCust6Event = cust6Event; newCust6Event.Date = cust6Date; NetGlobals.customEvents.Add(newCust6Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } } else if (_clickedEvent.Event.Order == 5) { DateTime newCust4Date = newEvent.Date; DateTime newRelDate = DateTime.Now; DateTime relDate = DateTime.Now; DateTime cust3Date = DateTime.Now; DateTime cust5Date = DateTime.Now; DateTime cust6Date = DateTime.Now; IEvent cust5Event = null; IEvent cust6Event = null; IEvent relEvent = null; string cust3Name = ""; if (individualData[22] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } individualData[22] = newEvent.Date.ToString("d", CultureInfo.InvariantCulture); if (_clickedEvent.Event.NumberOfEvents == 4) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Date = evnt.Date; cust3Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } }); int storeInt = int.Parse(individualData[19]); individualData[19] = Comparison(newCust4Date, cust3Date).ToString(); if (int.Parse(individualData[19]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust3Name); individualData[19] = storeInt.ToString(); _clickedEvent = null; return; } newRelDate = AddBusinessDays(newCust4Date, int.Parse(individualData[24])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[26] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[27] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } if (_clickedEvent.Event.NumberOfEvents == 5) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Date = evnt.Date; cust3Name = evnt.Name; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[19]); individualData[19] = Comparison(newCust4Date, cust3Date).ToString(); if (int.Parse(individualData[19]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust3Name); individualData[19] = storeInt.ToString(); _clickedEvent = null; return; } cust5Date = AddBusinessDays(newCust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust5Date, int.Parse(individualData[29])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[31] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[32] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust5Event.Date = cust5Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust5Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } if (_clickedEvent.Event.NumberOfEvents == 6) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 4) { cust3Date = evnt.Date; cust3Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Event = evnt; cust5Date = evnt.Date; originalCust5Event = evnt; drawOldCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust5Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 7) { cust6Event = evnt; cust6Date = evnt.Date; originalCust6Event = evnt; drawOldCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[19]); individualData[19] = Comparison(newCust4Date, cust3Date).ToString(); if (int.Parse(individualData[19]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust3Name); individualData[19] = storeInt.ToString(); _clickedEvent = null; return; } cust5Date = AddBusinessDays(newCust4Date, int.Parse(individualData[24])); individualData[27] = cust5Date.ToString("d", CultureInfo.InvariantCulture); cust6Date = AddBusinessDays(cust5Date, int.Parse(individualData[29])); individualData[32] = cust6Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust6Date, int.Parse(individualData[34])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[36] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[37] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust5Event.Date = cust5Date; drawCust6Event.Date = cust6Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust5Event); NetGlobals.customEvents.Remove(cust6Event); IEvent newCust5Event = cust5Event; newCust5Event.Date = cust5Date; NetGlobals.customEvents.Add(newCust5Event); IEvent newCust6Event = cust6Event; newCust6Event.Date = cust6Date; NetGlobals.customEvents.Add(newCust6Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } } else if (_clickedEvent.Event.Order == 6) { DateTime newCust5Date = newEvent.Date; DateTime newRelDate = DateTime.Now; DateTime relDate = DateTime.Now; DateTime cust4Date = DateTime.Now; DateTime cust6Date = DateTime.Now; IEvent cust6Event = null; IEvent relEvent = null; string cust4Name = ""; if (individualData[27] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } individualData[27] = newEvent.Date.ToString("d", CultureInfo.InvariantCulture); if (_clickedEvent.Event.NumberOfEvents == 5) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Date = evnt.Date; cust4Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } }); int storeInt = int.Parse(individualData[24]); individualData[24] = Comparison(newCust5Date, cust4Date).ToString(); if (int.Parse(individualData[24]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust4Name); individualData[24] = storeInt.ToString(); _clickedEvent = null; return; } newRelDate = AddBusinessDays(newCust5Date, int.Parse(individualData[29])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[31] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[32] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } if (_clickedEvent.Event.NumberOfEvents == 6) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 5) { cust4Date = evnt.Date; cust4Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } else if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 7) { cust6Event = evnt; cust6Date = evnt.Date; originalCust6Event = evnt; drawOldCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; drawCust6Event = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents }; } }); int storeInt = int.Parse(individualData[24]); individualData[24] = Comparison(newCust5Date, cust4Date).ToString(); if (int.Parse(individualData[24]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust4Name); individualData[24] = storeInt.ToString(); _clickedEvent = null; return; } cust6Date = AddBusinessDays(newCust5Date, int.Parse(individualData[29])); individualData[32] = cust6Date.ToString("d", CultureInfo.InvariantCulture); newRelDate = AddBusinessDays(cust6Date, int.Parse(individualData[34])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[36] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[37] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; drawCust6Event.Date = cust6Date; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); NetGlobals.customEvents.Remove(cust6Event); IEvent newCust6Event = cust6Event; newCust6Event.Date = cust6Date; NetGlobals.customEvents.Add(newCust6Event); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } } else if (_clickedEvent.Event.Order == 7) { DateTime newCust6Date = newEvent.Date; DateTime newRelDate = DateTime.Now; DateTime relDate = DateTime.Now; DateTime cust5Date = DateTime.Now; IEvent relEvent = null; string cust5Name = ""; if (individualData[32] == newEvent.Date.ToString("d", CultureInfo.InvariantCulture)) { invisEvent.Enabled = true; MessageBox.Show("Nothing has changed"); _clickedEvent = null; return; } individualData[32] = newEvent.Date.ToString("d", CultureInfo.InvariantCulture); if (_clickedEvent.Event.NumberOfEvents == 6) { NetGlobals.customEvents.ForEach(delegate(IEvent evnt) { if (evnt.Name == _clickedEvent.Event.Name && evnt.Order == 6) { cust5Date = evnt.Date; cust5Name = evnt.Name; } else if (evnt.EventText == _clickedEvent.Event.Name + " Release Date") { relEvent = evnt; relDate = evnt.Date; originalRel = evnt; drawOldRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = Color.Black, Enabled = false, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; drawRelEvent = new CustomEvent { Name = evnt.Name, EventText = evnt.EventText, IgnoreTimeComponent = true, Date = evnt.Date, EventColor = evnt.EventColor, Order = evnt.Order, NumberOfEvents = evnt.NumberOfEvents, }; } }); int storeInt = int.Parse(individualData[29]); individualData[29] = Comparison(newCust6Date, cust5Date).ToString(); if (int.Parse(individualData[29]) < 0) { invisEvent.Enabled = true; MessageBox.Show("This event cannot be before " + cust5Name); individualData[29] = storeInt.ToString(); _clickedEvent = null; return; } newRelDate = AddBusinessDays(newCust6Date, int.Parse(individualData[34])); while (newRelDate.DayOfWeek != DayOfWeek.Tuesday && newRelDate.DayOfWeek != DayOfWeek.Wednesday && newRelDate.DayOfWeek != DayOfWeek.Thursday) { newRelDate = AddBusinessDays(newRelDate, 1); } currentDaysLost = Comparison(newRelDate, relDate); daysLost += currentDaysLost; individualData[36] = newRelDate.ToString("d", CultureInfo.InvariantCulture); individualData[37] = daysLost.ToString(); drawNewEvent = newEvent; drawRelEvent.Date = newRelDate; if (Checker(oldReleaseDate, Comparison(newRelDate, relDate), _clickedEvent.Event)) { commit = true; NetGlobals.customEvents.Add(newEvent); NetGlobals.customEvents.Remove(_clickedEvent.Event); NetGlobals.customEvents.Remove(relEvent); IEvent newRelEvent = relEvent; newRelEvent.Date = newRelDate; NetGlobals.customEvents.Add(newRelEvent); NetGlobals.tempEvents.Clear(); NetGlobals.tempEvents.AddRange(NetGlobals.customEvents); saveTemp(); Refresh(); } } } } } } }
public void NewEvent(string name, string type, string[] date, Color color, int order, int numberOfEvents) { var newEvent = new CustomEvent { Name = name, EventText = name + " " + type, IgnoreTimeComponent = true, Date = new DateTime(int.Parse(date[2]), int.Parse(date[0]), int.Parse(date[1])), EventColor = color, Order = order, NumberOfEvents = numberOfEvents, }; Calendar.NET.NetGlobals.customEvents.Add(newEvent); calendar1.AddEvent(newEvent); }