private MFilm Entity(dynamic result) { var entity = new MFilm() { Id = Convert.ToInt32(result[_column[0]]) as int? ?? 0, Judul = result[_column[1]].ToString() as string, Harga = Convert.ToInt32(result[_column[2]]) as int? ?? 0, }; return(entity); }
public void TestFilmCreate() { const bool expected = true; var actual = false; var ent = new MFilm(); try { ent.Judul = "Test"; ent.Harga = 1000 as int? ?? 0; CFilm.GetInstance.Create(ent); actual = true; } catch { } Assert.AreEqual(expected, actual); }
public void Update(MFilm data) { if (IsValidate()) { var isflaged = false; _sql.Query = string.Format("UPDATE film SET judul_film = '{0}', harga_film = '{1}' WHERE id_film = '{2}'", data.Judul, data.Harga, Code); isflaged = _sql.ExecuteUpdate(); if (isflaged) { _table = Read(); GetInstance.Index(); _viewact.Close(); } else { MessageBox.Show("Proses update gagal!!!", "Peringatan", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } }
public void Create(MFilm data) { if (IsValidate()) { var isflaged = false; _sql.Query = string.Format("INSERT INTO film (`judul_film`,`harga_film`) VALUES ('{0}', '{1}')", data.Judul, data.Harga); isflaged = _sql.ExecuteUpdate(); if (isflaged) { _table = Read(); _viewact.Close(); } else { MessageBox.Show("Proses simpan gagal!!!", "Peringatan", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } }
public MJadwal() { Film = new MFilm(); Ruang = new MRuang(); }