private GDMCustomDate GetDate() { GDMCustomDate result = null; GDMCalendar cal1 = cmbDate1Calendar.GetSelectedTag <GDMCalendar>(); GDMCalendar cal2 = cmbDate2Calendar.GetSelectedTag <GDMCalendar>(); GDMDate gcd1 = GDMDate.CreateByFormattedStr(txtDate1.NormalizeDate, cal1, true); if (gcd1 == null) { throw new ArgumentNullException("gcd1"); } GDMDate gcd2 = GDMDate.CreateByFormattedStr(txtDate2.NormalizeDate, cal2, true); if (gcd2 == null) { throw new ArgumentNullException("gcd2"); } gcd1.YearBC = chkBC1.Checked.GetValueOrDefault(); gcd2.YearBC = chkBC2.Checked.GetValueOrDefault(); switch (cmbDateType.SelectedIndex) { case 0: result = gcd1; break; case 1: // BEF gcd2 result = GDMCustomDate.CreateRange(null, gcd2); break; case 2: // AFT gcd1 result = GDMCustomDate.CreateRange(gcd1, null); break; case 3: // "BET " + gcd1 + " AND " + gcd2 result = GDMCustomDate.CreateRange(gcd1, gcd2); break; case 4: // FROM gcd1 result = GDMCustomDate.CreatePeriod(gcd1, null); break; case 5: // TO gcd2 result = GDMCustomDate.CreatePeriod(null, gcd2); break; case 6: // FROM gcd1 TO gcd2 result = GDMCustomDate.CreatePeriod(gcd1, gcd2); break; case 7: // ABT gcd1 result = GDMCustomDate.CreateApproximated(gcd1, GDMApproximated.daAbout); break; case 8: // CAL gcd1 result = GDMCustomDate.CreateApproximated(gcd1, GDMApproximated.daCalculated); break; case 9: // EST gcd1 result = GDMCustomDate.CreateApproximated(gcd1, GDMApproximated.daEstimated); break; } return(result); }
private GDMCustomDate AssembleDate() { GDMCustomDate result = null; GDMCalendar cal1 = (GDMCalendar)fView.Date1Calendar.SelectedTag; GDMCalendar cal2 = (GDMCalendar)fView.Date2Calendar.SelectedTag; GDMDate gcd1 = GDMDate.CreateByFormattedStr(fView.Date1.NormalizeDate, cal1, true); if (gcd1 == null) { throw new ArgumentNullException("gcd1"); } GDMDate gcd2 = GDMDate.CreateByFormattedStr(fView.Date2.NormalizeDate, cal2, true); if (gcd2 == null) { throw new ArgumentNullException("gcd2"); } gcd1.YearBC = fView.Date1BC.Checked; gcd2.YearBC = fView.Date2BC.Checked; switch (fView.EventDateType.SelectedIndex) { case 0: result = gcd1; break; case 1: // BEF gcd2 result = GDMCustomDate.CreateRange(null, null, gcd2); break; case 2: // AFT gcd1 result = GDMCustomDate.CreateRange(null, gcd1, null); break; case 3: // "BET " + gcd1 + " AND " + gcd2 result = GDMCustomDate.CreateRange(null, gcd1, gcd2); break; case 4: // FROM gcd1 result = GDMCustomDate.CreatePeriod(null, gcd1, null); break; case 5: // TO gcd2 result = GDMCustomDate.CreatePeriod(null, null, gcd2); break; case 6: // FROM gcd1 TO gcd2 result = GDMCustomDate.CreatePeriod(null, gcd1, gcd2); break; case 7: // ABT gcd1 result = GDMCustomDate.CreateApproximated(null, gcd1, GDMApproximated.daAbout); break; case 8: // CAL gcd1 result = GDMCustomDate.CreateApproximated(null, gcd1, GDMApproximated.daCalculated); break; case 9: // EST gcd1 result = GDMCustomDate.CreateApproximated(null, gcd1, GDMApproximated.daEstimated); break; } return(result); }