public void UpdateDayRepeat() { note.Content = "123321"; note.Start = Convert.ToDateTime("2010-1-1 11:1:1"); note.End = Convert.ToDateTime("2010-1-1 12:1:1"); note.Owner = new Account(); note.Owner.Id = 79; DayRepeat day = new DayRepeat(); day.RangeStart = Convert.ToDateTime("2010-11-1 11:1:1"); day.NDayOnce = 1; note.RepeatType = day; note.Save(); Assert.IsTrue(note.PKID > 0); note.Content = "5432"; ((DayRepeat)note.RepeatType).EveryWeek = true; note.Update(); }
public void InsertGetDayRepeatTest() { note.Content = "123321"; note.Start = Convert.ToDateTime("2010-1-1 11:1:1"); note.End = Convert.ToDateTime("2010-1-1 12:1:1"); note.Owner = new Account(); note.Owner.Id = 79; DayRepeat day = new DayRepeat(); day.RangeStart = Convert.ToDateTime("2010-11-1 11:1:1"); day.NDayOnce = 1; note.RepeatType = day; note.Save(); Notes n = Notes.GetByID(note.PKID); Assert.AreEqual(n.Owner.Id, note.Owner.Id); Assert.IsTrue(n.RepeatType is DayRepeat); }
public NotesViewModel(Notes.Notes note) { _Note = note; if (_Note.RepeatType is NoRepeat) { _NoRepeat = (NoRepeat)_Note.RepeatType; } else if (_Note.RepeatType is DayRepeat) { _DayRepeat = (DayRepeat)_Note.RepeatType; } else if (_Note.RepeatType is WeekRepeat) { _WeekRepeat = (WeekRepeat)_Note.RepeatType; } else if (_Note.RepeatType is MonthRepeat) { _MonthRepeat = (MonthRepeat)_Note.RepeatType; } }
private static Notes.Notes MadeDayRepeatNotes(string startHour, string startMinutes, string endHour, string endMinutes, string startRange, string endRange, string chosetype, string ndayOnce, string content, string shares, string pkid) { Notes.Notes note = new Notes.Notes(); note.PKID = Convert.ToInt32(pkid); note.Content = content.Trim(); note.Start = Convert.ToDateTime(string.Format("2010-1-1 {0}:{1}", startHour, startMinutes)); note.End = Convert.ToDateTime(string.Format("2010-1-1 {0}:{1}", endHour, endMinutes)); note.ShareSet = new Share(); note.ShareSet.NoteID = note.PKID; note.ShareSet.Accounts = Share.toAccountList(shares); DayRepeat repeat = new DayRepeat(); switch (chosetype) { case "1": repeat.NDayOnce = Convert.ToInt32(ndayOnce); break; case "2": repeat.EveryWork = true; break; case "3": repeat.EveryWeek = true; break; } repeat.RangeStart = Convert.ToDateTime(startRange); if (!string.IsNullOrEmpty(endRange.Trim())) { repeat.RangeEnd = Convert.ToDateTime(endRange); } note.RepeatType = repeat; return(note); }