예제 #1
0
 public Day(DateTime date, double defaultHourSalary, double daySolfa, TimeNode arriveTime, TimeNode leaveTime,
            bool delayPermission, bool absentPermission, bool absentNoPermission, bool holidayPermission)
     : base(arriveTime, leaveTime, delayPermission, absentPermission, absentNoPermission, holidayPermission)
 {
     this.mDate                      = date;
     this.mDayName                   = date.Date.ToString("yyyy/MM/dd");
     this.mDefaultHourSalary         = defaultHourSalary;
     this.mDaySolfa                  = daySolfa;
     this.mDefaultOverTimeHourSalary = defaultHourSalary * 1.5;
     this.mDelayPenaltySalary        = this.PenaltyDelayHours * this.mDefaultHourSalary;
     this.mOverTimeSalary            = this.OverTimeHours * this.mDefaultOverTimeHourSalary;
 }
예제 #2
0
 public WorkTime(WorkTime tempWorkTime)
 {
     this.mArriveTime            = new TimeNode(tempWorkTime.ArriveTime);
     this.mLeaveTime             = new TimeNode(tempWorkTime.LeaveTime);
     this.mHoursDelayPermission  = tempWorkTime.HoursDelayPermission;
     this.mAbsentDayPermission   = tempWorkTime.AbsentDayPermission;
     this.mAbsentDayNoPermission = tempWorkTime.AbsentDayNoPermission;
     this.mHolidayPermission     = tempWorkTime.HoliDayPermission;
     this.mDelayMinuts           = this.CalculateDelayMinuts();
     this.mPenaltyDelayHours     = this.CalculatePenaltyHours();
     this.mOverTimeMunits        = this.CalculateOverTimeMunits();
     this.mOverTimeHours         = (double)(this.mOverTimeMunits / 60.0);
 }
예제 #3
0
 public WorkTime(TimeNode arriveTime, TimeNode leaveTime, bool delayPermission, bool absentPermission,
                 bool absentNoPermission, bool holidayPermission)
 {
     this.mArriveTime            = new TimeNode(arriveTime);
     this.mLeaveTime             = new TimeNode(leaveTime);
     this.mHoursDelayPermission  = delayPermission;
     this.mAbsentDayPermission   = absentPermission;
     this.mAbsentDayNoPermission = absentNoPermission;
     this.mHolidayPermission     = holidayPermission;
     this.mDelayMinuts           = this.CalculateDelayMinuts();
     this.mPenaltyDelayHours     = this.CalculatePenaltyHours();
     this.mOverTimeMunits        = this.CalculateOverTimeMunits();
     this.mOverTimeHours         = (double)(this.mOverTimeMunits / 60.0);
 }
예제 #4
0
 public TimeNode(TimeNode tempNode)
 {
     this.mHour  = tempNode.Hour;
     this.mMinut = tempNode.Minut;
 }
예제 #5
0
        // Validate the Day Data
        private void btn_AddThisDay_Click(object sender, EventArgs e)
        {
            TimeNode tempArriveNode, tempLeaveNode;

            if (cmbx_EmployeeNames.SelectedIndex == 0)
            {
                MessageBox.Show("اختر اسم الموظف أولاً !");
                return;
            }
            if (!CheckArriveTime() && !(rdbtn_AbsentPermissionHoliday.Checked ||
                                        rdbtn_AbsentPermissionDay.Checked || rdbtn_AbsentNoPermissionDay.Checked))
            {
                MessageBox.Show("يوجد خطأ في وقت الوصول !"); return;
            }
            else
            {
                if ((rdbtn_AbsentPermissionHoliday.Checked ||
                     rdbtn_AbsentPermissionDay.Checked || rdbtn_AbsentNoPermissionDay.Checked))
                {
                    tempArriveNode = new TimeNode(-1, -1);
                    tempLeaveNode  = new TimeNode(-1, -1);
                }
                else
                {
                    tempArriveNode = new TimeNode(int.Parse(txt_ArriveH.Text), int.Parse(txt_ArriveM.Text));
                }
            }
            if (!CheckLeaveTime() && !(rdbtn_AbsentPermissionHoliday.Checked ||
                                       rdbtn_AbsentPermissionDay.Checked || rdbtn_AbsentNoPermissionDay.Checked))
            {
                MessageBox.Show("يوجد خطأ في وقت الانصراف !"); return;
            }
            else
            {
                if ((rdbtn_AbsentPermissionHoliday.Checked ||
                     rdbtn_AbsentPermissionDay.Checked || rdbtn_AbsentNoPermissionDay.Checked))
                {
                    tempArriveNode = new TimeNode(-1, -1);
                    tempLeaveNode  = new TimeNode(-1, -1);
                }
                else
                {
                    tempLeaveNode = new TimeNode(int.Parse(txt_LeaveH.Text), int.Parse(txt_LeaveM.Text));
                }
            } double Solfa = 0.0;

            if (!CheckSolfa())
            {
                MessageBox.Show("يوجد خطأ في خانة السلفة !"); return;
            }
            else if (txt_Solfa.Text != "")
            {
                Solfa = Double.Parse(txt_Solfa.Text);
            }
            String EmpName = cmbx_EmployeeNames.SelectedItem.ToString(), SelectedDate = "";

            TempEmployee = new Employee(EmployeeList[EmpName]);
            if (!CheckPermission())
            {
                return;
            }
            WorkTime tempWorkTime = new WorkTime(tempArriveNode, tempLeaveNode, rdbtn_DelayPermissionHours.Checked,
                                                 rdbtn_AbsentPermissionDay.Checked, rdbtn_AbsentNoPermissionDay.Checked, rdbtn_AbsentPermissionHoliday.Checked);
            String monthKey = dateTimePicker1.Value.Date.ToString("yyyy/MM");
            String dayKey   = dateTimePicker1.Value.Date.ToString("yyyy/MM/dd");

            if (TempEmployee.WorkMonths.ContainsKey(monthKey) &&
                TempEmployee.WorkMonths[monthKey].MonthHistory.ContainsKey(dayKey))
            {
                DialogResult dialogResult = MessageBox.Show("هذا التاريخ موجود بالفعل .. هل تريد التعديل ؟", "تعديل التاريخ", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }
            }
            TempEmployee.AddDay(new Day(dateTimePicker1.Value.Date, 0, Solfa, tempWorkTime));
            EmployeeList[EmpName] = new Employee(TempEmployee);
            initPanel(false);
        }