private void btnTakeJob_Click(object sender, EventArgs e)
 {
     if (lstJobs.SelectedIndex < 0)
     {
         MessageBox.Show("No job is currently selected");
     }
     else
     {
         jobLogic.assignJob(selectedJob.Id, loggedEmployee.Id);
         this.Hide();
         JobScreen jobScreen = new JobScreen(new Job(id: selectedJob.Id, contractID: jobContract.Id, employeeID: loggedEmployee.Id, jobStatus: "Assigned", jobDescription: selectedJob.JobDescription, clientSatisfaction: selectedJob.ClientSatisfaction, jobCategory: selectedJob.JobCategory, jobType: selectedJob.JobType, new Pay("", 600)), loggedEmployee);
         jobScreen.Show();
         this.Close();
     }
 }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txt_UserName.Text == "" || txt_Password.Text == "")
            {
                MessageBox.Show("Please provide User Name and Password");
                return;
            }
            try
            {
                AuthenticationBusinessLogic authLogic       = new AuthenticationBusinessLogic();
                Dictionary <string, string> userAuthDetails = authLogic.Authenticate(txt_UserName.Text, authenticationLogic.Encipher(txt_Password.Text, 12));

                if (userAuthDetails != null)
                {
                    EmployeeBusinessLogic employeeBusinessLogic = new EmployeeBusinessLogic();

                    switch (userAuthDetails["userType"])
                    {
                    case "CallCentre":
                        List <Employee> callCentreDetails = employeeBusinessLogic.searchEmployeesByParamater(employeeSearchParamaters.id, employeeType.callCenter, userAuthDetails["id"]);
                        this.Hide();
                        FrmCallCenter frmCallCenter = new FrmCallCenter(callCentreDetails[0]);
                        frmCallCenter.Show();
                        break;

                    case "Technician":
                        List <Employee> technicianDetails = employeeBusinessLogic.searchEmployeesByParamater(employeeSearchParamaters.id, employeeType.technician, userAuthDetails["id"]);

                        List <Employee> stanbyEmployees = employeeBusinessLogic.employeesOnStandBy(employeeType.technician);

                        if (stanbyEmployees.FindIndex(employee => employee.Id == technicianDetails[0].Id) >= 0)
                        {
                            AvailableJobsScreen availableJobsScreen = new AvailableJobsScreen(technicianDetails[0]);
                            this.Hide();
                            availableJobsScreen.Show();
                        }
                        else
                        {
                            Job       currentJob = jobLogic.getJobsBySearchParamater(jobSearchParamaters.employeeID, technicianDetails[0].Id).Except(jobLogic.getJobsBySearchParamater(jobSearchParamaters.status, "Completed")).ToList()[0];
                            JobScreen jobScreen  = new JobScreen(job: currentJob, employee: technicianDetails[0]);
                            this.Hide();
                            jobScreen.Show();
                        }
                        break;

                    case "Client":
                        ClientBusinessLogic clientBusinessLogic = new ClientBusinessLogic();
                        List <Client>       clientDetails       = clientBusinessLogic.searchClientByParameter(clientSearchParameter.id, userAuthDetails["id"]);

                        FrmClientSatisfaction clientSatisfaction = new FrmClientSatisfaction(clientDetails[0]);
                        this.Hide();
                        clientSatisfaction.Show();
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }