Beispiel #1
0
        protected static FR_L5DWS_GEWTPFH_1725 Execute(DbConnection Connection, DbTransaction Transaction, P_L5DWS_GEWTPFH_1725 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_L5DWS_GEWTPFH_1725();
            //Put your code here

            ORM_CMN_BPT_EMP_EffectiveWorkTime_Position.Query positionQuery = new ORM_CMN_BPT_EMP_EffectiveWorkTime_Position.Query();
            positionQuery.EffectiveWorkTime_Header_RefID = Parameter.EffectiveWorkTime_Header_RefID;
            positionQuery.IsDeleted    = false;
            positionQuery.Tenant_RefID = securityTicket.TenantID;

            var positions = ORM_CMN_BPT_EMP_EffectiveWorkTime_Position.Query.Search(Connection, Transaction, positionQuery);

            List <L5DWS_GEWTFD_1648_Position> listOfPositions = new List <L5DWS_GEWTFD_1648_Position>();

            foreach (var position in positions)
            {
                L5DWS_GEWTFD_1648_Position newPosition = new L5DWS_GEWTFD_1648_Position();
                newPosition.Activity_RefID = position.Activity_RefID;
                newPosition.CMN_BPT_EMP_EffectiveWorkTime_PositionID = position.CMN_BPT_EMP_EffectiveWorkTime_PositionID;
                newPosition.CMN_BPT_EMP_Employe_RefID = position.CMN_BPT_EMP_Employe_RefID;
                newPosition.CMN_BPT_EMP_Employee_LeaveRequest_RefID = position.CMN_BPT_EMP_Employee_LeaveRequest_RefID;
                newPosition.EffectiveWorkTime_Header_RefID          = position.EffectiveWorkTime_Header_RefID;
                newPosition.SourceOfEntry            = position.SourceOfEntry;
                newPosition.Workplace_RefID          = position.Workplace_RefID;
                newPosition.WorkTime_Duration_in_sec = position.WorkTime_Duration_in_sec;
                newPosition.WorkTime_StartTime       = position.WorkTime_StartTime;


                if (position.CMN_BPT_EMP_Employee_LeaveRequest_RefID != Guid.Empty)
                {
                    ORM_CMN_BPT_EMP_Employee_LeaveRequest.Query lrQuery = new ORM_CMN_BPT_EMP_Employee_LeaveRequest.Query();
                    lrQuery.CMN_BPT_EMP_Employee_LeaveRequestID = position.CMN_BPT_EMP_Employee_LeaveRequest_RefID;
                    lrQuery.IsDeleted    = false;
                    lrQuery.Tenant_RefID = securityTicket.TenantID;

                    var leaveRequest = ORM_CMN_BPT_EMP_Employee_LeaveRequest.Query.Search(Connection, Transaction, lrQuery).FirstOrDefault();
                    newPosition.AbsenceReason_RefID = leaveRequest.CMN_BPT_STA_AbsenceReason_RefID;
                }
                else
                {
                    newPosition.AbsenceReason_RefID = Guid.Empty;
                }


                listOfPositions.Add(newPosition);
            }

            returnValue.Result = new L5DWS_GEWTPFH_1725();
            returnValue.Result.EffectiveWorkTimePositions = listOfPositions.ToArray();

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_L5DWS_GEWTFDAE_0953 Execute(DbConnection Connection, DbTransaction Transaction, P_L5DWS_GEWTFDAE_0953 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_L5DWS_GEWTFDAE_0953();
            //Put your code here

            ORM_CMN_BPT_EMP_EffectiveWorkTime_Header.Query effectiveWorkTimeHeaderQuery = new ORM_CMN_BPT_EMP_EffectiveWorkTime_Header.Query();
            effectiveWorkTimeHeaderQuery.EffectiveBusinessDay = Parameter.currentDate.Date;
            effectiveWorkTimeHeaderQuery.Employee_RefID       = Parameter.EmployeeID;
            effectiveWorkTimeHeaderQuery.IsDeleted            = false;
            effectiveWorkTimeHeaderQuery.Tenant_RefID         = securityTicket.TenantID;


            var header = ORM_CMN_BPT_EMP_EffectiveWorkTime_Header.Query.Search(Connection, Transaction, effectiveWorkTimeHeaderQuery).FirstOrDefault();

            if (header == null)
            {
                returnValue.Result = new L5DWS_GEWTFDAE_0953();
                returnValue.Result.EffectiveWorkTime = null;
                return(returnValue);
            }

            L5DWS_GEWTFD_1648 resultItem = new L5DWS_GEWTFD_1648();
            resultItem.CMN_STR_PPS_EffectiveWorkTime_HeaderID = header.CMN_STR_PPS_EffectiveWorkTime_HeaderID;
            resultItem.BreakDurationTime_in_sec    = header.BreakDurationTime_in_sec;
            resultItem.ContractWorkerText          = header.ContractWorkerText;
            resultItem.EffectiveBusinessDay        = header.EffectiveBusinessDay;
            resultItem.Employee_RefID              = header.Employee_RefID;
            resultItem.IsBreakTimeManualySpecified = header.IsBreakTimeManualySpecified;
            resultItem.SheduleBreakTemplate_RefID  = header.SheduleBreakTemplate_RefID;
            resultItem.WorktimeComment             = header.WorktimeComment;

            ORM_CMN_BPT_EMP_EffectiveWorkTime_Position.Query positionQuery = new ORM_CMN_BPT_EMP_EffectiveWorkTime_Position.Query();
            positionQuery.EffectiveWorkTime_Header_RefID = header.CMN_STR_PPS_EffectiveWorkTime_HeaderID;
            positionQuery.IsDeleted    = false;
            positionQuery.Tenant_RefID = securityTicket.TenantID;

            var positions = ORM_CMN_BPT_EMP_EffectiveWorkTime_Position.Query.Search(Connection, Transaction, positionQuery);

            List <L5DWS_GEWTFD_1648_Position> listOfPositions = new List <L5DWS_GEWTFD_1648_Position>();

            foreach (var position in positions)
            {
                L5DWS_GEWTFD_1648_Position newPosition = new L5DWS_GEWTFD_1648_Position();
                newPosition.Activity_RefID = position.Activity_RefID;
                newPosition.CMN_BPT_EMP_EffectiveWorkTime_PositionID = position.CMN_BPT_EMP_EffectiveWorkTime_PositionID;
                newPosition.CMN_BPT_EMP_Employe_RefID = position.CMN_BPT_EMP_Employe_RefID;
                newPosition.CMN_BPT_EMP_Employee_LeaveRequest_RefID = position.CMN_BPT_EMP_Employee_LeaveRequest_RefID;
                newPosition.EffectiveWorkTime_Header_RefID          = position.EffectiveWorkTime_Header_RefID;
                newPosition.SourceOfEntry            = position.SourceOfEntry;
                newPosition.Workplace_RefID          = position.Workplace_RefID;
                newPosition.WorkTime_Duration_in_sec = position.WorkTime_Duration_in_sec;
                newPosition.WorkTime_StartTime       = position.WorkTime_StartTime;

                if (position.CMN_BPT_EMP_Employee_LeaveRequest_RefID != Guid.Empty)
                {
                    ORM_CMN_BPT_EMP_Employee_LeaveRequest.Query lrQuery = new ORM_CMN_BPT_EMP_Employee_LeaveRequest.Query();
                    lrQuery.CMN_BPT_EMP_Employee_LeaveRequestID = position.CMN_BPT_EMP_Employee_LeaveRequest_RefID;
                    lrQuery.IsDeleted    = false;
                    lrQuery.Tenant_RefID = securityTicket.TenantID;

                    var leaveRequest = ORM_CMN_BPT_EMP_Employee_LeaveRequest.Query.Search(Connection, Transaction, lrQuery).FirstOrDefault();
                    newPosition.AbsenceReason_RefID = leaveRequest.CMN_BPT_STA_AbsenceReason_RefID;
                }
                else
                {
                    newPosition.AbsenceReason_RefID = Guid.Empty;
                }

                listOfPositions.Add(newPosition);
            }

            resultItem.Positions = listOfPositions.ToArray();

            returnValue.Result = new L5DWS_GEWTFDAE_0953();
            returnValue.Result.EffectiveWorkTime = resultItem;

            return(returnValue);

            #endregion UserCode
        }