public void WriteXml(XmlWriter writer) { writer.WriteStartElement("M"); if (!IsSystem) { writer.WriteAttributeString("sys", IsSystem.ToString()); } if (IsPrivate) { writer.WriteAttributeString("pri", IsPrivate.ToString()); } if (Sender != null && Sender.Length != 0) { writer.WriteAttributeString("sen", Sender); } if (Receiver != null && Receiver.Length != 0) { writer.WriteAttributeString("rec", Receiver); } writer.WriteString(Text); writer.WriteEndElement(); }
public override JObject ToJson() { JObject jObject = base.ToJson(); jObject.Add("Name", Name); jObject.Add("Code", Code); jObject.Add("IsSystem", IsSystem.ToString()); jObject.Add("IsDefault", IsDefault.ToString()); return(jObject); }
internal IDictionary <string, object> GetAllValues() { var values = new Dictionary <string, object>(); values.Add("Id", Id); values.Add("NodeTypeId", NodeTypeId); values.Add("NodeType", FormatNodeType(NodeTypeId)); values.Add("ContentListId", ContentListId); values.Add("ContentListTypeId", ContentListTypeId); values.Add("ParentId", ParentId); values.Add("Name", Name); values.Add("DisplayName", DisplayName); values.Add("Path", Path); values.Add("Index", Index); values.Add("CreatingInProgress", CreatingInProgress.ToString().ToLower()); values.Add("IsDeleted", IsDeleted.ToString().ToLower()); values.Add("IsInherited", IsInherited.ToString().ToLower()); values.Add("CreationDate", FormatDate(CreationDate)); values.Add("ModificationDate", FormatDate(ModificationDate)); values.Add("CreatedById", CreatedById); values.Add("CreatedBy", FormatUser(CreatedById)); values.Add("ModifiedById", ModifiedById); values.Add("ModifiedBy", FormatUser(ModifiedById)); values.Add("VersionId", VersionId); values.Add("Version", Version.ToString()); values.Add("VersionCreationDate", FormatDate(VersionCreationDate)); values.Add("VersionModificationDate", FormatDate(VersionModificationDate)); values.Add("VersionCreatedById", VersionCreatedById); values.Add("VersionCreatedBy", FormatUser(VersionCreatedById)); values.Add("VersionModifiedById", VersionModifiedById); values.Add("VersionModifiedBy", FormatUser(VersionModifiedById)); values.Add("Locked", Locked.ToString().ToLower()); values.Add("LockedById", LockedById); values.Add("LockedBy", FormatUser(LockedById)); values.Add("ETag", ETag); values.Add("LockType", LockType); values.Add("LockTimeout", LockTimeout); values.Add("LockDate", FormatDate(LockDate)); values.Add("LockToken", LockToken); values.Add("LastLockUpdate", FormatDate(LastLockUpdate)); values.Add("IsSystem", IsSystem.ToString().ToLower()); values.Add("ClosestSecurityNodeId", ClosestSecurityNodeId); values.Add("SavingState", SavingState); foreach (var key in dynamicData.Keys) { var propType = ActiveSchema.PropertyTypes.GetItemById(key); if (propType != null) { values.Add(propType.Name.Replace("#", "_"), FormatDynamicData(dynamicData[key] ?? string.Empty, propType.DataType)); } } return(values); }
}//ToXml() public JObject ToJson() { //JObject Ret = new JObject(); JObject RootPropObj = new JObject(); //Ret[CswEnumNbtViewXmlNodeName.TreeView.ToString()] = RootPropObj; RootPropObj["nodename"] = CswEnumNbtViewXmlNodeName.TreeView.ToString().ToLower(); RootPropObj["viewname"] = ViewName; RootPropObj["version"] = "1.0"; RootPropObj["iconfilename"] = IconFileName; RootPropObj["selectable"] = Selectable.ToString().ToLower(); RootPropObj["mode"] = ViewMode.ToString(); RootPropObj["width"] = (Width > 0) ? Width.ToString() : ""; RootPropObj["viewid"] = (ViewId.isSet()) ? ViewId.get().ToString() : ""; RootPropObj["category"] = Category; RootPropObj["visibility"] = Visibility.ToString(); RootPropObj["visibilityroleid"] = (VisibilityRoleId != null) ? VisibilityRoleId.PrimaryKey.ToString() : ""; RootPropObj["visibilityrolename"] = (VisibilityRoleId != null) ? _CswNbtResources.Nodes[VisibilityRoleId].NodeName : ""; RootPropObj["visibilityuserid"] = (VisibilityUserId != null) ? VisibilityUserId.PrimaryKey.ToString() : ""; RootPropObj["visibilityusername"] = (VisibilityUserId != null) ? _CswNbtResources.Nodes[VisibilityUserId].NodeName : ""; RootPropObj["groupbysiblings"] = GroupBySiblings; RootPropObj["included"] = Included.ToString().ToLower(); RootPropObj["isdemo"] = IsDemo.ToString().ToLower(); RootPropObj["issystem"] = IsSystem.ToString().ToLower(); RootPropObj["includetempnodes"] = IncludeTempNodes.ToString().ToLower(); RootPropObj["gridgroupbycol"] = GridGroupByCol.ToString().ToLower(); RootPropObj["showdelete"] = false; //for ViewContentTree - don't show the "X" on view root JObject ChildObject = new JObject(); if (null == RootPropObj[_ChildRelationshipsName] || RootPropObj[_ChildRelationshipsName].Type != JTokenType.Object) { RootPropObj[_ChildRelationshipsName] = ChildObject; // Recurse on child ViewNodes foreach (CswNbtViewRelationship ChildRelationship in ChildRelationships) { JProperty ChildRelationshipProp = ChildRelationship.ToJson(); if (null == ChildObject[ChildRelationshipProp.Name]) { ChildObject.Add(ChildRelationshipProp); } } } //return Ret; return(RootPropObj); }//ToXml()
public XmlNode ToXml(XmlDocument XmlDoc) { XmlNode RootXmlNode = XmlDoc.CreateNode(XmlNodeType.Element, CswEnumNbtViewXmlNodeName.TreeView.ToString(), ""); XmlAttribute ViewNameAttribute = XmlDoc.CreateAttribute("viewname"); ViewNameAttribute.Value = ViewName; RootXmlNode.Attributes.Append(ViewNameAttribute); //bz #5157 XmlAttribute ViewVersionAttribute = XmlDoc.CreateAttribute("version"); ViewVersionAttribute.Value = "1.0"; RootXmlNode.Attributes.Append(ViewVersionAttribute); XmlAttribute IconFileNameAttribute = XmlDoc.CreateAttribute("iconfilename"); IconFileNameAttribute.Value = IconFileName; RootXmlNode.Attributes.Append(IconFileNameAttribute); XmlAttribute SelectableAttribute = XmlDoc.CreateAttribute("selectable"); SelectableAttribute.Value = Selectable.ToString().ToLower(); RootXmlNode.Attributes.Append(SelectableAttribute); XmlAttribute ModeAttribute = XmlDoc.CreateAttribute("mode"); ModeAttribute.Value = ViewMode.ToString(); RootXmlNode.Attributes.Append(ModeAttribute); XmlAttribute WidthAttribute = XmlDoc.CreateAttribute("width"); if (Width > 0) { WidthAttribute.Value = Width.ToString(); } else { WidthAttribute.Value = ""; } RootXmlNode.Attributes.Append(WidthAttribute); XmlAttribute ViewIdAttribute = XmlDoc.CreateAttribute("viewid"); if (ViewId.isSet()) { ViewIdAttribute.Value = ViewId.get().ToString(); } else { ViewIdAttribute.Value = ""; } RootXmlNode.Attributes.Append(ViewIdAttribute); XmlAttribute CategoryAttribute = XmlDoc.CreateAttribute("category"); CategoryAttribute.Value = Category.ToString(); RootXmlNode.Attributes.Append(CategoryAttribute); XmlAttribute VisibilityAttribute = XmlDoc.CreateAttribute("visibility"); VisibilityAttribute.Value = Visibility.ToString(); RootXmlNode.Attributes.Append(VisibilityAttribute); XmlAttribute VisibilityRoleIdAttribute = XmlDoc.CreateAttribute("visibilityroleid"); if (VisibilityRoleId != null) { VisibilityRoleIdAttribute.Value = VisibilityRoleId.PrimaryKey.ToString(); } RootXmlNode.Attributes.Append(VisibilityRoleIdAttribute); XmlAttribute VisibilityUserIdAttribute = XmlDoc.CreateAttribute("visibilityuserid"); if (VisibilityUserId != null) { VisibilityUserIdAttribute.Value = VisibilityUserId.PrimaryKey.ToString(); } RootXmlNode.Attributes.Append(VisibilityUserIdAttribute); XmlAttribute GroupBySiblingsAttribute = XmlDoc.CreateAttribute("groupbysiblings"); GroupBySiblingsAttribute.Value = GroupBySiblings.ToString().ToLower(); RootXmlNode.Attributes.Append(GroupBySiblingsAttribute); XmlAttribute IncludedAttribute = XmlDoc.CreateAttribute("included"); IncludedAttribute.Value = Included.ToString().ToLower(); RootXmlNode.Attributes.Append(IncludedAttribute); XmlAttribute IsDemoAttribute = XmlDoc.CreateAttribute("isdemo"); IsDemoAttribute.Value = IsDemo.ToString().ToLower(); RootXmlNode.Attributes.Append(IsDemoAttribute); XmlAttribute IsSystemAttribute = XmlDoc.CreateAttribute("issystem"); IsSystemAttribute.Value = IsSystem.ToString().ToLower(); RootXmlNode.Attributes.Append(IsSystemAttribute); XmlAttribute IncludeTempNodesAttribute = XmlDoc.CreateAttribute("includetempnodes"); IncludeTempNodesAttribute.Value = IncludeTempNodes.ToString().ToLower(); RootXmlNode.Attributes.Append(IncludeTempNodesAttribute); XmlAttribute GridGroupByColAttribute = XmlDoc.CreateAttribute("gridgroupbycol"); GridGroupByColAttribute.Value = GridGroupByCol.ToString().ToLower(); RootXmlNode.Attributes.Append(GridGroupByColAttribute); // Recurse on child ViewNodes foreach (CswNbtViewRelationship ChildRelationship in this.ChildRelationships) { XmlNode ChildXmlNode = ChildRelationship.ToXml(XmlDoc); RootXmlNode.AppendChild(ChildXmlNode); } return(RootXmlNode); }//ToXml()
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "DataRefTypeID") { ret = true; if (DataRefTypeID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefTypeGUID") { ret = true; if (DataRefTypeGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "DataRefType") { ret = true; if (DataRefType.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDefault") { ret = true; if (IsDefault.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsSystem") { ret = true; if (IsSystem.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }
public bool HaveColumn(string columnName, string columnValue, out bool retValueMatched) { bool ret = false; bool valueMatched = false; if (columnName == "InfoCategoryID") { ret = true; if (InfoCategoryID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryGUID") { ret = true; if (InfoCategoryGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "RevisionNo") { ret = true; if (RevisionNo.ToString() == columnValue) { valueMatched = true; } } if (columnName == "InfoCategoryName") { ret = true; if (InfoCategoryName.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserID") { ret = true; if (UserID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "UserGUID") { ret = true; if (UserGUID.ToString() == columnValue) { valueMatched = true; } } if (columnName == "CreatedDate") { ret = true; if (CreatedDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "LastUpdateDate") { ret = true; if (LastUpdateDate.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsActive") { ret = true; if (IsActive.ToString() == columnValue) { valueMatched = true; } } if (columnName == "Sequence") { ret = true; if (Sequence.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsDefault") { ret = true; if (IsDefault.ToString() == columnValue) { valueMatched = true; } } if (columnName == "IsSystem") { ret = true; if (IsSystem.ToString() == columnValue) { valueMatched = true; } } retValueMatched = valueMatched; return(ret); }