コード例 #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);
            }
        }
コード例 #2
0
 private void deleteButton_Click(object sender, EventArgs e)
 {
     if (this.listPisnicekView.SelectedItems.Count > 0)
     {
         try
         {
             selected = Int32.Parse(listPisnicekView.SelectedItems[0].Text);
             PisnickaService.DeletePisnicka(selected);
             infoLabel.Text = "pisnicka smazana";
             this.Refresh();
         }
         catch (Exception ex)
         {
             varovaniLabel.Show();
             exceptionLabel.Show();
         }
     }
 }