Example #1
0
 private void btnUpdateEmp_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         if (empBind.Current is Technicians)
         {
             Technicians t = (Technicians)empBind.Current;
             if (t.UpdateTech())
             {
                 MessageBoxShower.ShowInfo("The Technician was successfully updated!", "Success");
             }
             else
             {
                 CustomExceptions error = new CustomExceptions("The Technician could not be updated.Please try again later.", "Something went wrong..");
             }
         }
         else if (empBind.Current is CallOperators)
         {
             CallOperators co = (CallOperators)empBind.Current;
             if (co.UpdateCallOperator())
             {
                 MessageBoxShower.ShowInfo("The Call Operator was successfully updated!", "Success");
             }
             else
             {
                 CustomExceptions error = new CustomExceptions("The Call Operator could not be updated.Please try again later.", "Something went wrong..");
             }
         }
     }
 }
Example #2
0
 private bool NoDuplicates(object emp)
 {
     if (emp is Technicians)
     {
         Technicians        t     = (Technicians)emp;
         List <Technicians> techs = t.GetAllTechnicians();
         foreach (Technicians item in techs)
         {
             if (item.PersonId == t.PersonId)
             {
                 return(false);
             }
         }
     }
     else if (emp is CallOperators)
     {
         CallOperators        co      = (CallOperators)emp;
         List <CallOperators> callOps = co.GetCallOperators();
         foreach (CallOperators item in callOps)
         {
             if (item.PersonId == co.PersonId)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Example #3
0
 private void btnDecline_Click(object sender, EventArgs e)
 {
     btnClose.Visible = true;
     if (ValidateForm())
     {
         current = (Client)bind1.Current;
         if (start != null)
         {
             end = DateTime.UtcNow;
             callTime.Stop();
             CallOperators co   = frmMain.loggedIn.GetMatchingCallOperator();
             CallLog       call = new CallLog(co, current, start, end, rtxtRemarks.Text);
             if (call.InsertCall())
             {
                 MessageBoxShower.ShowInfo("This called has been logged. Thank you.", "Call Log");
             }
             else
             {
                 CustomExceptions error = new CustomExceptions("This call could not be logged. Please try again", "Logging Error!");
             }
         }
     }
     else
     {
         CustomExceptions error = new CustomExceptions("Please complete all fields!", "Validation Error!");
     }
 }
Example #4
0
 private void btnAddEmp_Click(object sender, EventArgs e)
 {
     if (ValidateForm())
     {
         if (cmbType.SelectedItem.ToString() == "Technician")
         {
             Technicians t = new Technicians(txtId.Text, txtName.Text, txtSurname.Text, new Address("", txtLine1.Text, txtLine2.Text, txtCity.Text, txtPostalCode.Text), new Contact("", txtCell.Text, txtEmail.Text), cmbStatus.SelectedItem.ToString(), cmbSkill.SelectedItem.ToString());
             if (NoDuplicates(t))
             {
                 if (t.AddTech())
                 {
                     MessageBoxShower.ShowInfo("The Technician was added to the system.", "Success!");
                     this.Close();
                 }
                 else
                 {
                     CustomExceptions error = new CustomExceptions("The Technician could not be added. Please try again.", "Failure!");
                 }
             }
             else
             {
                 CustomExceptions error = new CustomExceptions("A technician with this ID has already been added. Please update.", "Cannot add technician.");
             }
         }
         else if (cmbType.SelectedItem.ToString() == "Call Operator")
         {
             CallOperators c = new CallOperators(txtId.Text, txtName.Text, txtSurname.Text, new Address("", txtLine1.Text, txtLine2.Text, txtCity.Text, txtPostalCode.Text), new Contact("", txtCell.Text, txtEmail.Text), cmbStatus.SelectedItem.ToString());
             if (NoDuplicates(c))
             {
                 if (c.InsertCallOperator())
                 {
                     MessageBoxShower.ShowInfo("The Call Operator was added to the system.", "Success!");
                     this.Close();
                 }
                 else
                 {
                     CustomExceptions error = new CustomExceptions("The Call Operator could not be added. Please try again.", "Failure!");
                 }
             }
             else
             {
                 CustomExceptions error = new CustomExceptions("A Call Operator with this ID has already been added. Please update.", "Cannot add Call Operator.");
             }
         }
     }
     else
     {
         CustomExceptions error = new CustomExceptions("Please complete all fields.", "Cannot add Employee.");
     }
 }