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

            ORM_CMN_CAL_CalendarInstance CalendarInstance = new ORM_CMN_CAL_CalendarInstance();
            CalendarInstance.WeekStartsOnDay = 0;
            CalendarInstance.Tenant_RefID    = securityTicket.TenantID;
            CalendarInstance.Save(Connection, Transaction);

            ORM_CMN_BPT_STA_SettingProfile profile = new ORM_CMN_BPT_STA_SettingProfile();
            profile.IsLeaveTimeCalculated_InDays = true;
            L2LN_GAL_1526[] AllLanguages = cls_Get_All_Languages.Invoke(Connection, Transaction, securityTicket).Result;
            profile.StafMember_Caption = new Dict();
            profile.StafMember_Caption.DictionaryID = Guid.NewGuid();

            if (AllLanguages != null)
            {
                foreach (var lang in AllLanguages)
                {
                    if (lang.ISO_639_1.ToUpper() == "DE")
                    {
                        profile.StafMember_Caption.AddEntry(lang.CMN_LanguageID, "Mitarbeiter");
                    }
                    if (lang.ISO_639_1.ToUpper() == "EN")
                    {
                        profile.StafMember_Caption.AddEntry(lang.CMN_LanguageID, "Staff");
                    }
                }
            }
            profile.Tenant_RefID = securityTicket.TenantID;
            profile.Save(Connection, Transaction);

            ORM_CMN_Tenant tenant = new ORM_CMN_Tenant();
            if (securityTicket.TenantID != Guid.Empty)
            {
                var result = tenant.Load(Connection, Transaction, securityTicket.TenantID);
                if (result.Status != FR_Status.Success || tenant.CMN_TenantID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            tenant.CMN_BPT_STA_SettingProfile_RefID = profile.CMN_BPT_STA_SettingProfileID;
            tenant.CMN_CAL_CalendarInstance_RefID   = CalendarInstance.CMN_CAL_CalendarInstanceID;
            tenant.Save(Connection, Transaction);
            return(returnValue);

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



            ORM_CMN_BPT_STA_SettingProfile profile = new ORM_CMN_BPT_STA_SettingProfile();
            if (Parameter.CMN_BPT_STA_SettingProfileID != Guid.Empty)
            {
                var result = profile.Load(Connection, Transaction, Parameter.CMN_BPT_STA_SettingProfileID);
                if (result.Status != FR_Status.Success || profile.CMN_BPT_STA_SettingProfileID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            profile.IsLeaveTimeCalculated_InDays  = Parameter.IsLeaveTimeCalculated_InDays;
            profile.IsLeaveTimeCalculated_InHours = Parameter.IsLeaveTimeCalculated_InHours;
            profile.StafMember_Caption            = Parameter.StafMember_Caption;
            profile.Default_SurchargeCalculation_UseAccumulated = Parameter.Default_SurchargeCalculation_UseAccumulated;
            profile.Default_SurchargeCalculation_UseMaximum     = Parameter.Default_SurchargeCalculation_UseMaximum;
            profile.Save(Connection, Transaction);

            ORM_CMN_Tenant item = new ORM_CMN_Tenant();

            var result2 = item.Load(Connection, Transaction, securityTicket.TenantID);
            if (result2.Status != FR_Status.Success || item.CMN_TenantID == Guid.Empty)
            {
                item.CMN_TenantID = securityTicket.TenantID;
            }
            item.IsUsing_WorkAreas  = Parameter.IsUsing_Offices;
            item.IsUsing_WorkAreas  = Parameter.IsUsing_WorkAreas;
            item.IsUsing_Workplaces = Parameter.IsUsing_Workplaces;


            item.Save(Connection, Transaction);

            returnValue.Result = item.CMN_TenantID;
            return(returnValue);

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

            ORM_CMN_CAL_APR_ResponsiblePerson responsiblePersons = new ORM_CMN_CAL_APR_ResponsiblePerson();
            if (Parameter.CMN_CAL_APR_ResponsiblePersonID != Guid.Empty)
            {
                var result = responsiblePersons.Load(Connection, Transaction, Parameter.CMN_CAL_APR_ResponsiblePersonID);
                if (result.Status != FR_Status.Success || responsiblePersons.CMN_CAL_APR_ResponsiblePersonID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            responsiblePersons.NumberOfResponsiblePersonsRequiredToApprove = Parameter.NumberOfResponsiblePersonsRequiredToApprove;
            responsiblePersons.Tenant_RefID = securityTicket.TenantID;
            responsiblePersons.Save(Connection, Transaction);

            ORM_CMN_CAL_Event_ApprovalProcess_Type eventApprovalProcessType = new ORM_CMN_CAL_Event_ApprovalProcess_Type();
            if (Parameter.CMN_CAL_Event_ApprovalProcess_TypeID != Guid.Empty)
            {
                var result = eventApprovalProcessType.Load(Connection, Transaction, Parameter.CMN_CAL_Event_ApprovalProcess_TypeID);
                if (result.Status != FR_Status.Success || eventApprovalProcessType.CMN_CAL_Event_ApprovalProcess_TypeID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            eventApprovalProcessType.Tenant_RefID                   = securityTicket.TenantID;
            eventApprovalProcessType.IsResponsiblePersonBased       = true;
            eventApprovalProcessType.IfResponsiblePersonBased_RefID = responsiblePersons.CMN_CAL_APR_ResponsiblePersonID;
            eventApprovalProcessType.Save(Connection, Transaction);

            ORM_CMN_Tenant_ActiveApprovalProcessType activeApprovalProcessType = new ORM_CMN_Tenant_ActiveApprovalProcessType();
            if (Parameter.CMN_Tenant_ActiveApprovalProcessTypeID != Guid.Empty)
            {
                var result = activeApprovalProcessType.Load(Connection, Transaction, Parameter.CMN_Tenant_ActiveApprovalProcessTypeID);
                if (result.Status != FR_Status.Success || activeApprovalProcessType.CMN_Tenant_ActiveApprovalProcessTypeID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            activeApprovalProcessType.Tenant_RefID = securityTicket.TenantID;
            activeApprovalProcessType.IsActive     = true;
            activeApprovalProcessType.CMN_CAL_Event_ApprovalProcess_Type_RefID = eventApprovalProcessType.CMN_CAL_Event_ApprovalProcess_TypeID;
            activeApprovalProcessType.Save(Connection, Transaction);

            ORM_CMN_Tenant tenantItem = new ORM_CMN_Tenant();
            if (securityTicket.TenantID != Guid.Empty)
            {
                var result = tenantItem.Load(Connection, Transaction, securityTicket.TenantID);
                if (result.Status != FR_Status.Success || tenantItem.CMN_TenantID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            tenantItem.IsUsing_Offices     = Parameter.IsUsing_Offices;
            tenantItem.IsUsing_WorkAreas   = Parameter.IsUsing_WorkAreas;
            tenantItem.IsUsing_Workplaces  = Parameter.IsUsing_Workplaces;
            tenantItem.IsUsing_CostCenters = Parameter.IsUsing_CostCenters;
            tenantItem.Save(Connection, Transaction);

            return(returnValue);

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



            if (Parameter.CalendarInstanceID == Guid.Empty)
            {
                ORM_CMN_Tenant tenant = new ORM_CMN_Tenant();
                if (securityTicket.TenantID != Guid.Empty)
                {
                    var result = tenant.Load(Connection, Transaction, securityTicket.TenantID);
                    if (result.Status != FR_Status.Success || tenant.CMN_TenantID == Guid.Empty)
                    {
                        var error = new FR_Guid();
                        error.ErrorMessage = "No Such ID";
                        error.Status       = FR_Status.Error_Internal;
                        return(error);
                    }
                }
                if (tenant.CMN_CAL_CalendarInstance_RefID == Guid.Empty)
                {
                    ORM_CMN_CAL_CalendarInstance instance = new ORM_CMN_CAL_CalendarInstance();
                    instance.WeekStartsOnDay = 1;
                    instance.Save(Connection, Transaction);
                    tenant.CMN_CAL_CalendarInstance_RefID = instance.CMN_CAL_CalendarInstanceID;
                    tenant.Save(Connection, Transaction);
                }
            }

            ORM_CMN_CAL_Event calendarEvent = new ORM_CMN_CAL_Event();
            if (Parameter.CMN_CAL_EventID != Guid.Empty)
            {
                var result = calendarEvent.Load(Connection, Transaction, Parameter.CMN_CAL_EventID);
                if (result.Status != FR_Status.Success || calendarEvent.CMN_CAL_EventID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            calendarEvent.CalendarInstance_RefID = Parameter.CalendarInstanceID;
            calendarEvent.EndTime             = Parameter.EndTime;
            calendarEvent.IsRepetitive        = Parameter.IsRepetitive;
            calendarEvent.R_EventDuration_sec = Parameter.R_EventDuration_sec;

            calendarEvent.StartTime              = Parameter.StartTime;
            calendarEvent.Tenant_RefID           = securityTicket.TenantID;
            calendarEvent.CalendarInstance_RefID = Parameter.CalendarInstanceID;

            if (Parameter.IsRepetitive)
            {
                ORM_CMN_CAL_Repetition repetition = new ORM_CMN_CAL_Repetition();
                if (Parameter.CMN_CAL_RepetitionID != Guid.Empty)
                {
                    var result = repetition.Load(Connection, Transaction, Parameter.CMN_CAL_RepetitionID);
                    if (result.Status != FR_Status.Success || repetition.CMN_CAL_RepetitionID == Guid.Empty)
                    {
                        var error = new FR_Guid();
                        error.ErrorMessage = "No Such ID";
                        error.Status       = FR_Status.Error_Internal;
                        return(error);
                    }
                }
                repetition.IsDaily          = Parameter.IsDaily;
                repetition.IsMonthly        = Parameter.IsMonthly;
                repetition.IsWeekly         = Parameter.IsWeekly;
                repetition.IsYearly         = Parameter.IsYearly;
                repetition.R_CronExpression = Parameter.R_CronExpression;
                repetition.Tenant_RefID     = securityTicket.TenantID;
                repetition.Save(Connection, Transaction);
                calendarEvent.IsRepetitive     = true;
                calendarEvent.Repetition_RefID = repetition.CMN_CAL_RepetitionID;

                ORM_CMN_CAL_Repetition_Ranx repetitionRange = new ORM_CMN_CAL_Repetition_Ranx();
                if (Parameter.repetitionRangesCMN_CAL_Repetition_RangeID != Guid.Empty)
                {
                    var result = repetitionRange.Load(Connection, Transaction, Parameter.repetitionRangesCMN_CAL_Repetition_RangeID);
                    if (result.Status != FR_Status.Success || repetitionRange.CMN_CAL_Repetition_RangeID == Guid.Empty)
                    {
                        var error = new FR_Guid();
                        error.ErrorMessage = "No Such ID";
                        error.Status       = FR_Status.Error_Internal;
                        return(error);
                    }
                }
                repetitionRange.End_AfterSpecifiedOccurrences = Parameter.repetitionRangesEnd_AfterSpecifiedOccurrences;
                repetitionRange.End_ByDate            = Parameter.repetitionRangesEnd_ByDate;
                repetitionRange.HasEndType_DateTime   = Parameter.repetitionRangesHasEndType_DateTime;
                repetitionRange.HasEndType_NoEndDate  = Parameter.repetitionRangesHasEndType_NoEndDate;
                repetitionRange.HasEndType_Occurrence = Parameter.repetitionRangesHasEndType_Occurrence;
                repetitionRange.Repetition_RefID      = repetition.CMN_CAL_RepetitionID;
                repetitionRange.Tenant_RefID          = securityTicket.TenantID;
                repetitionRange.Save(Connection, Transaction);

                if (Parameter.IsDaily)
                {
                    ORM_CMN_CAL_RepetitionPatterns_Daily daily = new ORM_CMN_CAL_RepetitionPatterns_Daily();
                    if (Parameter.dailyCMN_CAL_RepetitionPattern_DailyID != Guid.Empty)
                    {
                        var result = daily.Load(Connection, Transaction, Parameter.dailyCMN_CAL_RepetitionPattern_DailyID);
                        if (result.Status != FR_Status.Success || daily.CMN_CAL_RepetitionPattern_DailyID == Guid.Empty)
                        {
                            var error = new FR_Guid();
                            error.ErrorMessage = "No Such ID";
                            error.Status       = FR_Status.Error_Internal;
                            return(error);
                        }
                    }
                    daily.Repetition_EveryNumberOfDays = Parameter.dailyRepetition_EveryNumberOfDays;
                    daily.Repetition_RefID             = repetition.CMN_CAL_RepetitionID;
                    daily.Tenant_RefID = securityTicket.TenantID;
                    daily.Save(Connection, Transaction);
                }
                else if (Parameter.IsWeekly)
                {
                    ORM_CMN_CAL_RepetitionPatterns_Weekly weekly = new ORM_CMN_CAL_RepetitionPatterns_Weekly();
                    if (Parameter.weeklyCMN_CAL_RepetitionPattern_WeeklyID != Guid.Empty)
                    {
                        var result = weekly.Load(Connection, Transaction, Parameter.weeklyCMN_CAL_RepetitionPattern_WeeklyID);
                        if (result.Status != FR_Status.Success || weekly.CMN_CAL_RepetitionPattern_WeeklyID == Guid.Empty)
                        {
                            var error = new FR_Guid();
                            error.ErrorMessage = "No Such ID";
                            error.Status       = FR_Status.Error_Internal;
                            return(error);
                        }
                    }
                    weekly.HasRepeatingOn_Fridays        = Parameter.weeklyHasRepeatingOn_Fridays;
                    weekly.HasRepeatingOn_Mondays        = Parameter.weeklyHasRepeatingOn_Mondays;
                    weekly.HasRepeatingOn_Saturdays      = Parameter.weeklyHasRepeatingOn_Saturdays;
                    weekly.HasRepeatingOn_Sundays        = Parameter.weeklyHasRepeatingOn_Sundays;
                    weekly.HasRepeatingOn_Thursdays      = Parameter.weeklyHasRepeatingOn_Thursdays;
                    weekly.HasRepeatingOn_Tuesdays       = Parameter.weeklyHasRepeatingOn_Tuesdays;
                    weekly.HasRepeatingOn_Wednesdays     = Parameter.weeklyHasRepeatingOn_Wednesdays;
                    weekly.Repetition_EveryNumberOfWeeks = Parameter.weeklyRepetition_EveryNumberOfWeeks;
                    weekly.Repetition_RefID = repetition.CMN_CAL_RepetitionID;
                    weekly.Tenant_RefID     = securityTicket.TenantID;
                    weekly.Save(Connection, Transaction);
                }
                else if (Parameter.IsMonthly)
                {
                    ORM_CMN_CAL_RepetitionPatterns_Monthly monthly = new ORM_CMN_CAL_RepetitionPatterns_Monthly();
                    if (Parameter.monthlyCMN_CAL_RepetitionPattern_MonthlyID != Guid.Empty)
                    {
                        var result = monthly.Load(Connection, Transaction, Parameter.monthlyCMN_CAL_RepetitionPattern_MonthlyID);
                        if (result.Status != FR_Status.Success || monthly.CMN_CAL_RepetitionPattern_MonthlyID == Guid.Empty)
                        {
                            var error = new FR_Guid();
                            error.ErrorMessage = "No Such ID";
                            error.Status       = FR_Status.Error_Internal;
                            return(error);
                        }
                    }
                    monthly.Repetition_EveryNumberOfMonths = Parameter.monthlyRepetition_EveryNumberOfMonths;
                    monthly.Repetition_RefID = repetition.CMN_CAL_RepetitionID;
                    monthly.Tenant_RefID     = securityTicket.TenantID;
                    if (Parameter.monthlyIsRelative)
                    {
                        monthly.IsFixed    = false;
                        monthly.IsRelative = true;
                        ORM_CMN_CAL_RepetitionPatterns_Relative relative = new ORM_CMN_CAL_RepetitionPatterns_Relative();
                        if (Parameter.relativeCMN_CAL_RepetitionPattern_RelativeID != Guid.Empty)
                        {
                            var result = relative.Load(Connection, Transaction, Parameter.relativeCMN_CAL_RepetitionPattern_RelativeID);
                            if (result.Status != FR_Status.Success || relative.CMN_CAL_RepetitionPattern_RelativeID == Guid.Empty)
                            {
                                var error = new FR_Guid();
                                error.ErrorMessage = "No Such ID";
                                error.Status       = FR_Status.Error_Internal;
                                return(error);
                            }
                        }
                        relative.IsFriday     = Parameter.relativeIsFriday;
                        relative.IsMonday     = Parameter.relativeIsMonday;
                        relative.IsSaturday   = Parameter.relativeIsSaturday;
                        relative.IsSunday     = Parameter.relativeIsSunday;
                        relative.IsThursday   = Parameter.relativeIsThursday;
                        relative.IsTuesday    = Parameter.relativeIsTuesday;
                        relative.IsWednesday  = Parameter.relativeIsWednesday;
                        relative.IsWeekDay    = Parameter.relativeIsWeekDay;
                        relative.IsWeekendDay = Parameter.relativeIsWeekendDay;
                        relative.Ordinal      = Parameter.relativeOrdinal;
                        relative.Tenant_RefID = securityTicket.TenantID;
                        relative.Save(Connection, Transaction);
                        monthly.IfRelative_RepetitionPattern_RefID = relative.CMN_CAL_RepetitionPattern_RelativeID;
                    }
                    else
                    {
                        monthly.IsRelative         = false;
                        monthly.IsFixed            = true;
                        monthly.IfFixed_DayOfMonth = Parameter.monthlyIfFixed_DayOfMonth;
                    }
                    monthly.Save(Connection, Transaction);
                }
                else
                {
                    ORM_CMN_CAL_RepetitionPatterns_Yearly yearly = new ORM_CMN_CAL_RepetitionPatterns_Yearly();
                    if (Parameter.yearlyCMN_CAL_RepetitionPattern_YearlyID != Guid.Empty)
                    {
                        var result = yearly.Load(Connection, Transaction, Parameter.yearlyCMN_CAL_RepetitionPattern_YearlyID);
                        if (result.Status != FR_Status.Success || yearly.CMN_CAL_RepetitionPattern_YearlyID == Guid.Empty)
                        {
                            var error = new FR_Guid();
                            error.ErrorMessage = "No Such ID";
                            error.Status       = FR_Status.Error_Internal;
                            return(error);
                        }
                    }
                    yearly.Repetition_EveryNumberOfYears = Parameter.yearlyRepetition_EveryNumberOfYears;
                    yearly.Repetition_Month = Parameter.yearlyRepetition_Month;
                    yearly.Repetition_RefID = repetition.CMN_CAL_RepetitionID;
                    yearly.Tenant_RefID     = securityTicket.TenantID;
                    if (Parameter.yearlyIsRelative)
                    {
                        yearly.IsRelative = true;
                        yearly.IsFixed    = false;
                        ORM_CMN_CAL_RepetitionPatterns_Relative relative = new ORM_CMN_CAL_RepetitionPatterns_Relative();
                        if (Parameter.relativeCMN_CAL_RepetitionPattern_RelativeID != Guid.Empty)
                        {
                            var result = relative.Load(Connection, Transaction, Parameter.relativeCMN_CAL_RepetitionPattern_RelativeID);
                            if (result.Status != FR_Status.Success || relative.CMN_CAL_RepetitionPattern_RelativeID == Guid.Empty)
                            {
                                var error = new FR_Guid();
                                error.ErrorMessage = "No Such ID";
                                error.Status       = FR_Status.Error_Internal;
                                return(error);
                            }
                        }
                        relative.IsFriday     = Parameter.relativeIsFriday;
                        relative.IsMonday     = Parameter.relativeIsMonday;
                        relative.IsSaturday   = Parameter.relativeIsSaturday;
                        relative.IsSunday     = Parameter.relativeIsSunday;
                        relative.IsThursday   = Parameter.relativeIsThursday;
                        relative.IsTuesday    = Parameter.relativeIsTuesday;
                        relative.IsWednesday  = Parameter.relativeIsWednesday;
                        relative.IsWeekDay    = Parameter.relativeIsWeekDay;
                        relative.IsWeekendDay = Parameter.relativeIsWeekendDay;
                        relative.Ordinal      = Parameter.relativeOrdinal;
                        relative.Tenant_RefID = securityTicket.TenantID;

                        relative.Save(Connection, Transaction);
                        yearly.IfRelative_RepetitionPattern_RefID = relative.CMN_CAL_RepetitionPattern_RelativeID;
                        yearly.IsFixed = false;
                    }
                    else
                    {
                        yearly.IsRelative         = false;
                        yearly.IsFixed            = true;
                        yearly.IfFixed_DayOfMonth = Parameter.yearlyIfFixed_DayOfMonth;
                    }
                    yearly.Save(Connection, Transaction);
                }
            }
            else
            {
                calendarEvent.IsRepetitive     = false;
                calendarEvent.Repetition_RefID = Guid.Empty;
            }

            calendarEvent.Save(Connection, Transaction);

            ORM_CMN_STR_SCE_StructureCalendarEvent structureEvent = new ORM_CMN_STR_SCE_StructureCalendarEvent();
            if (Parameter.CMN_STR_SCE_StructureCalendarEventID != Guid.Empty)
            {
                var result = structureEvent.Load(Connection, Transaction, Parameter.CMN_STR_SCE_StructureCalendarEventID);
                if (result.Status != FR_Status.Success || structureEvent.CMN_STR_SCE_StructureCalendarEventID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }

            if (Parameter.IsHavingCapacityRestriction)
            {
                ORM_CMN_STR_SCE_CapacityRestriction capacityRestriction = new ORM_CMN_STR_SCE_CapacityRestriction();
                if (Parameter.CMN_STR_SCE_CapacityRestrictionID != Guid.Empty)
                {
                    var result = capacityRestriction.Load(Connection, Transaction, Parameter.CMN_STR_SCE_CapacityRestrictionID);
                    if (result.Status != FR_Status.Success || capacityRestriction.CMN_STR_SCE_CapacityRestrictionID == Guid.Empty)
                    {
                        var error = new FR_Guid();
                        error.ErrorMessage = "No Such ID";
                        error.Status       = FR_Status.Error_Internal;
                        return(error);
                    }
                }
                capacityRestriction.IsValueCalculated_InHeadCount    = Parameter.IsValueCalculated_InHeadCount;
                capacityRestriction.IsValueCalculated_InPercentage   = Parameter.IsValueCalculated_InPercentage;
                capacityRestriction.IsValueCalculated_InWorkingHours = Parameter.IsValueCalculated_InWorkingHours;
                capacityRestriction.CapacityRestrictionType_RefID    = Parameter.CMN_STR_SCE_CapacityRestriction_TypeID;
                capacityRestriction.Tenant_RefID    = securityTicket.TenantID;
                capacityRestriction.ValueCalculated = Parameter.ValueCalculated;
                capacityRestriction.Save(Connection, Transaction);
                structureEvent.IfHavingCapacityRestriction_Restriction_RefID = capacityRestriction.CMN_STR_SCE_CapacityRestrictionID;
                structureEvent.IsHavingCapacityRestriction = true;
            }
            else
            {
                structureEvent.IsHavingCapacityRestriction = false;
            }

            var eventType = new ORM_CMN_STR_SCE_StructureCalendarEvent_Type();

            var resultForType = eventType.Load(Connection, Transaction, Parameter.StructureCalendarEvent_Type_RefID);
            if (resultForType.Status != FR_Status.Success || eventType.CMN_STR_SCE_StructureCalendarEvent_TypeID == Guid.Empty)
            {
                var error = new FR_Guid();
                error.ErrorMessage = "No Such ID";
                error.Status       = FR_Status.Error_Internal;
                return(error);
            }



            structureEvent.IsWorkingDayEvent                 = eventType.IsWorkingDay;
            structureEvent.IsWorkingHalfDayEvent             = eventType.IsHalfWorkingDay;
            structureEvent.IsNonWorkingDay                   = eventType.IsNonWorkingDay;
            structureEvent.CMN_CAL_Event_RefID               = calendarEvent.CMN_CAL_EventID;
            structureEvent.StructureCalendarEvent_Type_RefID = Parameter.StructureCalendarEvent_Type_RefID;
            structureEvent.R_CalendarInstance_RefID          = Parameter.CalendarInstanceID;
            structureEvent.StructureEvent_Description        = Parameter.StructureEvent_Description;
            structureEvent.StructureEvent_Name               = Parameter.StructureEvent_Name;
            structureEvent.Tenant_RefID = securityTicket.TenantID;
            structureEvent.IsEvent_ImportedFromTemplate = Parameter.IsEvent_ImportedFromTemplate;
            structureEvent.IsBusinessDay = Parameter.IsBusinessDay;
            structureEvent.Save(Connection, Transaction);
            returnValue.Result = structureEvent.CMN_STR_SCE_StructureCalendarEventID;


            ORM_CMN_STR_SCE_ForbiddenLeaveType whereInstanceForbiddenLeaveType = CSV2Core_MySQL.Support.SQLClassFilter.GetDefaultInstance <ORM_CMN_STR_SCE_ForbiddenLeaveType>();
            whereInstanceForbiddenLeaveType.CMN_STR_SCE_StructureCalendarEvent_RefID = structureEvent.CMN_STR_SCE_StructureCalendarEventID;
            CSV2Core_MySQL.Support.SQLClassFilter.Delete(Connection, Transaction, whereInstanceForbiddenLeaveType);

            foreach (var forbidenLeaveType in Parameter.forbidenLeaveTypes)
            {
                ORM_CMN_STR_SCE_ForbiddenLeaveType item = new ORM_CMN_STR_SCE_ForbiddenLeaveType();
                if (forbidenLeaveType.CMN_STR_SCE_ForbiddenLeaveTypeID != Guid.Empty)
                {
                    var result = item.Load(Connection, Transaction, forbidenLeaveType.CMN_STR_SCE_ForbiddenLeaveTypeID);
                    if (result.Status != FR_Status.Success || item.CMN_STR_SCE_ForbiddenLeaveTypeID == Guid.Empty)
                    {
                        var error = new FR_Guid();
                        error.ErrorMessage = "No Such ID";
                        error.Status       = FR_Status.Error_Internal;
                        return(error);
                    }
                }
                item.CMN_BPT_STA_AbsenceReason_RefID          = forbidenLeaveType.CMN_BPT_STA_AbsenceReasonID;
                item.CMN_STR_SCE_StructureCalendarEvent_RefID = structureEvent.CMN_STR_SCE_StructureCalendarEventID;
                item.Tenant_RefID = securityTicket.TenantID;
                item.Save(Connection, Transaction);
            }
            return(returnValue);


            #endregion UserCode
        }