public void GetReserve(string isbn) { string roleid = (string)Session["roleid"]; List <Reserve> lr = new List <Reserve>(); string access_token = (string)Session["access_token"]; string num = (string)Session["num"]; //先得到有多少数量 int total = ReserveADO.getAllNum(roleid, isbn, access_token, num); //再根据数量来一个一个读取信息 JObject jo = ReserveADO.getReserve(roleid, isbn, access_token, num); for (int i = 0; i < total; i++) { Reserve item = ReserveADO.getItem(jo, i, access_token); if (item.status == 0) { string src = ReserveADO.getUrl(jo, i, access_token); item.url = src; } else { item.url = "../images/expire.jpg"; } lr.Add(item); } reserve.DataSource = lr; reserve.DataBind(); }
protected void role_SelectedIndexChanged(object sender, EventArgs e) { int index = reserve.SelectedIndex; //MessageBox.Show(index+""); string str = reserve.Rows[index].Cells[1].Text; //MessageBox.Show(str);//书号 string str1 = reserve.Rows[index].Cells[7].Text; //MessageBox.Show(str1);//which哪一本 string str2 = reserve.Rows[index].Cells[6].Text; //MessageBox.Show(str2);//状态 if (str2 == "-1" || str2 == "1") { MessageBox.Show("该预约不可取消"); return; } string access_token = (string)Session["access_token"]; //获取图书信息并修改 if (OperateCloud.cancelReserve(str, str1, access_token) == true) { if (ReserveADO.cancelRes(str, str1, access_token) == "0") { MessageBox.Show("取消预约成功"); } else { MessageBox.Show("取消预约失败"); } //将图书数据库的数据恢复调用云函数即可 GetReserve(isbn.Text); } else { MessageBox.Show("取消预约失败"); } }