//-----------------------------------------------------------------------------------------------------------------------------------
        //
        //                                  CRONUS Eventhandlers
        //
        //-----------------------------------------------------------------------------------------------------------------------------------

        private void btnDeleteEmployee_Click(object sender, RoutedEventArgs e)
        {
            ClearOutput();
            int index = dgEmployee.SelectedIndex;

            if (index >= 0)
            {
                CronusReference.Employee emp = eventkalenderViewModel.Employees.ElementAt(index);
                string no = emp.No;
                eventkalenderViewModel.DeleteEmployee(no);
            }
        }
        private void dgEmployee_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int index = dgEmployee.SelectedIndex;

            if (index > -1)
            {
                CronusReference.Employee temp = new CronusReference.Employee();
                temp = eventkalenderViewModel.Employees.ElementAt(index);
                txtEmployeeFirstName.Text = temp.FirstName;
                txtEmployeeLastName.Text  = temp.LastName;
                txtEmployeeNumber.Text    = temp.No;
            }
        }
        public void DeleteEmployee(string no)
        {
            try
            {
                CronusReference.Employee temp = new CronusReference.Employee();
                temp.No = no;

                Employees.Remove(Employees.FirstOrDefault(e => e.No == temp.No));
                cronusClient.DeleteEmployee(temp.No);
            }
            catch (Exception ex)
            {
                Status = ExceptionHandler.GetErrorMessage(ex);
            }
        }
 public void AddEmployee(string no, string firstName, string lastName)
 {
     try
     {
         CronusReference.Employee emp = new CronusReference.Employee();
         emp.No        = no;
         emp.FirstName = firstName;
         emp.LastName  = lastName;
         Employees.Add(emp);
         cronusClient.AddEmployee(no, firstName, lastName);
     }
     catch (Exception ex)
     {
         Status = ExceptionHandler.GetErrorMessage(ex);
     }
 }
 public void UpdateEmployee(string no, string firstName, string lastName, int index)
 {
     try
     {
         CronusReference.Employee emp = new CronusReference.Employee();
         emp.No        = no;
         emp.FirstName = firstName;
         emp.LastName  = lastName;
         index         = Employees.IndexOf(Employees.Where(e => e.No == no).FirstOrDefault());
         Employees.ElementAt(index).FirstName = emp.FirstName;
         Employees.ElementAt(index).LastName  = emp.LastName;
         cronusClient.UpdateEmployee(no, firstName, lastName);
     }
     catch (Exception ex)
     {
         Status = ExceptionHandler.GetErrorMessage(ex);
     }
 }