Exemple #1
0
 public ICsiRevisionedObject GetItemByRef(string itemName, string revision, bool useROR)
 {
     foreach (object allChild in this.GetAllChildren())
     {
         CsiXmlElement csiXmlElementImpl = allChild as CsiXmlElement;
         if (!(csiXmlElementImpl.FindChildByName("__name") is CsiXmlElement childByName1) ||
             !itemName.Equals(CsiXmlHelper.GetFirstTextNodeValue(childByName1)))
         {
             continue;
         }
         if (!(csiXmlElementImpl.FindChildByName("__useROR") is CsiXmlElement childByName2) ||
             XmlConvert.ToBoolean(CsiXmlHelper.GetFirstTextNodeValue(childByName2)) != useROR)
         {
             continue;
         }
         if (useROR || Util.StringUtil.IsEmptyString(revision))
         {
             return((ICsiRevisionedObject) new CsiRevisionedObject(this.GetOwnerDocument(),
                                                                   csiXmlElementImpl.GetDomElement()));
         }
         if (!(csiXmlElementImpl.FindChildByName("__rev") is CsiXmlElement childByName3) || !revision.Equals(CsiXmlHelper.GetFirstTextNodeValue(childByName3)))
         {
             continue;
         }
         return((ICsiRevisionedObject) new CsiRevisionedObject(this.GetOwnerDocument(), csiXmlElementImpl.GetDomElement()));
     }
     return(null);
 }
Exemple #2
0
 public CsiParameter(ICsiDocument doc, string paramName, ICsiXmlElement parent) : base(doc, "__parameter", parent)
 {
     this.mElementName  = new CsiXmlElement(doc, "__name", this).GetDomElement();
     this.mElementValue = new CsiXmlElement(doc, "__value", this).GetDomElement();
     CsiXmlHelper.SetCdataNode(this.mElementName, paramName);
     CsiXmlHelper.SetCdataNode(this.mElementValue, "");
 }
 public CsiService(ICsiDocument doc, string serviceName, ICsiXmlElement parent)
     : base(doc, "__service", parent)
 {
     this.SetAttribute("__serviceType", serviceName);
     CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__txnGUID", CsiXmlHelper.GenerateGuid());
     CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__utcOffset", CsiXmlDataFormat.GetUTCOffset());
 }
Exemple #4
0
        public virtual void DeleteItemByIndex(int index)
        {
            ICsiXmlElement sourceElement = new CsiXmlElement(this.GetOwnerDocument(), "__listItem", this);

            sourceElement.SetAttribute("__listItemAction", "delete");
            CsiXmlHelper.FindCreateSetValue(sourceElement, "__index", Convert.ToString(index));
        }
        public virtual void RequestCdoDefinitionFieldByName(string typeName, string fieldName)
        {
            ICsiXmlElement sourceElement = base.ClearXmlElementChildByName("__CDODefinition");

            CsiXmlHelper.FindCreateSetValue(sourceElement, "__CDOTypeName", typeName);
            new CsiXmlElement(this.GetOwnerDocument(), "__field", sourceElement).SetAttribute("__name", fieldName);
        }
        public void DeleteItemByName(string itemName)
        {
            ICsiNamedObject sourceElement = new CsiNamedObject(this.GetOwnerDocument(), "__listItem", this);

            sourceElement.SetAttribute("__listItemAction", "delete");
            CsiXmlHelper.FindCreateSetValue2(sourceElement, "__key", "__name", itemName, true);
        }
Exemple #7
0
        public void DeleteItemByRef(string name, string level)
        {
            ICsiContainer sourceElement = new CsiContainer(this.GetOwnerDocument(), "__listItem", this);

            sourceElement.SetAttribute("__listItemAction", "delete");
            CsiXmlHelper.FindCreateSetValue2(sourceElement, "__key", "__name", name, true);
            CsiXmlHelper.FindCreateSetValue3(sourceElement, "__key", "__level", "__name", level, true);
        }
