/// <summary> /// Creates an instance of a Holiday object that does not move holidays. /// This is used in conjunction with adding a fixed holiday which does /// not need to be moved as the date is specifically picked for a /// specific day. /// </summary> /// <example> /// <code> /// DateTime Date = new DateTime(2006, 5, 23); /// bool singleYear = true; /// CHoliday myHoliday = new CHoliday(2, "BDay", Date, 0, eFrequency.SINGLE); /// </code> /// </example> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 05/23/06 ach N/A N/A Creation of class public CHoliday(int ID, string Name, DateTime date, int index, eFrequency yearFrequency) { m_intHolidayID = ID; m_strHolidayName = Name; m_dtHolidayDate = date; if (0 == index) { m_HolidayTypeIndex = eTypeIndex.TYPE_1; } else { m_HolidayTypeIndex = eTypeIndex.TYPE_2; } m_YearFrequency = yearFrequency; m_MoveFromSat = eMoveHoliday.DONT; m_MoveFromSun = eMoveHoliday.DONT; } //CHoliday
} //HolidayToXml /// <summary> /// This class takes a xml node of a holiday and converts it /// to a holiday type. /// </summary> /// <param name="HolNode"> /// Represents a xml node of a holiday. /// </param> /// <returns> /// A holiday type that corresponds to the xml node parameter. /// </returns> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 06/02/06 ach N/A N/A Creation of Class private CHoliday XmlToHoliday(XmlNode HolNode) { // Local Names string name; int id; int type; int month; int day; int year; eFrequency frequency; eMoveHoliday moveSat = eMoveHoliday.DONT; eMoveHoliday moveSun = eMoveHoliday.DONT; // Get the Holiday ID id = int.Parse(HolNode.FirstChild.InnerText); // Get The Holiday Name name = HolNode.FirstChild.NextSibling.InnerText; // Get The Holiday Day Type Index type = int.Parse(HolNode.FirstChild.NextSibling.NextSibling.InnerText); // Get The year if Holiday is a single year if ("SingleYear" == HolNode.LastChild.LastChild.Name) { frequency = eFrequency.SINGLE; year = int.Parse(HolNode.LastChild.LastChild.InnerText); } // Otherwise set the year to default to 2000 else { frequency = eFrequency.MULTI; year = 2000; switch (HolNode.LastChild.LastChild.Attributes[0].Value) { case "DONT": moveSat = eMoveHoliday.DONT; break; case "FRI": moveSat = eMoveHoliday.FRI; break; case "MON": moveSat = eMoveHoliday.MON; break; default: break; } switch (HolNode.LastChild.LastChild.Attributes[1].Value) { case "DONT": moveSun = eMoveHoliday.DONT; break; case "FRI": moveSun = eMoveHoliday.FRI; break; case "MON": moveSun = eMoveHoliday.MON; break; default: break; } } // Get the month and day XmlNode fixedHol = HolNode.LastChild.PreviousSibling.LastChild; month = int.Parse(fixedHol.FirstChild.InnerText); day = int.Parse(fixedHol.LastChild.InnerText); return(new CHoliday(id, name, new DateTime(year, month, day), type, frequency, moveSat, moveSun)); } //XmlToHoliday