本文整理汇总了C#中System.Guid.ToRQLString方法的典型用法代码示例。如果您正苦于以下问题:C# Guid.ToRQLString方法的具体用法?C# Guid.ToRQLString怎么用?C# Guid.ToRQLString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Guid
的用法示例。
在下文中一共展示了Guid.ToRQLString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTextContent
/// <summary>
/// Set the text content of a text element. This method exists, because it needs a different RQL element layout than all other queries.
/// </summary>
/// <param name="projectGuid"> Guid of the project containing the element </param>
/// <param name="languageVariant"> Language variant for setting the text in </param>
/// <param name="textElementGuid"> Guid of the text element </param>
/// <param name="typeString"> texttype value </param>
/// <param name="content"> new value </param>
/// <returns> Guid of the text element </returns>
public Guid SetTextContent(Guid projectGuid, ILanguageVariant languageVariant, Guid textElementGuid,
string typeString, string content)
{
const string SAVE_TEXT_CONTENT =
@"<IODATA loginguid=""{0}"" format=""1"" sessionkey=""{1}""><PROJECT><TEXT action=""save"" guid=""{2}"" texttype=""{3}"" >{4}</TEXT></PROJECT></IODATA>";
SelectProject(projectGuid);
languageVariant.Select();
string rqlResult =
SendRQLToServer(string.Format(SAVE_TEXT_CONTENT, _loginGuidStr, _sessionKeyStr,
textElementGuid == Guid.Empty ? "" : textElementGuid.ToRQLString(),
typeString, HttpUtility.HtmlEncode(content)));
//in version 11.2 the server returns <guid>\r\n, but we are only interested in the guid -> Trim()
string resultGuidStr = XElement.Load(new StringReader(rqlResult)).Value.Trim();
//result guid is empty, if the value was set to the same value it had before
if (string.IsNullOrEmpty(resultGuidStr))
{
return textElementGuid;
}
Guid newGuid;
if (!Guid.TryParse(resultGuidStr, out newGuid) ||
(textElementGuid != Guid.Empty && textElementGuid != newGuid))
{
throw new SmartAPIException(ServerLogin, "Could not set text for: {0}".RQLFormat(textElementGuid));
}
return newGuid;
}
示例2: GetForceLoginXmlNode
private XmlElement GetForceLoginXmlNode(PasswordAuthentication pa, Guid oldLoginGuid)
{
LOG.InfoFormat("User login will be forced. Old login guid was: {0}", oldLoginGuid.ToRQLString());
//hide user password in log message
string rql = string.Format(RQL_IODATA, RQL_LOGIN_FORCE.RQLFormat(pa.Username, pa.Password, oldLoginGuid));
string debugRQLOutput = string.Format(RQL_IODATA,
RQL_LOGIN_FORCE.RQLFormat(pa.Username, "*****", oldLoginGuid));
string result = SendRQLToServer(rql, debugRQLOutput);
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(result);
XmlNodeList xmlNodes = xmlDoc.GetElementsByTagName("LOGIN");
return (XmlElement) (xmlNodes.Count > 0 ? xmlNodes[0] : null);
}
示例3: GetTextContent
/// <summary>
/// Get the text content of a text element. This method exists, because it needs a different RQL element layout than all other queries.
/// </summary>
/// <param name="projectGuid"> Guid of the project containing the element </param>
/// <param name="lang"> Language variant to get the text from </param>
/// <param name="elementGuid"> Guid of the text element </param>
/// <param name="typeString"> texttype value </param>
/// <returns> text content of the element </returns>
public string GetTextContent(Guid projectGuid, ILanguageVariant lang, Guid elementGuid, string typeString)
{
const string LOAD_TEXT_CONTENT =
@"<IODATA loginguid=""{0}"" format=""1"" sessionkey=""{1}""><PROJECT><TEXT action=""load"" guid=""{2}"" texttype=""{3}""/></PROJECT></IODATA>";
SelectProject(projectGuid);
lang.Select();
return
SendRQLToServer(string.Format(LOAD_TEXT_CONTENT, _loginGuidStr, _sessionKeyStr,
elementGuid.ToRQLString(), typeString));
}
示例4: SelectProject
/// <summary>
/// Select a project. Subsequent queries will be executed in the context of this project.
/// </summary>
/// <param name="projectGuid"> Guid of the project to select </param>
public void SelectProject(Guid projectGuid)
{
if (SelectedProjectGuid.Equals(projectGuid))
{
return;
}
string result;
RQLException exception = null;
try
{
result =
ExecuteRQLRaw(
string.Format(RQL_SELECT_PROJECT, _loginGuidStr, projectGuid.ToRQLString().ToUpperInvariant()),
RQL.IODataFormat.LogonGuidOnly);
} catch (RQLException e)
{
exception = e;
result = e.Response;
}
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(result);
XmlNodeList xmlNodes = xmlDoc.GetElementsByTagName("SERVER");
if (xmlNodes.Count > 0)
{
SessionKey = ((XmlElement) xmlNodes[0]).GetAttributeValue("key");
SelectedProjectGuid = projectGuid;
return;
}
throw new SmartAPIException(ServerLogin,
String.Format("Couldn't select project {0}", projectGuid.ToRQLString()),
exception);
}
示例5: Session
/// <summary>
/// Create an session object for an already existing session on the server, e.g. when opening a plugin from within a running session.
/// </summary>
public Session(ServerLogin login, Guid loginGuid, string sessionKey, Guid projectGuid)
: this()
{
ServerLogin = login;
_loginGuidStr = loginGuid.ToRQLString();
_sessionKeyStr = sessionKey;
InitConnection();
XmlElement sessionInfo = GetUserSessionInfoElement();
SelectedProjectGuid = sessionInfo.GetGuid("projectguid");
SelectProject(projectGuid);
}
示例6: Logout
private void Logout(Guid logonGuid)
{
const string RQL_LOGOUT = @"<ADMINISTRATION><LOGOUT guid=""{0}""/></ADMINISTRATION>";
ExecuteRQLRaw(string.Format(RQL_LOGOUT, logonGuid.ToRQLString()), RQL.IODataFormat.LogonGuidOnly);
}
示例7: CreateCopyInProject
private ContentClass CreateCopyInProject(IProject project, Guid targetFolderGuid)
{
IContentClassFolder folder = project.ContentClassFolders.GetByGuid(targetFolderGuid);
if (folder == null)
{
throw new ArgumentException("no such content class folder '" + targetFolderGuid.ToRQLString() +
"' in project " + Name);
}
var xmlDoc = new XmlDocument();
XmlElement template = CreateTemplateXmlElement(xmlDoc, folder);
AddTemplateDescriptions(project, template);
AddTemplateVariants(template);
//AddProjectVariants(project, template);
return CreateContentClass(project, template);
}
示例8: CreateInProject
public void CreateInProject(IProject project, Guid parentFolderGuid)
{
const string CREATE_STRING =
@"<PROJECT><EXPORTFOLDER action=""assign"" guid=""{0}""><EXPORTFOLDER action=""addnew"" name=""{1}"" type=""{2}"" {3} /></EXPORTFOLDER></PROJECT>";
XmlDocument reply =
project.ExecuteRQL(string.Format(CREATE_STRING, parentFolderGuid.ToRQLString(), Name, ((int) _type),
SaveParameters()));
reply.GetElementsByTagName("EXPORTFOLDER");
}
示例9: CreateElement
/// <summary>
/// Create an element out of its XML representation (uses the attribute "elttype") to determine the element type and create the appropriate object.
/// </summary>
/// <param name="project"> Project containing the element </param>
/// <param name="elementGuid"> Guid of the element </param>
/// <param name="languageVariant">The language variant of the page element</param>
/// <exception cref="ArgumentException">if the "elttype" attribute of the XML node contains an unknown value</exception>
public static IPageElement CreateElement(IProject project, Guid elementGuid, ILanguageVariant languageVariant)
{
using (new LanguageContext(languageVariant))
{
XmlDocument xmlDoc = project.ExecuteRQL(string.Format(RETRIEVE_PAGE_ELEMENT, elementGuid.ToRQLString()));
var xmlNode = (XmlElement) xmlDoc.GetElementsByTagName("ELT")[0];
return CreateElement(project, xmlNode);
}
}