public HomeModule() { Get["/"] =_=> { return View["index.cshtml"]; }; Get["/addNew"] = _ =>{ return View["addNew.cshtml"]; }; Get["/allCds"] = _ =>{ List<Cd> allcds = Cd.GetAll(); return View["allCds.cshtml",allcds]; }; Get["/searchByArtist"] = _ =>{ return View["searchByArtist.cshtml"]; }; Get["/result"] = _ =>{ List<Cd> invCd = Cd.Find(Request.Query["search-artist"]); return View["searchResult.cshtml",invCd]; }; Post["/add_new"] = _ =>{ Cd oneCd = new Cd(Request.Form["artist"],Request.Form["title"]); return View["add_one.cshtml",oneCd]; }; }
static void Main(string[] args) { Floppy diskette = new Floppy(); diskette.Type = "Floppy"; diskette.Size = 1.44; diskette.SaveData(); diskette.Color = "Green"; Console.WriteLine(diskette.ToString()); Cd Roadrunner = new Cd(); Roadrunner.Artist = "Hurriganes"; Roadrunner.Type = "Audio cd"; Roadrunner.Size = 800; Roadrunner.TrackNumber = 11; Roadrunner.TrackNumber = 30; Console.WriteLine(Roadrunner.ToString()); Dvd Movie = new Dvd(); Movie.Type = "Movie DVD"; Movie.MovieName = "The Revenant"; Movie.Size = 50000; Movie.DualLayer = true; Movie.SaveData(); Movie.SaveData(); Console.WriteLine(Movie.ToString()); Console.ReadLine(); }
/// <exception cref="System.IO.IOException"></exception> public override char[] ReadCharArray(string fieldName) { var fd = Cd.GetField(fieldName); if (fd == null) { return(null); } if (fd.GetFieldType() != FieldType.CharArray) { throw new IncompatibleClassChangeError(); } return(base.ReadCharArray(fieldName)); }
/// <exception cref="System.IO.IOException"></exception> public override byte[] ReadByteArray(string fieldName) { var fd = Cd.GetField(fieldName); if (fd == null) { return(null); } if (fd.FieldType != FieldType.ByteArray) { throw new InvalidPortableFieldException(); } return(base.ReadByteArray(fieldName)); }
private static Displayable MapToCd(ElasticTitleIndex elasticProduct, Displayable displayable) { var cdItem = new Cd { StockLevel = elasticProduct.StockLevel, MediaCount = elasticProduct.MediaCount, Narrators = elasticProduct.Narrator, RecordingType = elasticProduct.RecordingType, }; Book book = (Book)cdItem; displayable = MapBookToDisplayable(elasticProduct, book); return(displayable); }
static void Dcheck(List <Dinamond> Lists) { foreach (var Cd in Lists) { if (Cd.realOrFake()) { System.Console.WriteLine("hang that"); } else { System.Console.WriteLine("hang gia "); } } }
private void BtnDelete_Click(object sender, RoutedEventArgs e) { Cd selectedCd = lbxCds.SelectedItem as Cd; if (selectedCd == null) { MessageBox.Show("Sie müssen eine Cd auswählen!"); } Repository.GetInstance().RemoveCd(selectedCd); _cds = Repository.GetInstance().GetAllCds(); lbxCds.ItemsSource = _cds; }
/// <exception cref="System.IO.IOException"></exception> public override byte ReadByte(string fieldName) { var fd = Cd.GetField(fieldName); if (fd == null) { return(0); } if (fd.GetFieldType() != FieldType.Byte) { throw new IncompatibleClassChangeError(); } return(base.ReadByte(fieldName)); }
public HomeModule() { Get["/"] = _ => { return(View ["index.cshtml"]); }; Get["/new_Cd"] = _ => { return(View["new_cd.cshtml"]); }; Post["/"] = _ => { Cd newCd = new Cd(Request.Form["Cd-Name"], Request.Form["Cd-Artist"]); List <Cd> Cdlist = Cd.GetAll(); return(View["index.cshtml", Cdlist]); }; }
/// <exception cref="System.IO.IOException"></exception> public override TPortable ReadPortable <TPortable>(string fieldName) { var fd = Cd.GetField(fieldName); if (fd == null) { return(default(TPortable)); } if (fd.GetFieldType() != FieldType.Portable) { throw new IncompatibleClassChangeError(); } return(base.ReadPortable <TPortable>(fieldName)); }
/// <exception cref="System.IO.IOException"></exception> public override string ReadUTF(string fieldName) { var fd = Cd.GetField(fieldName); if (fd == null) { return(null); } if (fd.GetFieldType() != FieldType.Utf) { throw new IncompatibleClassChangeError(); } return(base.ReadUTF(fieldName)); }
/// <exception cref="System.IO.IOException"></exception> public override bool ReadBoolean(string fieldName) { var fd = Cd.GetField(fieldName); if (fd == null) { return(false); } if (fd.GetFieldType() != FieldType.Boolean) { throw new IncompatibleClassChangeError(); } return(base.ReadBoolean(fieldName)); }
public ActionResult List() { Cd newCd = new Cd( Request.Form["title"], Request.Form["artist"], Request.Form["price"] ); newCd.Save(); List <Cd> allCds = Cd.GetAll(); return(View(allCds)); }
/// <exception cref="System.IO.IOException"></exception> public override bool ReadBoolean(string fieldName) { var fd = Cd.GetField(fieldName); if (fd == null) { return(false); } if (fd.FieldType != FieldType.Boolean) { throw new InvalidPortableFieldException(); } return(base.ReadBoolean(fieldName)); }
/// <exception cref="System.IO.IOException"></exception> public override char ReadChar(string fieldName) { var fd = Cd.GetField(fieldName); if (fd == null) { return('\0'); } if (fd.FieldType != FieldType.Char) { throw new InvalidPortableFieldException(); } return(base.ReadChar(fieldName)); }
// GET: Cds/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Cd cd = (Cd)db.ItemBases.Find(id); if (cd == null) { return(HttpNotFound()); } return(View(cd)); }
public void GetAll_ReturnsCds_CdList() { string artist1 = "Can"; string album1 = "Monster Movie"; string artist2 = "Nirvana"; string album2 = "Bleach"; Cd newCd1 = new Cd(artist1, album1); Cd newCd2 = new Cd(artist2, album2); List <Cd> newCdList = new List <Cd> { newCd1, newCd2 }; List <Cd> result = Cd.GetAll(); CollectionAssert.AreEqual(newCdList, result); }
public static void Main() { Cd firstCd = new Cd("Master of Reality", "Black Sabbath", 10); Cd secondCd = new Cd("Electric Ladyland", "Jimi Hendrix", 10); Cd thirdCd = new Cd("Nevermind", "Nirvana", 10); List<Cd> Cds = new List<Cd>() { firstCd, secondCd, thirdCd }; foreach (Cd album in Cds) { Console.WriteLine(album.Title); Console.WriteLine("By " + album.Artist); Console.WriteLine("Price: $" + album.Price); } }
public void Find_ReturnsCorrectCd_Cd() { string artist1 = "Can"; string album1 = "Monster Movie"; string artist2 = "Nirvana"; string album2 = "Bleach"; Cd newCd1 = new Cd(artist1, album1); Cd newCd2 = new Cd(artist2, album2); List <Cd> newCdList = new List <Cd> { newCd1, newCd2 }; Cd result = Cd.Find(2); Assert.AreEqual(newCd2, result); }
void BtnDelete_Click(object sender, RoutedEventArgs e) { Cd selectedCd = (Cd)lbxCds.SelectedItem; if (selectedCd == null) { MessageBox.Show("Sie müssen eine Cd auswählt haben"); } Repository repository = Repository.GetInstance(); repository.DeleteCd(selectedCd); _cds = repository.GetAllCds(); lbxCds.ItemsSource = _cds; }
public void GenericsIteratorTest2() { CdRack cdRack = new CdRack(); cdRack.AppendCd(new Cd("Thriller")); cdRack.AppendCd(new Cd("Back in Black")); cdRack.AppendCd(new Cd("Bat out of Hell")); cdRack.AppendCd(new Cd("The Dark Side of the Moon")); IIterator <Cd> it = cdRack.Iterator(); while (it.HasNext()) { Cd cd = it.Next(); Debug.WriteLine(cd.Title); } }
public void UpdateCd(Cd cd) { using (var ctx = new ContextModel()) { Genre gen = ctx.Genres.FirstOrDefault(x => x.ID == cd.Genre.ID); UserTable user = ctx.UserTables.FirstOrDefault(x => x.ID == cd.User.ID); Cd c = ctx.Cds.FirstOrDefault(x => x.ID == cd.ID); c.Name = cd.Name; c.Description = cd.Description; c.Image = cd.Image; c.Genre = gen; c.User = user; ctx.SaveChanges(); } }
public HomeModule() { Get["/"] = _ => { var allCds = Cd.GetAll(); return(View["All_cds.cshtml", allCds]); }; Get["/add_cds"] = _ => { return(View["add_Cd.cshtml"]); }; Post["/all_cd"] = _ => { var newCd = new Cd(Request.Form["new-title"], Request.Form["new-artist"], Request.Form["new-price"]); var allCds = Cd.GetAll(); return(View["All_cds.cshtml", allCds]); }; }
private void addBookButton_Click(object sender, EventArgs e) { bool allFeildsFull = true; string title = titleTextBox.Text; if (title == "") { allFeildsFull = false; } string performer = performerTextBox.Text; if (performer == "") { allFeildsFull = false; } string producer = producerTextBox.Text; if (producer == "") { allFeildsFull = false; } string publisher = publisherTextBox.Text; if (publisher == "") { allFeildsFull = false; } // Only forms with all fields completed shall pass // If that is false, display an error message // and pause program if (allFeildsFull == false) { MessageBox.Show("ERROR! All fields must be filled out."); } else // All fields have data, so continue. { Cd cd = new Cd(title, performer, producer, publisher); media.Add(cd); // Let the user know the book was added successfully. MessageBox.Show(successString); titleTextBox.Text = ""; performerTextBox.Text = ""; publisherTextBox.Text = ""; producerTextBox.Text = ""; } }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { Cd selectedCd = lbxCds.SelectedItem as Cd; if (selectedCd == null) { MessageBox.Show("Sie müssen eine Cd auswählen!"); } else { AddCdWindow addCdWindow = new AddCdWindow(selectedCd); addCdWindow.ShowDialog(); } _cds = Repository.GetInstance().GetAllCds(); lbxCds.ItemsSource = _cds; }
private void checkoutCdButton_Click(object sender, EventArgs e) { if (idTextBox.Text != "" && customerComboBox.SelectedIndex > -1) { int cdId = Convert.ToInt32(idTextBox.Text); Object selectedItem = customerComboBox.SelectedItem; string cId = selectedItem.ToString(); string[] id = cId.Split(' '); int customerId = Convert.ToInt32(id[0]); foreach (Media c in mediaItems) { if (c is Cd) { Cd itemAsCd = (Cd)c; if (itemAsCd.Id == cdId) { if (!itemAsCd.IsCheckedOut()) { itemAsCd.CheckOut(); } } } } bool success = true; if (success) { MessageBox.Show(successString); ClearCdFields(); mediaListView.Clear(); populateListView(); MediaController.PopulateMainCdsViewList(mediaListView, mediaItems); customerComboBox.SelectedIndex = -1; } else { MessageBox.Show(noSuccessString); } } else { MessageBox.Show(noSuccessString); } }
private void BtnDel_Clicked(object sender, RoutedEventArgs e) { rep = Repository.GetInstance(); Cd selectedCd = (Cd)lbxCds.SelectedItem; if (selectedCd != null) { rep.RemoveCd(selectedCd); } else { MessageBox.Show("Wählen Sie CD zum Löschen"); } _cds = rep.GetAllCds(); lbxCds.ItemsSource = _cds; }
private void BtnEdit_Clicked(object sender, RoutedEventArgs e) { rep = Repository.GetInstance(); Cd selectedCd = (Cd)lbxCds.SelectedItem; if (selectedCd != null) { EditCdWindow editCdWindow = new EditCdWindow(selectedCd); editCdWindow.ShowDialog(); } else { MessageBox.Show("Wählen Sie eine CD zum Bearbeiten"); } _cds = rep.GetAllCds(); lbxCds.ItemsSource = _cds; }
public override Vector3D SampleF(ref ShadeRec sr, ref Vector3D wo, out Vector3D wi, out double pdf) { Vector3D w = sr.Normal; Vector3D v = new Vector3D(0.0034, 1, 0.0071); v = v.CrossProduct(w); v = v.Normalize().ToVector3D(); Vector3D u = v.CrossProduct(w); Vector3D sp = SamplerRef.SampleHemisphere(); wi = sp.X * u + sp.Y * v + sp.Z * w; wi = wi.Normalize().ToVector3D(); pdf = (float)(sr.Normal * wi * (1.0 / Math.PI)); return(Cd.ScaleBy(Kd * (1.0 / Math.PI))); }
private void AddCdWindow_Loaded(object sender, RoutedEventArgs e) { btnSave.Click += BtnSave_Click; btnCancel.Click += BtnCancel_Click; if (_cd == null) { DataContext = new Cd() { AlbumTitle = "Bitte Titel eingeben", Artist = "Bitte Artist eingeben" }; } else { DataContext = _cd; } }
private void AddCdWindow_Loaded(object sender, RoutedEventArgs e) { btnSave.Click += BtnSave_Click; btnCancle.Click += BtnCancle_Click; if (_cd == null) { DataContext = new Cd { AlbumTitle = "Bitte geben Sie hier den Titel ein!", Artist = "Bitte geben Sie hier den Artist ein" }; } else { DataContext = _cd; } }
public static void Main() { Cd firstCd = new Cd("Master of Reality", "Black Sabbath", 10); Cd secondCd = new Cd("Electric Ladyland", "Jimi Hendrix", 10); Cd thirdCd = new Cd("Nevermind", "Nirvana", 10); List <Cd> Cds = new List <Cd>() { firstCd, secondCd, thirdCd }; foreach (Cd album in Cds) { Console.WriteLine(album.Title); Console.WriteLine("By " + album.Artist); Console.WriteLine("Price: $" + album.Price); } }
private void BtnDelete_Click(object sender, RoutedEventArgs e) { _highlightedCd = listBoxCds.SelectedItem as Cd; Repository repository = Repository.GetInstance(); if (_highlightedCd != null) { repository.DeleteCd(_highlightedCd); } else { MessageBox.Show("Keine CD ausgewählt!"); } _cds = repository.GetAllCds(); listBoxCds.ItemsSource = _cds; }
private static string GetExternalCdImageUri(Cd cd, bool isThumbnail) { // --------------------------- LAST.FM ------------------------- var searchQuery = LastFmRepository.GetLastFmSearchQuery(cd); var lastFmAlbum = LastFmRepository.GetLastFmAlbumFromSeachQuery(searchQuery); if (lastFmAlbum != null){ if (isThumbnail) return lastFmAlbum.SmallImageUrl; return lastFmAlbum.LargeImageUrl; } // --------------------------- END LAST.FM --------------------- // Here we can try other sources if available return string.Empty; }