public ActionResult Create(iDiary iDiary)
        {
            iDiary.Appointments[0].CreatedBy = iDiary.Reminders[0].ClientPersonnelID;
            try
            {
                if (iDiary.AddDiaryAppointment())
                {
                    ModelState.Clear();
                    iDiary.Appointments.Clear();
                    iDiary.Reminders.Clear();
                    iDiary.ReminderValues = new List<string>();
                    iDiary.Appointments = new List<DiaryAppointment>();
                    iDiary.Reminders = new List<AquariumDiaryManagement.Reminder>();
                    iDiary.DiaryTexts.AllDiaryTexts = new List<DiaryText>();
                    iDiary.DiaryTitles.AllDiaryTitles = new List<DiaryTitle>();

                    iDiary.Appointments.Add(new DiaryAppointment());
                    iDiary.Reminders.Add(new AquariumDiaryManagement.Reminder());

                    iDiary.Appointments[0].EndDate = DateTime.Now.AddDays(7);
                    iDiary.Appointments[0].DueDate = DateTime.Now;

                    iDiary.GetAllLeads();
                    iDiary.GetAllUsers();
                    iDiary.GetAllTimeshiftValues();
                    iDiary.GetAllDiaryTitles();
                    iDiary.GetDefaultDiaryText();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(iDiary);
        }
        public ActionResult Edit(iDiary iDiary)
        {
            iDiary.Appointments[0].CreatedBy = iDiary.Reminders[0].ClientPersonnelID;

            try
            {
                if (iDiary.AddDiaryAppointment())
                {
                    iDiary.AddDiaryLog(iDiary.Appointments[0].DiaryAppointmentID, 3, DateTime.Now, iDiary.Appointments[0].CreatedBy, "Task Updated");
                    iDiary.GetAllLeads();
                    iDiary.GetAllUsers();
                    iDiary.GetAllTimeshiftValues();
                    iDiary.GetAllDiaryTitles();
                    iDiary.GetDefaultDiaryText();
                    iDiary.GetAllDiaryLogsbyID(iDiary.Appointments[0].DiaryAppointmentID);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(iDiary);
        }
        public ActionResult Create()
        {
            iDiary Diary = new iDiary();

            Diary.ReminderValues = new List<string>();
            Diary.Appointments = new List<DiaryAppointment>();
            Diary.Reminders = new List<AquariumDiaryManagement.Reminder>();
            Diary.DiaryPriorities = new List<DiaryPriority>();
            DiaryPriority dp = new DiaryPriority();

            try
            {
                Diary.Appointments.Add(new DiaryAppointment());
                Diary.Reminders.Add(new AquariumDiaryManagement.Reminder());
                dp.GetAllDiaryPriorities();
                Diary.DiaryPriorities.Add(dp);

                Diary.Appointments[0].EndDate = DateTime.Now.AddDays(7);
                Diary.Appointments[0].DueDate = DateTime.Now;
                Diary.GetAllLeads();
                Diary.GetAllUsers();
                Diary.GetAllTimeshiftValues();
                Diary.GetAllDiaryTitles();
                Diary.GetDefaultDiaryText();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return View(Diary);
        }