Пример #1
0
        private void DoPunchIn(string enrollmentId)
        {
            PunchManager     punchManager = new PunchManager();
            UserVoiceManager mgr          = new UserVoiceManager();

            EmployeeEnrollment enrollment = mgr.GetEmployeeEnrollment(enrollmentId);

            if (enrollment != null)
            {
                Punch p = new Punch
                {
                    ClientId            = enrollment.ClientId,
                    EmployeeUid         = enrollment.EmployeeUid,
                    DepartmentUid       = enrollment.DepartmentUid,
                    PunchDateTime       = DateTime.Now,
                    PunchSourceTypeId   = (byte)1, //manual
                    PunchActivityTypeId = (byte)1, //work
                    PunchStatusTypeId   = (byte)1, //auto
                    LaborAssociations   = new System.Collections.Generic.List <LaborPunchAssociation>(),
                    IsActive            = true,
                    CanBeProcessed      = true,
                    UserKey             = Guid.Parse("C00E2729-9FFA-E511-8893-005056BD7869")
                };

                punchManager.InsertPunch(p);
            }
            else
            {
                throw new Exception("Enrollment record could not be read from cosmosdb");
            }
        }