protected void Updatepwd(RepeaterCommandEventArgs e) { conn updatepwd = new conn(); string oldpwd = ((TextBox)this.Repeater1.Items[0].FindControl("oldpwd")).Text.Trim(); string newpwd = ((TextBox)this.Repeater1.Items[0].FindControl("newpwd")).Text.Trim(); string name = Session["userid"].ToString(); string result = updatepwd.checklogin(name, oldpwd); if (result == null) { Response.Write("<script language='javascript'>alert('原密码不正确!');</script>"); } else { string upsql = "update staffinfo set PWD=?newpwd,LastModify=?lastmodify WHERE SID =?session"; MySqlParameter[] insertpar = { new MySqlParameter("?newpwd", MySqlDbType.VarChar), new MySqlParameter("?lastmodify", MySqlDbType.VarChar), new MySqlParameter("?session", MySqlDbType.VarChar) }; insertpar[0].Value = newpwd; insertpar[1].Value = DateTime.Now; insertpar[2].Value = Session["userid"]; int num = updatepwd.ExecuteSql(upsql, insertpar); if (num == 1) { Response.Write("<script language='javascript'>alert('更新成功!');location.replace(document.referrer);</script>"); } else { Response.Write("<script language='javascript'>alert('更新失败!');</script>"); } } }
protected void Updatepersonal(RepeaterCommandEventArgs e) { conn updatename = new conn(); string gender = ((DropDownList)this.Repeater1.Items[0].FindControl("gender")).SelectedValue.Trim(); string lovestate = ((DropDownList)this.Repeater1.Items[0].FindControl("lovestate")).SelectedValue.Trim(); string birth = ((TextBox)this.Repeater1.Items[0].FindControl("birth")).Text.Trim(); string age = ((TextBox)this.Repeater1.Items[0].FindControl("age")).Text.Trim(); string upsql = "update staffinfo set Gender=?gender,LoveState=?lovestate,LastModify=?lastmodify,Birth=?birth,Age=?age WHERE SID =?session"; MySqlParameter[] insertpar = { new MySqlParameter("?gender", MySqlDbType.VarChar), new MySqlParameter("?lovestate", MySqlDbType.VarChar), new MySqlParameter("?lastmodify", MySqlDbType.VarChar), new MySqlParameter("?birth", MySqlDbType.VarChar), new MySqlParameter("?age", MySqlDbType.VarChar), new MySqlParameter("?session", MySqlDbType.VarChar) }; insertpar[0].Value = gender; insertpar[1].Value = lovestate; insertpar[2].Value = DateTime.Now; insertpar[3].Value = birth; insertpar[4].Value = age; insertpar[5].Value = Session["userid"]; int num = updatename.ExecuteSql(upsql, insertpar); if (num == 1) { Response.Write("<script language='javascript'>alert('更新成功!');</script>"); } else { Response.Write("<script language='javascript'>alert('更新失败!');</script>"); } }
protected void Updatework(RepeaterCommandEventArgs e) { conn updatename = new conn(); string sid = ((TextBox)this.Repeater1.Items[0].FindControl("sid")).Text.Trim(); string zfb = ((TextBox)this.Repeater1.Items[0].FindControl("zfb")).Text.Trim(); string bank = ((TextBox)this.Repeater1.Items[0].FindControl("bank")).Text.Trim(); string card = ((TextBox)this.Repeater1.Items[0].FindControl("card")).Text.Trim(); string upsql = "update staffinfo set SID=?sid,ZFB=?zfb,Bank=?bank,Card=?card,LastModify=?lastmodify WHERE SID =?session"; MySqlParameter[] insertpar = { new MySqlParameter("?sid", MySqlDbType.VarChar), new MySqlParameter("?zfb", MySqlDbType.VarChar), new MySqlParameter("?bank", MySqlDbType.VarChar), new MySqlParameter("?card", MySqlDbType.VarChar), new MySqlParameter("?lastmodify", MySqlDbType.VarChar), new MySqlParameter("?session", MySqlDbType.VarChar) }; insertpar[0].Value = sid; insertpar[1].Value = zfb; insertpar[2].Value = bank; insertpar[3].Value = card; insertpar[4].Value = DateTime.Now; insertpar[5].Value = Session["userid"]; int num = updatename.ExecuteSql(upsql, insertpar); if (num == 1) { Response.Write("<script language='javascript'>alert('更新成功!');location.replace(document.referrer);</script>"); } else { Response.Write("<script language='javascript'>alert('更新失败!');</script>"); } }
protected void Button2_Click(object sender, EventArgs e) { //Response.Write("<script language='javascript'>alert('提交时出现了一些意外!');</script>"); string insert = "insert into applyadvise (ApplyName,Person,Advise,Score,Time)values(?applyname,?person,?advise,?scorce,?time)"; MySqlParameter[] insertpar = { new MySqlParameter("?applyname", MySqlDbType.VarChar), new MySqlParameter("?person", MySqlDbType.VarChar), new MySqlParameter("?advise", MySqlDbType.VarChar), new MySqlParameter("?scorce", MySqlDbType.VarChar), new MySqlParameter("?time", MySqlDbType.VarChar) }; insertpar[0].Value = name.Text; insertpar[1].Value = Session["userid"]; insertpar[2].Value = advise.Text; insertpar[3].Value = score.Text; insertpar[4].Value = DateTime.Now; conn apply = new conn(); int no = apply.ExecuteSql(insert, insertpar); name.Text = ""; advise.Text = ""; score.Text = ""; if (no == 1) { Response.Write("<script language='javascript'>alert('提交成功');</script>"); } else if (no == 0) { Response.Write("<script language='javascript'>alert('提交时出现了一些意外!');</script>"); } }
protected void Button3_Click1(object sender, EventArgs e)//注册 { conn reg = new conn(); MySqlParameter[] mysp = { new MySqlParameter("?username", MySqlDbType.VarChar), new MySqlParameter("?sid", MySqlDbType.VarChar) }; mysp[0].Value = regname.Text; mysp[1].Value = regstuid.Text; string sql = "select * from staffinfo where Name=?username or SID=?sid"; bool result = reg.ReadSql(sql, mysp); if (result == false) { string insert = "insert into staffinfo (SID,Name,Tel,Email,PWD,RegestTime)values(?regsid,?regusername,?tel,?email,?pwd,?regtime)"; MySqlParameter[] insertpar = { new MySqlParameter("?regsid", MySqlDbType.VarChar), new MySqlParameter("?regusername", MySqlDbType.VarChar), new MySqlParameter("?tel", MySqlDbType.VarChar), new MySqlParameter("?email", MySqlDbType.VarChar), new MySqlParameter("?pwd", MySqlDbType.VarChar), new MySqlParameter("?regtime", MySqlDbType.VarChar) }; insertpar[0].Value = regstuid.Text; insertpar[1].Value = regname.Text; insertpar[2].Value = regphone.Text; insertpar[3].Value = regemail.Text; insertpar[4].Value = regpassword.Text; insertpar[5].Value = DateTime.Now; int no = reg.ExecuteSql(insert, insertpar); if (no == 1) { Response.Write("<script language='javascript'>alert('注册成功!现在可以登录了!');</script>"); } else if (no == 0) { Response.Write("<script language='javascript'>alert('注册写入时出现了一些意外!');</script>"); } } else { Response.Write("<script language='javascript'>alert('该用户名或学号已经存在请重新注册!');</script>"); } }
protected void Updatename(RepeaterCommandEventArgs e) { conn updatename = new conn(); string Nickname = ((TextBox)this.Repeater1.Items[0].FindControl("Nickname")).Text.Trim(); string Name = ((TextBox)this.Repeater1.Items[0].FindControl("Name")).Text.Trim(); string Sign = ((TextBox)this.Repeater1.Items[0].FindControl("Sign")).Text.Trim(); string upsql = "update staffinfo set Name=?name,Nickname=?nickname,Sign=?sign,LastModify=?lastmodify,Gender=?gender WHERE SID =?session"; string gender = ((DropDownList)this.Repeater1.Items[0].FindControl("Gender")).SelectedValue.Trim(); MySqlParameter[] insertpar = { new MySqlParameter("?name", MySqlDbType.VarChar), new MySqlParameter("?nickname", MySqlDbType.VarChar), new MySqlParameter("?sign", MySqlDbType.VarChar), new MySqlParameter("?lastmodify", MySqlDbType.VarChar), new MySqlParameter("?session", MySqlDbType.VarChar), new MySqlParameter("?gender", MySqlDbType.VarChar) }; insertpar[0].Value = Name; insertpar[1].Value = Nickname; insertpar[2].Value = Sign; insertpar[3].Value = DateTime.Now; insertpar[4].Value = Session["userid"]; insertpar[5].Value = gender; int num = updatename.ExecuteSql(upsql, insertpar); if (num == 1) { //bind(); //Response.Write("<script language='javascript'>alert('更新成功!');</script>"); ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "", "alert('更新成功')", true); //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "age1", "alert('更新成功')", true); } else { Response.Write("<script language='javascript'>alert('更新失败!');</script>"); } }
protected void Updatecontact(RepeaterCommandEventArgs e) { conn updatename = new conn(); string email = ((TextBox)this.Repeater1.Items[0].FindControl("email")).Text.Trim(); string tel = ((TextBox)this.Repeater1.Items[0].FindControl("tel")).Text.Trim(); string qq = ((TextBox)this.Repeater1.Items[0].FindControl("qq")).Text.Trim(); string address = ((TextBox)this.Repeater1.Items[0].FindControl("address")).Text.Trim(); string homeaddress = ((TextBox)this.Repeater1.Items[0].FindControl("homeaddress")).Text.Trim(); string upsql = "update staffinfo set Email=?email,Tel=?tel,QQ=?qq,LastModify=?lastmodify,Address=?address,HomeAddress=?homeaddress WHERE SID =?session"; MySqlParameter[] insertpar = { new MySqlParameter("?email", MySqlDbType.VarChar), new MySqlParameter("?tel", MySqlDbType.VarChar), new MySqlParameter("?qq", MySqlDbType.VarChar), new MySqlParameter("?lastmodify", MySqlDbType.VarChar), new MySqlParameter("?address", MySqlDbType.VarChar), new MySqlParameter("?homeaddress", MySqlDbType.VarChar), new MySqlParameter("?session", MySqlDbType.VarChar) }; insertpar[0].Value = email; insertpar[1].Value = tel; insertpar[2].Value = qq; insertpar[3].Value = DateTime.Now; insertpar[4].Value = address; insertpar[5].Value = homeaddress; insertpar[6].Value = Session["userid"]; int num = updatename.ExecuteSql(upsql, insertpar); if (num == 1) { Response.Write("<script language='javascript'>alert('更新成功!');location.replace(document.referrer);</script>"); } else { Response.Write("<script language='javascript'>alert('更新失败!');</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Request["q12"].Length == 11 && !check()) { if (Request["q4"] == "店长" || Request["q4"] == "店员") { try { conn apply = new conn(); string sql = "insert into apply (Name,Major,GenderAge,Position,Way,Forwhat,Bring,Salary,Sure,Advise,ElseThing,Tel,time)values(?name,?major,?genderage,?position,?way,?forwhat,?bring,?salary,?sure,?advise,?elsething,?tel,?time)"; MySqlParameter[] insertpar = { new MySqlParameter("?name", MySqlDbType.VarChar), new MySqlParameter("?major", MySqlDbType.VarChar), new MySqlParameter("?genderage", MySqlDbType.VarChar), new MySqlParameter("?position", MySqlDbType.VarChar), new MySqlParameter("?way", MySqlDbType.VarChar), new MySqlParameter("?forwhat", MySqlDbType.VarChar), new MySqlParameter("?bring", MySqlDbType.VarChar), new MySqlParameter("?salary", MySqlDbType.VarChar), new MySqlParameter("?sure", MySqlDbType.VarChar), new MySqlParameter("?advise", MySqlDbType.VarChar), new MySqlParameter("?elsething", MySqlDbType.VarChar), new MySqlParameter("?tel", MySqlDbType.VarChar), new MySqlParameter("?time", MySqlDbType.VarChar) }; insertpar[0].Value = Request["q1"]; insertpar[1].Value = Request["q2"]; insertpar[2].Value = Request["q3"]; insertpar[3].Value = Request["q4"]; insertpar[4].Value = Request["q5"]; insertpar[5].Value = Request["q6"]; insertpar[6].Value = Request["q7"]; insertpar[7].Value = Request["q8"]; insertpar[8].Value = Request["q9"]; insertpar[9].Value = Request["q10"]; insertpar[10].Value = Request["q11"]; insertpar[11].Value = Request["q12"]; insertpar[12].Value = DateTime.Now; int num = apply.ExecuteSql(sql, insertpar); if (num == 1) { Response.Write("<script language='javascript'>alert('提交成功!请耐心等候通知面试,感谢你的支持!');location.href='../../Do/login.aspx';</script>"); } else { Response.Write("<script language='javascript'>alert('提交失败!');</script>"); } } catch { Response.Write("<script language='javascript'>alert('提交报名失败了,有可能你的输入格式不正确,请重新填写!');location.href='index.html';</script>"); } } else { Response.Write("<script language='javascript'>alert('输入不合法!请选择应聘选择职位');location.href='index.html';</script>"); } } else { Response.Write("<script language='javascript'>alert('提交失败,输入不合法,电话无效!');location.href='../../Do/login.aspx';</script>"); } }