private string getApplyList(HttpContext context) { int page = Convert.ToInt32(context.Request["page"]), rows = Convert.ToInt32(context.Request["rows"]); List <CommRelationInfo> cris = bllCommRelation.GetRelationList(BLLJIMP.Enums.CommRelationType.ApplyToTutor, null, null, page, rows); int TCount = bllCommRelation.GetRelationCount(BLLJIMP.Enums.CommRelationType.ApplyToTutor, null, null); List <dynamic> result = new List <dynamic>(); foreach (var item in cris) { UserInfo user = bllUser.GetUserInfo(item.RelationId); result.Add(new { id = item.AutoId, userAutoId = user.AutoID, userId = user.UserID, name = user.TrueName, company = user.Company, postion = user.Postion, phone = user.Phone, userFollowCount = bllCommRelation.GetRelationCount(BLLJIMP.Enums.CommRelationType.FollowUser, null, item.RelationId), followUserCount = bllCommRelation.GetRelationCount(BLLJIMP.Enums.CommRelationType.FollowUser, item.RelationId, null), articleCount = bllUser.GetCount <JuActivityInfo>(string.Format(" UserId ='{0}' And IsDelete=0 And IsHide=0 And WebsiteOwner='{1}'", item.RelationId, bllUser.WebsiteOwner)), applyDate = item.RelationTime.ToString("yyyy-MM-dd") }); } return(Common.JSONHelper.ObjectToJson(new { rows = result, total = TCount })); }
/// <summary> /// 新闻资讯列表 /// </summary> /// <param name="context"></param> /// <returns></returns> private string getNewsList(HttpContext context) { int page = Convert.ToInt32(context.Request["page"]), rows = Convert.ToInt32(context.Request["rows"]); string type = "Article"; string cateId = "83"; string keyword = context.Request["keyword"]; if (page == 0) { page = 1; } if (rows == 0) { rows = int.MaxValue; } int totalCount = 0; var dataList = bll.GetJuActivityList(type, null, out totalCount, page, rows, null, currentUserInfo.UserID, cateId, bll.WebsiteOwner, keyword); var data = from p in dataList select new { id = p.JuActivityID, title = p.ActivityName, pv = p.PV, hide = p.IsHide, favNum = bllCommRelation.GetRelationCount(CommRelationType.JuActivityFavorite, p.JuActivityID.ToString(), null), cmtNum = p.CommentCount }; return(Common.JSONHelper.ObjectToJson(new { rows = data, total = totalCount })); }
/// <summary> /// 新闻资讯列表 /// </summary> /// <param name="context"></param> /// <returns></returns> private string getPartnerList(HttpContext context) { int page = Convert.ToInt32(context.Request["page"]), rows = Convert.ToInt32(context.Request["rows"]); string type = context.Request["type"]; string cateId = "79"; string keyword = context.Request["keyword"]; string status = context.Request["status"]; if (page == 0) { page = 1; } if (rows == 0) { rows = int.MaxValue; } int totalCount = 0; var dataList = bll.GetJuActivityList(type, null, out totalCount, page, rows, null, currentUserInfo.UserID, cateId, bll.WebsiteOwner, keyword, "", "", "", "", false, "", false, true, status); var data = from p in dataList select new { id = p.JuActivityID, title = p.ActivityName, pv = p.PV, hide = p.IsHide, status = p.TStatus, province = (p.ProvinceCode == "0" || string.IsNullOrWhiteSpace(p.ProvinceCode)) ? "全国" : bllKeyValueData.GetDataVaule("Province", p.ProvinceCode), favNum = bllCommRelation.GetRelationCount(CommRelationType.JuActivityFavorite, p.JuActivityID.ToString(), null), cmtNum = p.CommentCount, img = p.ThumbnailsPath, sort = p.Sort }; return(Common.JSONHelper.ObjectToJson(new { rows = data, total = totalCount })); }
/// <summary> /// 新闻资讯列表 /// </summary> /// <param name="context"></param> /// <returns></returns> private string getAskList(HttpContext context) { int page = Convert.ToInt32(context.Request["page"]), rows = Convert.ToInt32(context.Request["rows"]); string cateId = context.Request["cateId"]; string keyword = context.Request["keyword"]; if (string.IsNullOrWhiteSpace(cateId)) { cateId = "81,82"; } if (page == 0) { page = 1; } if (rows == 0) { rows = int.MaxValue; } int totalCount = 0; var dataList = bll.GetJuActivityList(null, null, out totalCount, page, rows, null, currentUserInfo.UserID, cateId, bll.WebsiteOwner, keyword); var data = from p in dataList select new { id = p.JuActivityID, title = p.ActivityName, type = p.CategoryName, pv = p.PV, hide = p.IsHide, province = (p.ProvinceCode == "0" || string.IsNullOrWhiteSpace(p.ProvinceCode)) ? "全国" : bllKeyValueData.GetDataDefVaule("Province", p.ProvinceCode), favNum = bllCommRelation.GetRelationCount(CommRelationType.JuActivityFavorite, p.JuActivityID.ToString(), null), cmtNum = p.CommentCount }; return(Common.JSONHelper.ObjectToJson(new { rows = data, total = totalCount })); }
public void ProcessRequest(HttpContext context) { string rtype = context.Request["rtype"], mainId = context.Request["mainId"], exchange = context.Request["exchange"]; //1时mainId,relationId互换 BLLJIMP.Enums.CommRelationType nType = new BLLJIMP.Enums.CommRelationType(); if (!Enum.TryParse(rtype, out nType)) { apiResp.code = 1; apiResp.msg = "类型格式不能识别"; bLLCommRelation.ContextResponse(context, apiResp); return; } if (mainId == "0" || string.IsNullOrWhiteSpace(mainId)) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound; apiResp.msg = "关联主Id错误"; bLLCommRelation.ContextResponse(context, apiResp); return; } currentUserInfo = bLLCommRelation.GetCurrentUserInfo(); if (this.currentUserInfo == null) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin; apiResp.msg = "请先登录"; bLLCommRelation.ContextResponse(context, apiResp); return; } string relationId = this.currentUserInfo.AutoID.ToString(); if (mainId == relationId) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail; apiResp.msg = "不能跟自己建立关系"; bLLCommRelation.ContextResponse(context, apiResp); return; } if (exchange == "1") { relationId = mainId; mainId = this.currentUserInfo.AutoID.ToString(); } if (!this.bLLCommRelation.ExistRelation(nType, mainId, relationId)) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsRepeat; apiResp.msg = "关系不存在"; bLLCommRelation.ContextResponse(context, apiResp); return; } if (this.bLLCommRelation.DelCommRelation(nType, mainId, relationId)) { if (nType == CommRelationType.FriendApply) { UserInfo toUser = bllUser.GetUserInfoByAutoID(int.Parse(mainId)); //拒绝好友申请删除申请关系 bLLCommRelation.DelCommRelation(CommRelationType.FriendApply, relationId, mainId); bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.RejectFriendApply, this.currentUserInfo, null, new List <UserInfo>() { toUser }, null); } else if (nType == CommRelationType.Friend) { UserInfo toUser = bllUser.GetUserInfoByAutoID(int.Parse(mainId)); //删除好友关系 bLLCommRelation.DelCommRelation(CommRelationType.Friend, mainId, relationId); bLLCommRelation.DelCommRelation(CommRelationType.Friend, relationId, mainId); bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.DeleteFriend, this.currentUserInfo, null, new List <UserInfo>() { toUser }, null); } else if (nType == CommRelationType.JuActivityPraise) { JuActivityInfo article = bll.GetJuActivity(int.Parse(mainId), false); //点赞数直接修改到主表 int praiseCount = bLLCommRelation.GetRelationCount(nType, mainId, null); bll.Update(article, string.Format("PraiseCount={0}", praiseCount), string.Format("JuActivityID={0}", article.JuActivityID)); bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.DisJuActivityPraise, this.currentUserInfo, article, article.UserID, null); } apiResp.status = true; apiResp.msg = "删除完成"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; } else { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail; apiResp.msg = "删除失败"; } bLLCommRelation.ContextResponse(context, apiResp); }
/// <summary> /// 公开课列表 /// </summary> /// <param name="context"></param> /// <returns></returns> private string getOpenList(HttpContext context) { int page = Convert.ToInt32(context.Request["page"]), rows = Convert.ToInt32(context.Request["rows"]); string type = "OpenClass"; string cateId = context.Request["cateId"]; string keyword = context.Request["keyword"]; if (page == 0) { page = 1; } if (rows == 0) { rows = int.MaxValue; } int totalCount = 0; //DataTable sourceData = this.bll.GetArticleNewList( // out totalCount, // page, // rows, // null, // keyword, // currentUserInfo.UserID, // type, // bll.WebsiteOwner, // cateId, // null, // null, // null, // null, // null, // null, // false // ); List <JuActivityInfo> sourceData = this.bll.GetJuActivityList(type, null, out totalCount, page, rows, null, currentUserInfo.UserID, cateId, bll.WebsiteOwner, keyword, null); List <dynamic> data = new List <dynamic>(); foreach (var item in sourceData) { data.Add(new { id = item.JuActivityID, title = item.ActivityName, type = item.CategoryName, pv = item.PV, hide = item.IsHide, integral = item.IsFee == 1 ? 0 : item.ActivityIntegral, favNum = item.FavoriteCount, buyNum = bllCommRelation.GetRelationCount(CommRelationType.ViewOpenClass, item.JuActivityID.ToString(), null), cmtNum = item.CommentCount, img = item.ThumbnailsPath.ToString() }); } return(Common.JSONHelper.ObjectToJson(new { rows = data, total = totalCount })); }