コード例 #1
0
        public static string ValidateDate(string day, string month, string year)
        {
            ExDateTime localTime     = DateTimeUtilities.GetLocalTime();
            int        datePartValue = WebPartUtilities.GetDatePartValue(day, localTime.Day);

            if (datePartValue == -1)
            {
                return(null);
            }
            int datePartValue2 = WebPartUtilities.GetDatePartValue(month, localTime.Month);

            if (datePartValue2 == -1)
            {
                return(null);
            }
            int datePartValue3 = WebPartUtilities.GetDatePartValue(year, localTime.Year);

            if (datePartValue3 <= 1 || datePartValue3 >= 9999)
            {
                return(null);
            }
            string result;

            try
            {
                ExDateTime date = new ExDateTime(UserContextManager.GetUserContext().TimeZone, datePartValue3, datePartValue2, datePartValue);
                result = DateTimeUtilities.GetIsoDateFormat(date);
            }
            catch (ArgumentOutOfRangeException)
            {
                ExTraceGlobals.CalendarTracer.TraceDebug <int, int, int>(0L, "Invalid date parameters for day: {1} month: {2}, year: {3}", datePartValue, datePartValue2, datePartValue3);
                result = null;
            }
            return(result);
        }
コード例 #2
0
ファイル: UserOptions.cs プロジェクト: YHZX2013/exchange_diff
 private void Load(IList <UserOptionPropertyDefinition> properties)
 {
     using (UserConfiguration userConfiguration = this.GetUserConfiguration())
     {
         if (userConfiguration != null)
         {
             IDictionary dictionary = userConfiguration.GetDictionary();
             for (int i = 0; i < properties.Count; i++)
             {
                 UserOptionPropertyDefinition userOptionPropertyDefinition = properties[i];
                 string propertyName  = userOptionPropertyDefinition.PropertyName;
                 object originalValue = dictionary[userOptionPropertyDefinition.PropertyName];
                 this.optionProperties[userOptionPropertyDefinition] = new UserOptions.UserOptionPropertyValue(userOptionPropertyDefinition.GetValidatedProperty(originalValue), false);
                 ExTraceGlobals.UserOptionsDataTracer.TraceDebug((long)this.GetHashCode(), "Loaded property: {0}", new object[]
                 {
                     this.optionProperties[userOptionPropertyDefinition].Value
                 });
             }
         }
         else
         {
             string value = WebPartUtilities.TryGetLocalMachineTimeZone();
             UserOptionPropertyDefinition propertyDefinition = UserOptionPropertySchema.GetPropertyDefinition(UserOptionPropertySchema.UserOptionPropertyID.TimeZone);
             this.optionProperties[propertyDefinition] = new UserOptions.UserOptionPropertyValue(value, false);
         }
     }
 }
コード例 #3
0
        public static WebPartListView LookUpWebPartView(StoreObjectType folderObjectType, string className, string view)
        {
            WebPartListView result = null;
            Dictionary <string, WebPartListView> dictionary = null;

            if (string.IsNullOrEmpty(view))
            {
                view = WebPartUtilities.GetDefaultView(className);
            }
            if (WebPartUtilities.Views.TryGetValue(folderObjectType, out dictionary))
            {
                dictionary.TryGetValue(view, out result);
            }
            return(result);
        }
