本文整理汇总了C#中Snippet.PrintNull方法的典型用法代码示例。如果您正苦于以下问题:C# Snippet.PrintNull方法的具体用法?C# Snippet.PrintNull怎么用?C# Snippet.PrintNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Snippet
的用法示例。
在下文中一共展示了Snippet.PrintNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StoreHit
public bool StoreHit(Snippet snippet)
{
//check input validity:
if (snippet == null)
{
SetLastError(log, ErrorCodes.WRONG_INPUT, string.Format("Input error: snippet={0}", snippet.PrintNull()));
return false;
}
//send the request and parse the response:
S2CResObj<object> resp = SendReqObj("SnippetHit/" + snippet.ID, string.Empty, true, false);
//build the result:
return ParseBoolResponse(resp);
}
示例2: StoreCopyAction
public bool StoreCopyAction(Snippet snippet, bool embedded)
{
//check input validity:
if (snippet == null)
{
SetLastError(log, ErrorCodes.WRONG_INPUT, string.Format("Input error: snippet={0}", snippet.PrintNull()));
return false;
}
//send the request and parse the response:
S2CResObj<object> resp = SendReqObj("Explore/WhoCopy?snippetId=" + snippet.ID + "&embedded=" + embedded,
string.Empty, true, false);
//build the result:
return ParseBoolResponse(resp);
}
示例3: SaveSnippet
/////////////////////////////////////////////////////////////////////////////////////////////////////
#region Create/Add/Modify Methods
/////////////////////////////////////////////////////////////////////////////////////////////////////
///// <summary>
///// Create a Snippet having Owner and Creator = CurrentUser
///// </summary>
//public long SaveSnippet(Snippet snippet)
//{
// //Check that the client has been already logged in, and if this is not the case, automatically login:
// if (!CheckLogin())
// {
// SetLastError(log, "Cannot login into the system");
// return -1;
// }
// snippet.TargetGroupID = CurrentUser.PersonalGroupID;
// return CreateSnippet(snippet, CurrentUser);
//}
public long SaveSnippet(Snippet snippet)
{
if ((snippet == null) || (snippet.AreFieldsValid() != SnippetWrongField.OK))
{
SetLastError(log, ErrorCodes.WRONG_INPUT,
string.Format("Input error: snippet={0}, creator={1}", snippet.PrintNull(), CurrentUser.PrintNull()));
return -1;
}
//Check that the client has been already logged in, and if this is not the case, automatically login:
if (!CheckLogin())
{
SetLastError(log, ErrorCodes.NOT_LOGGED_IN, "Cannot login into the system");
return -1;
}
//send the request and parse the response:
string contentToSend = "content=" + HttpUtility.UrlEncode(snippet.Serialize(m_serialFormat));
S2CResObj<object> resp = SendReqObj(CREATE_SNIPPET_URL, contentToSend, true);
//build the result:
long result = ParseLongResponse(resp);
if (result == -1)
{
//check if the Status is TARGET_GROUP_INVALID:
if ((resp != null) && (resp.Status == ErrorCodes.TARGET_GROUP_DELETED))
return -2;
}
return result;
}