Esempio n. 1
0
        private string ShowSkillDialog()
        {
            EmployeeBusinessLogic employeeBusiness = new EmployeeBusinessLogic();
            List <Skill>          employeeSkils    = employeeBusiness.getEmployeeSkills(selectedStaff);

            List <string> currentSkills = new List <string>();

            foreach (Skill skill in employeeSkils)
            {
                currentSkills.Add(skill.ID);
            }

            List <string> newSkills = employeeBusiness.listAllSkills(currentSkills);

            Form prompt = new Form()
            {
                Width           = 500,
                Height          = 150,
                FormBorderStyle = FormBorderStyle.FixedDialog,
                Text            = "Please enter your new skill name",
                StartPosition   = FormStartPosition.CenterScreen
            };
            Label lblPassword = new Label()
            {
                Left = 50, Top = 20, Text = "New Skill"
            };
            ComboBox cmbSkills = new ComboBox()
            {
                Left = 50, Top = 50, Width = 400
            };

            int count = 0;

            foreach (string item in newSkills)
            {
                cmbSkills.Items.Add(new ComboBoxItem(item, count));
                count++;
            }

            Button confirmation = new Button()
            {
                Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK
            };

            confirmation.Click += (sender, e) => { prompt.Close(); };
            prompt.Controls.Add(cmbSkills);
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(lblPassword);
            prompt.AcceptButton = confirmation;

            return(prompt.ShowDialog() == DialogResult.OK ? cmbSkills.Name : "");
        }
        private void AvailableJobsScreen_Load(object sender, EventArgs e)
        {
            jobCategory jobCategory;
            jobType     jobType;

            switch (employeeLogic.getEmployeeSkills(loggedEmployee)[0].Category)
            {
            case "Software":
                jobCategory = jobCategory.software;
                break;

            case "Hardware":
                jobCategory = jobCategory.hardware;
                break;

            default:
                jobCategory = jobCategory.hardware;
                break;
            }

            switch (employeeLogic.getEmployeeSkills(loggedEmployee)[0].Type)
            {
            case "Installation":
                jobType = jobType.installation;
                break;

            case "Repair":
                jobType = jobType.repair;
                break;

            default:
                jobType = jobType.installation;
                break;
            }

            lstJobs.DataSource = jobLogic.listUnassignedJobByCategoryAndType(jobCategory, jobType);
        }