Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MetroMessageBox.Show(this, "Are you sure you want to update this register?", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                // Tratamento das Datas
                EntitiesContext context = new EntitiesContext();
                EventDAO        edao    = new EventDAO();
                aBeg = DateTime.Parse(mdtDateBegin.Text);
                bBeg = aBeg.ToString("dd/MM/yyyy");
                cBeg = bBeg + " " + txtTimeBegin.Text;
                aEnd = DateTime.Parse(mdtDateEnd.Text);
                bEnd = aEnd.ToString("dd/MM/yyyy");
                cEnd = bEnd + " " + txtTimeEnd.Text;

                //Tratamento da Combo Box Artista
                ArtistDAO adao = new ArtistDAO();
                idart = adao.FindIdByCb(mcbArtEvent.Text);

                //Tratamento da Combo Box Menu
                MenuDAO mdao = new MenuDAO();
                idmenu = mdao.FindIdByCb(mcbMenuEvent.Text);

                Event eve = edao.FindId(global.ideve);
                eve.Name      = txtNameEvent.Text;
                eve.Desc      = txtDescEvent.Text;
                eve.TimeBegin = DateTime.Parse(cBeg);
                eve.TimeEnd   = DateTime.Parse(cEnd);
                eve.ArtistId  = idart;
                eve.MenuId    = idmenu;
                edao.Update();
                MetroMessageBox.Show(this, "Register Successfully Updated", "Updated", MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
            }
        }
Example #2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MetroMessageBox.Show(this, "Are you sure you want to delete this register?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         EventDAO edao = new EventDAO();
         Event    eve  = edao.FindId(global.ideve);
         edao.Remove(eve);
         MetroMessageBox.Show(this, "Register Successfully Deleted", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
     }
 }