Exemplo n.º 1
0
        /// <summary>
        /// Parses the specified XML.
        /// </summary>
        /// <param name="xml">The XML.</param>
        /// <returns>User or null if it's a folder.</returns>
        public static User Parse(XmlNode xml)
        {
            if (xml == null || xml.Attributes == null)
            {
                return(null);
            }

            try
            {
                var item = new User
                {
                    PrincipalId = xml.SelectAttributeValue("principal-id"),
                    Type        = EnumReflector.ReflectEnum(xml.SelectAttributeValue("type"), PrincipalType.user),
                    Name        = xml.SelectSingleNodeValue("name/text()"),
                    Login       = xml.SelectSingleNodeValue("login/text()"),
                    Email       = xml.SelectSingleNodeValue("email/text()"),
                    Manager     = xml.SelectSingleNodeValue("manager/text()"),
                };
                return(item);
            }
            catch (Exception ex)
            {
                TraceTool.TraceException(ex);
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Parses the specified XML.
        /// </summary>
        /// <param name="xml">The XML.</param>
        /// <returns>PermissionInfo object.</returns>
        public static PermissionInfo Parse(XmlNode xml)
        {
            if (xml == null || xml.Attributes == null)
            {
                return(null);
            }

            try
            {
                return(new PermissionInfo
                {
                    PrincipalId = xml.SelectAttributeValue("principal-id"),
                    PermissionStringValue = xml.SelectAttributeValue("permission-id"),
                    PermissionId = EnumReflector.ReflectEnum(xml.SelectAttributeValue("permission-id"), PermissionId.none),
                    IsPrimary = xml.ParseAttributeBool("is-primary"),
                    HasChildren = xml.ParseAttributeBool("has-children"),
                    Login = xml.SelectSingleNodeValue("login/text()"),
                    Name = xml.SelectSingleNodeValue("name/text()"),
                    Description = xml.SelectSingleNodeValue("description/text()")
                });
            }
            catch (Exception ex)
            {
                TraceTool.TraceException(ex);
            }

            return(null);
        }
Exemplo n.º 3
0
        public static TrainingItem Parse(XmlNode xml)
        {
            if (xml?.Attributes == null)
            {
                return(null);
            }
            var iconString = xml.SelectAttributeValue("icon");

            try
            {
                return(new TrainingItem
                {
                    ScoId = xml.SelectAttributeValue("sco-id"),
                    Type = EnumReflector.ReflectEnum(xml.SelectAttributeValue("type"), ScoType.not_set),
                    Icon = string.IsNullOrWhiteSpace(iconString)
                        ? ScoIcon.not_set
                        : EnumReflector.ReflectEnum(xml.SelectAttributeValue("icon"), ScoIcon.not_set),
                    PermissionId = xml.SelectAttributeValue("permission-id"),
                    Name = xml.SelectSingleNodeValue("name/text()"),
                    Description = xml.SelectSingleNodeValue("description/text()"),
                    UrlPath = xml.SelectSingleNodeValue("url-path/text()"),
                    DateBegin = xml.ParseNodeDateTime("date-begin/text()", default(DateTime)),
                    DateEnd = xml.ParseNodeDateTime("date-end/text()", default(DateTime)),
                    DateCreated = xml.ParseNodeDateTime("date-created/text()", default(DateTime)),
                    DateModified = xml.ParseNodeDateTime("date-modified/text()", default(DateTime)),
                });
            }
            catch (Exception ex)
            {
                TraceTool.TraceException(ex);
            }

            return(null);
        }
Exemplo n.º 4
0
        public static SwfTagCategory GetTagCategory(SwfTagCode code)
        {
            if (_mapcat == null)
            {
                _mapcat = EnumReflector.GetAttributeMap <SwfTagCode, SwfTagCategory, SwfTagCategoryAttribute>(attr => attr.Category);
            }
            SwfTagCategory result;

            return(_mapcat.TryGetValue(code, out result) ? result : SwfTagCategory.Unknown);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns minimum SWF version where tag with specified code was defined.
        /// </summary>
        /// <param name="code">tag code</param>
        /// <returns></returns>
        public static int GetTagVersion(SwfTagCode code)
        {
            if (_mapver == null)
            {
                _mapver = EnumReflector.GetAttributeMap <SwfTagCode, int, SwfVersionAttribute>(attr => attr.Version);
            }
            int result;

            return(_mapver.TryGetValue(code, out result) ? result : -1);
        }
Exemplo n.º 6
0
        public static MeetingItem Parse(XmlNode xml)
        {
            if (xml?.Attributes == null)
            {
                return(null);
            }
            var iconString = xml.SelectAttributeValue("icon");

            try
            {
                return(new MeetingItem
                {
                    ScoId = xml.SelectAttributeValue("sco-id"),
                    Type = EnumReflector.ReflectEnum(xml.SelectAttributeValue("type"), ScoType.not_set),
                    Icon = string.IsNullOrWhiteSpace(iconString)
                        ? ScoIcon.not_set
                        : EnumReflector.ReflectEnum(xml.SelectAttributeValue("icon"), ScoIcon.not_set),
                    PermissionId = xml.SelectAttributeValue("permission-id"),
                    ActiveParticipants = xml.ParseAttributeInt("active-participants"),
                    Name = xml.SelectSingleNodeValue("name/text()"),
                    Description = xml.SelectSingleNodeValue("description/text()"),
                    DomainName = xml.SelectSingleNodeValue("domain-name/text()"),
                    UrlPath = xml.SelectSingleNodeValue("url-path/text()"),
                    DateBegin = xml.ParseNodeDateTime("date-begin/text()", default(DateTime)),
                    DateEnd = xml.ParseNodeDateTime("date-end/text()", default(DateTime)),
                    Expired = xml.ParseNodeBool("description/text()"),
                    Duration = xml.ParseNodeTimeSpan("duration/text()", default(TimeSpan))
                });

                /*
                 * if (!string.IsNullOrEmpty(item.UrlPath) && adobeConnectRoot != null)
                 * {
                 * item.FullUrl = adobeConnectRoot.ToString().TrimEnd('/') + item.UrlPath;
                 * }
                 *
                 * item.Duration = item.DateEnd.Subtract(item.DateBegin);
                 *
                 * // if item.DateBegin is not defined and duration is 0 => then this is the folder which should be ignored
                 * if (!item.DateBegin.Equals(default(DateTime)) || item.Duration.TotalMinutes != 0)
                 * {
                 * return item;
                 * }
                 */
            }
            catch (Exception ex)
            {
                TraceTool.TraceException(ex);
            }

            return(null);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Returns minimum SWF version where action with specified code was defined.
        /// </summary>
        /// <param name="code">action code</param>
        /// <returns></returns>
        public static int GetActionVersion(SwfActionCode code)
        {
            if (_mapver == null)
            {
                _mapver = EnumReflector.GetAttributeMap <SwfActionCode, int, SwfVersionAttribute>(attr => attr.Version);
            }
            int result;

            if (_mapver.TryGetValue(code, out result))
            {
                return(result);
            }
            return(-1);
        }
Exemplo n.º 8
0
        public CustomField Parse(XmlNode xml)
        {
            if (xml == null)
            {
                throw new ArgumentNullException(nameof(xml));
            }

            return(new CustomField
            {
                PermissionId = EnumReflector.ReflectEnum(xml.SelectAttributeValue("permission-id"), PermissionId.none),
                ObjectType = EnumReflector.ReflectEnum <ObjectType>(xml.SelectAttributeValue("object-type")),
                FieldId = xml.SelectAttributeValue("field-id"),
                AccountId = xml.SelectAttributeValue("account-id"),
                DisplaySeq = xml.ParseAttributeInt("display-seq"),
                FieldType = EnumReflector.ReflectEnum <CustomField.CustomFieldType>(xml.SelectAttributeValue("field-type")),
                IsPrimary = xml.ParseAttributeBool("is-primary"),
                IsRequired = xml.ParseAttributeBool("is-required"),

                Name = xml.SelectSingleNodeValue("name/text()"),
                Comments = xml.SelectSingleNodeValue("comments/text()"),
            });
        }
Exemplo n.º 9
0
 /// <summary>
 /// Post-Sco-update routine.
 /// Called only if sco-update succeeded!
 /// </summary>
 /// <param name="scoId">The sco id.</param>
 /// <param name="model">The model.</param>
 protected override void SaveAdditionalData(string scoId, MeetingDetailModel model)
 {
     this.AdobeConnect.UpdatePublicAccessPermissions(scoId, EnumReflector.ReflectEnum(model.PermissionId, SpecialPermissionId.remove));
 }
Exemplo n.º 10
0
        public ActionResult SetPermission(string meetingId, string meetingName, string principalId, string permissionId, string currentPrincipalId, string returnUrl)
        {
            try
            {
                if (this.LoginWithSession().Success)
                {
                    AdobeConnect.UpdateMeetingPermissionForPrincipal(meetingId, principalId, EnumReflector.ReflectEnum(permissionId, MeetingPermissionId.not_set));
                }

                return(RedirectToAction("Index", new { meetingId, meetingName, currentPrincipalId, returnUrl }));
            }
            catch
            {
            }

            return(View(ViewName));
        }
Exemplo n.º 11
0
 /// <summary>
 /// The parse attribute enumerable.
 /// </summary>
 /// <param name="node">
 /// The node.
 /// </param>
 /// <param name="attribute">
 /// The attribute.
 /// </param>
 /// <param name="defaultValue">
 /// The default value.
 /// </param>
 /// <typeparam name="T">
 /// Any enumerable.
 /// </typeparam>
 /// <returns>
 /// The <see cref="T"/>.
 /// </returns>
 public static T ParseAttributeEnum <T>(this XmlNode node, string attribute, T defaultValue)
 {
     return(EnumReflector.ReflectEnum(node.SelectAttributeValue("type"), defaultValue));
 }