Ejemplo n.º 1
0
        public static int GetWorkingDays(CalendarAdapterBase calendarAdapter, ISessionContext sessionContext)
        {
            int result;

            if (calendarAdapter.DataSource.SharedType == SharedType.AnonymousAccess)
            {
                result = sessionContext.WorkingHours.WorkDays;
            }
            else if (calendarAdapter is CalendarAdapter)
            {
                CalendarFolder   folder   = ((CalendarAdapter)calendarAdapter).Folder;
                OwaStoreObjectId folderId = ((CalendarAdapter)calendarAdapter).FolderId;
                if (folder != null && Utilities.IsOtherMailbox(folder) && folderId.IsGSCalendar)
                {
                    result = calendarAdapter.DataSource.WorkingHours.WorkDays;
                }
                else
                {
                    result = sessionContext.WorkingHours.WorkDays;
                }
            }
            else
            {
                result = sessionContext.WorkingHours.WorkDays;
            }
            return(result);
        }
Ejemplo n.º 2
0
 // Token: 0x060024B0 RID: 9392 RVA: 0x000D4A8D File Offset: 0x000D2C8D
 public PrintDailyView(ISessionContext sessionContext, CalendarAdapterBase calendarAdapter, int startTime, int endTime, bool renderNotes) : base(sessionContext, calendarAdapter)
 {
     this.startTime      = startTime;
     this.endTime        = endTime;
     this.renderNotes    = renderNotes;
     this.printDateRange = calendarAdapter.DateRanges;
 }
 // Token: 0x060023DB RID: 9179 RVA: 0x000CED20 File Offset: 0x000CCF20
 public MonthlyViewBase(ISessionContext sessionContext, CalendarAdapterBase calendarAdapter) : base(sessionContext, calendarAdapter)
 {
     if (calendarAdapter != null && calendarAdapter.DateRanges != null && calendarAdapter.DataSource != null)
     {
         this.CreateVisuals();
         this.MapVisuals();
         this.monthName = base.DateRanges[7].Start.ToString("y", sessionContext.UserCulture);
     }
 }
Ejemplo n.º 4
0
        protected void RenderCalendarProperties(CalendarViewBase view)
        {
            CalendarAdapterBase calendarAdapter = view.CalendarAdapter;

            this.RenderValue(this.Output, "sFId", calendarAdapter.IdentityString);
            this.RenderValue(this.Output, "fHRtL", calendarAdapter.UserCanReadItem);
            this.RenderValue(this.Output, "Title", SanitizedHtmlString.GetSanitizedStringWithoutEncoding(calendarAdapter.CalendarTitle));
            this.RenderValue(this.Output, "sDD", view.FolderDateDescription);
            this.RenderValue(this.Output, "fCC", calendarAdapter.DataSource.UserCanCreateItem);
            CalendarAdapter calendarAdapter2 = calendarAdapter as CalendarAdapter;

            this.RenderValue(this.Output, "iSharedType", (int)calendarAdapter.DataSource.SharedType);
            if (calendarAdapter2 != null)
            {
                if (calendarAdapter2.PromotedFolderId != null)
                {
                    this.RenderValue(this.Output, "sPromotedFolderId", calendarAdapter2.PromotedFolderId.ToBase64String());
                }
                this.RenderValue(this.Output, "sLegacyDN", calendarAdapter2.LegacyDN);
                if (calendarAdapter2.DataSource.SharedType == SharedType.InternalFreeBusy)
                {
                    this.RenderValue(this.Output, "sCalendarOwnerDisplayName", calendarAdapter2.CalendarOwnerDisplayName);
                }
                this.RenderValue(this.Output, "iOlderExchangeCalendarType", (int)calendarAdapter2.OlderExchangeSharedCalendarType);
                this.RenderColor(calendarAdapter2);
                this.RenderValue(this.Output, "fPublishedOut", calendarAdapter2.IsPublishedOut);
                if (calendarAdapter2.IsExternalSharedInFolder)
                {
                    if (calendarAdapter2.LastAttemptTime != ExDateTime.MinValue)
                    {
                        this.RenderValue(this.Output, "dtSyncTime", calendarAdapter2.LastAttemptTime.ToString("g", this.SessionContext.UserCulture));
                    }
                    if (calendarAdapter2.LastSuccessSyncTime != ExDateTime.MinValue)
                    {
                        this.RenderValue(this.Output, "dtSuccessSyncTime", calendarAdapter2.LastSuccessSyncTime.ToString("g", this.SessionContext.UserCulture));
                    }
                }
                this.RenderValue(this.Output, "fArchive", calendarAdapter2.IsInArchiveMailbox);
                if (calendarAdapter2.DataSource.SharedType == SharedType.WebCalendar)
                {
                    this.RenderValue(this.Output, "sWebCalUrl", calendarAdapter2.WebCalendarUrl);
                    return;
                }
            }
            else if (calendarAdapter is PublishedCalendarAdapter)
            {
                PublishedCalendarAdapter publishedCalendarAdapter = (PublishedCalendarAdapter)calendarAdapter;
                this.RenderValue(this.Output, "sPublishRange", SanitizedHtmlString.Format(LocalizedStrings.GetNonEncoded(-1428371010), new object[]
                {
                    publishedCalendarAdapter.PublishedFromDateTime.ToShortDateString(),
                    publishedCalendarAdapter.PublishedToDateTime.ToShortDateString()
                }));
            }
        }
