示例#1
0
 public override Film Add(Film entity)
 {
     if (entity.Id.Equals(Guid.Empty))
     {
         _context.Films().Add(entity);
     }
     return((entity == null) ? null : (Film)entity.Clone());
 }
示例#2
0
 void InitValues(Film film)
 {
     filmObj             = film.Clone() as Film;
     textBoxName.Text    = filmObj.FilmName;
     textBoxAgeRate.Text = filmObj.AgeRate.ToString();
     richTextBoxComment.Document.Blocks.Clear();
     richTextBoxComment.AppendText(filmObj.Description);
 }
示例#3
0
 public override Film Add(Film entity)
 {
     if (entity == null)
     {
         throw new Exception("Null Argument");
     }
     if (entity.Id.Equals(Guid.Empty))
     {
         entity.Id = Guid.NewGuid();
         _entities.Add(entity);
     }
     return((Film)entity.Clone());
 }
示例#4
0
 private void btnDone_Click(object sender, EventArgs e)
 {
     //Introducerea tranzactiei in baza de date
     if (dtpRetur.Value.Date <= DateTime.Today.Date)
     {
         MessageBox.Show("Data de retur introdusa incorect", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (checkedListBox.CheckedItems.Count != 0)
         {
             String[] filmeSelectate = checkedListBox.CheckedItems.Cast <string>().ToArray();
             foreach (string titluFilm in filmeSelectate)
             {
                 Film film         = listaFilmeStoc.Where(i => i.Titlu == titluFilm).FirstOrDefault();
                 Film filmDeVandut = film.Clone() as Film;
                 film.Stoc--;
                 listaFilmeDeVandut.Add(filmDeVandut);
                 FilmInchiriat filmInchiriat = new FilmInchiriat()
                 {
                     Titlu = titluFilm
                 };
                 filmeInchiriate.Add(filmInchiriat);
             }
             _client.IdClient *= 10;
             inchiriere        = new Inchiriere()
             {
                 dataTranzactie  = DateTime.Today,
                 idClient        = _client.IdClient,
                 filmeInchiriate = filmeInchiriate,
                 sfarsitPerioada = dtpRetur.Value
             };
             context.Inchierieri.Add(inchiriere);
             context.SaveChanges();
             if (MessageBox.Show("Doriți să vizualizati factura?", "Print preview", MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 printPreview();
             }
             resetareFormular();
         }
         else
         {
             MessageBox.Show("Adăugați filme în listă și bifați-le pentru validare",
                             "Validare", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
示例#5
0
        public override Film GetFilmByTitleAndType(string title, bool bluray)
        {
            Film entity = _context.Films().Single(f => (f.Title.Contains(title) && f.IsBluray == bluray));

            return((entity == null) ? null : (Film)entity.Clone());
        }
示例#6
0
        public override Film GetById(Guid id)
        {
            Film entity = _context.Films().Single(f => f.Id.Equals(id));

            return((entity == null) ? null : (Film)entity.Clone());
        }
示例#7
0
        public override Film GetFilmByTitleAndType(string title, bool bluray)
        {
            Film entity = _entities.Single(f => (f.Title.Contains(title) && f.IsBluray == bluray));

            return((Film)entity.Clone());
        }
示例#8
0
        public override Film GetById(Guid id)
        {
            Film entity = _entities.Single(f => f.Id.Equals(id));

            return((Film)entity.Clone());
        }