示例#1
0
        private void pridatButton_Click(object sender, EventArgs e)
        {
            editControl ec = editControl2;


            Lide novyClovek = new Lide();

            novyClovek.jmeno    = ec.jmenoEdit.Text;
            novyClovek.prijmeni = ec.prijmeniEdit.Text;
            novyClovek.ulice    = ec.uliceEdit.Text;
            novyClovek.obec     = ec.obecEdit.Text;
            novyClovek.telefon  = Int32.Parse(ec.telEdit.Text);
            novyClovek.email    = ec.emailEdit.Text;

            //EvidenceLidiEntities db = new EvidenceLidiEntities();
            DbLocal.Lide.Add(novyClovek);
            try
            {
                DbLocal.SaveChanges();
                MessageBox.Show("Hotovo!");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Chyba", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#2
0
        public editaceForm(EvidenceLidiEntities db, Lide editClovek)
        {
            InitializeComponent();
            DbLocal = db;

            editControl ec = editControl1;

            ec.jmenoEdit.Text    = editClovek.jmeno;
            ec.prijmeniEdit.Text = editClovek.prijmeni;
            ec.uliceEdit.Text    = editClovek.ulice;
            ec.obecEdit.Text     = editClovek.obec;
            ec.telEdit.Text      = editClovek.telefon.ToString();
            ec.emailEdit.Text    = editClovek.email;

            EditClovekId = DbLocal.Lide.Find(editClovek.id_osoba).id_osoba;
        }
示例#3
0
        private void editovatButton_Click(object sender, EventArgs e)
        {
            Lide editClovek = new Lide();

            editClovek.id_osoba = Int32.Parse(gridView1.GetFocusedRowCellDisplayText(idColumn));
            editClovek.jmeno    = gridView1.GetFocusedRowCellDisplayText(jmenoColumn);
            editClovek.prijmeni = gridView1.GetFocusedRowCellDisplayText(prijmeniColumn);
            editClovek.ulice    = gridView1.GetFocusedRowCellDisplayText(uliceColumn);
            editClovek.obec     = gridView1.GetFocusedRowCellDisplayText(obecColumn);
            editClovek.telefon  = Int32.Parse(gridView1.GetFocusedRowCellDisplayText(telefonColumn));
            editClovek.email    = gridView1.GetFocusedRowCellDisplayText(emailColumn);

            editaceForm editForm = new editaceForm(dbContext, editClovek);      //formular pridani osoby

            if (editForm.ShowDialog() == DialogResult.OK)
            {
                gridControl1.DataSource = dbContext.Lide.Local.ToBindingList();
                gridView1.RefreshData();
            }
        }