Esempio n. 1
0
 protected void RenderReminderDate()
 {
     TaskUtilities.RenderReminderDate(base.Response.Output, base.Item, this.IsReminderSet && !this.IsPublicItem);
 }
Esempio n. 2
0
 protected void RenderReminderTimeDropDownList()
 {
     TaskUtilities.RenderReminderTimeDropDownList(base.UserContext, base.Response.Output, base.Item, this.IsReminderSet && !this.IsPublicItem);
 }
        public void Save()
        {
            ExTraceGlobals.TasksCallTracer.TraceDebug((long)this.GetHashCode(), "EditTaskEventHandler.Save");
            bool       flag       = base.IsParameterSet("Id");
            bool       flag2      = false;
            bool       flag3      = false;
            ExDateTime?exDateTime = null;
            Task       task       = this.GetTask(new PropertyDefinition[0]);

            try
            {
                if (!base.IsParameterSet("Id"))
                {
                    OwaStoreObjectId owaStoreObjectId = (OwaStoreObjectId)base.GetParameter("fId");
                    if (owaStoreObjectId != null && owaStoreObjectId.IsOtherMailbox)
                    {
                        ADSessionSettings adSettings        = Utilities.CreateScopedADSessionSettings(base.UserContext.LogonIdentity.DomainName);
                        ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromLegacyDN(adSettings, owaStoreObjectId.MailboxOwnerLegacyDN);
                        task[TaskSchema.TaskOwner] = exchangePrincipal.MailboxInfo.DisplayName;
                    }
                    else
                    {
                        task[TaskSchema.TaskOwner] = base.UserContext.ExchangePrincipal.MailboxInfo.DisplayName;
                    }
                }
                if (base.IsParameterSet("subj"))
                {
                    task.Subject = (string)base.GetParameter("subj");
                }
                if (base.IsParameterSet("sd"))
                {
                    task.StartDate = this.GetDateValue("sd");
                }
                if (base.IsParameterSet("dd"))
                {
                    task.DueDate = this.GetDateValue("dd");
                }
                if (base.IsParameterSet("dc"))
                {
                    exDateTime = this.GetDateValue("dc");
                    if (exDateTime != null)
                    {
                        flag2 = true;
                    }
                }
                if (base.IsParameterSet("st"))
                {
                    TaskStatus taskStatus = (TaskStatus)base.GetParameter("st");
                    if (taskStatus == TaskStatus.Completed)
                    {
                        flag2 = true;
                    }
                    else
                    {
                        TaskUtilities.SetIncomplete(task, taskStatus);
                    }
                }
                if (base.IsParameterSet("pri"))
                {
                    task[ItemSchema.Importance] = (Importance)base.GetParameter("pri");
                }
                if (base.IsParameterSet("pc"))
                {
                    double num = (double)((int)base.GetParameter("pc")) / 100.0;
                    if (!flag2 || num != 1.0)
                    {
                        if (num >= 0.0 && num < 1.0)
                        {
                            task.PercentComplete = num;
                        }
                        else if (num == 1.0)
                        {
                            flag2 = true;
                        }
                    }
                }
                if (base.IsParameterSet("rs"))
                {
                    bool flag4 = (bool)base.GetParameter("rs");
                    task[ItemSchema.ReminderIsSet] = flag4;
                    if (flag4 && base.IsParameterSet("rd"))
                    {
                        ExDateTime?dateValue = this.GetDateValue("rd");
                        if (dateValue != null)
                        {
                            task[ItemSchema.ReminderDueBy] = dateValue.Value;
                        }
                    }
                }
                if (base.IsParameterSet("ps"))
                {
                    task[ItemSchema.Sensitivity] = (((bool)base.GetParameter("ps")) ? Sensitivity.Private : Sensitivity.Normal);
                }
                if (base.IsParameterSet("tw"))
                {
                    int num2 = (int)base.GetParameter("tw");
                    if (num2 < 0 || num2 > 1525252319)
                    {
                        throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(-1310086288));
                    }
                    task[TaskSchema.TotalWork] = num2;
                }
                if (base.IsParameterSet("aw"))
                {
                    int num3 = (int)base.GetParameter("aw");
                    if (num3 < 0 || num3 > 1525252319)
                    {
                        throw new OwaInvalidRequestException(LocalizedStrings.GetNonEncoded(210380742));
                    }
                    task[TaskSchema.ActualWork] = num3;
                }
                if (base.IsParameterSet("mi"))
                {
                    task[TaskSchema.Mileage] = (string)base.GetParameter("mi");
                }
                if (base.IsParameterSet("bl"))
                {
                    task[TaskSchema.BillingInformation] = (string)base.GetParameter("bl");
                }
                if (base.IsParameterSet("co"))
                {
                    string   text = (string)base.GetParameter("co");
                    string[] value;
                    if (string.IsNullOrEmpty(text))
                    {
                        value = new string[0];
                    }
                    else
                    {
                        value = new string[]
                        {
                            text
                        };
                    }
                    task[TaskSchema.Companies] = value;
                }
                if (base.IsParameterSet("nt"))
                {
                    string text2 = (string)base.GetParameter("nt");
                    if (text2 != null)
                    {
                        BodyConversionUtilities.SetBody(task, text2, Markup.PlainText, base.UserContext);
                    }
                }
                if (base.IsParameterSet("RcrT"))
                {
                    Recurrence recurrence = base.CreateRecurrenceFromRequest();
                    if ((recurrence != null || task.Recurrence != null) && (recurrence == null || task.Recurrence == null || !recurrence.Equals(task.Recurrence)))
                    {
                        task.Recurrence = recurrence;
                        flag3           = true;
                    }
                }
                if (flag2 && exDateTime == null)
                {
                    if (task.CompleteDate == null)
                    {
                        exDateTime = new ExDateTime?(DateTimeUtilities.GetLocalTime());
                    }
                    else
                    {
                        exDateTime = new ExDateTime?(task.CompleteDate.Value);
                    }
                }
                if (!flag3 && flag2)
                {
                    task.SetStatusCompleted(exDateTime.Value);
                }
                Utilities.SaveItem(task, flag);
                task.Load();
                if (flag3 && flag2)
                {
                    OwaStoreObjectId owaStoreObjectId2 = OwaStoreObjectId.CreateFromStoreObject(task);
                    string           changeKey         = task.Id.ChangeKeyAsBase64String();
                    task.Dispose();
                    task = Utilities.GetItem <Task>(base.UserContext, owaStoreObjectId2, changeKey, TaskUtilities.TaskPrefetchProperties);
                    task.SetStatusCompleted(exDateTime.Value);
                    Utilities.SaveItem(task);
                    task.Load();
                }
                if (!flag)
                {
                    OwaStoreObjectId owaStoreObjectId3 = OwaStoreObjectId.CreateFromStoreObject(task);
                    if (ExTraceGlobals.TasksDataTracer.IsTraceEnabled(TraceType.DebugTrace))
                    {
                        ExTraceGlobals.TasksDataTracer.TraceDebug <string>((long)this.GetHashCode(), "New task item ID is '{0}'", owaStoreObjectId3.ToBase64String());
                    }
                    this.Writer.Write("<div id=itemId>");
                    this.Writer.Write(owaStoreObjectId3.ToBase64String());
                    this.Writer.Write("</div>");
                }
                this.Writer.Write("<div id=ck>");
                this.Writer.Write(task.Id.ChangeKeyAsBase64String());
                this.Writer.Write("</div>");
                base.MoveItemToDestinationFolderIfInScratchPad(task);
            }
            finally
            {
                task.Dispose();
            }
        }
 public void GenerateWhen()
 {
     this.Writer.Write(TaskUtilities.GenerateWhen(base.UserContext, base.CreateRecurrenceFromRequest()));
 }
 // Token: 0x06003119 RID: 12569 RVA: 0x001215A0 File Offset: 0x0011F7A0
 public static TaskType GetTaskType(Task task)
 {
     return(TaskUtilities.GetTaskType(task));
 }
