public ActionResult DeleteConfirmed(long id)
        {
            RecurringItem recurringitem = this.dataContext.RecurringItems.Find(id);

            this.dataContext.RecurringItems.Remove(recurringitem);
            this.dataContext.SaveChanges();
            return(RedirectToAction("Details", "WorkItem", new { id = recurringitem.WorkItemId }));
        }
Exemple #2
0
 public void UpdateRecurringItem(RecurringItem existingRecurringItem, Outlook.AppointmentItem item)
 {
     existingRecurringItem.Start     = item.Start;
     existingRecurringItem.End       = item.End;
     existingRecurringItem.Duration  = (item.End - item.Start).TotalHours;
     existingRecurringItem.Subject   = item.Subject;
     existingRecurringItem.Body      = item.Body;
     existingRecurringItem.Location  = item.Location;
     existingRecurringItem.UpdatedAt = DateTime.Now;
 }
        //
        // GET: /RecurringItem/Delete/5

        public ActionResult Delete(long id = 0)
        {
            RecurringItem recurringitem = this.dataContext.RecurringItems.Find(id);

            if (recurringitem == null)
            {
                return(HttpNotFound());
            }
            return(View(recurringitem));
        }
 public ActionResult Edit(RecurringItem recurringitem)
 {
     if (ModelState.IsValid)
     {
         this.dataContext.Entry(recurringitem).State = EntityState.Modified;
         recurringitem.UpdatedAt = DateTime.Now;
         this.dataContext.SaveChanges();
         return(RedirectToAction("Details", "WorkItem", new { id = recurringitem.WorkItemId }));
     }
     return(View(recurringitem));
 }
Exemple #5
0
        public int ScheduleReminder(WorkItem workItem, RecurringItem recurringItem)
        {
            var message = "";

            try
            {
                scheduler.SetRecurringItemReminderData(scheduler, workItem, recurringItem);
                var reminderServiceResult = scheduler.ScheduleReminder();
                message = scheduler.HandleReminderServiceResult(reminderServiceResult);
            }
            catch (Exception ex)
            {
                message = "Atgādinājuma ieplānošana beigusies ar kļūdu! " + ex.Message;
            }

            if (message.Length != 0)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
 public string GetJobId(WorkItem workItem, RecurringItem recurringItem)
 {
     return("recurringItem" + recurringItem.Id.ToString() + "by" + workItem.CreatedByUserId.ToString() + "@" + workItem.CreatedAt.ToString());
 }
 public void SetRecurringItemReminderData(ReminderScheduler scheduler, WorkItem workItem, RecurringItem recurringItem)
 {
     scheduler.Id           = "recurringItem" + recurringItem.Id.ToString() + "by" + workItem.CreatedByUserId.ToString() + "@" + workItem.CreatedAt.ToString();
     scheduler.WorkItemType = workItem.WorkItemType;
     scheduler.Reminder     = workItem.Reminder;
     scheduler.StartTime    = recurringItem.Start;
     scheduler.EndTime      = recurringItem.End;
     scheduler.Duration     = recurringItem.Duration;
     scheduler.Origin       = workItem.Origin;
     scheduler.Location     = recurringItem.Location;
     scheduler.Subject      = recurringItem.Subject;
     scheduler.MailTo       = workItem.CreatedBy.Email;
     //scheduler.Url = Url.Action("Details", "RecurringItem", new { id = recurringItem.Id }, Request.Url.Scheme);
 }