/// <summary> /// 修改读者信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void changereader_Click(object sender, EventArgs e) { LibraryCard.no += 1; String r_no = no.Text; String filepath = ""; if (!picture.HasFile) { filepath = r_pic; } else { String filename = U_Date.NowTimeToUnix() + "." + U_File.GetFex(picture.FileName); r_pic = Server.MapPath("/Uploads/") + filename; filepath = "/Uploads/" + filename; picture.SaveAs(r_pic); } if (new DataReader().ChangeReaderInfo(r_name, r_sex, r_no, r_pno, filepath, r_id)) { Response.Redirect("/success.aspx", true); } else { Response.Write("<script>alert('修改失败,请重新修改!')</script>"); } }
/// <summary> /// 提交读者信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void addreader_Click(object sender, EventArgs e) { String r_name = name.Text; List <Reader> readers = new DataReader().GetReaderInfo(); LibraryCard.no = readers[readers.Count - 1].R_id + 1; String r_no = "201601" + (LibraryCard.no + 10000); String r_pno = pno.Text; String filename = U_Date.NowTimeToUnix() + "." + U_File.GetFex(picture.FileName); String r_pic = Server.MapPath("/Uploads/") + filename; if (picture.HasFile) { picture.SaveAs(r_pic); } if (new DataReader().AddReader(r_name, r_sex, r_no, r_pno, "/Uploads/" + filename)) { Response.Redirect("/success.aspx", true); } else { Response.Write("<script>alert('添加失败,请重新添加!')</script>"); } }