Exemple #8
0
        public ICsiRevisionedObject ChangeItemByIndex(int index)
        {
            ICsiRevisionedObject revisionedObject = (ICsiRevisionedObject) new CsiRevisionedObject(this.GetOwnerDocument(), "__listItem", (ICsiXmlElement)this);

            revisionedObject.SetAttribute("__listItemAction", "change");
            CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)revisionedObject, "__index", XmlConvert.ToString(index));
            return(revisionedObject);
        }
 private bool GetUseRor()
 {
     if (this.FindChildByName("__useROR") is CsiXmlElement childByName)
     {
         return(CsiXmlHelper.GetFirstTextNodeValue(childByName).Equals("true"));
     }
     return(false);
 }
        public ICsiSubentity ChangeItemByIndex(int index)
        {
            ICsiSubentity csiSubentity = (ICsiSubentity) new CsiSubentity(this.GetOwnerDocument(), "__listItem", (ICsiXmlElement)this);

            csiSubentity.SetAttribute("__listItemAction", "change");
            CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)csiSubentity, "__index", XmlConvert.ToString(index));
            return(csiSubentity);
        }
 private string GetRevision()
 {
     if (this.FindChildByName("__rev") is CsiXmlElement childByName)
     {
         return(CsiXmlHelper.GetFirstTextNodeValue(childByName));
     }
     return((string)null);
 }
 public virtual string GetRevision()
 {
     if (this.FindChildByName("__rev") is CsiXmlElement childByName)
     {
         return(CsiXmlHelper.GetFirstTextNodeValue(childByName));
     }
     return(string.Empty);
 }
Exemple #13
0
        public ICsiNamedSubentity ChangeItemByName(string itemName)
        {
            ICsiNamedSubentity csiNamedSubentity = (ICsiNamedSubentity) new CsiNamedSubentity(this.GetOwnerDocument(), "__listItem", (ICsiXmlElement)this);

            csiNamedSubentity.SetAttribute("__listItemAction", "change");
            CsiXmlHelper.FindCreateSetValue2((ICsiXmlElement)csiNamedSubentity, "__key", "__name", itemName, true);
            return(csiNamedSubentity);
        }
Exemple #14
0
 public void SetRef(string name, string level)
 {
     CsiXmlHelper.FindCreateSetValue(this, "__name", name, true);
     if (!StringUtil.IsEmptyString(level))
     {
         CsiXmlHelper.FindCreateSetValue2(this, "__level", "__name", level, true);
     }
 }
        public ICsiNamedObject ChangeItemByIndex(int index)
        {
            ICsiNamedObject sourceElement = new CsiNamedObject(this.GetOwnerDocument(), "__listItem", this);

            sourceElement.SetAttribute("__listItemAction", "change");
            CsiXmlHelper.FindCreateSetValue(sourceElement, "__index", XmlConvert.ToString(index));
            return(sourceElement);
        }
 public void SetRef(string name, string revision, bool useRor)
 {
     CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__name", name, true);
     if (!useRor && revision != null)
     {
         CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__rev", revision, true);
     }
     CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__useROR", useRor ? "true" : "false");
 }
Exemple #17
0
        public ICsiDataField DeleteItemByValue(string val)
        {
            CsiDataField sourceElement = new CsiDataField(this.GetOwnerDocument(), "__listItem", this);

            sourceElement.SetAttribute("__listItemAction", "delete");
            ICsiXmlElement element = CsiXmlHelper.FindCreateSetValue2(sourceElement, "__key", "__value", val, true);

            return(new CsiDataField(this.GetOwnerDocument(), (element as CsiXmlElement).GetDomElement()));
        }
Exemple #18
0
        public void DeleteItemByRef(string itemName, string revision, bool useROR)
        {
            ICsiRevisionedObject revisionedObject = (ICsiRevisionedObject) new CsiRevisionedObject(this.GetOwnerDocument(), "__listItem", (ICsiXmlElement)this);

            revisionedObject.SetAttribute("__listItemAction", "delete");
            CsiXmlHelper.FindCreateSetValue2((ICsiXmlElement)revisionedObject, "__key", "__name", itemName, true);
            CsiXmlHelper.FindCreateSetValue2((ICsiXmlElement)revisionedObject, "__key", "__rev", revision, true);
            CsiXmlHelper.FindCreateSetValue2((ICsiXmlElement)revisionedObject, "__key", "__useROR", useROR ? "true" : "false");
        }
 public CsiParameters(ICsiDocument doc, string tagName, ICsiXmlElement parent) : base(doc, tagName, parent)
 {
     if (!(tagName.Equals("__parameters") || tagName.Equals("__queryParameters")))
     {
         string src  = base.GetType().FullName + ".Constructor()";
         string desc = CsiXmlHelper.GetInvalidElement(tagName) + "(valid elements are: __parameters and " + "__queryParameters)";
         throw new CsiClientException(-1L, desc, src);
     }
 }
 public void SetContainerRef(string name, string level)
 {
     CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__name", name);
     if (level.Length <= 0)
     {
         return;
     }
     CsiXmlHelper.FindCreateSetValue2((ICsiXmlElement)this, "__level", "__name", level);
 }
 public void SetRevisionedObjectRef(string name, string rev, bool useROR)
 {
     CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__name", name);
     if (!useROR && rev != null)
     {
         CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__rev", rev);
     }
     CsiXmlHelper.FindCreateSetValue((ICsiXmlElement)this, "__useROR", useROR ? "true" : "false");
 }
