public static NGDate ToNGDate(this ContactDate date) { var ngDate = new NGDate() { Kind = (NGDateKind)date.Kind, Month = date.Month, Day = date.Day, Year = date.Year, Description = date.Description }; return(ngDate); }
public static ContactDate ToContactDate(this NGDate date) { var winDate = new ContactDate() { Kind = (ContactDateKind)date.Kind, Month = date.Month, Day = date.Day, Year = date.Year, Description = date.Description }; return(winDate); }
private void BirthDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e) { var picker = sender as DatePicker; DateTime?date = picker.SelectedDate; if (date == null) { // ... A null object. //this.Title = "No date"; } else { // ... No need to display the time. //this.Title = date.Value.ToShortDateString(); ContactDate cd = new ContactDate(); cd.Year = date.Value.Year; cd.Month = (uint)date.Value.Month; cd.Day = (uint)date.Value.Day; cd.Kind = ContactDateKind.Birthday; contact.ImportantDates.Add(cd); } }