Example #1
0
        // Ends the call and saves the information to the database.
        private void btnEnd_Click_1(object sender, EventArgs e)
        {
            string duration = lblHours.Text + ":" + lblMinutes.Text + ":" + lblSeconds.Text;

            string[] arrayNotes = rtxNotes.Text.Split('\n');

            string notes = "";

            for (int i = 0; i < arrayNotes.Length; i++)
            {
                notes = notes + " " + arrayNotes[i];
            }

            string reason = cmbReason.Items[cmbReason.SelectedIndex].ToString();

            PhoneCall call = new PhoneCall();

            if (cmbReason.SelectedIndex != 0)
            {
                timer.Stop();

                call = new PhoneCall(0, duration, DateTime.Now, reason, notes, int.Parse(admin.AdministratorID.ToString()));

                call.AddCall();

                this.Hide();
            }
            else
            {
                MessageBox.Show("Please choose a reason for the call!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }