Esempio n. 1
0
        private void insertButton_Click(object sender, EventArgs e)
        {
            try
            {
                IPisnickaGateway  pisnickagateway  = new PisnickaGateway();
                IAlbumGateway     albumGateway     = new AlbumGateway();
                IZanrGateway      zanrgateway      = new ZanrGateway();
                IInterpretGateway interpretgateway = new InterpretGateway();


                pisnickagateway.Nazev = nazevBox.Text;
                pisnickagateway.Delka = delkaBox.Text;
                zanrgateway.Id        = Int32.Parse(zanrBox.Text);
                interpretgateway.Id   = Int32.Parse(interpretBox.Text);
                albumGateway.Id       = Int32.Parse(albumBox.Text);



                Pisnicka  p = new Pisnicka(pisnickagateway);
                Interpret i = new Interpret(interpretgateway);
                Zanr      z = new Zanr(zanrgateway);
                Album     a = new Album(albumGateway);


                PisnickaService.InsertPisnicku(p, i, z, a);

                infoLabel.Text = "pisnicka vložena";
            }
            catch (Exception ex)
            {
                infoLabel.Text = "Něco je špatně";
                Console.WriteLine(ex);
            }
        }
Esempio n. 2
0
        public IAlbumGateway SelectId(int id)
        {
            Collection <IAlbumGateway> a = new Collection <IAlbumGateway>();
            XElement xelement            = XElement.Load(@"./../../../XML/XML_sablona.xml");
            var      homePhone           = from phoneno in xelement.Elements("album")
                                           where (string)phoneno.Element("id") == id.ToString()
                                           select phoneno;

            foreach (XElement xEle in homePhone)
            {
                IAlbumGateway al    = new AlbumGateway();
                DateTime      datum = DateTime.Parse(xEle.Element("datumVydani").Value);

                al.Id            = Int32.Parse(xEle.Element("id").Value);
                al.Nazev         = xEle.Element("nazev").Value;
                al.PocetPisnicek = Int32.Parse(xEle.Element("pocetPisnicek").Value);
                al.DatumVydani   = datum;

                a.Add(al);
            }
            IAlbumGateway album = new AlbumGateway();

            if (a.Count == 1)
            {
                album = a[0];
            }
            return(album);
        }
Esempio n. 3
0
        public void InsertAlbum(Album album)
        {
            Album a = album;
            //IAlbumGateway ag = new AlbumGateway();
            IAlbumGateway xag = new AlbumGateway();

            xag.Nazev       = a.Nazev;
            xag.DatumVydani = a.DatumVydani;


            //ag.Insert();
            xag.Insert();
        }
Esempio n. 4
0
        public static void InsertPisnicku(Pisnicka pisnicka, Interpret interpret, Zanr zanr, Album album)
        {
            Pisnicka  p = pisnicka;
            Zanr      z = zanr;
            Interpret i = interpret;
            Album     a = album;

            IPisnickaGateway  pg = new PisnickaGateway();
            IZanrGateway      zg = new ZanrGateway();
            IAlbumGateway     ag = new AlbumGateway();
            IInterpretGateway ig = new InterpretGateway();

            pg.Insert();
        }