Exemplo n.º 1
0
        public void CheckInterfaceRuleGroup(ShiftPair pair)
        {
            BWorkGroupCalendar  busWorkGroup = new BWorkGroupCalendar();
            WorkGroupRepository workRep      = new WorkGroupRepository(false);
            IList <WorkGroup>   list         = workRep.GetAllWorkGroupByShift(pair.ShiftId);

            foreach (WorkGroup workGroup in list)
            {
                busWorkGroup.CheckInterfaceRuleGroup(workGroup.ID);
            }
        }
Exemplo n.º 2
0
 protected void UpdateCFP(ShiftPair obj, UIActionType action)
 {
     //return;
     if (action == UIActionType.ADD || action == UIActionType.EDIT || action == UIActionType.DELETE)
     {
         BWorkGroupCalendar  busWorkGroup = new BWorkGroupCalendar();
         WorkGroupRepository workRep      = new WorkGroupRepository(false);
         IList <WorkGroup>   list         = workRep.GetAllWorkGroupByShift(obj.ShiftId);
         foreach (WorkGroup workGroup in list)
         {
             DateTime?firstUse = shiftRepository.GetFirstShiftUsedInWorkGroup(obj.ShiftId, workGroup.ID);
             if (firstUse != null && firstUse > Utility.GTSMinStandardDateTime)
             {
                 busWorkGroup.UpdateCFPByWorkGroupId(workGroup.ID, (DateTime)firstUse);
             }
         }
     }
 }
Exemplo n.º 3
0
        public void UpdateYearlyHolidayWorkGroups(decimal selectedHolidayID, List <decimal> WorkGroupIdList, int year)
        {
            BWorkGroupCalendar WorkGroupCalendar = new BWorkGroupCalendar();
            IList <decimal>    HolidayList       = new List <decimal>();

            HolidayList.Add(selectedHolidayID);
            IList <CalendarCellInfo> CalendarCellInfoList = new List <CalendarCellInfo>();

            // BWorkGroupCalendar WorkGroupCalendarBusiness = new BWorkGroupCalendar();

            try
            {
                //if (WorkGroupIdList.Count > 0)
                //{
                using (NHibernateSessionManager.Instance.BeginTransactionOn())
                {
                    this.DeleteYearlyHolidayWorkGroups(selectedHolidayID, year);
                    foreach (decimal workgroupIdItem in WorkGroupIdList)
                    {
                        YearlyHolidayWorkGroups yearlyHolidayWorkGroups = new YearlyHolidayWorkGroups()
                        {
                            calendarType = new CalendarType()
                            {
                                ID = selectedHolidayID
                            }, workGroup = new WorkGroup()
                            {
                                ID = workgroupIdItem
                            }, Year = year
                        };
                        this.SaveChanges(yearlyHolidayWorkGroups, UIActionType.ADD);
                        CalendarCellInfoList = WorkGroupCalendar.GetAll(workgroupIdItem, year);
                        if (CalendarCellInfoList.Count > 0)
                        {
                            int lastDayofEndMonth = 0;
                            switch (BLanguage.CurrentSystemLanguage)
                            {
                            case LanguagesName.Parsi:
                                PersianCalendar pCal = new PersianCalendar();
                                lastDayofEndMonth = 29;
                                if (pCal.IsLeapYear(year))
                                {
                                    lastDayofEndMonth = 30;
                                }
                                break;

                            case LanguagesName.English:
                                lastDayofEndMonth = 31;
                                break;
                            }
                            IList <CalendarCellInfo> CalendarCellInfoWithOutHoliday = WorkGroupCalendar.RepetitionPeriod(year, 1, 1, 12, lastDayofEndMonth, HolidayList, CalendarCellInfoList);
                            WorkGroupCalendar.SaveChanges(CalendarCellInfoWithOutHoliday, workgroupIdItem, year);
                        }
                    }
                }
                NHibernateSessionManager.Instance.CommitTransactionOn();
                //}
            }
            catch (Exception ex)
            {
                NHibernateSessionManager.Instance.RollbackTransactionOn();
                throw ex;
            }
        }