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()); } }
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; }
public override string ToString() { JsonObject serialized = new JsonObject(); serialized.Put(KEY_MMSI, this.Mmsi); serialized.Put(KEY_NAME, this.Name); return serialized.ToString(); }
public static string getSystemParaBuildinCode() { Jayrock.Json.JsonObject ja = new Jayrock.Json.JsonObject(); Jayrock.Json.JsonObject jo; DatabaseAccess dbAccess = new DatabaseAccess(); string sql = "select * from SystemParaBuildin"; System.Data.DataTable dt; dbAccess.open(); try { dt = dbAccess.select(sql); foreach (System.Data.DataRow row in dt.Rows) { jo = new Jayrock.Json.JsonObject(); foreach (System.Data.DataColumn col in dt.Columns) { jo.Accumulate(col.ColumnName, row[col.ColumnName]); } ja.Accumulate(row["ID"].ToString(), jo); } } catch { throw; } finally { dbAccess.close(); } return(ja.ToString()); }
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; }
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()); }
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()); }
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; }
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; }
/// <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()); } }
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()); } }
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()); }
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()); }
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()); }
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()); }
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()); }
/// <summary> /// 根据关键字查询课程信息 /// </summary> /// <param name="context"></param> private void getCourseCount(HttpContext context) { string uid = context.Request.Params["uid"]; JsonObject json = new JsonObject(); if (!string.IsNullOrEmpty(uid)) { int count = coursesBLL.PublishCourseCount(int.Parse(uid)); json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); json.Put("COUNT", count); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } context.Response.Write(json.ToString()); }
private void IndexCommen(HttpContext context) { int RowCount = 0; int PageCount = 0; JsonObject json = new JsonObject(); BLL.Tao.Comment bll = new BLL.Tao.Comment(); Model.Tao.PageModel page = new Model.Tao.PageModel(); page.PageIndex = 1; page.PageSize = 10; List<Maticsoft.Model.Tao.Comment> list = bll.GetCommentList(out RowCount, out PageCount, page, -1); if (list.Count > 0) { json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); json.Put("ROWCOUNT", RowCount); json.Put("PAGECOUNT", PageCount); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } context.Response.Write(json.ToString()); }
private void HotKey(HttpContext context) { JsonObject json = new JsonObject(); List<Maticsoft.Model.Tao.Courses> list = coursesBLL.GetHotKey(); if (list != null) { JsonArray data = new JsonArray(); list.ForEach(info => data.Add(new JsonObject( new string[] { "Tags" }, new object[] { info.Tags } ))); 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()); }
/// <summary> /// 根据关键字查询课程信息 /// </summary> /// <param name="context"></param> private void GetAuthentic(HttpContext context) { string uid = context.Request.Params["uid"]; JsonObject json = new JsonObject(); if (!string.IsNullOrEmpty(uid)) { BLL.UserExp.UsersExp userBll = new BLL.UserExp.UsersExp(); System.Data.DataSet dsUser = userBll.GetUserCertificate(int.Parse(uid), null, 1); System.Text.StringBuilder strAuthenticArray = new System.Text.StringBuilder(); for (int i = 0; i < dsUser.Tables[0].Rows.Count; i++) { strAuthenticArray.Append(dsUser.Tables[0].Rows[i]["ApproveName"].ToString()); strAuthenticArray.Append(" "); } json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); json.Put("COUNT", strAuthenticArray.ToString()); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } context.Response.Write(json.ToString()); }
private void GetCateNav(HttpContext context) { JsonObject json = new JsonObject(); string strId = context.Request.Params["cateID"]; int cateId = Common.Globals.SafeInt(strId, 0); BLL.Tao.Categories categoriesBLL = new BLL.Tao.Categories(); System.Text.StringBuilder str = new System.Text.StringBuilder(); Maticsoft.Model.Tao.Categories model = categoriesBLL.GetModelByCache(cateId); if (null != model) { string[] strPath = model.Path.Split('|'); str.Append(" 全部分类 "); foreach (string s in strPath) { if (Maticsoft.Common.PageValidate.IsNumber(s)) { Maticsoft.Model.Tao.Categories categoriesModel = categoriesBLL.GetModelByCache(int.Parse(s)); if (null != categoriesModel) { str.Append(" > " + categoriesModel.Name); } } } json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); json.Put("NAV", str.ToString()); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } context.Response.Write(json.ToString()); }
/// <summary> /// 根据分类ID查询课程信息 /// </summary> /// <param name="context"></param> private void GetCourseByCateID(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 = 7; int OrderType = Maticsoft.Common.Globals.SafeInt(context.Request.Params["SortT"], 0); int courseType = Maticsoft.Common.Globals.SafeInt(context.Request.Params["CourseType"], 0); string strTime = context.Request.Params["TimeStr"]; JsonObject json = new JsonObject(); if (!string.IsNullOrEmpty(strId)) { int CID = Common.Globals.SafeInt(strId, -1); if (courseType == 1) { List<Maticsoft.Model.Tao.SearchCourse> list = coursesBLL.GetListByCateId(out RowCount, out PageCount, CID, intPi, intPz, OrderType, strTime, courseType); 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 if (courseType == 2) { BLL.Tao.OffLineCourse bll = new BLL.Tao.OffLineCourse(); List<Maticsoft.Model.Tao.SearchCourse> Offlist = bll.GetListByCateId(out RowCount, out PageCount, CID, intPi, intPz, OrderType, strTime); if (Offlist.Count > 0) { JsonArray data = new JsonArray(); Offlist.ForEach(info => data.Add( new JsonObject( new string[] { "CourseID", "CourseName", "TimeDuration", "Price", "PV", "CreatedUserID", "ImageUrl", "TrueName", "DepartmentID", "NAME", "CategoryId", "BookCount" }, new object[] { info.Courseid, info.Coursename, info.StartTime.ToString("yyyy-MM-dd"), info.Price, info.Pv, info.Createduserid, info.Imageurl, info.TrueName, info.DepartmentId, info.EnterName, info.CategoryId,info.BookCount } ))); json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); json.Put(TAO_KEY_DATA, data); } } else { List<Maticsoft.Model.Tao.SearchCourse> list = coursesBLL.GetListByCateId(out RowCount, out PageCount, CID, intPi, intPz, OrderType, strTime, courseType); 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()); }
public void ProcessRequest(HttpContext context) { string action = context.Request.Params["Action"]; context.Response.Clear(); context.Response.ContentType = "application/json"; try { switch (action) { #region 推荐课程 case "Recommended": RecommendedCourse(context); break; #endregion #region 公开课 case "PubCourse": PubCourseList(context); break; #endregion #region 其他课程 case "OtherCourse": OtherCourseList(context); break; #endregion #region 名师推荐 case "TeaRec": TeacherRecommended(context); break; #endregion #region 评论内容 case "SelectPage": IndexCommen(context); break; #endregion #region 加载评论内容 case "FirstPage": FirstPageCommen(context); break; #endregion #region 加载评论内容 case "joinCom": JoinComment(context); break; #endregion #region 热门关键字 case "HotKey": HotKey(context); break; #endregion #region case "ModuleList": ShowCourseModule(context); break; #endregion #region 视频评论分页 case "VideoComPage": VideoCommen(context); break; #endregion #region 视频评论信息 case "VideoCom": VideoCommen(context); break; #endregion #region 插入评论评论信息 case "InsertCom": InsertComment(context); break; #endregion #region 根据uid获取用户信息 case "UserInfo": GetUserInfo(context); break; #endregion #region 获取相关课程信息 case "RelateCourse": RelateCourse(context); break; #endregion #region 课程列表信息 case "GetCourseByCateID": GetCourseByCateID(context); break; #endregion #region 课程列表信息 case "GetCourseByKEY": GetCourseByKEY(context); break; #endregion #region 导航信息 case "GetCateNav": GetCateNav(context); break; #endregion #region 获取教师信息 case "GetTeacherCount": GetTeacherCount(context); break; #endregion #region 获取已关注该课程的人数 case "GetFavCount": GetFavCount(context); break; #endregion #region 获取已购买课程的人数 case "GetChoseCount": GetChoseCount(context); break; #endregion case "uploadico": string strFileUrl = Maticsoft.Common.ConfigHelper.GetConfigString("CourseThumbnai"); UploadPic(context.Request, context.Response, strFileUrl); break; case "RelateTeacherCourse": RelateTeacherCourse(context); break; case "GetCourseByUserID": GetCourseByUserID(context); break; case "GetTeacherByKEY": GetTeacherByKEY(context); break; case "GetTeachInfo": GetTeachInfo(context); break; case "getCourseCount": getCourseCount(context); break; case "GetAuthentic": GetAuthentic(context); break; case "OffLineCourse": OffLineCourse(context); break; case "RegionName": RegionName(context); break; 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()); } }
/// <summary> /// 根据关键字查询课程信息 /// </summary> /// <param name="context"></param> private void GetTeacherByKEY(HttpContext context) { BLL.SysManage.UsersExp ubll = new BLL.SysManage.UsersExp(); int RowCount = 0; int PageCount = 0; string strIKey = context.Request.Params["StrKey"]; string strPi = context.Request.Params["pageIndex"]; int intPi = 0; if (!int.TryParse(strPi, out intPi))//将字符串页码 转成 整型页码,如果失败,设置页码为1 { intPi = 1; } int intPz = 7; JsonObject json = new JsonObject(); if (!string.IsNullOrEmpty(strIKey)) { List<Maticsoft.Model.SysManage.Users> list = ubll.GetListByTeacherkey(out RowCount, out PageCount, strIKey, intPi, intPz); if (list.Count > 0) { JsonArray data = new JsonArray(); list.ForEach(info => data.Add( new JsonObject( new string[] { "UserID", "UesrName", "TrueName" }, new object[] { info.UserID, info.UserName, info.TrueName } ))); 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()); }
private void InsertComment(HttpContext context) { JsonObject json = new JsonObject(); string strMid = context.Request.Params["Mid"]; string strCid = context.Request.Params["Cid"]; string strUid = context.Request.Params["Uid"]; string strPid = context.Request.Params["Pid"];// string strCtype = context.Request.Params["Ctype"]; string strContent = context.Request.Params["Con"]; if (!string.IsNullOrEmpty(strMid) && !string.IsNullOrEmpty(strCid) && !string.IsNullOrEmpty(strUid) && !string.IsNullOrEmpty(strPid)) { Model.Tao.Comment model = new Model.Tao.Comment(); model.CourseID = int.Parse(strCid); if (strMid != "null") { model.ModuleID = int.Parse(strMid); } model.UserID = int.Parse(strUid); model.ParentID = int.Parse(strPid); model.Comments = strContent; model.Status = 1; model.CommentDate = DateTime.Now; model.Type = Common.Globals.SafeInt(strCtype, 0); int comId = bll.Add(model); if (comId > 0) { List<Maticsoft.Model.Tao.Comment> list = bll.GetModelList(comId); if (list.Count > 0) { 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); } } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_ERROR); } } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_ERROR); } context.Response.Write(json.ToString()); }
/// <summary> /// 获取开课教师人数 /// </summary> /// <param name="context"></param> private void GetTeacherCount(HttpContext context) { JsonObject json = new JsonObject(); string strCid = context.Request.Params["cid"]; if (!string.IsNullOrEmpty(strCid)) { int counts = coursesBLL.GetTeacherCount(int.Parse(strCid)); json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); json.Put("NUM", counts); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } context.Response.Write(json.ToString()); }
/// <summary> /// 根据关键字查询课程信息 /// </summary> /// <param name="context"></param> private void GetCourseByKEY(HttpContext context) { int RowCount = 0; int PageCount = 0; string strIKey = context.Request.Params["StrKey"]; string strPi = context.Request.Params["pageIndex"]; int intPi = 0; if (!int.TryParse(strPi, out intPi))//将字符串页码 转成 整型页码,如果失败,设置页码为1 { intPi = 1; } int intPz = 7; int OrderType = Maticsoft.Common.Globals.SafeInt(context.Request.Params["SortT"], 0); int courseType = Maticsoft.Common.Globals.SafeInt(context.Request.Params["CourseType"], 0); string strTime = context.Request.Params["TimeStr"]; int? deptid = null; if (context.Request.Params["DPT"] != "null") { deptid = Maticsoft.Common.Globals.SafeInt(context.Request.Params["DPT"], -1); } JsonObject json = new JsonObject(); if (!string.IsNullOrEmpty(strIKey)) { List<Maticsoft.Model.Tao.SearchCourse> list = coursesBLL.GetListByKEY(out RowCount, out PageCount, strIKey, intPi, intPz, OrderType, strTime, courseType, deptid); 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()); }
/// <summary> /// 检查邮箱唯一性 /// </summary> private void ValidateEmail(HttpRequest Request, HttpResponse Response) { JsonObject json = new JsonObject(); if (!string.IsNullOrEmpty(Request.Params["Email"]) && !string.IsNullOrEmpty(Request.Params["Uid"])) { string Email = Request.Params["Email"]; string strId = Request.Params["Uid"]; int uid = Common.Globals.SafeInt(strId, -1); Maticsoft.Model.SysManage.Users model = new BLL.SysManage.Users().GetModel(uid); if (new BLL.SysManage.Users().ExistsByEmail(Email) && model.Email == Email) { json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); } else if (new BLL.SysManage.Users().ExistsByEmail(Email) && model.Email != Email) { json.Put(TAO_KEY_STATUS, "WARNING"); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } Response.Write(json.ToString()); }
/// <summary> /// 根据关键字查询课程信息 /// </summary> /// <param name="context"></param> private void GetTeachInfo(HttpContext context) { BLL.SysManage.UsersExp ubll = new BLL.SysManage.UsersExp(); string uid = context.Request.Params["uid"]; JsonObject json = new JsonObject(); if (!string.IsNullOrEmpty(uid)) { List<Maticsoft.Model.UserExp.UsersExp> list = ubll.GetModelList(int.Parse(uid)); if (list.Count > 0) { JsonArray data = new JsonArray(); list.ForEach(info => data.Add( new JsonObject( new string[] { "UserAvatar", "Tags" }, new object[] { info.UserAvatar, info.Tags } ))); 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()); }
private void TradeLsit(HttpContext context,string action) { int RowCount = 0; int PageCount = 0; decimal Balance = 0.0M; JsonObject json = new JsonObject(); string strID = context.Request.Params["UserId"]; int uid = Common.Globals.SafeInt(strID, 0); string strIndex = context.Request.Params["PageIndex"]; int PageIndex = Common.Globals.SafeInt(strIndex, 1); int PageSize = 10; List<Model.Tao.TradeDetails> list = null; if (action == "currentMon") { list = bll.GetListByUId(out RowCount, out PageCount, out Balance, uid, PageIndex, PageSize, true); } else { list = bll.GetListByUId(out RowCount, out PageCount, out Balance, uid, PageIndex, PageSize, false); } if (list.Count > 0) { JsonArray data = new JsonArray(); list.ForEach(info => data.Add(new JsonObject( new string[] { "ID", "DataTime", "InCome", "Pay", "Balance", "Remark" }, new object[] { info.ID, info.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), info.TradeAmount, info.Pay, info.Balance, info.Remark } ))); json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); json.Put(TAO_KEY_DATA, data); json.Put("ROWCOUNT", RowCount); json.Put("PAGECOUNT", PageCount); json.Put("BALANCE", Balance); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } context.Response.Write(json.ToString()); }
private void GetUserInfo(HttpContext context) { JsonObject json = new JsonObject(); string strUid = context.Request.Params["Uid"]; if (!string.IsNullOrEmpty(strUid)) { BLL.UserExp.UsersExp user = new BLL.UserExp.UsersExp(); DataSet ds = user.GetUserInfo(int.Parse(strUid)); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { json.Put("UserName", ds.Tables[0].Rows[0]["UserName"]); json.Put("UserAvatar", ds.Tables[0].Rows[0]["UserAvatar"]); json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } context.Response.Write(json.ToString()); }