public CsiXmlElement(ICsiDocument document, string tagName, ICsiXmlElement parentElement) { this.mDocument = null; if (StringUtil.IsEmptyString(tagName)) { throw new Exceptions.CsiClientException(0x2e0016L, base.GetType().FullName + ".csiXMLElement()"); } this.mDocument = document; string str = tagName; ICsiXmlElement element = parentElement; CsiXmlElement child = null; while (str != null) { int index = str.IndexOf("."); if (index > 0) { tagName = str.Substring(0, index); str = str.Substring(index + 1); } else { tagName = str; str = null; } this.mDOMElement = (document as CsiDocument).CreateDomElement(tagName); child = new CsiXmlElement(document, this.mDOMElement); element.AppendChild(child); element = child; } }
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 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()); }
public virtual void SetAlwaysReturnSelectionValues(bool val) { if (val == this.GetAlwaysReturnSelectionValues()) { return; } ICsiXmlElement childByName1 = this.GetRootElement().FindChildByName("__session"); if (childByName1 == null) { throw new CsiClientException(-1L, "会话不存在", this.GetType().FullName + ".setAlwaysReturnSelectionValues()"); } ICsiXmlElement childByName2 = childByName1.FindChildByName("__connect"); if (childByName2 == null) { throw new CsiClientException(-1L, "连接不存在", this.GetType().FullName + ".setAlwaysReturnSelectionValues()"); } ICsiXmlElement parentElement = childByName2.FindChildByName("__processingDefaults") ?? (ICsiXmlElement) new CsiXmlElement((ICsiDocument)this, "__processingDefaults", childByName2); ICsiXmlElement childByName3 = parentElement.FindChildByName("__alwaysGetSelectionValues"); if (childByName3 == null) { ICsiXmlElement csiXmlElement = (ICsiXmlElement) new CsiXmlElement((ICsiDocument)this, "__alwaysGetSelectionValues", parentElement); } else { parentElement.RemoveChild(childByName3); } }
public ICsiXmlElement RemoveChild(ICsiXmlElement child) { CsiXmlElement impl = (CsiXmlElement)child; this.mDOMElement.RemoveChild(impl.GetDomElement()); return(impl); }
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 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 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())); }
private ICsiXmlElement GetAllFieldElement() { ICsiXmlElement element = base.FindChildByName("__allFields"); if (element == null) { element = new CsiXmlElement(this.GetOwnerDocument(), "__allFields", this); } return(element); }
public CsiDocument(ICsiSession session) { this.mSession = session; this.mRequestDocument = new XmlDocument(); this.mResponseDocument = (ICsiDocument)null; this.mRootElement = (ICsiXmlElement) new CsiXmlElement((ICsiDocument)this, this.mRequestDocument.CreateElement("__InSite")); this.mRequestDocument.AppendChild((XmlNode)(this.mRootElement as CsiXmlElement).GetDomElement()); this.mRootElement.SetAttribute("__version", "1.1"); this.mRootElement.SetAttribute("__encryption", "2"); }
public static ICsiXmlElement FindCreateSetValue2(ICsiXmlElement sourceElement, string firstLevelTag, string secondLevelTag, string val, bool isCdata) { ICsiXmlElement element = sourceElement.FindChildByName(firstLevelTag); if (element == null) { element = new CsiXmlElement(sourceElement.GetOwnerDocument(), firstLevelTag, sourceElement); } return(FindCreateSetValue(element, secondLevelTag, val, isCdata)); }
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())); }
private void CreateConnect(string userName, string password, ICsiXmlElement parent) { ICsiDocument document = parent.GetOwnerDocument(); ICsiXmlElement element = new CsiXmlElement(document, "__connect", parent); ICsiNamedObject obj2 = new CsiNamedObject(document, "user", element); obj2.SetRef(userName); ICsiDataField field = new CsiDataField(document, "password", element); field.SetEncryptedValue(password); }
public virtual ICsiLabel GetLabel() { ICsiXmlElement element = base.FindChildByName("__label"); if (element == null) { string tagName = "__field" + '.' + "__label"; element = base.FindChildByName(tagName); } return(element as ICsiLabel); }
protected ICsiXmlElement ClearXmlElementChildByName(string parent, string child) { ICsiXmlElement element = this.FindChildByName(parent); if (element == null) { return(new CsiXmlElement(this.GetOwnerDocument(), parent, this)); } this.removeChildByName(element, child); return(element); }
private void CreateConnectWithoutPassword(string userName, string sessionId, ICsiXmlElement parent) { ICsiDocument document = parent.GetOwnerDocument(); ICsiXmlElement element = new CsiXmlElement(document, "__useSession", parent); ICsiNamedObject obj2 = new CsiNamedObject(document, "user", element); obj2.SetRef(userName); ICsiDataField field = new CsiDataField(document, "sessionId", element); field.SetAttribute("__encrypted", "no"); field.SetValue(sessionId); }
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); } }
public ICsiXmlElement FindChildByName(string tagName) { ICsiXmlElement element = null; string[] stringList = StringUtil.GetStringList(tagName, '.'); XmlElement element2 = this.RecursiveGetElement(this.GetDomElement(), stringList); if (element2 != null) { element = CsiXmlHelper.CreateCsiElement(this.GetOwnerDocument(), element2); } return(element); }
protected virtual void removeChildByName(ICsiXmlElement element, string name) { if (StringUtil.IsEmptyString(name)) { element.RemoveAllChildren(); } else { ICsiXmlElement child = element.FindChildByName(name); if (child != null) { element.RemoveChild(child); } } }
public virtual void SetStartRow(long val) { try { ICsiXmlElement childByName = this.FindChildByName("__startRow"); if (null != childByName) { this.RemoveChild(childByName); } ICsiDataField csiDataFieldImpl = new CsiDataField(this.GetOwnerDocument(), "__startRow", (ICsiXmlElement)this, Convert.ToString(val)); } catch (Exception ex) { } }
public virtual void SetResultsetSize(long size) { try { ICsiXmlElement childByName = this.FindChildByName("__rowSetSize"); if (null != childByName) { this.RemoveChild(childByName); } CsiDataField csiDataFieldImpl = new CsiDataField(this.GetOwnerDocument(), "__rowSetSize", (ICsiXmlElement)this, XmlConvert.ToString(size)); } catch (Exception ex) { } }
public static ICsiXmlElement FindCreateSetValue(ICsiXmlElement sourceElement, string tagName, string val, bool isCdata = false) { CsiXmlElement impl = (CsiXmlElement)sourceElement.FindChildByName(tagName); if (impl == null) { impl = new CsiXmlElement(sourceElement.GetOwnerDocument(), tagName, sourceElement); } if (!(!isCdata || StringUtil.IsEmptyString(val))) { SetCdataNode(impl.GetDomElement(), val); return(impl); } SetTextNode(impl.GetDomElement(), val); return(impl); }
public virtual void SetResultsetSize(long size) { try { ICsiXmlElement childByName = this.FindChildByName("__rowSetSize"); if (null != childByName) { this.RemoveChild(childByName); } CsiDataField csiDataFieldImpl = new CsiDataField(this.GetOwnerDocument(), "__rowSetSize", (ICsiXmlElement)this, XmlConvert.ToString(size)); } catch (Exception ex) { LogHelper.Error <CsiRequestSelectionValuesEx>(ex.Message); } }
public virtual void SetStartRow(long val) { try { ICsiXmlElement childByName = this.FindChildByName("__startRow"); if (null != childByName) { this.RemoveChild(childByName); } ICsiDataField csiDataFieldImpl = new CsiDataField(this.GetOwnerDocument(), "__startRow", (ICsiXmlElement)this, Convert.ToString(val)); } catch (Exception ex) { LogHelper.Error <CsiRequestSelectionValuesEx>(ex.Message); } }
public ICsiXmlElement AppendChild(ICsiXmlElement child) { CsiXmlElement impl = (CsiXmlElement)child; try { if (this.mDOMElement.OwnerDocument == impl.GetDomElement().OwnerDocument) { this.mDOMElement.AppendChild(impl.GetDomElement()); } } catch (Exception exception) { throw new Exceptions.CsiClientException(-1L, exception, base.GetType().FullName + ".appendChild()"); } return(child); }
protected virtual ICsiXmlElement FindChildByName(string firstLevelChildTagName, string secondLevelChildTagName, string nameText) { IEnumerator enumerator = CsiXmlHelper.GetChildrenByName(this.GetOwnerDocument(), this.GetDomElement(), firstLevelChildTagName).GetEnumerator(); while (enumerator.MoveNext()) { ICsiXmlElement current = enumerator.Current as ICsiXmlElement; if (current.FindChildByName(secondLevelChildTagName) is CsiXmlElement impl) { string str = impl.GetDomElement().Value; if (str == null) { str = impl.GetElementValue(); } if (nameText.Equals(str)) { return(current); } } } return(null); }
private void SetDocument(XmlDocument doc) { this.mRequestDocument = doc; this.mRootElement = (ICsiXmlElement) new CsiXmlElement((ICsiDocument)this, doc.DocumentElement); this.mExceptions.Clear(); }
public CsiContainer(ICsiDocument doc, string name, ICsiXmlElement parent) : base(doc, name, parent) { }
public CsiSelectionValuesEx(CsiDocument doc, ICsiXmlElement parent) : base(doc, "__selectionValuesEx", parent) { }
public CsiParentInfo(ICsiDocument doc, string name, ICsiXmlElement parent) : base(doc, name, parent) { }