/// <summary> /// 添加借书信息 /// </summary> /// <param name="r_id"></param> /// <param name="b_id"></param> /// <param name="numberfirst"></param> /// <returns></returns> public bool AddB_R(int r_id, int b_id, int numberfirst) { Int32 b_booktime = Int32.Parse(U_Date.NowTimeToUnix()); long r_booktime = Int64.Parse(U_Date.NowTimeToUnix() + 86400 * numberfirst); return(new MysqlOperate().IDU(new String[] { "insert into b_r(r_id,b_id,numberfirst,b_booktime,r_booktime) values(" + r_id + "," + b_id + "," + numberfirst + "," + b_booktime + "," + r_booktime + ")" })); }
/// <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>"); } }
/// <summary> /// 图书入库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void addbook_Click(object sender, EventArgs e) { if (new DataBook().AddBook(int.Parse(t_id), b_name.Text, int.Parse(b_no.Text), int.Parse(b_total.Text), int.Parse(b_total.Text), int.Parse(U_Date.NowTimeToUnix()))) { Response.Redirect("/success.aspx", true); } else { Response.Write("<script>alert('添加失败,请重新添加!')</script>"); } }