예제 #1
0
        private void Btn_additions_Click(object sender, EventArgs e)
        {
            //open form and pass over current date
            //run procedure to populate all the dates for this week --
            dateInsert di = new dateInsert();

            di.check_date(_selectedDate);
            frmWeeklyAD AD = new frmWeeklyAD(_selectedDate, _department);

            AD.ShowDialog();
            //need to pass the NEW overtime value into the upper right textbox to stop the value over-writing it
            txtAD.Text = AD.additionForSD.ToString();
            this.Close();
        }
예제 #2
0
        private void lstStaff_DoubleClick(object sender, EventArgs e)
        {
            double remainingHours;
            //string remainingPlacementType;

            Staff s = new Staff(lstStaff.SelectedItem.ToString());

            getStandardHours(s._staffID);

            Placement p = new Placement(_selectedDate, s._staffID, _department, "Full Day", _standardHours);

            p.notPresent();
            p.checkPlacement();

            p.getWeldTeamUserID();
            p.checkWeldTeamAbsence();


            //CHECKS IF STAFF MEMBERS IN WELD TEAM 2 ARE CURRENTLY ON HOLIDAY OR ABSENT
            if (s._staffID == 165)
            {
                if (p._weldTeamMembersPresent == 1)
                {
                    p._hours = _standardHours / 2;
                    MessageBox.Show("One member of this weld team is either absent or on holiday. Adding half the hours", "Half Placement", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                if (p._weldTeamMembersPresent == 2)
                {
                    p._hours = _standardHours * 0;
                    MessageBox.Show("Both members of this team are either absent or on holiday", "Zero Placement", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }


            if (p._notPresentType == 5 || p._notPresentType == 2)
            {
                MessageBox.Show("This staff member is either absent today or has a full day holiday!", "Cannot Place", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (p._notPresentType == 3)
            {
                MessageBox.Show("This staff member has half day holiday so can only be placed for half day", "Half Day Placement", MessageBoxButtons.OK, MessageBoxIcon.Error);
                remainingHours = _standardHours / 2;
                Placement p3 = new Placement(_selectedDate, s._staffID, _department, "Half Day", remainingHours);
                p3.addPlacment();
            }
            else
            {
                if (p._alreadyPlaced == true)
                {
                    if (p._existingPlacementHours == _standardHours)
                    {
                        MessageBox.Show("Staff member already has a full day placement for this day!", "Already Placed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        if (p._existingPlacementHours != _standardHours && p._existingPlacementHours > 0)
                        {
                            remainingHours = _standardHours - p._existingPlacementHours;
                            MessageBox.Show("Staff member already placed for " + p._existingPlacementHours.ToString(), "Staff member part placed", MessageBoxButtons.OK, MessageBoxIcon.Information);


                            Placement p2 = new Placement(_selectedDate, s._staffID, _department, p._existingPlacementType, remainingHours);
                            p2.addPlacment();
                        }
                        else
                        {
                            DialogResult weekly = MessageBox.Show("Would you like to assign '" + s._fullname + "' more days in " + _department + " this week?", "Weekly Placement", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                            if (weekly == DialogResult.Yes)
                            {
                                //run procedure to populate all the dates for this week --
                                dateInsert di = new dateInsert();
                                di.check_date(_selectedDate);
                                //open form
                                frmWeeklyInsert frm = new frmWeeklyInsert(s._staffID, s._fullname, _selectedDate, _department);
                                frm.ShowDialog();
                            }
                            else
                            {
                                p.addPlacment(); // add placement is here so there is no way it should be the reason for changing the placements  on the next form close
                            }
                        }
                    }
                }
            }



            checkExistingSelections();
        }