newPass.aspx.cs
Upload User: lusr621
Upload Date: 2022-01-11
Package Size: 1001k
Code Size: 3k
Development Platform:

VBScript

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. public partial class newPass : System.Web.UI.Page
  12. {
  13.     protected void Page_Load(object sender, EventArgs e)
  14.     {
  15.         if (Session["UserType"] == "gr")
  16.         {
  17.             Panel2.Visible = false;
  18.             LinkButton1.Visible = false;
  19.         }
  20.         else
  21.             if (Session["UserType"] == "qy")
  22.             {
  23.                 Panel1.Visible = false;
  24.             }
  25.     }
  26.     protected void Button1_Click(object sender, EventArgs e)
  27.     {
  28.         string name=Session["UserName"].ToString();
  29.         string userType=Session["UserType"].ToString();
  30.         string sql="";
  31.         if (userType == "gr")
  32.         {
  33.             sql = "update tb_grUser set Pass='" + txtNewPass.Text + "'where Name='" + name + "'";
  34.         }
  35.         else
  36.             if (userType == "qy")
  37.             { 
  38.                 sql="update tb_User set UserPass='"+txtNewPass.Text+"' where UserName='"+name+"'";
  39.             }
  40.         if (dataOperate.execSQL(sql))
  41.         {
  42.             Panel2.Visible = false;
  43.             Panel1.Visible = true;
  44.             RegisterStartupScript("true","<script>alert('修改成功!')</script>");
  45.         }
  46.         else {
  47.             Panel2.Visible = false;
  48.             Panel1.Visible = true;
  49.             RegisterStartupScript("false","<script>alert('修改失败!')</script>");
  50.         }
  51.         
  52.     }
  53.     protected void Button2_Click(object sender, EventArgs e)
  54.     {
  55.         string name = Session["UserName"].ToString();      
  56.         string linkman = this.txtLinkman.Text;
  57.         string companyName = this.txtCompanyName.Text;
  58.         string ddlKind = this.ddlKind.SelectedValue;
  59.         string calling = this.txtCalling.Text;
  60.         string licenceNumber = this.txtLicenceNumber.Text;
  61.         string address = this.txtAddress.Text;
  62.         string phone = this.txtPhone.Text;
  63.         string fax = this.txtFax.Text;
  64.         string email = this.txtEmail.Text;
  65.         string networkIP = this.txtNetworkIP.Text;
  66.         string content = this.txtContent.Text;
  67.         string sql = "update tb_User set Linkman='" + linkman + "',CompanyName='"+companyName+"',Kind='"+ddlKind+"',Calling='"+calling+"',LicenceNumber='"+
  68.             licenceNumber+"',Address='"+address+"',Phone='"+phone+"',Fax='"+fax+"',Email='"+email+"',NetworkIP='"+networkIP+"',Content='"+
  69.             content+"' where UserName='"+name+"'";
  70.         if (dataOperate.execSQL(sql))
  71.         {
  72.             RegisterStartupScript("true", "<script>alert('修改成功!')</script>");
  73.         }
  74.         else
  75.         {
  76.             RegisterStartupScript("false", "<script>alert('修改失败!')</script>");
  77.         }
  78.     }
  79.     protected void LinkButton1_Click(object sender, EventArgs e)
  80.     {
  81.         Panel1.Visible = false;
  82.         Panel2.Visible = true;
  83.     }
  84.     protected void LinkButton2_Click(object sender, EventArgs e)
  85.     {
  86.         Panel2.Visible = false;
  87.         Panel1.Visible = true;
  88.     }
  89. }