private async void Gv_Reservations_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { if (Gv_Reservations.FocusedRowHandle < 0) { return; } var id = Guid.Parse(Gv_Reservations.GetFocusedRowCellValue("BookId").ToString()); try { var book = await _bookApi.GetBook(id); book.Photo = Image.FromFile(book.BookPhoto); Pe_Photo.Image = book.Photo; Te_BookId.EditValue = book.Id; Te_BookName.Text = book.BookName; Te_Author.Text = book.Author; Te_PublishingHouse.Text = book.PublishingName; Te_Category.Text = book.CategoryName; Te_Price.EditValue = book.Price; Te_ISBN.Text = book.ISBN; Te_ReleaseTime.EditValue = book.ReleaseDate; } catch (Exception exception) { PopupProvider.Error("获取预约书籍信息异常!", exception); } }
private async void Ribe_Delete_ButtonClick(object sender, ButtonPressedEventArgs e) { if (Gv_Reservations.FocusedRowHandle < 0) { return; } try { var isRemove = Convert.ToBoolean(Gv_Reservations.GetFocusedRowCellValue("IsRemove")); if (isRemove) { PopupProvider.Warning("该预约记录已删除!"); return; } if (Convert.ToInt32(e.Button.Tag) == 1) { return; } if (XtraMessageBox.Show("确认删除!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } var id = Gv_Reservations.GetFocusedRowCellDisplayText("Id"); var result = await _reservationApi.DeleteReservation(id); if (result.ResultCode != 1) { PopupProvider.Warning(result.ResultMessage); return; } PopupProvider.Success(result.ResultMessage); } catch (Exception exception) { PopupProvider.Error("操作异常!", exception); } }