private void SetGuideDetail() { int id = SiteAbout.gInt("id"); string name = SiteAbout.gStr("name"); string url = SiteAbout.gStr("url"); string type = SiteAbout.gStr("type"); int sortid = SiteAbout.gInt("sortid"); if (id > 0) { zs.Model.Tbl_Guide modelGuide = bllGuide.GetModel(id); modelGuide.sortid = sortid; modelGuide.type = type; modelGuide.url = url; modelGuide.name = name; Response.ContentType = "application/json"; if (bllGuide.Update(modelGuide)) { if (type == "news") { modelGuide.url = "./newslist.aspx?id=" + ApplicationMethod.encript(id.ToString()); bllGuide.Update(modelGuide); } Response.Write("{\"status\":\"true\"}"); } else { Response.Write("{\"status\":\"false\"}"); } } else { if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(url) || string.IsNullOrEmpty(type)) { return; } zs.Model.Tbl_Guide modelGuide = new zs.Model.Tbl_Guide(); modelGuide.pid = 0; modelGuide.sortid = sortid; modelGuide.type = type; modelGuide.url = url; modelGuide.name = name; Response.ContentType = "application/json"; int ret = bllGuide.Add(modelGuide); if (ret > 0) { if (type == "news") { modelGuide.id = ret; modelGuide.url = "./newslist.aspx?id=" + ApplicationMethod.encript(ret.ToString()); bllGuide.Update(modelGuide); } Response.Write("{\"status\":\"true\"}"); } else { Response.Write("{\"status\":\"false\"}"); } } }
private void UsersBind(List <zs.Model.Tbl_Video> userList, int pageSize)//repeater分页并绑定 { try { PagedDataSource objPage = new PagedDataSource(); objPage.DataSource = userList; objPage.AllowPaging = true; objPage.PageSize = pageSize; int CurPage; if (Request.QueryString["page"] != null) { CurPage = Convert.ToInt32(Request.QueryString["page"]); } else { CurPage = 1; } objPage.CurrentPageIndex = CurPage - 1; Repeater1.DataSource = objPage; Repeater1.DataBind(); RecordCount.Text = objPage.DataSourceCount.ToString(); PageCount.Text = objPage.PageCount.ToString(); Pageindex.Text = CurPage.ToString(); Literal1.Text = PageList(objPage.PageCount, CurPage); FirstPage.NavigateUrl = Request.CurrentExecutionFilePath + "?id=" + ApplicationMethod.encript(id) + "&page=1"; PrevPage.NavigateUrl = Request.CurrentExecutionFilePath + "?id=" + ApplicationMethod.encript(id) + "&page=" + (CurPage - 1); NextPage.NavigateUrl = Request.CurrentExecutionFilePath + "?id=" + ApplicationMethod.encript(id) + "&page=" + (CurPage + 1); LastPaeg.NavigateUrl = Request.CurrentExecutionFilePath + "?id=" + ApplicationMethod.encript(id) + "&page=" + objPage.PageCount.ToString(); if (CurPage <= 1 && objPage.PageCount <= 1) { FirstPage.NavigateUrl = ""; PrevPage.NavigateUrl = ""; NextPage.NavigateUrl = ""; LastPaeg.NavigateUrl = ""; } if (CurPage <= 1 && objPage.PageCount > 1) { FirstPage.NavigateUrl = ""; PrevPage.NavigateUrl = ""; } if (CurPage >= objPage.PageCount) { NextPage.NavigateUrl = ""; LastPaeg.NavigateUrl = ""; } } catch (Exception error) { Response.Write(error.ToString()); } finally { } }
public string GetXueyuanList() { List <zs.Model.Tbl_Xueyuan> models = bllx.GetModelList(""); StringBuilder sb = new StringBuilder(); foreach (zs.Model.Tbl_Xueyuan model in models) { sb.Append("<li class=''>"); sb.Append("<a href='zhuanye.aspx?xid=" + ApplicationMethod.encript(model.id.ToString()) + "'>"); sb.Append(model.name + "</a></li>"); } return(sb.ToString()); }
private void InitData() { string id = ApplicationMethod.decript(Request.QueryString["id"].ToString()); zs.Model.Tbl_Xueyuan model = bll.GetModelByCache(int.Parse(id)); name = model.name; nameen = model.nameen; conts = model.conts; yuanzhang = model.yuanzhang; image1 = model.image1; image2 = model.image2; image3 = model.image3; tags = "浙江树人大学招生网," + model.name; desc = ApplicationMethod.NoHtmlCode(model.conts, 80); xid = ApplicationMethod.encript(model.id.ToString()); this.Page.Title = model.name + " - 浙江树人大学招生网"; this.Repeater1.DataSource = bll.GetList(2, "", "newid()"); this.Repeater1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { string ids = Request.QueryString["id"].ToString(); if (ids != "0") { zs.Model.Tbl_User model = bll.GetModel(int.Parse(ids)); model.userName = this.tb_name.Text.Trim(); model.userPsw = ApplicationMethod.encript(this.tb_Psw.Text.Trim()); bll.Update(model); ViewState["userid"] = ids; } else { zs.Model.Tbl_User model = new zs.Model.Tbl_User(); model.userName = this.tb_name.Text.Trim(); model.userPsw = ApplicationMethod.encript(this.tb_Psw.Text.Trim()); bll.Add(model); ViewState["userid"] = bll.GetModelList("userName='******'")[0].id; } } }
protected void btn_Login_Click(object sender, EventArgs e) { zs.BLL.Tbl_User blluser = new zs.BLL.Tbl_User(); string userName = CheckInput(this.tb_userName.Text.Trim()); string userPSW = CheckInput(this.tb_password.Text.Trim()); if (blluser.Exists(userName)) { //存在用户名 if (blluser.GetModel(userName).userPsw == ApplicationMethod.encript(userPSW)) { //密码正确 Response.Cookies["userId"].Value = blluser.GetModel(userName).id.ToString(); Response.Cookies["userName"].Value = blluser.GetModel(userName).userName; Response.Redirect("./Default.aspx"); } else {//密码错误 ClientScript.RegisterClientScriptBlock(this.GetType(), "showPError", "<script>alert('用户名密码不正确,请确认!')</script>"); } } else {//用户名不存在 ClientScript.RegisterClientScriptBlock(this.GetType(), "showUError", "<script>alert('用户名密码不正确,请确认!')</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { this.Label1.Text = ApplicationMethod.encript(this.TextBox1.Text.Trim()); }
private string PageList(int Pagecount, int Pageindex) { StringBuilder sb = new StringBuilder(); sb.Append("<select id=\"Page_Jump\" name=\"Page_Jump\" onchange=\"window.location='" + Request.CurrentExecutionFilePath + "?id=" + ApplicationMethod.encript(id) + "&page='+ this.options[this.selectedIndex].value + '';\">"); for (int i = 1; i <= Pagecount; i++) { if (Pageindex == i) { sb.Append("<option value='" + i + "' selected>" + i + "</option>"); } else { sb.Append("<option value='" + i + "'>" + i + "</option>"); } } sb.Append("</select>"); return(sb.ToString()); }