예제 #1
0
        /// <summary>
        /// Преобразует XElement в экземпляр CheckAccessResult
        /// </summary>
        /// <param name="src">Исходный XElement</param>
        /// <returns>Экземпляр CheckAccessResult</returns>
        static public CheckAccessResult FromXElement(XElement src)
        {
            CheckAccessResult obj = new CheckAccessResult();

            if (src != null)
            {
                if (src.Element("Delete") != null)
                {
                    obj.Delete = src.Element("Delete").getValue(false);
                }
                if (src.Element("InsertChildren") != null)
                {
                    obj.InsertChildren = src.Element("InsertChildren").getValue(false);
                }
                if (src.Element("Read") != null)
                {
                    obj.Read = src.Element("Read").getValue(false);
                }
                if (src.Element("Update") != null)
                {
                    obj.Update = src.Element("Update").getValue(false);
                }
            }

            return(obj);
        }
예제 #2
0
        static public ObjectAccessResult FromXElement(XElement src)
        {
            ObjectAccessResult obj = new ObjectAccessResult()
            {
                Id     = -1,
                Access = new CheckAccessResult()
                {
                    Read           = false,
                    Update         = false,
                    InsertChildren = false,
                    Delete         = false
                }
            };

            if (src != null)
            {
                if (src.Element("Id") != null)
                {
                    obj.Id = src.Element("Id").getValue(-1);
                }
                if (src.Element("CheckAccessResult") != null)
                {
                    obj.Access = CheckAccessResult.FromXElement(src.Element("CheckAccessResult"));
                }
            }

            return(obj);
        }
예제 #3
0
 /// <summary>
 /// Преобразует экземпляр CheckAccessResult в XElement
 /// </summary>
 /// <param name="obj">Исходный CheckAccessResult</param>
 /// <returns>Результирующий XElement</returns>
 static public XElement ToXElement(CheckAccessResult obj)
 {
     return(new XElement("CheckAccessResult",
                         new XElement("Delete", obj.Delete),
                         new XElement("InsertChildren", obj.InsertChildren),
                         new XElement("Read", obj.Read),
                         new XElement("Update", obj.Update)));
 }
예제 #4
0
 /// <summary>
 /// Преобразует экземпляр ObjectAccessResult в XElement
 /// </summary>
 /// <param name="obj">Исходный ObjectAccessResult</param>
 /// <returns>Результирующий XElement</returns>
 static public XElement ToXElement(ObjectAccessResult obj)
 {
     return(new XElement("ObjectAccessResult",
                         new XElement("Id", obj.Id),
                         CheckAccessResult.ToXElement(obj.Access)));
 }