Exemple #22
0
        public virtual Array GetListItems()
        {
            Array array = CsiXmlHelper.GetChildrenByName(this.GetOwnerDocument(), base.GetDomElement(), "__listItem");

            if (array.Length > 0)
            {
                return(array);
            }
            return(null);
        }
Exemple #23
0
        public void RequestFieldDefinition()
        {
            CsiMetaData sourceElement = base.FindChildByName("__metadata") as CsiMetaData;

            if (sourceElement == null)
            {
                sourceElement = new CsiMetaData(this.GetOwnerDocument(), this);
            }
            CsiXmlHelper.FindCreateSetValue(sourceElement, "__fieldDef", null);
        }
        public virtual ICsiXmlElement GetParentElement()
        {
            XmlNode parentNode = this.mDOMElement.ParentNode;

            if ((parentNode != null) && (parentNode.NodeType == XmlNodeType.Element))
            {
                return(CsiXmlHelper.CreateCsiElement(this.GetOwnerDocument(), parentNode as XmlElement));
            }
            return(null);
        }
Exemple #25
0
        public CsiQueryParameters(ICsiDocument doc, XmlElement element) : base(doc, element)
        {
            string name = element.Name;

            if (!name.Equals("__queryParameters"))
            {
                string desc = CsiXmlHelper.GetInvalidElement(name) + "(有效元素是: __queryParameters). ";
                throw new CsiClientException(-1L, desc, base.GetType().FullName + ".Constructor()");
            }
        }
Exemple #26
0
        public ICsiDataField ChangeItemByIndex(int index, string val)
        {
            CsiDataField sourceElement = new CsiDataField(this.GetOwnerDocument(), "__listItem", this);

            sourceElement.SetAttribute("__listItemAction", "change");
            CsiXmlHelper.FindCreateSetValue(sourceElement, "__index", Convert.ToString(index));
            ICsiXmlElement element = CsiXmlHelper.FindCreateSetValue(sourceElement, "__value", val, true);

            return(new CsiDataField(this.GetOwnerDocument(), (element as CsiXmlElement).GetDomElement()));
        }
Exemple #27
0
 public virtual void SetValue(string val)
 {
     try
     {
         CsiXmlHelper.SetCdataNode(this.mElementValue, val);
     }
     catch (XmlException exception)
     {
         throw new CsiClientException(-1L, exception, base.GetType().FullName + ".setValue()");
     }
 }
Exemple #28
0
        public virtual string GetName()
        {
            CsiXmlElement csiElement = (CsiXmlElement)base.FindChildByName("__name");
            string        str        = string.Empty;

            if (csiElement != null)
            {
                str = CsiXmlHelper.GetFirstTextNodeValue(csiElement);
            }
            return(str);
        }
 private string GetLevel()
 {
     if (!(this.FindChildByName("__level") is CsiXmlElement childByName1))
     {
         return((string)null);
     }
     if (childByName1.FindChildByName("__name") is CsiXmlElement childByName2)
     {
         return(CsiXmlHelper.GetFirstTextNodeValue(childByName2));
     }
     return((string)null);
 }
        private void requestCDOSubTypes(string childTag, string nameOrId, bool recurse)
        {
            ICsiXmlElement parentElement = base.ClearXmlElementChildByName("__CDOSubType");

            if (recurse)
            {
                new CsiXmlElement(this.GetOwnerDocument(), "__recurse", parentElement);
            }
            if ((nameOrId != null) && (childTag != null))
            {
                CsiXmlHelper.FindCreateSetValue(parentElement, childTag, nameOrId);
            }
        }