Example #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dataGridViewPersonel.SelectedRows.Count == 0)
            {
                MessageBox.Show("Silinecek satırı Seçiniz");
                return;
            }

            Personel p = (Personel)dataGridViewPersonel.SelectedRows[0].DataBoundItem;

            HotelRepository.personels.Remove(p);

            dataGridViewPersonel.DataSource = null;
            dataGridViewPersonel.DataSource = HotelRepository.personels;
        }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (id == -1)
            {
               Personel  p = new Personel(txtName.Text, txtSurname.Text);
                HotelRepository.personels.Add(p);
            }
            else
            {
                Personel p = HotelRepository.personels.Where(c => c.Id == id).FirstOrDefault();
                p.Name = txtName.Text;
                p.SurName = txtSurname.Text;
            }

            Close();
        }
Example #3
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            if (dataGridViewPersonel.SelectedRows.Count == 0)
            {
                MessageBox.Show("Editlenecek satırı Seçiniz");
                return;
            }

            Personel p = (Personel)dataGridViewPersonel.SelectedRows[0].DataBoundItem;

            AddPersonel frm = new AddPersonel(p);

            frm.ShowDialog();

            dataGridViewPersonel.DataSource = null;
            dataGridViewPersonel.DataSource = HotelRepository.personels;
        }