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 Gv_Borrows_FocusedRowChanged(object sender,
                                                        DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            try
            {
                if (Gv_Borrows.FocusedRowHandle < 0)
                {
                    return;
                }
                var isExpired = Convert.ToBoolean(Gv_Borrows.GetFocusedRowCellValue("IsExpired"));
                Sb_PayFine.Enabled = isExpired;
                var id   = Guid.Parse(Gv_Borrows.GetFocusedRowCellValue("BookId").ToString());
                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);
            }
        }
Exemplo n.º 3
0
        private async void Refresh(uint id)
        {
            chapters.Clear();
            book = await bookApi.GetBook(id);

            if (book == null)
            {
                return;
            }
            NameTb.Text = book.Name;
            DescTb.Text = book.Description;
            var data = await bookApi.GetChapterListAsync(book.Id);

            if (data == null)
            {
                return;
            }
            foreach (var item in data)
            {
                chapters.Add(item);
            }
        }