Пример #1
0
        public static short GetEntityTime(Absence absence, int time, double contractHours, double weekDays)
        {
            //if (absence != null && absence.CountAsOneDay)
            //    return (short)MinutesInDay;

            return (short)Math.Round ((time /
                   (contractHours / weekDays / (double)DayMinutes)));
        }
Пример #2
0
        //public static short GetEntityTime(short begin, short end, decimal contractHours, decimal weekDays)
        //{
        //    return (short)((end - begin) /
        //           ((decimal)contractHours / (decimal)weekDays / DayMinutes));
        //}
        //public static short GetEntityTime(short begin, short end, decimal coeficient)
        //{
        //    return (short)((decimal)(end - begin) / coeficient);
        //}
        public static short GetEntityTime(Absence absence, short begin, short end, double contractHours, double weekDays)
        {
            if (absence != null && absence.CountAsOneDay)
                return (short)MinutesInDay;

            return GetEntityTime(absence, (end - begin), contractHours, weekDays);

            //return (short)((end - begin) /
            //       ((double)contractHours / (double)weekDays / (double)DayMinutes));
        }
Пример #3
0
        private bool CheckUsedAbsence(Absence absence)
        {
            if (absence == null)
                throw new ArgumentNullException();

            if (_idsUsedAbsence == null || _idsUsedAbsence.Length == 0) 
                return false;

            foreach (long id in _idsUsedAbsence)
                if (absence.ID == id) return true;

            return false;
        }
Пример #4
0
        public bool MarkAsAbsenceTime(short begintime, short endtime, Absence absence)
        {
            int index = begintime / 15;

            for (int i = begintime; i < endtime; i += 15, index++)
            {
                if (_recordingTimes[index].AbsenceEntity != absence) Modified = true;
                _recordingTimes[index].AbsenceEntity = absence;
            }

            return Modified;
        }
Пример #5
0
 public void AddToDiction(Absence absence)
 {
     _diction[absence.ID] = absence;
 }
Пример #6
0
 public AbsenceName( long languageID, string name, Absence absence )
 {
     this._languageID = languageID;
     this._name = name;
     this._absence = absence;
 }
Пример #7
0
 public AbsenceName(long languageID, string name, Absence absence)
 {
     this._languageID = languageID;
     this._name       = name;
     this._absence    = absence;
 }
Пример #8
0
        private void ProcessAbsence(Absence absence)
        {
            Debug.Assert(absence != null);
            if (absence == null) return;
            BzEmployeeHoliday employeeentity = GetFocusedEntity();

            List<DateTime> lstDates = CreateDateListFromSelectedRange();

            employeeentity.CheckDates(lstDates);

            Debug.Assert(employeeentity != null);
            if (employeeentity == null) return;



            if (lstDates != null && lstDates.Count > 0)
            {
                List<AbsenceTimeRange> newAbsences = new List<AbsenceTimeRange>();

                StoreDay storeday = null;
                AbsenceTimeRange absencetime = null;

                foreach (DateTime date in lstDates)
                {
                    storeday = _query.StoreDays[date];
                    Debug.Assert(storeday != null);

                    absencetime = new AbsenceTimeRange();
                    absencetime.ID = ClientEnvironment.AbsenceTimePlanningService.CreateEntity().ID;
                    absencetime.Date = date;
                    absencetime.AbsenceID = absence.ID;
                    absencetime.EmployeeID = employeeentity.EmployeeId;
                    absencetime.Absence = absence;
                    absencetime.Begin = storeday.OpenTime;
                    //absencetime.End = (short)(absencetime.Begin + DateTimeHelper.RoundToQuoter(employeeentity.GetAvgWorkingHourADay(date)));
                    absencetime.End = (short)(absencetime.Begin + employeeentity.GetAvgWorkingHourADay(date));
                    absencetime.Time = employeeentity.GetAbsenceTimeAsDay(absence, date, (absencetime.End - absencetime.Begin));


                    newAbsences.Add(absencetime);
                }
                if (newAbsences.Count > 0)
                {
                    employeeentity.SetAbsence(newAbsences);

                    BuildTotalSums();
                    gvAbsencePlanning.RefreshRow(gvAbsencePlanning.FocusedRowHandle);
                    Modified = true;
                }
            }
        }
Пример #9
0
 private void SaveInputDataTo(Absence entity)
 {
     entity.Name = AbsenceName;
     entity.CharID = Abbreviation;
     entity.CountryID = CountryID;
     entity.Color = AbsenceColor;
     entity.IsFixed = IsFixedAmount;
     entity.WithoutFixedTime = WithoutFixedTimeAmount;
     entity.Value = AbsenceValue;
     entity.UseInCalck = UseInCalculation;
     entity.SystemID = SystemId;
     entity.CountAsOneDay = CountAsOneDay;
     entity.IsShow = IsShow;
 }
Пример #10
0
 private void AssignAbsence(Absence source, Absence dest)
 {
     Debug.Assert(source!= null);
     Debug.Assert(dest != null);
     BaseEntity.CopyTo(source, dest);
 }
Пример #11
0
 public AbsenceForm(Absence entity)
 {
     InitializeComponent();
     EntityControl = null;
     Absence = entity;
 }