/// <summary> /// 最新书评 /// </summary> /// <param name="pagnation"></param> /// <param name="httpServletRequest"></param> /// <param name="umeService"></param> /// <returns></returns> ArrayOfAnyType2anyTypeMap getBookReviewTop(int num, UMEServicePortTypeClient umeService) { ArrayOfAnyType2anyTypeMap returnVal = new ArrayOfAnyType2anyTypeMap(); returnVal = umeService.getBookReviewTop(num); return returnVal; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; int count; CY.UME.Core.Business.Account account; #region validate if (!CY.Utility.Common.ParseUtility.TryParseInt32(context.Request.QueryString["num"], out count)) { count = 10; } count = (count < 1) ? 10 : count; account = CY.UME.Core.Global.GetCurrentAccount(); if (account == null || account.Id==0) { context.Response.Write("{success: false, msg: '登录超时,请重新登录!'}"); return; } #endregion try { CY.UME.Core.Business.University university = account.UniversityInfo; if (university == null) { context.Response.Write("{success:false,msg:'用户不存在'}"); return; } string url = university.LibServicesAddress; if (url.Trim().Length == 0) { context.Response.Write("{success:false,msg:'请求服务不存在'}"); return; } UMEServicePortTypeClient client = new UMEServicePortTypeClient(new BasicHttpBinding(), new EndpointAddress(url)); ArrayOfAnyType2anyTypeMap result = client.getDigitalResourceTop(count); string str = Newtonsoft.Json.JavaScriptConvert.SerializeObject(result); context.Response.Clear(); TimeSpan cacheDuration = TimeSpan.FromDays(1); context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetExpires(DateTime.Now.Add(cacheDuration)); context.Response.Cache.SetMaxAge(cacheDuration); context.Response.Cache.AppendCacheExtension("must-revalidate, proxy-revalidate"); context.Response.Write("{success: true, dbs: " + str + "}"); } catch { context.Response.Clear(); context.Response.Write("{success: false, msg: '服务器忙,请稍后再试'}"); } }
/// <summary> /// 本月最热数据库 /// </summary> /// <param name="pagnation"></param> /// <param name="httpServletRequest"></param> /// <param name="umeService"></param> /// <returns>返回List</returns> ArrayOfAnyType2anyTypeMap getDigitalResourceTop(int num, UMEServicePortTypeClient umeService) { ArrayOfAnyType2anyTypeMap returnVal = new ArrayOfAnyType2anyTypeMap(); returnVal = umeService.getMonthBooksHitTop(num); return returnVal; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; string strRecordsNum = context.Request.QueryString["recordsNum"].ToString().Trim(); int recordNum = 0; if (!int.TryParse(strRecordsNum,out recordNum)) { context.Response.Write("{success:false,message:'参数错误!'}"); return; } try { UMEServicePortTypeClient umeService = new UMEServicePortTypeClient(); string topBookThisMonth, topDigitalResourceThisMonth, topBookReview, topNewBook; topBookThisMonth = Newtonsoft.Json.JavaScriptConvert.SerializeObject(getMonthBooksHitTop(recordNum, umeService));//本月最热图书 topDigitalResourceThisMonth = Newtonsoft.Json.JavaScriptConvert.SerializeObject(getDigitalResourceTop(recordNum, umeService));//本月最热数据库 topBookReview = Newtonsoft.Json.JavaScriptConvert.SerializeObject(getBookReviewTop(recordNum, umeService));//最新书评 topNewBook = Newtonsoft.Json.JavaScriptConvert.SerializeObject(getNewBookTop(recordNum, umeService));//新书通报 context.Response.Write("{success:true,topBookThisMonth:" + topBookThisMonth + ",topDigitalResourceThisMonth:" + topDigitalResourceThisMonth + ",topBookReview:" + topBookReview + ",topNewBook:" + topNewBook + "}"); } catch (Exception ex) { context.Response.Write("{success:false,message:'获取信息失败!错误信息:" + ex.Message + "'}"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; //string strAccountId = context.Request.QueryString["accountId"].ToString().Trim();//获取用户Id //long accountId = 0; CY.UME.Core.Business.Account account; #region validate account = CY.UME.Core.Global.GetCurrentAccount(); if (account==null || account.Id==0) { context.Response.Write("{success:false,message:'用户登录失败,请重新登录!'}"); return; } #endregion try { CY.UME.Core.Business.University university = account.UniversityInfo; if (university == null) { context.Response.Write("{success:false,msg:'用户不存在'}"); return; } string url = university.LibServicesAddress; if (url.Length == 0) { context.Response.Write("{success:false,message:'请求服务不存在'}"); return; } UMEServicePortTypeClient umeService = new UMEServicePortTypeClient(new BasicHttpBinding(),new EndpointAddress(url)); string userBorrowRemind; anyType2anyTypeMap returnVal = new anyType2anyTypeMap(); returnVal = umeService.getBorrowReturnInfo(account.ExtendInfo.LibUserId); //获取用户图书提醒(你有?本书快超期,你有?书已超期) userBorrowRemind = Newtonsoft.Json.JavaScriptConvert.SerializeObject(returnVal); context.Response.Clear(); TimeSpan cacheDuration = TimeSpan.FromDays(1); context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetExpires(DateTime.Now.Add(cacheDuration)); context.Response.Cache.SetMaxAge(cacheDuration); context.Response.Cache.AppendCacheExtension("must-revalidate, proxy-revalidate"); context.Response.Write("{success:true,userBorrowRemind:" + userBorrowRemind +"}"); } catch (Exception ex) { context.Response.Write("{success:false,message:'获取信息失败,错误信息:" + ex.Message + "'}"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; string key = context.Request.QueryString["key"].ToString().Trim();//关键字 int keyType = Utility.Common.ConvertUtility.ConvertToInt(context.Request.QueryString["keyType"], 1);//关键字类型(默认为1,按图书名搜索) int currentPage =Utility.Common.ConvertUtility.ConvertToInt(context.Request.QueryString["currentPage"], 0);//当前页码(默认为0,第一页) int pageSize = Utility.Common.ConvertUtility.ConvertToInt(context.Request.QueryString["pageSize"], 7);//每页多少条(默认为7,7条书局) //string strAccountId = context.Request.QueryString["accountId"].ToString(); //long accountId=0; CY.UME.Core.Business.Account account; #region validate account = CY.UME.Core.Global.GetCurrentAccount(); if (account == null || account.Id == 0) { context.Response.Write("{success:false,message:'用户登录失败,请重新登录!'}"); return; } #endregion try { CY.UME.Core.Business.University university = account.UniversityInfo; if (university == null) { context.Response.Write("{success:false,msg:'用户不存在'}"); return; } string url = university.LibServicesAddress; if (url.Length == 0) { context.Response.Write("{success:false,message:'请求服务不存在'}"); return; } UMEServicePortTypeClient umeService = new UMEServicePortTypeClient(new BasicHttpBinding(),new EndpointAddress(url)); ArrayOfAnyType2anyTypeMap BookList = new ArrayOfAnyType2anyTypeMap(); BookList = umeService.getBookByTypeWithPage(key, keyType, currentPage, pageSize); string strJson = Newtonsoft.Json.JavaScriptConvert.SerializeObject(BookList); context.Response.Clear(); TimeSpan cacheDuration = TimeSpan.FromDays(1); context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetExpires(DateTime.Now.Add(cacheDuration)); context.Response.Cache.SetMaxAge(cacheDuration); context.Response.Cache.AppendCacheExtension("must-revalidate, proxy-revalidate"); context.Response.Write("{success:true,json:" + strJson + "}"); } catch (Exception ex) { context.Response.Write("{success:false,message:'搜索失败!错误信息:" + ex.Message + "'}"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; //string strAccountId = context.Request.Form["accountId"].ToString().Trim(); string strBorrowId = context.Request.Form["borrowId"].ToString().Trim(); long borrowId = 0; CY.UME.Core.Business.Account account; #region validate account = CY.UME.Core.Global.GetCurrentAccount(); if (account == null || account.Id == 0) { context.Response.Write("{success:false,message:'用户登录失败,请重新登录!'}"); return; } if (!long.TryParse(strBorrowId, out borrowId)) { context.Response.Write("{success:false,message:'参数错误!'}"); return; } #endregion try { CY.UME.Core.Business.University university = account.UniversityInfo; if (university == null) { context.Response.Write("{success:false,msg:'用户不存在'}"); return; } string url = university.LibServicesAddress; if (url.Length == 0) { context.Response.Write("{success:false,message:'请求服务不存在'}"); return; } UMEServicePortTypeClient umeService = new UMEServicePortTypeClient(new BasicHttpBinding(),new EndpointAddress(url)); anyType2anyTypeMap returnInfo = new anyType2anyTypeMap(); string strJson; returnInfo = umeService.saveRenewBook(account.ExtendInfo.LibUserId, borrowId); strJson = Newtonsoft.Json.JavaScriptConvert.SerializeObject(returnInfo); context.Response.Write("{success:true,json:" + strJson + "}"); } catch (Exception ex) { context.Response.Write("{success:false,message:获取信息失败!错误信息:" + ex.Message + "}"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; long bookId = 0; CY.UME.Core.Business.Account account; #region validate account = CY.UME.Core.Global.GetCurrentAccount(); if (account == null || account.Id==0) { context.Response.Write("{success:false,msg:'用户登录失败,请重新登录'}"); return; } if (!long.TryParse(context.Request.Form["bookId"].ToString(), out bookId)) { context.Response.Write("{success:false,msg:'参数错误'}"); return; } #endregion try { CY.UME.Core.Business.University university = account.UniversityInfo; if (university == null) { context.Response.Write("{success:false,msg:'用户不存在'}"); return; } string url = university.LibServicesAddress; if (url.Trim().Length == 0) { context.Response.Write("{success: false, msg: '请求服务不存在'}"); return; } UMEServicePortTypeClient umeService = new UMEServicePortTypeClient(new BasicHttpBinding(), new EndpointAddress(url)); string strReturnVal = umeService.cancelBooking(account.ExtendInfo.LibUserId); } catch (Exception ex) { context.Response.Write("{success:false,msg:" + ex.Message + "}"); } context.Response.Write("Hello World"); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "aplication/json"; //long accountId = 0; CY.UME.Core.Business.Account account; #region validate account = CY.UME.Core.Global.GetCurrentAccount(); if (account == null || account.Id == 0) { context.Response.Write("{success:false,msg:'用户登录失败,请重新登录'}"); return; } #endregion try { CY.UME.Core.Business.University university = account.UniversityInfo; if (university == null) { context.Response.Write("{success:false,msg:'用户不存在'}"); return; } string url = university.LibServicesAddress; if (url.Trim().Length == 0) { context.Response.Write("{success:false,msg:'请求服务不存在'}"); return; } UMEServicePortTypeClient umeService = new UMEServicePortTypeClient(new BasicHttpBinding(), new EndpointAddress(url)); ArrayOfAnyType2anyTypeMap arrList = new ArrayOfAnyType2anyTypeMap(); arrList = umeService.getUsefulBooking(account.ExtendInfo.LibUserId); string strJson = Newtonsoft.Json.JavaScriptConvert.SerializeObject(arrList); context.Response.Write("{success:true,json:" + strJson + "}"); } catch (Exception ex) { context.Response.Write("{success:false,msg:'错误信息:" + ex.Message + "'}"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; //string strAccountId = context.Request.QueryString["accountId"].ToString().Trim();//spaceAccount string strCurrentPage = context.Request.QueryString["currentPage"].ToString().Trim(); string strPageSize = context.Request.QueryString["pageSize"].ToString().Trim(); //long spaceAccountId = 0;//spaceAccount int currentPage=0; int pageSize= 0; CY.UME.Core.Business.Account account; #region validate account = CY.UME.Core.Global.GetCurrentAccount(); if (account == null || account.Id == 0) { context.Response.Write("{success:false,message:'用户登录失败,请重新登录!'}"); return; } if (!int.TryParse(strCurrentPage, out currentPage) || !int.TryParse(strPageSize, out pageSize)) { context.Response.Write("{success:false,message:'参数错误!'}"); return; } #endregion try { CY.UME.Core.Business.University university = account.UniversityInfo; if (university == null) { context.Response.Write("{success:false,msg:'用户不存在'}"); return; } string url = university.LibServicesAddress; if (url.Trim().Length == 0) { context.Response.Write("{success:false,message:'请求服务不存在'}"); return; } UMEServicePortTypeClient umeService = new UMEServicePortTypeClient(new BasicHttpBinding(), new EndpointAddress(url)); ArrayOfAnyType2anyTypeMap hostoryBookList = new ArrayOfAnyType2anyTypeMap(); hostoryBookList = umeService.getReaderHistoryBorrowBooksInfo(account.ExtendInfo.LibUserId, currentPage, pageSize); string strJson = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hostoryBookList); context.Response.Clear(); TimeSpan cacheDuration = TimeSpan.FromDays(1); context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetExpires(DateTime.Now.Add(cacheDuration)); context.Response.Cache.SetMaxAge(cacheDuration); context.Response.Cache.AppendCacheExtension("must-revalidate, proxy-revalidate"); context.Response.Write("{success:true,json:" + strJson + "}"); } catch (Exception ex) { context.Response.Write("{success:false,message:'获取信息失败!错误信息:" + ex.Message + "'}"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; //string strAccountId = context.Request.Form["accountId"].ToString().Trim();//获取用户Id //long accountId = 0; CY.UME.Core.Business.Account account; #region validate account = CY.UME.Core.Global.GetCurrentAccount(); if (account == null || account.Id == 0) { context.Response.Write("{success:false,message:'用户登录失败,请重新登录!'}"); return; } //if (!long.TryParse(strAccountId, out accountId)) //{ // context.Response.Write("{success:false,message:'参数错误!'}"); // return; //} #endregion try { CY.UME.Core.Business.University university = account.UniversityInfo; if (university == null) { context.Response.Write("{success:false,msg:'用户不存在'}"); return; } string url = university.LibServicesAddress; if (url.Trim().Length == 0) { context.Response.Write("{success:false,msg:'请求服务不存在'}"); return; } System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding(); UMEServicePortTypeClient umeService = new UMEServicePortTypeClient(binding, new EndpointAddress(url)); ArrayOfAnyType2anyTypeMap returnVal = new ArrayOfAnyType2anyTypeMap(); string strJson; returnVal = umeService.getReaderNowBorrowBooksInfo(account.ExtendInfo.LibUserId);//用户当前的借阅情况(当前借阅图书) if (returnVal == null) { context.Response.Write("{success:true,json:[]}"); return; } strJson = Newtonsoft.Json.JavaScriptConvert.SerializeObject(returnVal); context.Response.Write("{success:true,json:" + strJson + "}"); } catch { context.Response.Write("{success:false,message:'服务器忙,请稍后再试!'}"); } }