private void SetUIDefaults()
 {
     StartDate.DisplayTime    = !Activity.Timeless;
     ReminderDuration.Enabled = Activity.Alarm;
     Duration.Enabled         = !Activity.Timeless;
     StartDate.Timeless       = Activity.Timeless;
     ActivityFacade.BindLeaderList(UserId, Activity.UserId);
 }
Exemple #2
0
    private void SetCommonDefaults()
    {
        ActivityFacade.BindLeaderList(UserId, Activity.UserId);

        //Check if the type is being passed as a Param.
        //This should take precedent over a newly created Type default of atAppointment
        if (GetParam("type") != null)
        {
            //TODO: Refactor OUT all references to atMeeting, OR add atMeeting to the ActivityType enum
            string type = GetParam("type") == "atMeeting" ? "atAppointment" : GetParam("type");
            Activity.Type = (ActivityType)Enum.Parse(typeof(ActivityType), type);
        }

        switch (Activity.Type)
        {
        case ActivityType.atAppointment:
            Result.PickListName      = "Meeting Result Codes";
            Category.PickListName    = "Meeting Category Codes";
            Description.PickListName = "Meeting Regarding";
            break;

        case ActivityType.atPhoneCall:
            Result.PickListName      = "Phone Call Result Codes";
            Category.PickListName    = "Phone Call Category Codes";
            Description.PickListName = "Phone Call Regarding";
            break;

        case ActivityType.atToDo:
            Result.PickListName      = "To Do Result Codes";
            Category.PickListName    = "To Do Category Codes";
            Description.PickListName = "To Do Regarding";
            break;

        case ActivityType.atPersonal:
            Result.PickListName      = "Personal Activity Result Codes";
            Description.PickListName = "Personal Activity Regarding";
            break;

        case ActivityType.atEMail:
            Category.PickListName    = "To Do Category Codes";
            Description.PickListName = "To Do Regarding";
            break;

        case ActivityType.atNote:
            Category.PickListName    = "Note Category Codes";
            Description.PickListName = "Note Regarding";
            break;

        default:
            Result.PickListName = "Meeting Result Codes";
            break;
        }

        Result.PickListValue = Result.DefaultPickListItem;

        if (string.IsNullOrEmpty(Result.PickListValue))
        {
            Result.PickListValue = GetLocalResourceObject("Const_Complete").ToString();
        }

        IUserOptionsService userOption = ApplicationContext.Current.Services.Get <IUserOptionsService>();
        string defFollowUpActivity     = userOption.GetCommonOption("DefaultFollowupActivity", "ActivityAlarm");
        string followupValue           = "None";

        switch (defFollowUpActivity)
        {
        case ("Phone Call"):
            followupValue = "atPhoneCall";
            break;

        case ("Meeting"):
            followupValue = "atMeeting";
            break;

        case ("To-Do"):
            followupValue = "atToDo";
            break;
        }

        FollowUp.SelectedValue = followupValue;

        string carryOverNotes = userOption.GetCommonOption("CarryOverNotes", "ActivityAlarm");

        CarryOverNotes.Checked = (carryOverNotes != "No") && (carryOverNotes != "F");

        string carryOverAttachments = userOption.GetCommonOption("CarryOverAttachments", "ActivityAlarm");

        CarryOverAttachments.Checked = (carryOverAttachments != "No") && (carryOverAttachments != "F");

        Completed.DateTimeValue = DateTime.UtcNow;
        Scheduled.DateTimeValue = Activity.StartDate;

        Duration.Enabled = !Activity.Timeless;
    }