本文整理汇总了C#中Jayrock.Json.JsonObject.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.ToString方法的具体用法?C# JsonObject.ToString怎么用?C# JsonObject.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jayrock.Json.JsonObject
的用法示例。
在下文中一共展示了JsonObject.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessRequest
public void ProcessRequest(HttpContext context)
{
string action = context.Request.Form["Action"];
context.Response.Clear();
context.Response.ContentType = "application/json";
try
{
switch (action)
{
#region 本月账单
case "currentMon":
TradeLsit(context, action);
break;
#endregion
#region 全部账单
case "allMon":
TradeLsit(context, action);
break;
#endregion
default:
break;
}
}
catch (Exception ex)
{
JsonObject json = new JsonObject();
json.Put(TAO_KEY_STATUS, TAO_STATUS_ERROR);
json.Put(TAO_KEY_DATA, ex);
context.Response.Write(json.ToString());
}
}
示例2: RequestAsync
public static TransmissionWebClient RequestAsync(JsonObject data, bool allowRecursion)
{
TransmissionWebClient wc = new TransmissionWebClient(true, true);
byte[] bdata = GetBytes(data.ToString());
int r = requestid++;
#if LOGRPC
Program.LogDebug("RPC request: " + r, data.ToString());
#endif
wc.UploadDataCompleted += new UploadDataCompletedEventHandler(wc_UploadDataCompleted);
wc.UploadDataAsync(new Uri(Program.Settings.Current.RpcUrl), null, bdata, new TransmissonRequest(r, bdata, allowRecursion));
return wc;
}
示例3: ToString
public override string ToString()
{
JsonObject serialized = new JsonObject();
serialized.Put(KEY_MMSI, this.Mmsi);
serialized.Put(KEY_NAME, this.Name);
return serialized.ToString();
}
示例4: Process
public override bool Process(HttpServer.IHttpRequest request, HttpServer.IHttpResponse response, HttpServer.Sessions.IHttpSession session)
{
if (request.UriPath.StartsWith(Url))
{
string hash = request.QueryString["hash"].Value;
if (string.IsNullOrEmpty(hash))
{
ThreadServerModule._404(response);
}
else
{
if (Program.queued_files.ContainsKey(hash))
{
FileQueueStateInfo f = Program.queued_files[hash];
JsonObject ob = new JsonObject();
ob.Add("p", f.Percent().ToString());
ob.Add("s", string.Format("{0} / {1}", Program.format_size_string(f.Downloaded), Program.format_size_string(f.Length)));
ob.Add("c", f.Status == FileQueueStateInfo.DownloadStatus.Complete);
WriteJsonResponse(response, ob.ToString());
}
else
{
ThreadServerModule._404(response);
}
}
return true;
}
return false;
}
示例5: Dispatch
public void Dispatch(JsonObject data)
{
JsonObject args = (JsonObject)data[ProtocolConstants.KEY_ARGUMENTS];
args.Put(ProtocolConstants.ARG_UID, uid);
if ((string)data[ProtocolConstants.KEY_METHOD] != ProtocolConstants.METHOD_AIS)
{
Trace.WriteLine(String.Format("==> [{0}] {1}", DateTime.Now, data));
if (OnCmdDispatched != null)
OnCmdDispatched(this, new CommandDispatchedEventArgs() { Request = data });
}
this.Dispatch(data.ToString());
}
示例6: ProcessRequest
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
HttpRequest Request = context.Request;
HttpResponse Response = context.Response;
JsonObject json = new JsonObject();
if (!string.IsNullOrEmpty(Request.Form["cid"]) && !string.IsNullOrEmpty(Request.Form["mids"]) && !string.IsNullOrEmpty(Request.Form["uid"]) && !string.IsNullOrEmpty(Request.Form["uEmail"]) && !string.IsNullOrEmpty(Request.Form["uName"]) && !string.IsNullOrEmpty(Request.Form["SellerId"]) && !string.IsNullOrEmpty(Request.Form["tprice"]))
{
int cid = int.Parse(Request.Form["cid"]);
string mids = Request.Form["mids"];
int type = -1;
if(mids.Contains(','))
{
mids = mids.TrimEnd(',');
type = 1;
}
else
{
type = 0;
}
int uid = int.Parse(Request.Form["uid"]);
string email = Request.Form["uEmail"];
int sellerId = int.Parse(Request.Form["SellerId"]);
decimal totalPrice = decimal.Parse(Request.Form["tprice"]);
string uName = Request.Form["uName"];
Model.Tao.Orders orderList = new Model.Tao.Orders();
orderList.BuyerID = uid;
orderList.Email = email;
orderList.Amount = totalPrice;
orderList.UserName = uName;
orderList.SellerID = sellerId;
BLL.Tao.Orders orderBll = new BLL.Tao.Orders();
int OId = orderBll.CreateNewOrderInfo(orderList, cid, mids, type);
if (OId > 0)
{
json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS);
json.Put(TAO_KEY_DATA, OId);
}
else
{
json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
}
}
else
{
json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
}
context.Response.Write(json.ToString());
}
示例7: Save
public override bool Save(JsonObject s)
{
try
{
using (RegistryKey key = GetRootKey(true))
{
key.SetValue(GetType().ToString(), s.ToString());
key.SetValue("", GetType().ToString());
}
}
catch (Exception)
{
return false;
}
return true;
}
示例8: Save
public bool Save(string Filename, JsonObject s)
{
try
{
using (FileStream outFile = new FileStream(Filename, FileMode.Create, FileAccess.Write))
{
using (StreamWriter writer = new StreamWriter(outFile))
{
writer.Write(s.ToString());
}
}
}
catch (Exception)
{
return false;
}
return true;
}
示例9: ProcessRequest
/// <summary>
/// Processes the request.
/// </summary>
/// <param name="context">The context.</param>
public override void ProcessRequest(HttpContext context)
{
base.ProcessRequest(context);
CheckRequest(context.Request.QueryString["token"]);
context.Response.ContentType = "text/plain";
if (context.Request.Files["fuFile"] != null)
{
JsonObject ret = new JsonObject();
try
{
HttpPostedFile file = context.Request.Files["fuFile"];
if (file != null)
{
if (permittedExts.Contains(Path.GetExtension(file.FileName).ToLower()))
{
SignalManager sm = new SignalManager();
ret["fileName"] = sm.UploadAttachment(file);
}
else
{
ret["error"] = "WRONG_EXT";
}
}
else
ret["error"] = "NO_FILE";
}
catch (Exception ex)
{
ret["error"] = "ERROR";
ret["errorMessage"] = ex.Message;
ret["stackTrace"] = ex.StackTrace;
}
context.Response.Write(ret.ToString());
}
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (RequestContainsFile("fuFile"))
{
JsonObject ret = new JsonObject();
try
{
HttpPostedFile file = GetFileFromRequest("fuFile");
string fileName = Guid.NewGuid() + Path.GetExtension(file.FileName);
file.SaveAs(Path.Combine(Server.MapPath(ConfigurationManager.AppSettings["UploadPath"]), fileName));
ret["fileName"] = fileName;
}
catch (Exception ex)
{
ret["error"] = ex.Message;
}
Response.Write(ret.ToString());
}
}
示例11: RelateTeacherCourse
private void RelateTeacherCourse(HttpContext context)
{
int RowCount = 0;
int PageCount = 0;
string strId = context.Request.Params["CateId"];
string strPi = context.Request.Params["pageIndex"];
int intPi = 0;
if (!int.TryParse(strPi, out intPi))//将字符串页码 转成 整型页码,如果失败,设置页码为1
{
intPi = 1;
}
int intPz = Maticsoft.Common.Globals.SafeInt(context.Request.Params["pageSize"], 1);
JsonObject json = new JsonObject();
if (!string.IsNullOrEmpty(strId))
{
List<Maticsoft.Model.Tao.SearchCourse> list = coursesBLL.GetListByTeacherID(out RowCount, out PageCount, int.Parse(strId), intPi, intPz);
if (list.Count > 0)
{
JsonArray data = new JsonArray();
list.ForEach(info => data.Add(
new JsonObject(
new string[] { "CourseID", "CourseName", "TimeDuration", "Price", "PV", "CreatedUserID", "ImageUrl", "TrueName", "DepartmentID", "NAME", "CategoryId" },
new object[] { info.Courseid, info.Coursename, info.Timeduration, info.Price, info.Pv, info.Createduserid, info.Imageurl, info.TrueName, info.DepartmentId, info.EnterName, info.CategoryId }
)));
json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS);
json.Put(TAO_KEY_DATA, data);
}
json.Put("ROWCOUNT", RowCount);
json.Put("PAGECOUNT", PageCount);
}
else
{
json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
}
context.Response.Write(json.ToString());
}
示例12: RegionName
private void RegionName(HttpContext context)
{
BLL.Tao.Regions regionbll = new BLL.Tao.Regions();
JsonObject json = new JsonObject();
if (!string.IsNullOrEmpty(context.Request.Params["regionId"]))
{
int rid = Common.Globals.SafeInt(context.Request.Params["regionId"], 0);
json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS);
json.Put(TAO_KEY_DATA, regionbll.GetRegionAllName(rid));
}
else
{
json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
}
context.Response.Write(json.ToString());
}
示例13: RecommendedCourse
private void RecommendedCourse(HttpContext context)
{
List<Maticsoft.Model.Tao.SearchCourse> list = coursesBLL.GetRecommendedCourseList(4);
JsonObject json = new JsonObject();
if (list.Count > 0)
{
JsonArray data = new JsonArray();
list.ForEach(info => data.Add(
new JsonObject(
new string[] { "CourseID", "CourseName", "TimeDuration", "Price", "PV", "CreatedUserID", "ImageUrl", "TrueName", "DepartmentID", "NAME", "CategoryId" },
new object[] { info.Courseid, info.Coursename, info.Timeduration, info.Price, info.Pv, info.Createduserid, info.Imageurl, info.TrueName, info.DepartmentId, info.EnterName, info.CategoryId }
)));
json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS);
json.Put(TAO_KEY_DATA, data);
}
else
{
json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
}
context.Response.Write(json.ToString());
}
示例14: OffLineCourse
private void OffLineCourse(HttpContext context)
{
List<Maticsoft.Model.Tao.OffLineCourse> list = OffLinebll.GetModelList();
JsonObject json = new JsonObject();
if (list.Count > 0)
{
JsonArray data = new JsonArray();
list.ForEach(info => data.Add(
new JsonObject(
new string[] { "CourseID", "CourseName", "TimeDuration", "Price", "PV", "CreatedUserID", "ImageUrl", "CategoryId", "RegionID" },
new object[] { info.CourseID, info.CourseName, info.StartTime.ToString("yyyy-MM-dd"), info.CoursePrice, info.PV, info.CreatedUserID, info.ImageURL, info.CategoryId, info.RegionID }
)));
json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS);
json.Put(TAO_KEY_DATA, data);
}
else
{
json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
}
context.Response.Write(json.ToString());
}
示例15: JoinComment
private void JoinComment(HttpContext context)
{
string strPid = context.Request.Params["ParentID"];
JsonObject json = new JsonObject();
List<Maticsoft.Model.Tao.Comment> list = bll.GetChildComment(int.Parse(strPid));
if (list != null)
{
JsonArray data = new JsonArray();
list.ForEach(info => data.Add(new JsonObject(
new string[] { "CommentID", "OrderID", "CourseID", "ModuleID", "UserID", "CommentInfo", "CommentDate", "ParentID", "Score", "Status" },
new object[] { info.CommentID, info.OrderID, info.CourseID, info.ModuleID, info.UserID, info.Comments, info.CommentDate.ToString("yyyy-MM-dd HH:mm:ss"), info.ParentID, info.Score, info.Status }
)));
json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS);
json.Put(TAO_KEY_DATA, data);
}
else
{
json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED);
}
context.Response.Write(json.ToString());
}