protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); int intType = 0; int intUserID = 0; int intConcernID = 0; int intStatus = 0; int intCount = 0; intType = Convert.ToInt32(Classlibrary.GetRequest("Type", 0)); if (!intType.Equals(intType) || intType > 0) { switch (intType) { case 1: //添加关注 intUserID = Convert.ToInt32(Classlibrary.GetRequest("UserID", 0)); intConcernID = Convert.ToInt32(Classlibrary.GetRequest("ConcernID", 0)); intStatus = SqlLibrary.AddConcern(intUserID, intConcernID); if (intStatus == 1) { sb.Append("{\"Status\":1}"); //添加成功 this.strContent = sb.ToString(); } else if (intStatus == -1) { sb.Append("{\"Status\":-1}"); //添加失败,不是VIP this.strContent = sb.ToString(); } else { sb.Append("{\"Status\":0}"); //添加失败,关注已被添加 this.strContent = sb.ToString(); } break; case 2: //删除关注 intUserID = Convert.ToInt32(Classlibrary.GetRequest("UserID", 0)); intConcernID = Convert.ToInt32(Classlibrary.GetRequest("ConcernID", 0)); intStatus = SqlLibrary.DeleteConcern(intUserID, intConcernID); if (intStatus == 1) { sb.Append("{\"Status\":1}"); //删除成功 this.strContent = sb.ToString(); } else { sb.Append("{\"Status\":0}"); //删除失败,关注已被删除 this.strContent = sb.ToString(); } break; case 3: //统计关注数 intUserID = Convert.ToInt32(Classlibrary.GetRequest("UserID", 0)); intCount = SqlLibrary.CountConcern(intUserID); sb.Append("{\"Count\":" + intCount + "}"); this.strContent = sb.ToString(); break; case 4: //统计粉丝数 intUserID = Convert.ToInt32(Classlibrary.GetRequest("UserID", 0)); intCount = SqlLibrary.CountFans(intUserID); sb.Append("{\"Count\":" + intCount + "}"); this.strContent = sb.ToString(); break; } } }
protected void Page_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); int intType = 0; int intCount = 0; int intUserID = 0; string strSQL = null; string strProvince = null; string strCity = null; string strGender = null; string strCategory = null; intType = Convert.ToInt32(Classlibrary.GetRequest("Type", 0)); if (!intType.Equals(intType) || intType > 0) { switch (intType) { case 1: //大厅分页 strSQL = "SELECT ISNULL(Count(id),1) AS Count FROM [MT_Media] WITH(NOLOCK)"; intCount = Convert.ToInt32(SqlHelper.ExecuteScalar(SqlLibrary.GetServer_Main(), CommandType.Text, strSQL)); if (intCount % 8 > 0) { intCount = intCount / 8 + 1; } else { intCount = intCount / 8; } this.strContent = "{\"Page\":" + intCount + "}"; break; case 2: //关注分页 intUserID = Convert.ToInt32(Classlibrary.GetRequest("UserID", 1)); //intUserID = Convert.ToInt32(Session["UserID"]); DataTable dt = SqlLibrary.ReadConcernList(intUserID); if (dt != null) { intCount = dt.Rows.Count; if (intCount % 8 > 0) { intCount = intCount / 8 + 1; } else { intCount = intCount / 8; } this.strContent = "{\"Page\":" + intCount + "}"; } else { this.strContent = "{\"Page\":0}"; } break; case 3: //粉丝分页 intUserID = Convert.ToInt32(Classlibrary.GetRequest("UserID", 1)); intCount = SqlLibrary.CountFans(intUserID); if (intCount > 0) { if (intCount % 8 > 0) { intCount = intCount / 8 + 1; } else { intCount = intCount / 8; } this.strContent = "{\"Page\":" + intCount + "}"; } else { this.strContent = "{\"Page\":0}"; } break; case 4: //搜索分页 strProvince = Classlibrary.GetRequest("Province", 1).ToString(); strCity = Classlibrary.GetRequest("City", 1).ToString(); strGender = Classlibrary.GetRequest("Gender", 1).ToString(); strCategory = Classlibrary.GetRequest("Category", 1).ToString(); intCount = SqlLibrary.SearchUserListCount(strProvince, strCity, strGender, strCategory); if (intCount > 0) { if (intCount % 8 > 0) { intCount = intCount / 8 + 1; } else { intCount = intCount / 8; } this.strContent = "{\"Page\":" + intCount + "}"; } else { this.strContent = "{\"Page\":0}"; } break; } } }