Esempio n. 1
0
        public void UpdateGUI()
        {
            firingRequests = null;
            controls.Clear();
            flpRequests.Controls.Clear();
            firingRequests    = FiringRequests.GetAllFiringRequests();
            hiringRequests    = HiringRequests.GetAllHiringRequests();
            promotionrequests = PromotionRequests.GetAllPromotionRequests();
            foreach (FiringRequests fr in firingRequests)
            {
                controls.Add(new RequestControl(fr.PersonId, fr.CreatedById, fr.DepartmentId, fr.Description, fr.FirstName, fr.LastName, fr.Username, this));
            }

            foreach (PromotionRequests pr in promotionrequests)
            {
                controls.Add(new RequestControl(pr.PersonId, pr.CreatedById, pr.Username, pr.FirstName, pr.LastName, pr.HourlyWage, pr.DepartmentId, this));
            }

            foreach (HiringRequests hr in hiringRequests)
            {
                controls.Add(new RequestControl(hr.PersonId, hr.CreatedById, hr.Username, hr.FirstName, hr.LastName, hr.HourlyWage, hr.DepartmentId, hr.ContractStartDate, hr.PhoneNumber, hr.Email, this));
            }

            foreach (RequestControl request in controls)
            {
                flpRequests.Controls.Add(request);
            }
        }
Esempio n. 2
0
        private void btnSendPromotionRequest_Click(object sender, EventArgs e)
        {
            MySqlConnection conn = Utils.GetConnection();

            if (cmbDepartment.Text == "Department" || cmbDepartment.Text == "")
            {
                MessageBox.Show("Please select a department from the menu!");
            }
            else if (cmbEmployee.Text == "Employees" || cmbEmployee.Text == "")
            {
                MessageBox.Show("Please select an employee from the menu!");
            }
            else
            {
                int     employeeid         = ((EmployeeComboBoxItem)cmbEmployee.SelectedItem).Id;
                decimal CurrentWage        = Worker.GetworkerCurrentWage(employeeid);
                decimal employeeHourlyWage = numericHourlywage.Value;
                if (CurrentWage >= employeeHourlyWage)
                {
                    MessageBox.Show("The new wage can not be lower than the worker's current wage!");
                }
                else
                {
                    int    departmentId      = ((DepartmentComboBoxItem)cmbDepartment.SelectedItem).Id;
                    int    employeeId        = ((EmployeeComboBoxItem)cmbEmployee.SelectedItem).Id;
                    string employeeUsername  = ((EmployeeComboBoxItem)cmbEmployee.SelectedItem).Username;
                    string employeeFirstName = ((EmployeeComboBoxItem)cmbEmployee.SelectedItem).FirstName;
                    string employeeLastName  = ((EmployeeComboBoxItem)cmbEmployee.SelectedItem).LastName;
                    if (MessageBox.Show("Do you really want to send this Promotion request?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        try
                        {
                            PromotionRequests pr  = new PromotionRequests(employeeId, this.loggedUserId, employeeUsername, employeeFirstName, employeeLastName, departmentId, employeeHourlyWage);
                            PromotionRequests pr1 = new PromotionRequests(employeeId, this.loggedUserId, employeeHourlyWage);
                            if (!pr1.PrExists)
                            {
                                MessageBox.Show("Promotion request already exists!");
                            }
                            else
                            {
                                MessageBox.Show("Request sent successfully!");
                                this.Close();
                            }
                        }
                        catch (Exception ex)
                        {
                            string epra = ex.Message;
                        }
                        finally
                        {
                            conn.Close();
                        }
                    }
                }
            }
        }
Esempio n. 3
0
 private void btnApprove_Click_1(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you really want to approve this request?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (lblRequest.Text.Contains("Hiring"))
         {
             foreach (HiringRequests hr in HiringRequests.GetAllHiringRequests())
             {
                 if (hr.PersonId == personId)
                 {
                     hr.ApproveHiringRequest();
                 }
             }
             form.UpdateGUI();
         }
         else if (lblRequest.Text.Contains("firing"))
         {
             foreach (FiringRequests fr in FiringRequests.GetAllFiringRequests())
             {
                 if (fr.PersonId == personId)
                 {
                     fr.ApproveFiringRequest();
                 }
             }
             form.UpdateGUI();
         }
         else if (lblRequest.Text.Contains("Promotion"))
         {
             foreach (PromotionRequests pr in PromotionRequests.GetAllPromotionRequests())
             {
                 if (pr.PersonId == personId)
                 {
                     pr.ApprovePromotionRequest();
                 }
             }
             form.UpdateGUI();
         }
     }
 }