protected void Bt_login_Click(object sender, EventArgs e) { string expertID = txtUserID.Text; string expertPwd = txtUserPwd.Text; Expert expert = new Expert(); int flag = expert.Login(expertID, expertPwd); if (flag == 1) { expert.LoadInfo(expertID); Response.Cookies["userID"].Value = txtUserID.Text; Response.Cookies["userID"].Expires = DateTime.Now.AddDays(7); Response.Cookies["userName"].Value = expert.expertName; Response.Cookies["userName"].Expires = DateTime.Now.AddDays(7); Response.Cookies["userPwd"].Value = txtUserPwd.Text; Response.Cookies["userPwd"].Expires = DateTime.Now.AddDays(7); Response.Redirect("main.htm"); } else if (flag == -1) { Response.Write("<Script Language=JavaScript>alert(\"密码错误!\")</Script>"); } else if (flag == 0) { Response.Write("<Script Language=JavaScript>alert(\"用户名不存在!\")</Script>"); } }
protected void Bt_send_Click(object sender, EventArgs e) { if (IsValid) { Expert expert = new Expert(); expert.LoadInfo(Request.Cookies["userID"].Value.ToString()); string msgTo = expert.expertColumn; Hashtable ht = new Hashtable(); ht.Add("messageFrom", SQLString.GetQuotedString(Request.Cookies["userID"].Value.ToString())); ht.Add("messageTo", SQLString.GetQuotedString(msgTo)); ht.Add("messageTime", SQLString.GetQuotedString(DateTime.Now.ToString())); ht.Add("messageTitle", SQLString.GetQuotedString(txtTitle.Text)); ht.Add("messageContent", SQLString.GetQuotedString(txtContent.Text)); ht.Add("messageState", SQLString.GetQuotedString("0")); Message msg = new Message(); if (msg.NewMesg(ht)) { Response.Write("<Script Language=JavaScript>alert(\"发送成功!\")</Script>"); } else { Response.Write("<Script Language=JavaScript>alert(\"发送失败!\")</Script>"); } txtContent.Text = ""; txtTitle.Text = ""; } }
protected void Bt_Update_Click(object sender, EventArgs e) { if (Page.IsValid) { Expert expert = new Expert(); expert.LoadInfo(Request.Cookies["userID"].Value.ToString()); if (txtPwdold.Text == expert.expertPwd) { string xwhere = "where expertID=" + SQLString.GetQuotedString(Request.Cookies["userID"].Value.ToString()); Hashtable ht = new Hashtable(); ht.Add("expertPwd", SQLString.GetQuotedString(txtPwdnew.Text)); if (expert.Update(ht, xwhere)) { Response.Write("<Script Language=JavaScript>alert(\"密码修改成功!\")</Script>"); } else { Response.Write("<Script Language=JavaScript>alert(\"密码修改失败!\")</Script>"); } } else { Response.Write("<Script Language=JavaScript>alert(\"旧密码错误!\")</Script>"); } } }
private void GridviewBind() { string ID = txtexpertID.Text; string column = Dropcolumn.SelectedValue; string Name = txtexpertName.Text; Expert ep = new Expert(); DataSet ds = ep.LoadInfo(ID, column, Name); GridView1.DataSource = ds; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { string userID = Request.Cookies["userID"].Value.ToString(); Expert expert = new Expert(); expert.LoadInfo(userID); txtName.Text = expert.expertName; rblSex.SelectedValue = expert.expertSex; txtMail.Text = expert.expertMail; txtPhone.Text = expert.expertPhone; txtAddress.Text = expert.expertAddress; txtInfo.Text = expert.expertInfo; ddlcolumn.SelectedValue = expert.expertColumn; } }
private void GridviewBind() { string ID = txtexpertID.Text; string column = Dropcolumn.SelectedValue; string Name = txtexpertName.Text; Expert ep = new Expert(); DataSet ds = ep.LoadInfo(ID,column,Name); GridView1.DataSource = ds; GridView1.DataBind(); }