コード例 #1
0
        protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L5EM_DE_1006 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Base();
            //Put your code here

            P_L5EM_GEFE_1150 par = new P_L5EM_GEFE_1150();
            par.EmployeeID = Parameter.CMN_BPT_EMP_EmployeeID;
            L5EM_GEFE_1150 employee = cls_Get_Employee_For_EmployeeID.Invoke(Connection, Transaction, par, securityTicket).Result;


            ORM_CMN_BPT_EMP_Employee whereInstanceEmployee = CSV2Core_MySQL.Support.SQLClassFilter.GetDefaultInstance <ORM_CMN_BPT_EMP_Employee>();
            whereInstanceEmployee.CMN_BPT_EMP_EmployeeID = employee.CMN_BPT_EMP_EmployeeID;
            CSV2Core_MySQL.Support.SQLClassFilter.Delete(Connection, Transaction, whereInstanceEmployee);


            var enterpriseService          = InfrastructureFactory.CreateEnterpriseService();
            KeyPerformanceIndicator action = new KeyPerformanceIndicator();
            action.PerformedByAccountID     = securityTicket.AccountID;
            action.PerformedByApplicationID = Parameter.ApplicationID;
            action.PerformedOn               = DateTime.Now;
            action.PerformedByTenantID       = securityTicket.TenantID;
            action.KeyPerformanceIndicatorID = Guid.Parse("4dda967a-5399-4929-afae-7af64699895b");
            action.Value = cls_Get_Employees_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result.Length;

            var result = enterpriseService.SendMessage(action.ToPayload(), KeyPerformanceIndicator.MESSAGE_TYPE, Parameter.ApplicationID, EMessageRecipient.CUSTOMER_MANAGEMENT_PLATFORM);

            ORM_CMN_BPT_EMP_EmploymentRelationship whereInstanceContract = CSV2Core_MySQL.Support.SQLClassFilter.GetDefaultInstance <ORM_CMN_BPT_EMP_EmploymentRelationship>();
            whereInstanceContract.CMN_BPT_EMP_EmploymentRelationshipID = employee.CMN_BPT_EMP_EmploymentRelationshipID;
            CSV2Core_MySQL.Support.SQLClassFilter.Delete(Connection, Transaction, whereInstanceContract);

            ORM_CMN_BPT_EMP_EmploymentRelationship_2_WorkingContract.Query searchInstanceWorkingContract = new ORM_CMN_BPT_EMP_EmploymentRelationship_2_WorkingContract.Query();
            searchInstanceWorkingContract.WorkingContract_RefID = employee.CMN_BPT_EMP_EmploymentRelationshipID;
            List <ORM_CMN_BPT_EMP_EmploymentRelationship_2_WorkingContract> employmentRelationshipToWorkingContract = ORM_CMN_BPT_EMP_EmploymentRelationship_2_WorkingContract.Query.Search(Connection, Transaction, searchInstanceWorkingContract);
            if (employmentRelationshipToWorkingContract != null)
            {
                foreach (var relationShipToContract in employmentRelationshipToWorkingContract)
                {
                    ORM_CMN_BPT_EMP_WorkingContract workingContractQuery = CSV2Core_MySQL.Support.SQLClassFilter.GetDefaultInstance <ORM_CMN_BPT_EMP_WorkingContract>();
                    workingContractQuery.CMN_BPT_EMP_WorkingContractID = relationShipToContract.WorkingContract_RefID;
                    CSV2Core_MySQL.Support.SQLClassFilter.Delete(Connection, Transaction, workingContractQuery);


                    ORM_CMN_BPT_EMP_WorkingContract_AllowedAbsenceReason allowedreasons = CSV2Core_MySQL.Support.SQLClassFilter.GetDefaultInstance <ORM_CMN_BPT_EMP_WorkingContract_AllowedAbsenceReason>();
                    allowedreasons.WorkingContract_RefID = relationShipToContract.WorkingContract_RefID;
                    CSV2Core_MySQL.Support.SQLClassFilter.Delete(Connection, Transaction, allowedreasons);
                }
            }



            return(returnValue);

            #endregion UserCode
        }
