public void Test_GDMDateItemAsIConvertible() { var dtx1 = new GDMDateValue(); dtx1.ParseString("05 JAN 2013"); IConvertible dtItem1 = new GDMDateItem(dtx1); Assert.AreEqual(TypeCode.Object, dtItem1.GetTypeCode()); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToBoolean(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToChar(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToSByte(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToByte(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToInt16(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToUInt16(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToInt32(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToUInt32(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToInt64(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToUInt64(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToSingle(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToDouble(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToDecimal(null); }); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToDateTime(null); }); Assert.AreEqual("05.01.2013", dtItem1.ToString(null)); Assert.Throws(typeof(NotImplementedException), () => { dtItem1.ToType(typeof(Int32), null); }); }
public void Test_GDMDateItem_Common() { var dtx1 = new GDMDateValue(); dtx1.ParseString("05 JAN 2013"); var dtItem1 = new GDMDateItem(dtx1); Assert.AreEqual("05.01.2013", dtItem1.ToString()); var dtx2 = new GDMDateValue(); dtx2.ParseString("17 FEB 2013"); var dtItem2 = new GDMDateItem(dtx2); Assert.AreEqual("17.02.2013", dtItem2.ToString()); Assert.AreEqual(0, dtItem1.CompareTo(dtItem1)); Assert.AreEqual(-1, dtItem1.CompareTo(dtItem2)); Assert.AreEqual(-1, dtItem1.CompareTo(null)); Assert.AreEqual(+1, dtItem2.CompareTo(dtItem1)); dtItem1 = new GDMDateItem(dtx1); dtItem2 = new GDMDateItem(null); Assert.AreEqual(-1, dtItem1.CompareTo(dtItem2)); dtItem1 = new GDMDateItem(null); dtItem2 = new GDMDateItem(dtx2); Assert.AreEqual(+1, dtItem1.CompareTo(dtItem2)); dtItem1 = new GDMDateItem(null); dtItem2 = new GDMDateItem(null); Assert.AreEqual(0, dtItem1.CompareTo(dtItem2)); }
public GDMDateValue GetActualDates() { var result = new GDMDateValue(); result.ParseString(ActualDates); return(result); }
public Event(GDMDateValue date, string evType, string description, string overview, string note, bool important, bool capitalise) { fPreference = EventPreference.Unknown; fDate = date; if (capitalise) { GMHelper.Capitalise(ref description); } if (description.Length > 0) { if (description[description.Length - 1] == '.') { fDescription = description.Substring(0, description.Length - 1); } else { fDescription = description; } } fOverview = overview; fImportant = important; fNote = note; if (note == "") { fNote = null; } fType = evType; }
public void SetActualDates(GDMDateValue value) { if (value == null) { throw new ArgumentNullException("value"); } ActualDates = value.StringValue; }
public static int GetEventsYearsDiff(GDMDateValue ev1, GDMDateValue ev2, bool currentEnd = true) { int result = -1; try { int dt1 = GetChronologicalYear(ev1); int dt2 = GetChronologicalYear(ev2); if (currentEnd && dt2 == 0) { dt2 = DateTime.Now.Year; } if (dt1 != 0 && dt2 != 0) { result = Math.Abs(dt2 - dt1); } } catch (Exception ex) { Logger.WriteError("GKUtils.GetEventsYearsDiff()", ex); } return(result); }
public CListableYear(GDMDateValue date) { fDate = date; base.Text = ToString(); }
public QualifiedDate(GDMDateValue date, DateQualification qualification) { Date = date; Qualification = qualification; }
public static int GetChronologicalYear(GDMDateValue dateVal) { return((dateVal == null) ? 0 : dateVal.GetChronologicalYear()); }
public OccupationCounter(string name, GDMDateValue date) { Name = name; Date = date; }