Ejemplo n.º 5
0
 public PrintMonthlyView(ISessionContext sessionContext, CalendarAdapterBase calendarAdapter, bool workingDayOnly) : base(sessionContext, calendarAdapter)
 {
     this.showWeekNumbers = sessionContext.ShowWeekNumbers;
     this.calendar        = new GregorianCalendar();
     this.daysFormat      = (DateTimeUtilities.GetDaysFormat(sessionContext.DateFormat) ?? "%d");
     this.firstDayFormat  = "MMM %d";
     if (CalendarUtilities.FullMonthNameRequired(sessionContext.UserCulture))
     {
         this.firstDayFormat = string.Format("MMMM {0}", this.daysFormat);
     }
     this.workingDayOnly = workingDayOnly;
     this.sessionContext = sessionContext;
     this.workDays       = PrintMonthlyView.GetWorkingDays(calendarAdapter, sessionContext);
 }
Ejemplo n.º 6
0
 protected void RenderEmptyCalendar(CalendarAdapterBase calendarAdapterBase, int index)
 {
     if (index > 0)
     {
         this.Output.Write(",");
     }
     this.Output.Write("{");
     this.RenderValue(this.Output, "sFId", calendarAdapterBase.IdentityString);
     if (calendarAdapterBase is CalendarAdapter)
     {
         CalendarAdapter calendarAdapter = (CalendarAdapter)calendarAdapterBase;
         this.RenderValue(this.Output, "iOlderExchangeCalendarType", (int)calendarAdapter.OlderExchangeSharedCalendarType);
     }
     this.Output.Write("\"fHRtL\": 0}");
 }