コード例 #2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5EM_SEA_1409 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();



            ORM_CMN_BPT_EMP_ContractAbsenceAdjustment adjustment = new ORM_CMN_BPT_EMP_ContractAbsenceAdjustment();
            if (Parameter.AdjustmentID != Guid.Empty)
            {
                var result = adjustment.Load(Connection, Transaction, Parameter.AdjustmentID);
                if (result.Status != FR_Status.Success || adjustment.CMN_BPT_EMP_ContractAbsenceAdjustmentID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            Guid workingContractTimeFrameID = Guid.Empty;
            var  timeFrame = cls_Get_CalculationTimeFramesForTenant.Invoke(Connection, Transaction, securityTicket).Result.Where(x => x.CalculationTimeframe_StartDate.Year == Parameter.Year).FirstOrDefault();
            if (timeFrame == null)
            {
                ORM_CMN_CAL_CalculationTimeframe timeFramePar = new ORM_CMN_CAL_CalculationTimeframe();
                timeFramePar.CalculationTimeframe_StartDate        = new DateTime(Parameter.Year, 1, 1);
                timeFramePar.CalculationTimefrate_EndDate          = new DateTime(0);
                timeFramePar.CalculationTimeframe_EstimatedEndDate = new DateTime(Parameter.Year, 12, 31);
                timeFramePar.IsCalculationTimeframe_Active         = false;
                timeFramePar.Tenant_RefID = securityTicket.TenantID;
                timeFramePar.Save(Connection, Transaction);
                L5EM_GEFT_0959[] employees = cls_Get_Employees_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result;
                foreach (var emp in employees)
                {
                    ORM_CMN_BPT_EMP_EmploymentRelationship_Timeframe workingContractTimeFrame = new ORM_CMN_BPT_EMP_EmploymentRelationship_Timeframe();
                    workingContractTimeFrame.CalculationTimeframe_RefID   = timeFramePar.CMN_CAL_CalculationTimeframeID;
                    workingContractTimeFrame.EmploymentRelationship_RefID = emp.CMN_BPT_EMP_EmploymentRelationshipID;
                    workingContractTimeFrame.Tenant_RefID = securityTicket.TenantID;
                    workingContractTimeFrame.Save(Connection, Transaction);
                    if (emp.CMN_BPT_EMP_EmployeeID == Parameter.EmployeeID)
                    {
                        workingContractTimeFrameID = workingContractTimeFrame.CMN_BPT_EMP_EmploymentRelationship_TimeframeID;
                    }
                }
            }
            else
            {
                P_L5EM_GERTFFETF_1129 param = new P_L5EM_GERTFFETF_1129();
                param.EmployeeID             = Parameter.EmployeeID;
                param.CalculationTimeframeID = timeFrame.CMN_CAL_CalculationTimeframeID;
                L5EM_GERTFFETF_1129 workingContractTimeFrame = cls_Get_EmploymentRelationshipTimeFrame_For_Employee_And_TimeFrame.Invoke(Connection, Transaction, param, securityTicket).Result;
                if (workingContractTimeFrame == null)
                {
                    P_L5EM_GEFE_1150 empPar = new P_L5EM_GEFE_1150();
                    empPar.EmployeeID = Parameter.EmployeeID;
                    L5EM_GEFE_1150 employee = cls_Get_Employee_For_EmployeeID.Invoke(Connection, Transaction, empPar, securityTicket).Result;
                    ORM_CMN_BPT_EMP_EmploymentRelationship_Timeframe workingContractTimeFrameNew = new ORM_CMN_BPT_EMP_EmploymentRelationship_Timeframe();
                    workingContractTimeFrameNew.CalculationTimeframe_RefID   = timeFrame.CMN_CAL_CalculationTimeframeID;
                    workingContractTimeFrameNew.EmploymentRelationship_RefID = employee.CMN_BPT_EMP_EmploymentRelationshipID;
                    workingContractTimeFrameNew.Tenant_RefID = securityTicket.TenantID;
                    workingContractTimeFrameNew.Save(Connection, Transaction);
                    workingContractTimeFrameID = workingContractTimeFrameNew.CMN_BPT_EMP_EmploymentRelationship_TimeframeID;
                }
                else
                {
                    workingContractTimeFrameID = workingContractTimeFrame.CMN_BPT_EMP_EmploymentRelationship_TimeframeID;
                }
            }
            adjustment.AbsenceTime_InMinutes = Parameter.AbsenceTimeInMinutes;
            adjustment.AdjustmentComment     = Parameter.AdjustmentComment;
            adjustment.AbsenceReason_RefID   = Parameter.AbsenceReasonID;
            adjustment.EmploymentRelationship_Timeframe_RefID = workingContractTimeFrameID;
            adjustment.IsManual = Parameter.isManual;
            adjustment.InternalAdjustmentType  = Parameter.InternalAdjustmentType;
            adjustment.TriggeringAccount_RefID = securityTicket.AccountID;
            adjustment.AdjustmentDate          = Parameter.AdjustmentDate;
            adjustment.Tenant_RefID            = securityTicket.TenantID;
            adjustment.IsDeleted = Parameter.isDeleted;
            adjustment.Save(Connection, Transaction);
            returnValue.Result = adjustment.CMN_BPT_EMP_ContractAbsenceAdjustmentID;
            //Put your code here
            return(returnValue);

            #endregion UserCode
        }