public MainPageViewModel()
 {
     //Inicializo los daytos que necesito
     this.BookSelected = null;
     Repository        = new RBook();
     Books             = new ObservableCollection <Book>();
     Refresh();
 }
Esempio n. 2
0
        //Boton que elimina el registro que se mando a esta page
        private void Eliminar()
        {
            RBook Repository = new RBook();

            if (Repository.Delete(BookCurrent.ID))
            {
                App.Current.MainPage = new NavigationPage(new MainPage());
                return;
            }
        }
Esempio n. 3
0
        public ActionResult Booksalestop3()
        {
            IBook sa = new RBook();

            if (sa.FindAllBookName() != null)
            {
                return(PartialView(sa.FindAllBookName()));
            }
            return(PartialView(shouyeban));
        }
Esempio n. 4
0
        /// <summary>
        /// actualiza o elimina los datos segun corresponda
        /// </summary>
        private void CreateOrUdate()
        {
            RBook Repository = new RBook();

            if (_isNew)
            {
                if (Repository.Create(this.BookCurrent))
                {
                    App.Current.MainPage = new NavigationPage(new MainPage());
                    return;
                }
            }
            else
            {
                if (Repository.Update(BookCurrent.ID, BookCurrent))
                {
                    App.Current.MainPage = new NavigationPage(new MainPage());
                    return;
                }
            }
        }
Esempio n. 5
0
        //add rent book click event
        private void addBookBtn_Click(object sender, RoutedEventArgs e)
        {
            if (bookNameBox.Text.Length < 1 || ISBNBox.Text.Length < 1 || editionYearBox.Text.Length < 4 || authorBox.Text.Length < 2 || nbrPagesBox.Text.Length < 1 || !int.TryParse(ISBNBox.Text, out int x5) || !int.TryParse(nbrPagesBox.Text, out int x6) || !int.TryParse(editionYearBox.Text, out int x7) || !float.TryParse(priceBox.Text, out float x8))
            {
                if (bookNameBox.Text.Length < 1)
                {
                    hint1.Text = "Name is empty or too short";
                }
                else
                {
                    hint1.Text = "";
                }
                if (authorBox.Text.Length < 2)
                {
                    hint2.Text = "Author is empty or too short";
                }
                else
                {
                    hint2.Text = "";
                }
                if (ISBNBox.Text.Length < 1)
                {
                    hint3.Text = "ISBN is empty or too short";
                }
                else if (!int.TryParse(ISBNBox.Text, out int x))
                {
                    hint3.Text = "ISBN should be a number";
                }
                else if (nbrPagesBox.Text.Length < 1)
                {
                    hint3.Text = "Enter number of pages";
                }
                else if (!int.TryParse(nbrPagesBox.Text, out int x2))
                {
                    hint3.Text = "NUMBER of pages should be a NUMBER";
                }
                else
                {
                    hint3.Text = "";
                }
                if (editionYearBox.Text.Length < 1)
                {
                    hint4.Text = "Year of edition  is empty or too short";
                }
                else if (!int.TryParse(editionYearBox.Text, out int x))
                {
                    hint4.Text = "year should be a number";
                }
                else
                {
                    hint4.Text = "";
                }
                if (priceBox.Text.Length < 1)
                {
                    hint5.Text = "price is empty or too short";
                }
                else if (!float.TryParse(priceBox.Text, out float x))
                {
                    hint5.Text = "price should be a number";
                }
                else
                {
                    hint3.Text = "";
                }
            }
            else
            {
                confirmSnack.IsActive = true;
                DispatcherTimerConfirmSnack();

                RBook obj = new RBook(bookNameBox.Text, ISBNBox.Text, int.Parse(editionYearBox.Text), int.Parse(nbrPagesBox.Text), authorBox.Text, AudienceBox.Text, copyrightHolderBox.Text, editorBox.Text
                                      , genreBox.Text, float.Parse(priceBox.Text), languageBox.Text, illustratorBox.Text, BasicRatingBar.Value, coverContainer.Source, aboutBox.Text);
                obj.insertRentBook();
            }
        }