コード例 #4
0
        // Token: 0x06001915 RID: 6421 RVA: 0x00091B28 File Offset: 0x0008FD28
        private Folder ProcessWebPartRequest()
        {
            this.webPartParameters = this.LoadWebPartParameters();
            Folder result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                Folder folder = null;
                string text   = this.webPartParameters["fPath"];
                bool   flag   = string.Compare(this.webPartParameters["module"], "publicfolders", true) == 0;
                if (this.owaContext.IsExplicitLogon && flag)
                {
                    this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(1044509156), OwaEventHandlerErrorCode.WebPartExplicitLogonPublicFolderViaOwaBasicError);
                    result = null;
                }
                else if (flag && !this.userContext.IsFeatureEnabled(Feature.PublicFolders))
                {
                    this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(-1242252459), OwaEventHandlerErrorCode.WebPartSegmentationError);
                    result = null;
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.webPartParameters["id"]))
                    {
                        OwaStoreObjectId folderId = this.GetFolderId(this.webPartParameters["id"], flag);
                        if (folderId == null || !Folder.IsFolderId(folderId.StoreObjectId))
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(-1323257605), OwaEventHandlerErrorCode.WebPartUnsupportedItemError);
                        }
                        else
                        {
                            folder = this.GetFolderFromId(folderId);
                            if (folder == null)
                            {
                                this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(1725230116), OwaEventHandlerErrorCode.WebPartFolderPathError);
                            }
                        }
                    }
                    else if (!string.IsNullOrEmpty(text))
                    {
                        folder = this.GetFolderFromPath(text, flag);
                        if (folder == null)
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(1725230116), OwaEventHandlerErrorCode.WebPartFolderPathError);
                        }
                    }
                    else if (!string.IsNullOrEmpty(this.webPartParameters["module"]))
                    {
                        if (!WebPartPreFormAction.IsSupportedModule(this.webPartParameters["module"]))
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(string.Format(Strings.WebPartInvalidParameterError, "module"), OwaEventHandlerErrorCode.WebPartInvalidParameterError);
                        }
                        else
                        {
                            folder = this.GetFolderFromModule(this.webPartParameters["module"]);
                            if (folder == null)
                            {
                                this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(1725230116), OwaEventHandlerErrorCode.WebPartFolderPathError);
                            }
                        }
                    }
                    else
                    {
                        StoreObjectId storeObjectId = this.userContext.TryGetMyDefaultFolderId(DefaultFolderType.Inbox);
                        if (storeObjectId == null)
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(-1925343075), OwaEventHandlerErrorCode.WebPartContentsPermissionsError);
                        }
                        else
                        {
                            folder = this.GetFolderFromId(OwaStoreObjectId.CreateFromMailboxFolderId(storeObjectId));
                            if (folder == null)
                            {
                                this.owaContext.ErrorInformation = new ErrorInformation(LocalizedStrings.GetNonEncoded(-1925343075), OwaEventHandlerErrorCode.WebPartContentsPermissionsError);
                            }
                        }
                    }
                    if (folder == null)
                    {
                        result = null;
                    }
                    else
                    {
                        disposeGuard.Add <Folder>(folder);
                        if (!this.CheckFolderIsSupported(folder))
                        {
                            result = null;
                        }
                        else if (!string.IsNullOrEmpty(this.webPartParameters["view"]) && !this.IsViewValid(folder.Id.ObjectId.ObjectType))
                        {
                            this.owaContext.ErrorInformation = new ErrorInformation(string.Format(Strings.WebPartInvalidParameterError, "view"), OwaEventHandlerErrorCode.WebPartInvalidParameterError);
                            result = null;
                        }
                        else
                        {
                            if (ObjectClass.IsCalendarFolder(folder.ClassName) && (!string.IsNullOrEmpty(this.webPartParameters["d"]) || !string.IsNullOrEmpty(this.webPartParameters["m"]) || !string.IsNullOrEmpty(this.webPartParameters["y"])))
                            {
                                this.isoDateString = WebPartUtilities.ValidateDate(this.webPartParameters["d"], this.webPartParameters["m"], this.webPartParameters["y"]);
                                if (this.isoDateString == null)
                                {
                                    this.owaContext.ErrorInformation = new ErrorInformation(string.Format(LocalizedStrings.GetNonEncoded(-1413211833), "m, d, y"), OwaEventHandlerErrorCode.WebPartInvalidParameterError);
                                    return(null);
                                }
                            }
                            if (this.IsBasicClient())
                            {
                                this.webPartParameters["part"] = "1";
                            }
                            disposeGuard.Success();
                            result = folder;
                        }
                    }
                }
            }
            return(result);
        }