Beispiel #1
0
 private void btnCaricaLibro_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (txtMateria.Text == null || txtPrezzo.Text == null)
         {
             MessageBox.Show("Inserire tutti i valori", "", MessageBoxButton.OK, MessageBoxImage.Exclamation);
             txtMateria.Text = "";
             txtPrezzo.Text  = "";
             txtMateria.Focus();
         }
         else
         {
             string materia = txtMateria.Text;
             double prezzo  = double.Parse(txtPrezzo.Text);
             string isbn    = "libr2020" + i.ToString();
             i++;
             Libri l = new Libri(materia, prezzo, isbn);
             libro.Add(l);
             cmbLibri.Items.Add(l.GetISBN());
             txtMateria.Text = "";
             txtPrezzo.Text  = "";
             txtMateria.Focus();
             cmbLibri.SelectedIndex = -1;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         txtMateria.Text = "";
         txtPrezzo.Text  = "";
         txtMateria.Focus();
     }
 }
        private void AggiungiLibro_Load(object sender, EventArgs e)
        {
            Libri_pic.Image             = Maestre.Properties.Resources.No_image;
            Libri.DefaultCellStyle.Font = new Font("GROBOLD", 15);
            Libri.ColumnHeadersDefaultCellStyle.Font = new Font("GROBOLD", 13);
            Libri.ClearSelection();

            try
            {
                listaLibri = Queries.getLibri();
                refresh();
            }
            catch (Exception ex)
            {
                throw;
            }

            try
            {
                List <string> itemsGenere  = Queries.getGenere();
                List <string> itemsGenere2 = new List <string>(itemsGenere);
                genereCB.DataSource   = itemsGenere;
                genereCB_2.DataSource = itemsGenere2;
                refresh();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
 public Biblioteca()
 {
     for (int i = 0; i < 5; i++)
     {
         Libri.Add(new Libro("Libro " + i));
         Persone.Add(new Persona("Persona " + i));
     }
 }
Beispiel #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            Libri album = db.tbl_Librat.Find(id);

            db.tbl_Librat.Remove(album);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
        public ActionResult Krijo(Libri album)
        {
            if (ModelState.IsValid)
            {
                db.tbl_Librat.Add(album);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ZhanriId   = new SelectList(db.tbl_Zhanret, "ZhanriId", "Name", album.ZhanriId);
            ViewBag.AutoriId   = new SelectList(db.tbl_Autoret, "AutoriId", "Name", album.AutoriId);
            ViewBag.Letersiaid = new SelectList(db.tbl_Letersia, "LetersiaId", "Emri", album.LetersiaId);
            return(View(album));
        }
        public Biblioteca()
        {
            Libri.Add(new Libro("Guerra e pace"));
            Libri.Add(new Libro("Il signore degli anelli"));
            Libri.Add(new Libro("Iliade"));
            Libri.Add(new Libro("Apologia di Socrate"));
            Libri.Add(new Libro("Le affinità elettive"));

            Persone.Add(new Persona("Pippo"));
            Persone.Add(new Persona("Topolino"));
            Persone.Add(new Persona("Paperino"));
            Persone.Add(new Persona("Gastone"));
            Persone.Add(new Persona("Nonna Papera"));
        }
 private void Libri_SelectionChanged(object sender, EventArgs e)
 {
     Libri.ClearSelection();
 }
Beispiel #8
0
        public ActionResult Delete(int id)
        {
            Libri album = db.tbl_Librat.Find(id);

            return(View(album));
        }
Beispiel #9
0
        //
        // GET: /Admin/Details/5

        public ViewResult Details(int id)
        {
            Libri album = db.tbl_Librat.Find(id);

            return(View(album));
        }