Ejemplo n.º 1
0
 private void BindControls()
 {
     WorklogsRepository worklogsRepository = new WorklogsRepository();
     bindingSourceWorklogs.Clear();
     bindingSourceWorklogs.DataSource = worklogsRepository.GetAll();
     dataGridViewWorklogs.DataSource = bindingSourceWorklogs;
 }
Ejemplo n.º 2
0
        private void toolStripButtonEdit_Click(object sender, EventArgs e)
        {
            Worklog worklog = (Worklog)bindingSourceWorklogs.Current;
            FormAddEditWorklogs formAddWorklog = new FormAddEditWorklogs(worklog);

            if (formAddWorklog.ShowDialog() == DialogResult.OK)
            {
                WorklogsRepository worklogsRepository = new WorklogsRepository();
                worklogsRepository.Save(worklog);

                BindControls();
            }
        }
Ejemplo n.º 3
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            Worklog worklog = (Worklog)bindingSourceWorklogs.Current;
            DialogResult result = MessageBox.Show("Are you sure you want to delete this user?",
                "Confirmation",
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Question,
                MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                WorklogsRepository worklogsRepository = new WorklogsRepository();
                worklogsRepository.Delete(worklog);
                BindControls();
            }
        }