Beispiel #1
0
        private void BindControls()
        {
            CallsRepository callsRepository = new CallsRepository();

            bindingSourceCalls.Clear();
            bindingSourceCalls.DataSource = callsRepository.GetAllCalls(user.ID);
            dataGridViewCalls.DataSource  = bindingSourceCalls;
        }
Beispiel #2
0
        private void toolStripButtonEdit_Click(object sender, EventArgs e)
        {
            Call            call         = (Call)bindingSourceCalls.Current;
            FormAddEditCall editCallForm = new FormAddEditCall(call, user);

            if (editCallForm.ShowDialog() == DialogResult.OK)
            {
                CallsRepository callsRepository = new CallsRepository();
                callsRepository.Save(call);
                BindControls();
            }
        }
Beispiel #3
0
        private void toolStripButtonAdd_Click(object sender, EventArgs e)
        {
            Call            call        = new Call();
            FormAddEditCall formAddCall = new FormAddEditCall(call, user);

            if (formAddCall.ShowDialog() == DialogResult.OK)
            {
                CallsRepository callsRepository = new CallsRepository();
                callsRepository.Save(call);
                BindControls();
            }
        }
Beispiel #4
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            Call         call   = (Call)bindingSourceCalls.Current;
            DialogResult result = MessageBox.Show("Are you sure you want to delete this number?",
                                                  "Confirmation",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question,
                                                  MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                CallsRepository callsRepository = new CallsRepository();
                callsRepository.Delete(call);
                BindControls();
            }
        }