protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L5TW_DTW_1325 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Base(); var item = new ORM_CMN_STR_Profession(); if (Parameter.CMN_STR_ProfessionID != Guid.Empty) { var result = item.Load(Connection, Transaction, Parameter.CMN_STR_ProfessionID); if (result.Status != FR_Status.Success || item.CMN_STR_ProfessionID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } item.IsDeleted = true; item.Save(Connection, Transaction); ORM_CMN_STR_ProfessionKey.Query professionKeyQuery = new ORM_CMN_STR_ProfessionKey.Query(); professionKeyQuery.CMN_STR_Profession_RefID = Parameter.CMN_STR_ProfessionID; professionKeyQuery.IsDeleted = false; professionKeyQuery.Tenant_RefID = securityTicket.TenantID; ORM_CMN_STR_ProfessionKey.Query.SoftDelete(Connection, Transaction, professionKeyQuery); return(returnValue); #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3P_SP_1653 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); if (Parameter.StaffTypeID == Guid.Empty) { ORM_CMN_STR_Profession profession = new ORM_CMN_STR_Profession(); profession.CMN_STR_ProfessionID = Guid.NewGuid(); profession.ProfessionName = Parameter.Name; profession.IsDeleted = false; profession.Tenant_RefID = securityTicket.TenantID; if (Parameter.IsLANRNeeded) { ORM_CMN_STR_ProfessionKey professionKey = new ORM_CMN_STR_ProfessionKey(); professionKey.CMN_STR_ProfessionKeyID = Guid.NewGuid(); professionKey.CMN_STR_Profession_RefID = profession.CMN_STR_ProfessionID; professionKey.SocialSecurityProfessionKey = Parameter.ProfessionKey; professionKey.IsDeleted = false; professionKey.Tenant_RefID = securityTicket.TenantID; professionKey.Save(Connection, Transaction); } if (Parameter.Skills != null) { foreach (var skillParam in Parameter.Skills) { ORM_CMN_STR_Skill_2_Profession skill2profession = new ORM_CMN_STR_Skill_2_Profession(); skill2profession.AssignmentID = Guid.NewGuid(); skill2profession.Profession_RefID = profession.CMN_STR_ProfessionID; skill2profession.Skill_RefID = skillParam.StaffSkillID; skill2profession.IsDeleted = skillParam.IsDeleted; skill2profession.Tenant_RefID = securityTicket.TenantID; skill2profession.Save(Connection, Transaction); } } profession.Save(Connection, Transaction); returnValue.Result = profession.CMN_STR_ProfessionID; } else { var profession = ORM_CMN_STR_Profession.Query.Search(Connection, Transaction, new ORM_CMN_STR_Profession.Query { CMN_STR_ProfessionID = Parameter.StaffTypeID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }).SingleOrDefault(); if (Parameter.IsDeleted == false) { profession.ProfessionName = Parameter.Name; profession.IsDeleted = false; var professionKey = ORM_CMN_STR_ProfessionKey.Query.Search(Connection, Transaction, new ORM_CMN_STR_ProfessionKey.Query { SocialSecurityProfessionKey = Parameter.ProfessionKey, CMN_STR_Profession_RefID = Parameter.StaffTypeID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }).SingleOrDefault(); if (professionKey != null) { if (Parameter.IsLANRNeeded) { professionKey.SocialSecurityProfessionKey = Parameter.ProfessionKey; } else { professionKey.IsDeleted = true; } professionKey.Save(Connection, Transaction); } else { if (Parameter.IsLANRNeeded) { professionKey = new ORM_CMN_STR_ProfessionKey(); professionKey.CMN_STR_ProfessionKeyID = Guid.NewGuid(); professionKey.CMN_STR_Profession_RefID = profession.CMN_STR_ProfessionID; professionKey.SocialSecurityProfessionKey = Parameter.ProfessionKey; professionKey.IsDeleted = false; professionKey.Tenant_RefID = securityTicket.TenantID; professionKey.Save(Connection, Transaction); } } if (Parameter.Skills != null) { foreach (var skillParam in Parameter.Skills) { var skillsFromParam = ORM_CMN_STR_Skill_2_Profession.Query.Search(Connection, Transaction, new ORM_CMN_STR_Skill_2_Profession.Query { Skill_RefID = skillParam.StaffSkillID, Profession_RefID = Parameter.StaffTypeID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }).SingleOrDefault(); if (skillsFromParam == null) { ORM_CMN_STR_Skill_2_Profession skill2profession = new ORM_CMN_STR_Skill_2_Profession(); skill2profession.AssignmentID = Guid.NewGuid(); skill2profession.Profession_RefID = profession.CMN_STR_ProfessionID; skill2profession.Skill_RefID = skillParam.StaffSkillID; skill2profession.IsDeleted = skillParam.IsDeleted; skill2profession.Tenant_RefID = securityTicket.TenantID; skill2profession.Save(Connection, Transaction); } else { skillsFromParam.IsDeleted = skillParam.IsDeleted; skillsFromParam.Tenant_RefID = securityTicket.TenantID; skillsFromParam.Save(Connection, Transaction); } } } } else { var skillsForDelete = ORM_CMN_STR_Skill_2_Profession.Query.SoftDelete(Connection, Transaction, new ORM_CMN_STR_Skill_2_Profession.Query { Profession_RefID = Parameter.StaffTypeID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }); var professionKey = ORM_CMN_STR_ProfessionKey.Query.SoftDelete(Connection, Transaction, new ORM_CMN_STR_ProfessionKey.Query { SocialSecurityProfessionKey = Parameter.ProfessionKey, CMN_STR_Profession_RefID = Parameter.StaffTypeID, IsDeleted = false, Tenant_RefID = securityTicket.TenantID }); profession.IsDeleted = true; } profession.Save(Connection, Transaction); returnValue.Result = profession.CMN_STR_ProfessionID; } //Put your code here return(returnValue); #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5TW_STW_1325 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); var item = new ORM_CMN_STR_Profession(); if (Parameter.CMN_STR_ProfessionID != Guid.Empty) { var result = item.Load(Connection, Transaction, Parameter.CMN_STR_ProfessionID); if (result.Status != FR_Status.Success || item.CMN_STR_ProfessionID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } item.GlobalPropertyMatchingID = Parameter.GlobalPropertyMatchingID; item.ProfessionName = Parameter.ProfessionName; item.Tenant_RefID = securityTicket.TenantID; item.Save(Connection, Transaction); ORM_CMN_STR_ProfessionKey.Query professionKeyQuery = new ORM_CMN_STR_ProfessionKey.Query(); professionKeyQuery.CMN_STR_Profession_RefID = item.CMN_STR_ProfessionID; professionKeyQuery.IsDeleted = false; professionKeyQuery.Tenant_RefID = securityTicket.TenantID; List <ORM_CMN_STR_ProfessionKey> professionKeys = ORM_CMN_STR_ProfessionKey.Query.Search(Connection, Transaction, professionKeyQuery); if (professionKeys.Count != 0) { ORM_CMN_STR_ProfessionKey professionKey = professionKeys[0]; professionKey.SocialSecurityProfessionKey = Parameter.SocialSecurityProfessionKey; professionKey.Save(Connection, Transaction); } else { ORM_CMN_STR_ProfessionKey professionKey = new ORM_CMN_STR_ProfessionKey(); professionKey.SocialSecurityProfessionKey = Parameter.SocialSecurityProfessionKey; professionKey.CMN_STR_Profession_RefID = item.CMN_STR_ProfessionID; professionKey.Tenant_RefID = securityTicket.TenantID; ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query(); countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISOCode_Alpha2; countryQuery.IsDeleted = false; countryQuery.Tenant_RefID = securityTicket.TenantID; List <ORM_CMN_Country> countries = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery); if (countries.Count != 0) { ORM_CMN_Country country = countries[0]; ORM_CMN_Country_2_EconomicRegion.Query economicRegionToCountryQuery = new ORM_CMN_Country_2_EconomicRegion.Query(); economicRegionToCountryQuery.CMN_Country_RefID = country.CMN_CountryID; economicRegionToCountryQuery.IsDeleted = false; economicRegionToCountryQuery.Tenant_RefID = securityTicket.TenantID; List <ORM_CMN_Country_2_EconomicRegion> economicRegionToCountries = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction, economicRegionToCountryQuery); if (economicRegionToCountries.Count != 0) { ORM_CMN_EconomicRegion.Query economicRegionQuery = new ORM_CMN_EconomicRegion.Query(); economicRegionQuery.CMN_EconomicRegionID = economicRegionToCountries[0].CMN_EconomicRegion_RefID; economicRegionQuery.IsDeleted = false; economicRegionQuery.Tenant_RefID = securityTicket.TenantID; List <ORM_CMN_EconomicRegion> economicRegions = ORM_CMN_EconomicRegion.Query.Search(Connection, Transaction, economicRegionQuery); if (economicRegions.Count != 0) { professionKey.CMN_EconomicRegion_RefID = economicRegions[0].CMN_EconomicRegionID; } } else { ORM_CMN_Country_2_EconomicRegion economicRegionToCountry = new ORM_CMN_Country_2_EconomicRegion(); economicRegionToCountry.CMN_Country_RefID = country.CMN_CountryID; economicRegionToCountry.Tenant_RefID = securityTicket.TenantID; ORM_CMN_EconomicRegion economicRegion = new ORM_CMN_EconomicRegion(); economicRegion.IsEconomicRegionCountry = true; economicRegion.Tenant_RefID = securityTicket.TenantID; economicRegionToCountry.CMN_EconomicRegion_RefID = economicRegion.CMN_EconomicRegionID; economicRegion.Save(Connection, Transaction); economicRegionToCountry.Save(Connection, Transaction); professionKey.CMN_EconomicRegion_RefID = economicRegion.CMN_EconomicRegionID; } } professionKey.Save(Connection, Transaction); } returnValue.Result = item.CMN_STR_ProfessionID; return(returnValue); #endregion UserCode }