Exemple #1
0
        /*
         * public float[] MakeHoursV2(KlonsADataSet.TIMEPLAN_LISTRow dr, bool fornight)
         * {
         *  if (dr == null) return null;
         *
         *  float[] hr = new float[31];
         *  int i, d1;
         *
         *  for (i = 0; i < 31; i++)
         *      hr[i] = 0.0f;
         *
         *  float dhr = fornight ? dr.HOURS_NIGHT : dr.HOURS;
         *
         *  for (i = 0; i < 31; i++)
         *  {
         *      d1 = WeekDays[i];
         *      if (d1 == -1)
         *      {
         *          hr[i] = 0.0f;
         *          continue;
         *      }
         *
         *      if (HolyDays[i] == EHolyDay.Holiday)
         *      {
         *          hr[i] = 0.0f;
         *      }
         *      else if (d1 == 7 || (dr.KIND1 == SomeDataDefs.Id5DienuNedela && d1 == 6))
         *      {
         *          hr[i] = 0.0f;
         *      }
         *      else if (d1 == 6 && dr.KIND1 == SomeDataDefs.Id6DienuNedela)
         *      {
         *          if (fornight) hr[i] = dhr;
         *          else if (dhr == 7.0f) hr[i] = 4.0f;
         *          else hr[i] = dhr;
         *      }
         *      else
         *      {
         *          hr[i] = dhr;
         *      }
         *
         *      if (!fornight && HolyDays[i] == EHolyDay.DayBeforeHoliday && hr[i] == dhr)
         *      {
         *          hr[i] = dhr - 1;
         *      }
         *  }
         *  return hr;
         * }
         */

        public EDayTag[] MakeDayTags(KlonsADataSet.TIMEPLAN_LISTRow dr)
        {
            if (dr == null)
            {
                return(null);
            }

            EDayTag[] hr = new EDayTag[31];
            int       i, d1;

            for (i = 0; i < DaysInMonth; i++)
            {
                d1 = WeekDays[i];
                if (d1 == -1)
                {
                    break;
                }


                if (d1 == 7 || (dr.KIND1 == SomeDataDefs.Id5DienuNedela && d1 == 6))
                {
                    if (HolyDays[i] == EHolyDay.Holiday)
                    {
                        hr[i] = EDayTag.HolidayInFreeDay;
                    }
                    else
                    {
                        hr[i] = EDayTag.FreeDay;
                    }
                }
                else
                {
                    if (HolyDays[i] == EHolyDay.Holiday)
                    {
                        hr[i] = EDayTag.HolidayInWorkDay;
                    }
                    else if (HolyDays[i] == EHolyDay.DayBeforeHoliday)
                    {
                        hr[i] = EDayTag.WorkDayBeforeHoliday;
                    }
                    else
                    {
                        hr[i] = EDayTag.WorkDay;
                    }
                }
            }

            for (i = DaysInMonth; i < 31; i++)
            {
                hr[i] = EDayTag.None;
            }

            return(hr);
        }
Exemple #2
0
        public float[] MakeHours(KlonsADataSet.TIMEPLAN_LISTRow dr, bool fornight)
        {
            if (dr == null)
            {
                return(null);
            }

            float[] hr = new float[31];
            int     i, d1;

            for (i = 0; i < 31; i++)
            {
                hr[i] = 0.0f;
            }

            float dhr = fornight ? dr.HOURS_NIGHT : dr.HOURS;

            for (i = 0; i < 31; i++)
            {
                d1 = WeekDays[i];
                if (d1 == -1)
                {
                    hr[i] = 0.0f;
                    continue;
                }

                if (d1 == 7 || (dr.KIND1 == SomeDataDefs.Id5DienuNedela && d1 == 6))
                {
                    hr[i] = 0.0f;
                }
                else if (d1 == 6 && dr.KIND1 == SomeDataDefs.Id6DienuNedela)
                {
                    if (fornight)
                    {
                        hr[i] = dhr;
                    }
                    else if (dhr == 7.0f)
                    {
                        hr[i] = 5.0f;
                    }
                    else
                    {
                        hr[i] = dhr;
                    }
                }
                else
                {
                    hr[i] = dhr;
                }
            }
            return(hr);
        }