private static Notes.Notes MadeMonthRepeatNotes(string startHour, string startMinutes, string endHour, string endMinutes, string startRange, string endRange, string nMonth, string ndayMonthEnum, string monthDayTypeEnum, 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); MonthRepeat repeat = new MonthRepeat(); repeat.NMonth = Convert.ToInt32(nMonth); repeat.MonthDayTypeEnum = MonthDayTypeEnum.GetByValue(Convert.ToInt32(monthDayTypeEnum)); repeat.NDayMonthEnum = NDayMonthEnum.GetByValue(Convert.ToInt32(ndayMonthEnum)); repeat.RangeStart = Convert.ToDateTime(startRange); if (!string.IsNullOrEmpty(endRange.Trim())) { repeat.RangeEnd = Convert.ToDateTime(endRange); } note.RepeatType = repeat; return(note); }
private static Notes.Notes MadeWeekRepeatNotes(string startHour, string startMinutes, string endHour, string endMinutes, string startRange, string endRange, string nweek, string weeks, 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); WeekRepeat repeat = new WeekRepeat(); repeat.NWeek = Convert.ToInt32(nweek); repeat.WeekList = new List <string>(weeks.Split('|')); if (string.IsNullOrEmpty(repeat.WeekList[repeat.WeekList.Count - 1])) { repeat.WeekList.RemoveAt(repeat.WeekList.Count - 1); } repeat.RangeStart = Convert.ToDateTime(startRange); if (!string.IsNullOrEmpty(endRange.Trim())) { repeat.RangeEnd = Convert.ToDateTime(endRange); } note.RepeatType = repeat; return(note); }
private static Notes.Notes MadeNoRepeatNotes(string startDate, string startHour, string startMinutes, string endDate, string endHour, string endMinutes, 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("{0} {1}:{2}", startDate.Trim(), startHour, startMinutes)); note.End = Convert.ToDateTime(string.Format("{0} {1}:{2}", endDate.Trim(), endHour, endMinutes)); note.ShareSet = new Share(); note.ShareSet.NoteID = note.PKID; note.ShareSet.Accounts = Share.toAccountList(shares); note.RepeatType = new NoRepeat(); return(note); }
private void GetNoteByID() { List <ControlError> errorList = new List <ControlError>(); Notes.Notes note = new Notes.Notes(); try { note = _Facade.GetNoteByID(_Context.Request.Params["pkid"]); } catch (Exception e) { errorList.Add(new ControlError("lblShowDetailMessage", e.Message)); } _ResponseString = string.Format("{{item:{0},error:{1}}}", JsonConvert.SerializeObject(new NotesViewModel(note)), JsonConvert.SerializeObject(errorList)); }
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); }
public void DeleteNotes(string pkid) { Notes.Notes note = Notes.Notes.GetByID(Convert.ToInt32(pkid)); note.Delete(); }