Esempio n. 6
0
 protected void RenderReminderDate()
 {
     TaskUtilities.RenderReminderDate(base.Response.Output, base.Item, this.ReminderIsSet && !this.IsPublicItem && base.UserCanEditItem);
 }
Esempio n. 7
0
        // Token: 0x06002E13 RID: 11795 RVA: 0x001065BC File Offset: 0x001047BC
        public static ExDateTime?SetFlag(Item item, FlagAction flagAction, ExDateTime?dueDate)
        {
            UserContext userContext = UserContextManager.GetUserContext();
            ExDateTime? exDateTime  = null;
            ExDateTime  date        = DateTimeUtilities.GetLocalTime().Date;
            int         dayOfWeek   = DateTimeUtilities.GetDayOfWeek(userContext, date);

            item.TryGetProperty(ItemSchema.FlagStatus);
            FlagStatus flagStatus = ItemUtility.GetProperty <FlagStatus>(item, ItemSchema.FlagStatus, FlagStatus.NotFlagged);
            Task       task       = item as Task;

            if (task != null && task.IsComplete)
            {
                flagStatus = FlagStatus.Complete;
            }
            if (flagAction == FlagAction.Default && flagStatus != FlagStatus.Complete)
            {
                flagAction = userContext.UserOptions.FlagAction;
            }
            switch (flagAction)
            {
            case FlagAction.Default:
                exDateTime = ItemUtility.GetProperty <ExDateTime?>(item, ItemSchema.UtcStartDate, null);
                dueDate    = ItemUtility.GetProperty <ExDateTime?>(item, ItemSchema.UtcDueDate, null);
                break;

            case FlagAction.Today:
                dueDate = new ExDateTime?(date);
                dueDate = (exDateTime = dueDate);
                break;

            case FlagAction.Tomorrow:
                dueDate = new ExDateTime?(date.IncrementDays(1));
                dueDate = (exDateTime = dueDate);
                break;

            case FlagAction.ThisWeek:
                {
                    int num   = 7 - dayOfWeek;
                    int value = 2;
                    if (0 < num && num <= 2)
                    {
                        value = num - 1;
                    }
                    exDateTime = new ExDateTime?(date.IncrementDays(value));
                    while (date < exDateTime && !DateTimeUtilities.IsWorkingDay(exDateTime.Value, userContext.WorkingHours.WorkDays))
                    {
                        exDateTime = new ExDateTime?(exDateTime.Value.IncrementDays(-1));
                    }
                    if (num == 0)
                    {
                        num = 7;
                    }
                    dueDate = new ExDateTime?(date.IncrementDays(num - 1));
                    while (exDateTime < dueDate)
                    {
                        if (DateTimeUtilities.IsWorkingDay(dueDate.Value, userContext.WorkingHours.WorkDays))
                        {
                            break;
                        }
                        dueDate = new ExDateTime?(dueDate.Value.IncrementDays(-1));
                    }
                    break;
                }

            case FlagAction.NextWeek:
            {
                int num2 = 7 - dayOfWeek;
                if (num2 == 0)
                {
                    num2 = 7;
                }
                exDateTime = new ExDateTime?(date.IncrementDays(num2));
                int num3 = 0;
                while (num3 < 7 && !DateTimeUtilities.IsWorkingDay(exDateTime.Value, userContext.WorkingHours.WorkDays))
                {
                    exDateTime = new ExDateTime?(exDateTime.Value.IncrementDays(1));
                    num3++;
                }
                int num4 = 7 - DateTimeUtilities.GetDayOfWeek(userContext, exDateTime.Value);
                if (num4 == 7)
                {
                    num4 = 6;
                }
                dueDate = new ExDateTime?(exDateTime.Value.IncrementDays(num4));
                while (exDateTime < dueDate)
                {
                    if (DateTimeUtilities.IsWorkingDay(dueDate.Value, userContext.WorkingHours.WorkDays))
                    {
                        break;
                    }
                    dueDate = new ExDateTime?(dueDate.Value.IncrementDays(-1));
                }
                break;
            }

            case FlagAction.SpecificDate:
                exDateTime = dueDate;
                break;
            }
            if (task != null)
            {
                task.StartDate = exDateTime;
                task.DueDate   = dueDate;
                if (task.Status == TaskStatus.Completed)
                {
                    TaskUtilities.SetIncomplete(task, TaskStatus.InProgress);
                }
            }
            else
            {
                item.SetFlag(LocalizedStrings.GetNonEncoded(-1950847676), exDateTime, dueDate);
            }
            return(dueDate);
        }