Ejemplo n.º 7
0
 public PrintEventList(ISessionContext sessionContext, CalendarAdapterBase calendarAdapter, CalendarViewType viewType, bool workingDayOnly)
 {
     if (sessionContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     if (calendarAdapter == null)
     {
         throw new ArgumentNullException("calendarAdapter");
     }
     this.calendarAdapter = calendarAdapter;
     this.sessionContext  = sessionContext;
     this.workingDayOnly  = workingDayOnly;
     this.viewType        = viewType;
     this.visuals         = new Dictionary <ExDateTime, List <PrintCalendarVisual> >();
     foreach (ExDateTime exDateTime in this.GetEffectiveDates())
     {
         this.visuals.Add(exDateTime.Date, new List <PrintCalendarVisual>());
     }
     for (int j = 0; j < calendarAdapter.DataSource.Count; j++)
     {
         ExDateTime startTime   = calendarAdapter.DataSource.GetStartTime(j);
         ExDateTime endTime     = calendarAdapter.DataSource.GetEndTime(j);
         ExDateTime date        = startTime.Date;
         ExDateTime date2       = endTime.Date;
         ExDateTime exDateTime2 = date;
         while (exDateTime2 <= date2 && (!(exDateTime2 >= endTime) || !(startTime != endTime)))
         {
             if (this.visuals.ContainsKey(exDateTime2))
             {
                 this.visuals[exDateTime2].Add(this.GetVisual(j, date.Equals(exDateTime2)));
             }
             exDateTime2 = exDateTime2.IncrementDays(1);
         }
     }
     foreach (List <PrintCalendarVisual> list in this.visuals.Values)
     {
         list.Sort((PrintCalendarVisual a, PrintCalendarVisual b) => a.StartTime.CompareTo(b.StartTime));
     }
 }
Ejemplo n.º 8
0
        public static ExDateTime[] GetEffectiveDates(CalendarAdapterBase calendarAdapter, ISessionContext sessionContext, bool workingDayOnly)
        {
            List <ExDateTime> list = new List <ExDateTime>();
            bool flag        = false;
            int  workingDays = PrintMonthlyView.GetWorkingDays(calendarAdapter, sessionContext);

            for (int i = 0; i < calendarAdapter.DateRanges.Length; i++)
            {
                ExDateTime start = calendarAdapter.DateRanges[i].Start;
                if (start.Day == 1)
                {
                    if (flag)
                    {
                        break;
                    }
                    flag = true;
                }
                if (flag && PrintMonthlyView.ShouldRenderDay(start, workingDays, workingDayOnly))
                {
                    list.Add(start);
                }
            }
            return(list.ToArray());
        }
Ejemplo n.º 9
0
 internal CalendarAdapter[] GetAdapters(ExDateTime[] days, bool addOwaConditionAdvisor)
 {
     if (days == null)
     {
         throw new ArgumentNullException("days");
     }
     if (days.Length == 0)
     {
         throw new ArgumentException("Length of days cannot be 0.");
     }
     if (this.adapters == null)
     {
         List <CalendarAdapter> list  = new List <CalendarAdapter>();
         List <CalendarAdapter> list2 = new List <CalendarAdapter>();
         foreach (OwaStoreObjectId owaStoreObjectId in this.folderIds)
         {
             CalendarAdapter calendarAdapter;
             if (owaStoreObjectId.Equals(this.PropertyFolderId))
             {
                 calendarAdapter = new CalendarAdapter(this.userContext, this.propertyFolder);
             }
             else
             {
                 calendarAdapter = new CalendarAdapter(this.userContext, owaStoreObjectId);
             }
             try
             {
                 calendarAdapter.LoadData(CalendarUtilities.QueryProperties, days, addOwaConditionAdvisor, false);
             }
             catch (Exception)
             {
                 calendarAdapter.Dispose();
                 calendarAdapter = null;
                 list.AddRange(list2);
                 foreach (CalendarAdapter calendarAdapter2 in list)
                 {
                     if (calendarAdapter2 != null)
                     {
                         calendarAdapter2.Dispose();
                     }
                 }
                 throw;
             }
             if (calendarAdapter.DataSource is AvailabilityDataSource)
             {
                 list2.Add(calendarAdapter);
             }
             else
             {
                 list.Add(calendarAdapter);
             }
         }
         if (list2.Count > 0)
         {
             CalendarAdapter[]     array2 = list2.ToArray();
             FreeBusyQueryResult[] array3 = AvailabilityDataSource.BatchLoadData(this.userContext, array2, CalendarAdapterBase.ConvertDateTimeArrayToDateRangeArray(days));
             if (array3 != null)
             {
                 for (int j = 0; j < array2.Length; j++)
                 {
                     AvailabilityDataSource availabilityDataSource = (AvailabilityDataSource)array2[j].DataSource;
                     availabilityDataSource.LoadFromQueryResult(array3[j]);
                 }
             }
             list.AddRange(list2);
         }
         this.adapters = list.ToArray();
     }
     foreach (CalendarAdapter calendarAdapter3 in this.adapters)
     {
         calendarAdapter3.SaveCalendarTypeFromOlderExchangeAsNeeded();
     }
     return(this.adapters);
 }
Ejemplo n.º 10
0
 public PrintWeeklyAgendaView(ISessionContext sessionContext, CalendarAdapterBase calendarAdapter, CalendarViewType viewType, bool isHorizontalLayout) : base(sessionContext, calendarAdapter, viewType, viewType == CalendarViewType.WorkWeeklyAgenda)
 {
     this.isHorizontalLayout = isHorizontalLayout;
 }
Ejemplo n.º 11
0
 public MonthlyView(ISessionContext sessionContext, CalendarAdapterBase calendarAdapter) : base(sessionContext, calendarAdapter)
 {
 }