private void changeDate(int newIndex, section section) { String[] sections = lastDateTemplate.Split(new char[] { '/', '-', '.' }); switch (sections[(int)section]) { case "M": case "MM": DisplayedDate = DisplayedDate.AddMonths((newIndex + 1) - DisplayedDate.Month); break; case "d": case "dd": DisplayedDate = DisplayedDate.AddDays((newIndex + 1) - DisplayedDate.Day); break; case "yyyy": case "yy": DisplayedDate = DisplayedDate.AddYears((newIndex + MinYear) - DisplayedDate.Year); break; default: break; } }
public Budget() { InitializeComponent(); Presenter = new MainWindowPresenter(); DisplayedDate = DateTime.Now; TotalIncome = 0; labelMonth.Text = string.Format("{0}, {1}", DisplayedDate.ToString("MMMM"), DisplayedDate.ToString("yyyy")); GenerateBillsIfNewMonth(); ShowBills(); ShowIncome(); ShowAccounts(); }
private void buttonPrevMonth_Click(object sender, EventArgs e) { DisplayedDate = DisplayedDate.AddMonths(-1); labelMonth.Text = string.Format("{0:MMMM}, {1:yyyy}", DisplayedDate, DisplayedDate); ClearAndReload(); }
private void buttonNextMonth_Click(object sender, EventArgs e) { DisplayedDate = DisplayedDate.AddMonths(1); labelMonth.Text = $@"{DisplayedDate:MMMM}, {DisplayedDate:yyyy}"; ClearAndReload(); }
public RenewalTerm(XmlNode termNode, bool IsManagedItem, Template template, bool isFilter) : base(termNode, template, isFilter) { _isManagedItem = IsManagedItem; TermType = TermType.Renewal; NameRequired = true; if (template != null) if (template.RenewalEvent == null) template.Events.Add(new Event(EventType.Renewal, IsManagedItem)); XmlNode nodeEffectiveDate = termNode.SelectSingleNode(XMLNames._E_EffectiveDate); XmlNode nodeExpirationDate = termNode.SelectSingleNode(XMLNames._E_ExpirationDate); XmlNode nodeInitialDurationUnit = termNode.SelectSingleNode(XMLNames._E_InitialDurationUnit); XmlNode nodeInitialDurationUnitCount = termNode.SelectSingleNode(XMLNames._E_InitialDurationUnitCount); XmlNode nodeRenewalDurationUnit = termNode.SelectSingleNode(XMLNames._E_RenewalDurationUnit); XmlNode nodeRenewalDurationUnitCount = termNode.SelectSingleNode(XMLNames._E_RenewalDurationUnitCount); XmlNodeList listInitialDurationUnits = termNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_InitialDurationUnit,XMLNames._E_DurationUnit)); XmlNodeList listRenewalDurationUnits = termNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_RenewalDurationUnit,XMLNames._E_DurationUnit)); _renewerRoles = new List<Role>(); XmlNodeList listRenewers = termNode.SelectNodes(Utility.XMLHelper.GetXPath(false, XMLNames._E_Renewers, XMLNames._E_Renewer)); if (listRenewers != null) foreach (XmlNode nodeRenewer in listRenewers) { _renewerRoles.Add(new Role(Utility.XMLHelper.GetAttributeString(nodeRenewer, XMLNames._A_Role))); } _renewalType = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_RenewalType); _popUpText = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_PopUpText); _allowBackDating = Utility.XMLHelper.GetAttributeBool(termNode, XMLNames._A_AllowBackDating); _renewalCount = Utility.XMLHelper.GetAttributeInt(termNode, XMLNames._A_RenewalCount); _renewalDurationEditable = Utility.XMLHelper.GetAttributeBool(termNode, XMLNames._A_RenewalDurationEditable); _effectiveDateFormat = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_EffectiveDateFormat); _expirationDateFormat = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_ExpirationDateFormat); try { _displayedDate = (DisplayedDate)Enum.Parse(typeof(DisplayedDate), Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_DisplayedDate)); } catch { _displayedDate = DisplayedDate.ExpirationDate; } _sendNotification = Utility.XMLHelper.GetAttributeBool(termNode, XMLNames._A_SendNotification); string offsetType = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_DateOffsetType); try { _renewalTermType = (RenewalTermType)Enum.Parse(typeof(RenewalTermType), Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_RenewalTermType)); } catch (ArgumentException) { _renewalTermType = RenewalTermType.None; } _popUpText = Utility.XMLHelper.GetAttributeString(termNode, XMLNames._A_PopUpText); //EffectiveDate if (nodeEffectiveDate != null) { _effectiveDate = Utility.XMLHelper.GetValueDate(nodeEffectiveDate); } //ExpirationDate if (nodeExpirationDate != null) { //_expirationDate = Utility.XMLHelper.GetValueDate(nodeExpirationDate); _expirationDate_DBField = Utility.XMLHelper.GetAttributeString(nodeExpirationDate, XMLNames._A_DBFieldName); } //InitialDurationUnit if (nodeInitialDurationUnit != null) { _initialDurationUnit_PopUpIfNot = Utility.XMLHelper.GetAttributeBool(nodeInitialDurationUnit, XMLNames._A_PopUpIfNot); _initialDurationUnit_PopUpText = Utility.XMLHelper.GetAttributeString(nodeInitialDurationUnit, XMLNames._A_PopUpText); //Sub element DurationUnit_Value, Display if (listInitialDurationUnits != null) { _initialDurationUnits = new List<DurationUnit>(listInitialDurationUnits.Count); foreach (XmlNode nodeInitialDurationUnitDU in listInitialDurationUnits) { DurationUnit InitialDurationUnit = new DurationUnit(nodeInitialDurationUnitDU); _initialDurationUnits.Add(InitialDurationUnit); } } } //InitialDurationUnitCount if (nodeInitialDurationUnitCount != null) { _initialDurationUnitCountDefault = Utility.XMLHelper.GetAttributeInt(nodeInitialDurationUnitCount, XMLNames._A_Default); _initialDurationUnitCount = Utility.XMLHelper.GetValueInt(nodeInitialDurationUnitCount); } //RenewalDurationUnit if (nodeRenewalDurationUnit != null) { _renewalDurationUnit_PopUpIfNot = Utility.XMLHelper.GetAttributeBool(nodeRenewalDurationUnit, XMLNames._A_PopUpIfNot); _renewalDurationUnit_PopUpText = Utility.XMLHelper.GetAttributeString(nodeRenewalDurationUnit, XMLNames._A_PopUpText); //Sub element DurationUnit_Value, Display if (listRenewalDurationUnits != null) { _renewalDurationUnits = new List<DurationUnit>(listRenewalDurationUnits.Count); foreach (XmlNode nodeRenewalDurationUnitDU in listRenewalDurationUnits) { DurationUnit renewalDurationUnit = new DurationUnit(nodeRenewalDurationUnitDU); _renewalDurationUnits.Add(renewalDurationUnit); } } } //RenewalDurationUnitCount if (nodeRenewalDurationUnitCount != null) { _renewalDurationUnitCountDefault = Utility.XMLHelper.GetAttributeInt(nodeRenewalDurationUnitCount, XMLNames._A_Default); _renewalDurationUnitCount = Utility.XMLHelper.GetValueInt(nodeRenewalDurationUnitCount); } }
public RenewalTerm(bool systemTerm, bool IsManagedItem, Template template, bool isFilter) : base(systemTerm, template, isFilter) { TermType = TermType.Renewal; NameRequired = true; _initialDurationUnits = new List<DurationUnit>(); _renewalDurationUnits = new List<DurationUnit>(); _renewerRoles = new List<Role>(); _isManagedItem = IsManagedItem; _displayedDate = DisplayedDate.ExpirationDate; if (template != null) if (template.RenewalEvent == null) template.Events.Add(new Event(EventType.Renewal, IsManagedItem)); }