protected void Page_Load(object sender, EventArgs e) { //获取参数 string ls_aid = "", ls_cid = "", ls_page = "1", ls_pagesize = "10"; JpCommon JpCommon = new JpCommon(); if (this.Request.QueryString["cid"] != null) ls_cid = JpCommon.queryString2StrID(this.Request.QueryString["cid"].ToString(), 9); if (this.Request.QueryString["aid"] != null) ls_aid = JpCommon.queryString2StrID(this.Request.QueryString["aid"].ToString(), 9); if (this.Request.QueryString["page"] != null) ls_page = JpCommon.queryString2StrID(this.Request.QueryString["page"].ToString(), 9); if (this.Request.QueryString["pagesize"] != null) ls_pagesize = JpCommon.queryString2StrID(this.Request.QueryString["pagesize"].ToString(), 9); TPortalClass.JpComment JpComment = new TPortalClass.JpComment(); TPortalClass.JpUserVip JpUserVip = new TPortalClass.JpUserVip(); DataTable dt = JpComment.Getdocsbyaid_ysh_fy(ls_aid, ls_cid, Convert.ToInt32(ls_page), Convert.ToInt32(ls_pagesize)); DataTable tempTable = dt.Clone(); DataColumn col1 = new DataColumn("rytx", typeof(String)); DataColumn col2 = new DataColumn("showTime", typeof(String)); tempTable.Columns.Add(col1); tempTable.Columns.Add(col2); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); string ls_user = dt.Rows[i]["usid"].ToString(); DataTable dtrytx = JpUserVip.GetJpUserPic(ls_user); if (dtrytx.Rows.Count > 0) { dr["rytx"] = dtrytx.Rows[0]["hy_pic"].ToString(); } else { dr["rytx"] = "images/1211p1.png"; } dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["commenttime"].ToString())); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
public string BindTelSaveInfo(string pis_yzm, string pis_tel, string pis_name, string pis_code) { string pos_json = ""; string ls_yzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); if (pis_tel != "" && pis_name != "" && pis_code != "" && pis_yzm == ls_yzm) { try { TPortalClass.JpVerifyCode JpVerifyCode = new TPortalClass.JpVerifyCode(); DataTable dt = JpVerifyCode.GetCodesByTel(pis_tel); if (dt.Rows.Count > 0) { if (pis_code == dt.Rows[0]["hy_code"].ToString()) { TPortalClass.JpUserVip JpUserVip = new TPortalClass.JpUserVip(); JpUserVip.UpdateTel(pis_tel, pis_name); //绑定成功 pos_json = "{\"code\":\"0\"}"; } else { //验证码错误 pos_json = "{\"code\":\"1\"}"; } } } catch { //系统错误 pos_json = "{\"code\":\"2\"}"; } finally { } } else { //非法调用 pos_json = "{\"code\":\"3\"}"; } return pos_json; }
private void DataPlay() { TPortalClass.JpComment JpComment = new TPortalClass.JpComment(); TPortalClass.JpUserVip JpUserVip = new TPortalClass.JpUserVip(); string strOrder = " order by commenttime desc "; DataTable dt = JpComment.GetdocsbyaidAll(aid, cid, 1, 3, strOrder); DataTable tempTable = dt.Clone(); DataColumn col1 = new DataColumn("rytx", typeof(String)); DataColumn col2 = new DataColumn("showTime", typeof(String)); tempTable.Columns.Add(col1); tempTable.Columns.Add(col2); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); string ls_user = dt.Rows[i]["usid"].ToString(); DataTable dtrytx = JpUserVip.GetJpUserPic(ls_user); if (dtrytx.Rows.Count > 0) { dr["rytx"] = dtrytx.Rows[0]["hy_pic"].ToString(); } else { dr["rytx"] = "images/1211p1.png"; } dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["commenttime"].ToString())); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } tempTable.Rows.Add(dr); } rptListNew.DataSource = tempTable; rptListNew.DataBind(); //获得最热的数据 dt.Clear(); strOrder = " order by praiseCount desc "; dt = JpComment.GetdocsbyaidAll(aid, cid, 1, 3, strOrder); tempTable.Clear(); tempTable = dt.Clone(); DataColumn col3 = new DataColumn("rytx", typeof(String)); DataColumn col4 = new DataColumn("showTime", typeof(String)); tempTable.Columns.Add(col3); tempTable.Columns.Add(col4); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); string ls_user = dt.Rows[i]["usid"].ToString(); DataTable dtrytx = JpUserVip.GetJpUserPic(ls_user); if (dtrytx.Rows.Count > 0) { dr["rytx"] = dtrytx.Rows[0]["hy_pic"].ToString(); } else { dr["rytx"] = "images/1211p1.png"; } dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["commenttime"].ToString())); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } tempTable.Rows.Add(dr); } rptList.DataSource = tempTable; rptList.DataBind(); }
public string RegistValidate(string pis_yzm, string pis_tel, string pis_code) { string pos_json = ""; string ls_yzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); if (pis_tel != "" && pis_code != "" && pis_yzm == ls_yzm) { try { TPortalClass.JpVerifyCode JpVerifyCode = new TPortalClass.JpVerifyCode(); DataTable dt = JpVerifyCode.GetCodesByTel(pis_tel); if (dt.Rows.Count > 0) { if (pis_code == dt.Rows[0]["hy_code"].ToString()) { JpUserVip JpUserVip = new JpUserVip(); DataTable dt_user = JpUserVip.GetDocbyhyid(pis_tel); if (dt_user.Rows.Count > 0) { //该用户已注册 pos_json = "{\"code\":\"1\"}"; } else { //未注册验证码验证成功 pos_json = "{\"code\":\"0\"}"; } } else { //验证码错误 pos_json = "{\"code\":\"2\"}"; } } } catch { //系统错误 pos_json = "{\"code\":\"3\"}"; } finally { } } else { //非法调用 pos_json = "{\"code\":\"4\"}"; } return pos_json; }
public string RegistSaveInfo(string pis_yzm, string pis_uid, string pis_name, string pis_pwd, string pis_mmzt, string pis_flag) { string pos_json = ""; int ls_sort = 0; string ls_yzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); if (pis_uid != "" && pis_pwd != "" && pis_flag != "" && pis_yzm == ls_yzm) { try { if (pis_mmzt == "1") { pis_pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pis_pwd, "MD5"); } if (pis_mmzt == "2") { // pis_pwd = pis_pwd; } #region 本地账号注册 TPortalClass.JpUserVip JpUserVip = new TPortalClass.JpUserVip(); DataTable dt_userInfo = JpUserVip.GetJpUserByName(pis_name); if (dt_userInfo.Rows.Count > 0) { //用户名已存在 pos_json = "{\"code\":\"1\"}"; } else { DataTable dt = JpUserVip.GetMaxSort(); if (dt.Rows.Count > 0) { ls_sort = Convert.ToInt32(dt.Rows[0]["hy_sort"].ToString()) + 1; } else { ls_sort = 1; } JpUserVip.hy_addtime = System.DateTime.Now.ToString(); if (pis_flag == "0") { //本地注册方式 JpUserVip.hy_id = pis_uid; } else { //账号关联方式 JpUserVip.hy_id = ""; } JpUserVip.hy_name = pis_name; JpUserVip.hy_pwd = pis_pwd; JpUserVip.hy_sort = ls_sort; JpUserVip.InsertRegist(); //表示注册成功 pos_json = "{\"code\":\"0\"}"; } #endregion } catch { //系统错误 pos_json = "{\"code\":\"2\"}"; } finally { } } else { //非法调用 pos_json = "{\"code\":\"3\"}"; } return pos_json; }
public string ModifyPwdSaveInfo(string pis_yzm, string pis_uid, string pis_newpwd, string pis_mmzt) { string pos_json = ""; string ls_yzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); if (pis_uid != "" && pis_newpwd != "" && pis_mmzt != "" && pis_yzm == ls_yzm) { try { if (pis_mmzt == "1") { pis_newpwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pis_newpwd, "MD5"); } if (pis_mmzt == "2") { // pis_pwd = pis_pwd; } TPortalClass.JpUserVip JpUserVip = new TPortalClass.JpUserVip(); JpUserVip.UpdatePwd(pis_uid, pis_newpwd); //表示修改成功 pos_json = "{\"code\":\"0\"}"; } catch { //系统错误 pos_json = "{\"code\":\"1\"}"; } finally { } } else { //非法调用 pos_json = "{\"code\":\"2\"}"; } return pos_json; }
public string Login(string pis_yzm, string pis_uid, string pis_pwd, string pis_mmzt) { string pos_json = ""; string ls_pwd = ""; string ls_yzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); if (pis_uid != "" && pis_pwd != "" && pis_yzm == ls_yzm) { //判断用户名和密码是否正确 try { if (pis_mmzt == "1") { ls_pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pis_pwd, "MD5"); } if (pis_mmzt == "2") { // pis_pwd = pis_pwd; } TPortalClass.JpUserVip JpUserVip = new JpUserVip(); if (JpUserVip.Login(pis_uid, ls_pwd)) { DataTable dt = JpUserVip.GetJpUser(pis_uid); if (dt.Rows.Count > 0) { string fjlj = dt.Rows[0]["hy_pic"].ToString(); //得到头像路径 fjlj = Fjcl(fjlj); pos_json = "{\"code\":\"0\",\"username\":\"" + dt.Rows[0]["hy_name"].ToString() + "\",\"rytx\":\"" + fjlj + "\",\"id\":\"" + dt.Rows[0]["hy_id"].ToString() + "\"}"; } } else { //用户名或者密码错误 pos_json = "{\"code\":\"1\"}"; } } catch { //系统错误 pos_json = "{\"code\":\"2\"}"; } } else { //非法调用 pos_json = "{\"code\":\"3\"}"; } return pos_json; }