示例#1
0
 private void ProcessNotFixedTimeAbsence(Absence absence)
 {
     if (absence.WithoutFixedTime)
     {
         if (gridView.SelectedRowsCount == 1)
         {
             using (FormEnterAbsenceTime form = new FormEnterAbsenceTime())
             {
                 if (form.ShowDialog() == DialogResult.OK)
                 {
                     EmployeeDayView dayView = GetEmployeeDayView();
                     if (dayView != null)
                     {
                         dayView.SetAbsence(absence, form.BeginTime, form.EndTime);
                         if (dayView.Modified)
                         {
                             Context.Modified = true;
                         }
                         UpdateEmployeePlanningDays();
                     }
                 }
             }
         }
     }
 }
示例#2
0
        private void mi_MarkAsAbsence_Click(object sender, EventArgs e)
        {
            using (FormSelectAbsence formSelectAbsence = new FormSelectAbsence())
            {
                formSelectAbsence.IsPlanning = true;
                formSelectAbsence.Absences   = Context.Absences.ToList;
                StoreDay sd = Context.StoreDays[ViewDate];
                formSelectAbsence.ShowTimePanel = false;
                formSelectAbsence.SetDayInfo(sd.OpenTime, sd.CloseTime, Context.StoreDays.AvgDayInWeek);


                if (formSelectAbsence.Execute())
                {
                    if (gridView.SelectedRowsCount == 1)
                    {
                        EmployeeDayView dayView = GetEmployeeDayView(); //m_dailyView.GetByEmployeeId(empl.EmployeeId);
                        TimeColumnInfo  info    = null;

                        GridCell[] cells = gridView.GetSelectedCells();

                        if (dayView != null && cells != null && cells.Length > 0)
                        {
                            foreach (GridCell cell in cells)
                            {
                                info = GetColumnInfo(cell.Column);
                                if (info != null)
                                {
                                    dayView.SetAbsence(formSelectAbsence.SelectedAbsence, info.FromTime, info.ToTime);
                                }
                            }
                            if (dayView.Modified)
                            {
                                Context.Modified = true;
                            }
                            UpdateEmployeePlanningDays();
                        }
                    }
                }
            }
        }
示例#3
0
        private void ProcessFixedTimeAbsence(Absence absence)
        {
            if (absence.Value > 0)
            {
                int count = (int)(absence.Value * 60);

                if (gridView.SelectedRowsCount == 1)
                {
                    EmployeeDayView dayView = GetEmployeeDayView();
                    TimeColumnInfo  info    = GetColumnInfo(gridView.FocusedColumn);

                    if (dayView != null && info != null)
                    {
                        dayView.SetAbsence(absence, info.FromTime, info.FromTime + count);
                        if (dayView.Modified)
                        {
                            Context.Modified = true;
                        }
                        UpdateEmployeePlanningDays();
                    }
                }
            }
        }
示例#4
0
        private void ProcessCountAliquotAbsence(Absence absence)
        {
            if (absence.IsFixed)
            {
                if (gridView.SelectedRowsCount == 1)
                {
                    EmployeeDayView dayView = GetEmployeeDayView();

                    TimeColumnInfo info = GetColumnInfo(gridView.FocusedColumn);

                    if (dayView != null && info != null)
                    {
                        int count = DateTimeHelper.RoundToQuoter((short)((dayView.ContractHoursPerWeek / Context.StoreDays.AvgDayInWeek)));

                        dayView.SetAbsence(absence, info.FromTime, info.FromTime + count);
                        if (dayView.Modified)
                        {
                            Context.Modified = true;
                        }
                        UpdateEmployeePlanningDays();
                    }
                }
            }
        }