Пример #1
0
        public static string GetTimeSheetCode(TimeSheetCatalog catalog)
        {
            switch (catalog)
            {
            case TimeSheetCatalog.WorkingDay:
                return(string.Empty);

            case TimeSheetCatalog.Holiday:
                return(string.Format("H{0:d2}", rand.Next(1, 9)));

            case TimeSheetCatalog.WeekendOff:
                return(string.Format("W{0:d2}", rand.Next(1, 9)));

            case TimeSheetCatalog.WeekendOffHalf:
                return(string.Format("WH{0:d1}", rand.Next(1, 9)));

            case TimeSheetCatalog.Leave:
                return(string.Format("L{0:d2}", rand.Next(1, 99)));

            case TimeSheetCatalog.BusinessTrip:
                return(string.Format("BT{0:d1}", rand.Next(1, 9)));

            case TimeSheetCatalog.Overtime:
                return(string.Format("OT{0:d1}", rand.Next(1, 9)));

            case TimeSheetCatalog.Shift:
                return(string.Format("S{0:d2}", rand.Next(1, 99)));

            default:
                return(string.Empty);
            }
        }
Пример #2
0
        public Color GetColorByTimeSheetCatalog(TimeSheetCatalog catalog)
        {
            if (this.CatalogColors != null && this.CatalogColors.Count > 0)
            {
                foreach (TimeSheetCatalogColor catColor in this.CatalogColors)
                {
                    if (catColor.Catalog == catalog)
                    {
                        return(catColor.Color);
                    }
                }
            }

            return(Color.Empty);
        }
Пример #3
0
        public TimeSheetDay(TimeSheetDay tsDay)
        {
            // Copy status
            _status  = tsDay.Status;
            _catalog = tsDay.Catalog;

            // Copy shifts
            if (tsDay.ShiftItems != null)
            {
                this.ShiftItems = new List <ShiftRecord>();
                this.ShiftItems.AddRange(tsDay.ShiftItems);
            }

            // Copy leaves
            if (tsDay.LeaveItems != null)
            {
                this.LeaveItems = new List <LeaveRecord>();
                this.LeaveItems.AddRange(tsDay.LeaveItems);
            }

            // Copy day
            _day = tsDay.Day;
        }
Пример #4
0
 public TimeSheetCatalogColor(TimeSheetCatalog catalog, Color color)
 {
     this.Catalog = catalog;
     this.Color   = color;
 }
Пример #5
0
        public static TimeSheetStatus GetTimeSheetStatus(TimeSheetCatalog catalog)
        {
            var st = TimeSheetStatus.None;

            switch (catalog)
            {
            case TimeSheetCatalog.WorkingDay:
                st = TimeSheetStatus.None;
                break;

            case TimeSheetCatalog.Holiday:
                st = TimeSheetStatus.None;
                break;

            case TimeSheetCatalog.WeekendOff:
                st = rand.Next(2) == 0 ? TimeSheetStatus.None : TimeSheetStatus.ApprovedLeave;
                break;

            case TimeSheetCatalog.WeekendOffHalf:
                st = rand.Next(2) == 0 ? TimeSheetStatus.None : TimeSheetStatus.ApprovedLeave;
                break;

            case TimeSheetCatalog.Leave:
                st = rand.Next(2) == 0 ? TimeSheetStatus.None : TimeSheetStatus.ApprovedLeave;
                break;

            case TimeSheetCatalog.BusinessTrip:
                return(TimeSheetStatus.None);

            case TimeSheetCatalog.Overtime:
                switch (rand.Next(3))
                {
                case 0:
                    st = TimeSheetStatus.None;
                    break;

                case 1:
                    st = TimeSheetStatus.ApprovedOT;
                    break;

                case 2:
                    st = TimeSheetStatus.UnApprovedOT;
                    break;
                }
                return(st);

            case TimeSheetCatalog.Shift:
                switch (rand.Next(3))
                {
                case 0:
                    st = TimeSheetStatus.None;
                    break;

                case 1:
                    st = TimeSheetStatus.ValidTS;
                    break;

                case 2:
                    st = TimeSheetStatus.InvalidTS;
                    break;
                }
                break;

            default:
                return(TimeSheetStatus.None);
            }

            return(st);
        }
Пример #6
0
 public TimeSheetType()
 {
     _id      = 0;
     _code    = string.Empty;
     _catalog = TimeSheetCatalog.None;
 }