Пример #1
0
        public static hrHoliday GetHoliday(DateTime dt)
        {
            hrHoliday holiday = null;

            using (var serverContext = LightSwitchApplication.Application.Current.CreateDataWorkspace())
            {
                holiday = (hrHoliday)serverContext.ApplicationData.byHoliday(dt);
                return(holiday);
            }
        }
Пример #2
0
        public static void InsertWorkingHours(hrPerson person, DateTime dt)
        {
            hrWorkingHour wh = new hrWorkingHour();

            wh.EmpId        = person.Id;
            wh.hrPerson     = person;
            wh.UserName     = person.LSUser;
            wh.AccessCardID = person.AccessCardID;
            wh.DoorSysID    = person.DoorSysID;
            wh.WorkingDate  = dt;
            wh.RecYear      = dt.Year;
            wh.RecMonth     = dt.Month;
            wh.RecDay       = dt.Day;
            wh.DayOfWeek    = dt.DayOfWeek.ToString();
            wh.IsWorkingDay = IsStdWorkingDay(dt);
            wh.TotalHours   = 0;
            wh.TotalMinutes = 0;
            wh.Exception    = "NA";
            wh.Note         = "";
            if (IsStdWorkingDay(dt))
            {
                wh.StdWorkingHour      = 8;
                wh.AssignedWorkingHour = 8;
                wh.HourDiff            = -8;
            }
            else
            {
                wh.StdWorkingHour      = 0;
                wh.AssignedWorkingHour = 0;
                wh.HourDiff            = 0;
            }

            hrHoliday holiday = GetHoliday(dt);

            if (holiday != null)
            {
                //wh.Exception = "PH";
                wh.Note                = holiday.Name;
                wh.StdWorkingHour      = holiday.WorkingHour;
                wh.AssignedWorkingHour = holiday.WorkingHour;
                wh.HourDiff            = -1 * holiday.WorkingHour;
            }

            wh.MinuteDiff     = 0;
            wh.IsOTAccepted   = false;
            wh.OTAcceptedBy   = "";
            wh.AcceptedOTeHrs = 0;
            wh.AcceptedOTMin  = 0;
        }