예제 #1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L2CN_SC_1130 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            var item        = new ORM_CMN_Country();
            if (Parameter.CMN_CountryID != Guid.Empty)
            {
                var result = item.Load(Connection, Transaction, Parameter.CMN_CountryID);
            }

            if (Parameter.IsDeleted == true)
            {
                item.IsDeleted = true;
                return(new FR_Guid(item.Save(Connection, Transaction), item.CMN_CountryID));
            }

            //Creation specific parameters (Tenant, Account ... )
            if (Parameter.CMN_CountryID == Guid.Empty)
            {
                item.Tenant_RefID = securityTicket.TenantID;
            }

            item.Default_Language_RefID  = Parameter.Default_Language_RefID;
            item.Default_Currency_RefID  = Parameter.Default_Currency_RefID;
            item.Country_Name            = Parameter.Country_Name;
            item.Country_ISOCode_Alpha2  = Parameter.Country_ISOCode_Alpha2;
            item.Country_ISOCode_Alpha3  = Parameter.Country_ISOCode_Alpha3;
            item.Country_ISOCode_Numeric = Parameter.Country_ISOCode_Numeric;

            return(new FR_Guid(item.Save(Connection, Transaction), item.CMN_CountryID));

            #endregion UserCode
        }
예제 #2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3ER_SERAC_1621 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here
            ORM_CMN_EconomicRegion economicRegion = new ORM_CMN_EconomicRegion();

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

            ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
            countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISO;
            countryQuery.Tenant_RefID           = securityTicket.TenantID;
            countryQuery.IsDeleted = false;

            ORM_CMN_Country country = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery).FirstOrDefault();

            if (Parameter.CMN_EconomicRegionID != Guid.Empty)
            {
                ORM_CMN_Country_2_EconomicRegion.Query country2EconomicRegionQuery = new ORM_CMN_Country_2_EconomicRegion.Query();
                country2EconomicRegionQuery.CMN_EconomicRegion_RefID = Parameter.CMN_EconomicRegionID;
                country2EconomicRegionQuery.CMN_Country_RefID        = country.CMN_CountryID;
                country2EconomicRegionQuery.IsDeleted    = false;
                country2EconomicRegionQuery.Tenant_RefID = securityTicket.TenantID;
                if (ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction, country2EconomicRegionQuery).Count != 0)
                {
                    returnValue = new FR_Guid(Parameter.CMN_EconomicRegionID);
                    return(returnValue);
                }
            }
            foreach (var content in country.Country_Name.Contents)
            {
                economicRegion.EconomicRegion_Description.UpdateEntry(content.LanguageID, content.Content);
                economicRegion.EconomicRegion_Name.UpdateEntry(content.LanguageID, content.Content);
            }
            economicRegion.IsEconomicRegionCountry = true;
            economicRegion.Tenant_RefID            = securityTicket.TenantID;
            economicRegion.Save(Connection, Transaction);

            ORM_CMN_Country_2_EconomicRegion country2EconomicRegion = new ORM_CMN_Country_2_EconomicRegion();
            country2EconomicRegion.CMN_Country_RefID        = country.CMN_CountryID;
            country2EconomicRegion.CMN_EconomicRegion_RefID = economicRegion.CMN_EconomicRegionID;
            country2EconomicRegion.Tenant_RefID             = securityTicket.TenantID;
            country2EconomicRegion.Save(Connection, Transaction);

            returnValue = new FR_Guid(economicRegion.CMN_EconomicRegionID);

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5CS_SCSS_1318 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            var item        = new ORM_CMN_PER_CompulsorySocialSecurityStatus();
            if (Parameter.CMN_PER_CompulsorySocialSecurityStatusID != Guid.Empty)
            {
                var result = item.Load(Connection, Transaction, Parameter.CMN_PER_CompulsorySocialSecurityStatusID);
                if (result.Status != FR_Status.Success || item.CMN_PER_CompulsorySocialSecurityStatusID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }
            else
            {
                ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
                countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISO;
                countryQuery.Tenant_RefID           = securityTicket.TenantID;
                countryQuery.IsDeleted = false;

                ORM_CMN_Country country = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery).FirstOrDefault();

                ORM_CMN_Country_2_EconomicRegion.Query country2EconomicRegionQuery = new ORM_CMN_Country_2_EconomicRegion.Query();
                country2EconomicRegionQuery.CMN_Country_RefID = country.CMN_CountryID;
                country2EconomicRegionQuery.IsDeleted         = false;
                country2EconomicRegionQuery.Tenant_RefID      = securityTicket.TenantID;

                List <ORM_CMN_Country_2_EconomicRegion> country2EconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction, country2EconomicRegionQuery);

                Guid economicRegionID;

                if (country2EconomicRegion.Count == 0)
                {
                    P_L3ER_SERAC_1621 param = new P_L3ER_SERAC_1621();
                    param.Country_ISO = Parameter.Country_ISO;
                    economicRegionID  = cls_Save_EconomicRegion_As_Country.Invoke(Connection, Transaction, param, securityTicket).Result;
                }
                else
                {
                    economicRegionID = country2EconomicRegion.FirstOrDefault().CMN_EconomicRegion_RefID;
                }

                item.CMN_EconomicRegion_RefID = economicRegionID;
            }
            item.SocialSecurityStatus_Name        = Parameter.SocialSecurityStatus_Name;
            item.SocialSecurityStatus_Description = Parameter.SocialSecurityStatus_Description;
            item.GlobalPropertyMatchingID         = Parameter.GlobalPropertyMatchingID;
            item.SocialSecurityStatus_Code        = Parameter.SocialSecurityStatus_Code;
            item.Tenant_RefID = securityTicket.TenantID;
            item.Save(Connection, Transaction);
            returnValue.Result = item.CMN_PER_CompulsorySocialSecurityStatusID;

            //Put your code here
            return(returnValue);

            #endregion UserCode
        }
예제 #4
0
        private static string Get_CountryISO_For_SalaryType(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket, ORM_CMN_BPT_EMP_SalaryType salaryType)
        {
            string ISO = "";
            ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion salaryEconomicRegion;
            ORM_CMN_EconomicRegion economicRegion;
            FR_Base economicRegionRes;
            ORM_CMN_Country_2_EconomicRegion countryEconomicRegion;
            ORM_CMN_Country country;
            FR_Base         countryRes;

            salaryEconomicRegion = ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query.Search(Connection, Transaction,
                                                                                            new ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query()
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                CMN_BPT_EMP_SalaryType_RefID = salaryType.CMN_BPT_EMP_SalaryTypeID
            }).FirstOrDefault();

            if (salaryEconomicRegion == null)
            {
                return("");
            }

            economicRegion    = new ORM_CMN_EconomicRegion();
            economicRegionRes = economicRegion.Load(Connection, Transaction, salaryEconomicRegion.CMN_EconomicRegion_RefID);

            if (economicRegionRes.Status != FR_Status.Success || economicRegion.CMN_EconomicRegionID == Guid.Empty)
            {
                return("");
            }

            countryEconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction,
                                                                                  new ORM_CMN_Country_2_EconomicRegion.Query()
            {
                Tenant_RefID             = securityTicket.TenantID,
                IsDeleted                = false,
                CMN_EconomicRegion_RefID = economicRegion.CMN_EconomicRegionID
            }).FirstOrDefault();

            if (countryEconomicRegion == null)
            {
                return("");
            }

            country    = new ORM_CMN_Country();
            countryRes = country.Load(Connection, Transaction, countryEconomicRegion.CMN_Country_RefID);

            if (countryRes.Status != FR_Status.Success || country.CMN_CountryID == Guid.Empty)
            {
                return("");
            }

            ISO = country.Country_ISOCode_Alpha2;

            return(ISO);
        }
        protected static FR_L5TS_GTOSFC_1031 Execute(DbConnection Connection, DbTransaction Transaction, P_L5TS_GTOSFC_1031 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5TS_GTOSFC_1031();
            returnValue.Result = new L5TS_GTOSFC_1031();

            L5TS_GTOSFT_1419[] allTypes = cls_Get_TypesOfSalery_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result;

            ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
            countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISO;
            countryQuery.IsDeleted    = false;
            countryQuery.Tenant_RefID = securityTicket.TenantID;

            ORM_CMN_Country country = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery).FirstOrDefault();

            ORM_CMN_Country_2_EconomicRegion.Query country2EconomicRegionQuery = new ORM_CMN_Country_2_EconomicRegion.Query();
            country2EconomicRegionQuery.CMN_Country_RefID = country.CMN_CountryID;
            country2EconomicRegionQuery.IsDeleted         = false;
            country2EconomicRegionQuery.Tenant_RefID      = securityTicket.TenantID;

            ORM_CMN_Country_2_EconomicRegion country2EconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction, country2EconomicRegionQuery).FirstOrDefault();

            if (country2EconomicRegion == null)
            {
                return(returnValue);
            }

            ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query salaryType2EconomicRegionQuery = new ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query();
            salaryType2EconomicRegionQuery.CMN_EconomicRegion_RefID = country2EconomicRegion.CMN_EconomicRegion_RefID;
            salaryType2EconomicRegionQuery.IsDeleted    = false;
            salaryType2EconomicRegionQuery.Tenant_RefID = securityTicket.TenantID;

            List <ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion> listOfSalaryType2EconomicRegion = ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query.Search(Connection, Transaction, salaryType2EconomicRegionQuery);

            List <L5TS_GTOSFT_1419> resultTypes = new List <L5TS_GTOSFT_1419>();

            if (allTypes != null)
            {
                foreach (var salaryType2EconomicRegion in listOfSalaryType2EconomicRegion)
                {
                    resultTypes.Add(allTypes.FirstOrDefault(x => x.CMN_BPT_EMP_SalaryTypeID == salaryType2EconomicRegion.CMN_BPT_EMP_SalaryType_RefID));
                }
            }
            else
            {
                return(returnValue);
            }

            returnValue.Result.TypesOfSalary = resultTypes.ToArray();

            //Put your code here
            return(returnValue);

            #endregion UserCode
        }
        protected static FR_L5RL_GRFC_1352 Execute(DbConnection Connection, DbTransaction Transaction, P_L5RL_GRFC_1352 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5RL_GRFC_1352();
            returnValue.Result = new L5RL_GRFC_1352();

            L5RL_GRFT_0942[] allReligions = cls_Get_Religions_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result;

            ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
            countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISO;
            countryQuery.IsDeleted    = false;
            countryQuery.Tenant_RefID = securityTicket.TenantID;

            ORM_CMN_Country country = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery).FirstOrDefault();

            ORM_CMN_Country_2_EconomicRegion.Query country2EconomicRegionQuery = new ORM_CMN_Country_2_EconomicRegion.Query();
            country2EconomicRegionQuery.CMN_Country_RefID = country.CMN_CountryID;
            country2EconomicRegionQuery.IsDeleted         = false;
            country2EconomicRegionQuery.Tenant_RefID      = securityTicket.TenantID;

            ORM_CMN_Country_2_EconomicRegion country2EconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction, country2EconomicRegionQuery).FirstOrDefault();

            if (country2EconomicRegion == null)
            {
                return(returnValue);
            }

            ORM_CMN_PER_Religion_2_EconomicRegion.Query religion2EconomicRegionQuery = new ORM_CMN_PER_Religion_2_EconomicRegion.Query();
            religion2EconomicRegionQuery.CMN_EconomicRegion_RefID = country2EconomicRegion.CMN_EconomicRegion_RefID;
            religion2EconomicRegionQuery.IsDeleted    = false;
            religion2EconomicRegionQuery.Tenant_RefID = securityTicket.TenantID;

            List <ORM_CMN_PER_Religion_2_EconomicRegion> listOfReligion2EconomicRegion = ORM_CMN_PER_Religion_2_EconomicRegion.Query.Search(Connection, Transaction, religion2EconomicRegionQuery);

            List <L5RL_GRFT_0942> resultReligions = new List <L5RL_GRFT_0942>();

            if (allReligions != null)
            {
                foreach (var religion2EconomicRegion in listOfReligion2EconomicRegion)
                {
                    resultReligions.Add(allReligions.FirstOrDefault(x => x.CMN_PER_ReligionID == religion2EconomicRegion.CMN_PER_Religion_RefID));
                }
            }
            else
            {
                return(returnValue);
            }

            returnValue.Result.Religion = resultReligions.ToArray();

            return(returnValue);

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


            ORM_CMN_Country defauntCountry = ORM_CMN_Country.Query.Search(Connection, Transaction, new ORM_CMN_Country.Query()
            {
                IsDeleted    = false,
                Tenant_RefID = securityTicket.TenantID,
                IsDefault    = true
            }).FirstOrDefault();

            returnValue.Result = new L3CN_GDCfT_1358();
            returnValue.Result.DefaultCountry = defauntCountry;
            returnValue.Status = FR_Status.Success;
            return(returnValue);

            #endregion UserCode
        }
		protected static FR_L5CS_GCSSFC_1544 Execute(DbConnection Connection,DbTransaction Transaction,P_L5CS_GCSSFC_1544 Parameter,CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null){
			#region UserCode 
			var returnValue = new FR_L5CS_GCSSFC_1544();
            returnValue.Result = new L5CS_GCSSFC_1544();

            L5CS_GCSSFT_1319[] allStatuses = cls_Get_CompulsorySocialSecurityStatuses_For_Tenant.Invoke(Connection, Transaction, securityTicket).Result;

            ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
            countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISO;
            countryQuery.Tenant_RefID = securityTicket.TenantID;
            countryQuery.IsDeleted = false;

            ORM_CMN_Country country = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery).FirstOrDefault();

            ORM_CMN_Country_2_EconomicRegion.Query country2EconomicRegionQuery = new ORM_CMN_Country_2_EconomicRegion.Query();
            country2EconomicRegionQuery.CMN_Country_RefID = country.CMN_CountryID;
            country2EconomicRegionQuery.IsDeleted = false;
            country2EconomicRegionQuery.Tenant_RefID = securityTicket.TenantID;

            ORM_CMN_Country_2_EconomicRegion country2EconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction, country2EconomicRegionQuery).FirstOrDefault();

            if (country2EconomicRegion == null)
                return returnValue;

            List<L5CS_GCSSFT_1319> resultStatuses = new List<L5CS_GCSSFT_1319>();

            foreach (var status in allStatuses)
            {
                if (status.CMN_EconomicRegion_RefID == country2EconomicRegion.CMN_EconomicRegion_RefID)
                    resultStatuses.Add(status);
            }

            returnValue.Result.SocialSecurityStatuses = resultStatuses.ToArray();

			return returnValue;
			#endregion UserCode
		}
예제 #9
0
        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
        }
        protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L3_ACTT_1438 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode

            var returnValue = new FR_Base();

            if (Parameter == null)
            {
                returnValue.Status       = FR_Status.Error_Internal;
                returnValue.ErrorMessage = "Assign_Countries_To_Tenant method returned error message: Parameter is null.";
                return(returnValue);
            }

            ORM_CMN_Country[] countries = null;

            #region Retrieve all countries for tenant

            countries = ORM_CMN_Country.Query.Search(Connection, Transaction, new ORM_CMN_Country.Query()
            {
                Tenant_RefID = securityTicket.TenantID
            }).ToArray();

            #endregion

            #region Assign/deassign countries

            foreach (var countryToAssign in Parameter.AssignedCountries)
            {
                var country = countries.FirstOrDefault(c => c.Country_ISOCode_Alpha3 == countryToAssign.CountryISOCode);
                if (country == null)
                {
                    country = new ORM_CMN_Country();
                    country.CMN_CountryID          = Guid.NewGuid();
                    country.Country_ISOCode_Alpha3 = countryToAssign.CountryISOCode;
                    country.Country_Name           = countryToAssign.CountryName;
                    country.Creation_Timestamp     = DateTime.Now;
                    country.Default_Currency_RefID = Guid.Empty;
                    country.Default_Language_RefID = Guid.Empty;
                    country.Tenant_RefID           = securityTicket.TenantID;
                    country.IsDeleted = false;
                    country.Save(Connection, Transaction);
                }

                if (country.IsDeleted == true)
                {
                    country.IsDeleted = false;
                    country.Save(Connection, Transaction);
                }
            }

            foreach (var country in countries.Where(c => c.IsDeleted == false))
            {
                var countryToAssign = Parameter.AssignedCountries.FirstOrDefault(cta => cta.CountryISOCode == country.Country_ISOCode_Alpha3);
                if (countryToAssign == null)
                {
                    country.IsDeleted = true;
                    country.Save(Connection, Transaction);
                }
            }

            #endregion

            #region Set default country for tenant

            if (Parameter.DefaultCountry != null)
            {
                foreach (var country in countries)
                {
                    if (country.IsDefault)
                    {
                        country.IsDefault = false;
                        country.Save(Connection, Transaction);
                    }
                }

                foreach (var country in countries)
                {
                    if (country.Country_ISOCode_Alpha3 == Parameter.DefaultCountry.CountryISOCode)
                    {
                        country.IsDefault = true;
                        country.Save(Connection, Transaction);
                        break;
                    }
                }
            }

            #endregion

            returnValue.Status = FR_Status.Success;

            return(returnValue);

            #endregion UserCode
        }
예제 #11
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3TX_STX_1119 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            // Set Economic region
            if (Parameter.EconomicRegion_RefID == Guid.Empty)
            {
                var countryRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction,
                                                                                  new ORM_CMN_Country_2_EconomicRegion.Query {
                    IsDeleted = false, CMN_Country_RefID = Parameter.Country_RefID
                }).SingleOrDefault();

                if (countryRegion == null)
                {
                    var country = new ORM_CMN_Country();
                    country.Load(Connection, Transaction, Parameter.Country_RefID);
                    var region = new ORM_CMN_EconomicRegion();
                    region.EconomicRegion_Name = new Dict()
                    {
                        DictionaryID = Guid.NewGuid()
                    };
                    region.Tenant_RefID            = country.Tenant_RefID;
                    region.IsEconomicRegionCountry = true;
                    foreach (var content in country.Country_Name.Contents)
                    {
                        region.EconomicRegion_Name.AddEntry(content.LanguageID, content.Content);
                    }
                    region.Save(Connection, Transaction);
                    countryRegion = new ORM_CMN_Country_2_EconomicRegion();
                    countryRegion.CMN_EconomicRegion_RefID = region.CMN_EconomicRegionID;
                    countryRegion.CMN_Country_RefID        = country.CMN_CountryID;
                    countryRegion.Tenant_RefID             = country.Tenant_RefID;
                    countryRegion.Save(Connection, Transaction);
                }

                Parameter.EconomicRegion_RefID = countryRegion.CMN_EconomicRegion_RefID;
            }

            var item = new ORM_ACC_TAX_Tax();
            if (Parameter.ACC_TAX_TaxeID != Guid.Empty)
            {
                item.Load(Connection, Transaction, Parameter.ACC_TAX_TaxeID);
            }

            if (Parameter.IsDeleted == true)
            {
                item.IsDeleted = true;
                return(new FR_Guid(item.Save(Connection, Transaction), item.ACC_TAX_TaxeID));
            }

            //Creation specific parameters (Tenant, Account ... )
            if (Parameter.ACC_TAX_TaxeID == Guid.Empty)
            {
                item.Tenant_RefID = securityTicket.TenantID;
            }

            item.EconomicRegion_RefID = Parameter.EconomicRegion_RefID;
            item.TaxName = Parameter.TaxName;
            item.TaxRate = Parameter.TaxRate;

            return(new FR_Guid(item.Save(Connection, Transaction), item.ACC_TAX_TaxeID));

            #endregion UserCode
        }
예제 #12
0
        protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L5ZW_SDfNC_1707 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Bool();
            returnValue.Result = false;

            //Put your code here
            #region get securityTicket and businessParticipantID by Paramter.AccountID and set defaultLanguageID
            Guid tenantID;
            Guid businessParticipantID;

            if (Parameter.AccountID == Guid.Empty)
            {
                return(returnValue);
            }

            ORM_USR_Account orm_account = new ORM_USR_Account();
            var             result      = orm_account.Load(Connection, Transaction, Parameter.AccountID);
            if (result.Status != FR_Status.Success || orm_account.USR_AccountID == Guid.Empty)
            {
                return(returnValue);
            }

            tenantID       = orm_account.Tenant_RefID;
            securityTicket = new CSV2Core.SessionSecurity.SessionSecurityTicket()
            {
                TenantID = tenantID
            };

            ORM_CMN_BPT_BusinessParticipant.Query businessParticipantQuery = new ORM_CMN_BPT_BusinessParticipant.Query();
            businessParticipantQuery.IfTenant_Tenant_RefID = tenantID;
            businessParticipantQuery.IsDeleted             = false;
            ORM_CMN_BPT_BusinessParticipant businessParticipant = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, businessParticipantQuery).FirstOrDefault();

            if (businessParticipant == null)
            {
                return(returnValue);
            }

            businessParticipantID = businessParticipant.CMN_BPT_BusinessParticipantID;
            #endregion

            #region get languages for tenant and set parameter dict values
            P_L2LN_GALFTID_1530 languageParam = new P_L2LN_GALFTID_1530()
            {
                Tenant_RefID = tenantID
            };
            L2LN_GALFTID_1530[] languages = cls_Get_All_Languages_ForTenantID.Invoke(Connection, Transaction, languageParam, securityTicket).Result;
            SetParameterDictValues(Parameter, languages);

            List <ISOLanguage> languagesISOs = new List <ISOLanguage>();
            languagesISOs.AddRange(languages.Select(l => new ISOLanguage()
            {
                ISO        = l.ISO_639_1,
                LanguageID = l.CMN_LanguageID
            }).ToList());
            #endregion

            #region save defaultLanguage

            // We are setting language for bp and acc
            var defaultLanguage = languages.FirstOrDefault(i => i.ISO_639_1.ToLower().Contains(Parameter.DefaultLanguageCode.ToLower()));
            if (defaultLanguage != null)
            {
                businessParticipant.DefaultLanguage_RefID = defaultLanguage.CMN_LanguageID;
                businessParticipant.Save(Connection, Transaction);

                orm_account.DefaultLanguage_RefID = defaultLanguage.CMN_LanguageID;
                orm_account.Save(Connection, Transaction);
            }

            #endregion

            #region save default country

            if (Parameter.DefaultCountry != null)
            {
                ORM_CMN_Country country = new ORM_CMN_Country();
                country.CMN_CountryID          = Guid.NewGuid();
                country.Country_ISOCode_Alpha3 = Parameter.DefaultCountry.Code;
                country.Country_Name           = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                country.Creation_Timestamp     = DateTime.Now;
                country.Default_Currency_RefID = Guid.Empty;
                country.Default_Language_RefID = Guid.Empty;
                country.Tenant_RefID           = tenantID;
                country.IsDeleted = false;
                country.IsDefault = true;

                foreach (var languageItem in languages)
                {
                    country.Country_Name.UpdateEntry(languageItem.CMN_LanguageID, Parameter.DefaultCountry.Name);
                }

                country.Save(Connection, Transaction);
            }

            #endregion

            #region save default currency

            //asign currency
            if (Parameter.DefaultCurrency != null)
            {
                ORM_CMN_Currency currency = new ORM_CMN_Currency();
                currency.CMN_CurrencyID     = Guid.NewGuid();
                currency.Creation_Timestamp = DateTime.Now;
                currency.IsDeleted          = false;
                currency.ISO4127            = Parameter.DefaultCurrency.Code;
                currency.Name = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                currency.Tenant_RefID = tenantID;

                foreach (var language in languages)
                {
                    currency.Name.UpdateEntry(language.CMN_LanguageID, Parameter.DefaultCurrency.Name);
                }

                currency.Save(Connection, Transaction);

                //set default currency
                ORM_CMN_BPT_BusinessParticipant businessPart = new ORM_CMN_BPT_BusinessParticipant();
                businessPart.Load(Connection, Transaction, businessParticipantID);

                businessPart.DefaultCurrency_RefID = currency.CMN_CurrencyID;
                businessPart.Save(Connection, Transaction);
            }

            #endregion

            #region save organisational units
            if (Parameter.OrganisationalUnitParameters.Length > 0)
            {
                foreach (var item in Parameter.OrganisationalUnitParameters)
                {
                    cls_Save_Office.Invoke(Connection, Transaction, item, securityTicket);
                }
            }
            #endregion

            #region save cost centers
            if (Parameter.CostCenterParameters.Length > 0)
            {
                foreach (var item in Parameter.CostCenterParameters)
                {
                    cls_Save_CostCenter.Invoke(Connection, Transaction, item, securityTicket);
                }
            }
            #endregion

            #region save warehouses
            if (Parameter.WarehousesParameters.Length > 0)
            {
                #region save warehouse group
                P_L2WH_SWHG_1327 warehouseGroupParam = new P_L2WH_SWHG_1327();
                warehouseGroupParam.Parent_RefID               = Guid.Empty;
                warehouseGroupParam.WarehouseGroup_Name        = "Waregouse group";
                warehouseGroupParam.WarehouseGroup_Description = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                foreach (var language in languages)
                {
                    warehouseGroupParam.WarehouseGroup_Description.UpdateEntry(language.CMN_LanguageID, String.Empty);
                }

                var warehouseGroupID = cls_Save_Warehouse_Group.Invoke(Connection, Transaction, warehouseGroupParam, securityTicket).Result;
                #endregion

                foreach (var item in Parameter.WarehousesParameters)
                {
                    item.LOG_WRH_WarehouseGroupID = warehouseGroupID;
                    cls_Save_Warehouse.Invoke(Connection, Transaction, item, securityTicket);
                }
            }
            #endregion

            #region create dimension templates
            string           jsonTemplates      = ReadFromFile.LoadContentFromFile(@"Dimensions.json");
            List <Dimension> dimensionTemplates = JsonConvert.DeserializeObject <List <Dimension> >(jsonTemplates);

            int orderSequence = 1;
            ORM_CMN_PRO_Dimension       orm_dimension;
            ORM_CMN_PRO_Dimension_Value orm_dimensionValue;
            foreach (var template in dimensionTemplates)
            {
                orderSequence = 1;

                #region save dimension
                orm_dimension = new ORM_CMN_PRO_Dimension();
                orm_dimension.Product_RefID = Guid.Empty;
                orm_dimension.DimensionName = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_dimension.IsDimensionTemplate = true;
                orm_dimension.Tenant_RefID        = tenantID;

                foreach (var language in languages)
                {
                    orm_dimension.DimensionName.UpdateEntry(language.CMN_LanguageID, template.Name);
                }

                orm_dimension.Save(Connection, Transaction);
                #endregion

                #region save dimension values
                foreach (var templateValue in template.DimansionValues)
                {
                    orm_dimensionValue = new ORM_CMN_PRO_Dimension_Value();
                    orm_dimensionValue.Dimensions_RefID    = orm_dimension.CMN_PRO_DimensionID;
                    orm_dimensionValue.DimensionValue_Text = new Dict()
                    {
                        DictionaryID = Guid.NewGuid()
                    };
                    orm_dimensionValue.Tenant_RefID  = tenantID;
                    orm_dimensionValue.OrderSequence = orderSequence;

                    foreach (var language in languages)
                    {
                        orm_dimensionValue.DimensionValue_Text.UpdateEntry(language.CMN_LanguageID, templateValue);
                    }

                    orm_dimensionValue.Save(Connection, Transaction);

                    orderSequence++;
                }
                #endregion
            }
            #endregion

            #region create shipment types
            string shipmentTypesJson           = ReadFromFile.LoadContentFromFile(@"ShipmentTypes.json");
            List <ShipmentTypes> shipmentTypes = JsonConvert.DeserializeObject <List <ShipmentTypes> >(shipmentTypesJson);

            ORM_LOG_SHP_Shipment_Type orm_shipmentType;
            foreach (var type in shipmentTypes)
            {
                #region save LOG_SHP_Shipment_Type
                orm_shipmentType = new ORM_LOG_SHP_Shipment_Type();
                orm_shipmentType.ShipmentType_Name = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_shipmentType.ShipmentType_Description = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_shipmentType.Tenant_RefID = tenantID;

                foreach (var language in languages)
                {
                    orm_shipmentType.ShipmentType_Name.UpdateEntry(language.CMN_LanguageID, type.Name);
                    orm_shipmentType.ShipmentType_Description.UpdateEntry(language.CMN_LanguageID, string.Empty);
                }

                orm_shipmentType.Save(Connection, Transaction);
                #endregion
            }
            #endregion

            #region create number ranges

            string      numberRangesJson = ReadFromFile.LoadContentFromFile(@"NumberRanges.json");
            NumberRange numberRanges     = JsonConvert.DeserializeObject <NumberRange>(numberRangesJson);


            ORM_CMN_NumberRange_UsageArea numberRangeUsageArea;
            ORM_CMN_NumberRange           orm_numberRanges;
            foreach (var item in numberRanges.NumberRanges)
            {
                if (Parameter.IsCustomerRegistration && item.Name == "Customer orders")
                {
                    continue;
                }

                if (!Parameter.IsCustomerRegistration && item.Name == "Distribution orders")
                {
                    continue;
                }

                if (!Parameter.IsCustomerRegistration && item.Name == "Procurement orders")
                {
                    continue;
                }

                numberRangeUsageArea = new ORM_CMN_NumberRange_UsageArea();
                numberRangeUsageArea.UsageArea_Name = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                numberRangeUsageArea.UsageArea_Description = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                foreach (var language in languages)
                {
                    numberRangeUsageArea.UsageArea_Name.UpdateEntry(language.CMN_LanguageID, item.Name);
                    numberRangeUsageArea.UsageArea_Description.UpdateEntry(language.CMN_LanguageID, string.Empty);
                }
                numberRangeUsageArea.Tenant_RefID           = tenantID;
                numberRangeUsageArea.GlobalStaticMatchingID = item.GlobalStaticMatchingID;
                numberRangeUsageArea.Save(Connection, Transaction);

                orm_numberRanges = new ORM_CMN_NumberRange();
                orm_numberRanges.NumberRange_Name            = item.Name;
                orm_numberRanges.Tenant_RefID                = tenantID;
                orm_numberRanges.NumberRange_UsageArea_RefID = numberRangeUsageArea.CMN_NumberRange_UsageAreaID;
                orm_numberRanges.FixedPrefix = item.FixedPrefix;
                orm_numberRanges.Formatting_LeadingFillCharacter = item.FillCharacter;
                orm_numberRanges.Formatting_NumberLength         = item.Length;
                orm_numberRanges.Value_Current = item.CurrentValue;
                orm_numberRanges.Value_Start   = item.StartValue;
                orm_numberRanges.Value_End     = item.EndValue;
                orm_numberRanges.Save(Connection, Transaction);
            }


            #endregion

            #region create inventory change reasons

            string inventoryChangeReasonsJson = ReadFromFile.LoadContentFromFile(@"InventoryChangeReasons.json");
            List <InventoryChangeReasons> inventoryChangeReasons = JsonConvert.DeserializeObject <List <InventoryChangeReasons> >(inventoryChangeReasonsJson);

            ORM_LOG_WRH_InventoryChangeReason orm_inventoryChangeReason;
            foreach (var reason in inventoryChangeReasons)
            {
                #region save inventory change reason

                orm_inventoryChangeReason = new ORM_LOG_WRH_InventoryChangeReason();
                orm_inventoryChangeReason.GlobalPropertyMatchingID = InventoryChangeReasons.InventoryChangeReasonGlobalPropertyMatchingID + "-" + reason.Name;
                orm_inventoryChangeReason.InventoryChange_Name     = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_inventoryChangeReason.InventoryChange_Description = new Dict()
                {
                    DictionaryID = Guid.NewGuid()
                };
                orm_inventoryChangeReason.Tenant_RefID = tenantID;

                foreach (var language in languages)
                {
                    orm_inventoryChangeReason.InventoryChange_Name.UpdateEntry(language.CMN_LanguageID, reason.Name);
                    orm_inventoryChangeReason.InventoryChange_Description.UpdateEntry(language.CMN_LanguageID, string.Empty);
                }

                orm_inventoryChangeReason.Save(Connection, Transaction);

                #endregion
            }

            #endregion

            #region create shipment statuses
            var shipmentStatuses = Enum.GetValues(typeof(EShipmentStatus));

            var shipmentStatusDicts = EnumUtils.GetDictObjectsForStaticListData <EShipmentStatus>(
                ResourceFilePath.ShipmentStatus, ORM_LOG_SHP_Shipment_Status.TableName, languagesISOs);

            var statusCodeCount = 1;
            ORM_LOG_SHP_Shipment_Status shipmentStatus;
            foreach (EShipmentStatus status in shipmentStatuses)
            {
                shipmentStatus = new ORM_LOG_SHP_Shipment_Status();
                shipmentStatus.GlobalPropertyMatchingID = EnumUtils.GetEnumDescription((EShipmentStatus)status);
                shipmentStatus.Status_Code  = statusCodeCount++;
                shipmentStatus.Status_Name  = shipmentStatusDicts[EnumUtils.GetEnumDescription((EShipmentStatus)status)];
                shipmentStatus.Tenant_RefID = tenantID;

                shipmentStatus.Save(Connection, Transaction);
            }
            #endregion

            if (Parameter.IsCustomerRegistration)
            {
                #region create procurement order statuses
                var procurementStatuses = Enum.GetValues(typeof(EProcurementStatus));
                ORM_ORD_PRC_ProcurementOrder_Status procurementOrderStatus;
                foreach (EProcurementStatus status in procurementStatuses)
                {
                    procurementOrderStatus = new ORM_ORD_PRC_ProcurementOrder_Status();
                    procurementOrderStatus.GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(status);
                    procurementOrderStatus.Tenant_RefID             = tenantID;

                    procurementOrderStatus.Save(Connection, Transaction);
                }
                #endregion
            }
            else
            {
                #region create customer order statuses
                var customerOrderStatuses = Enum.GetValues(typeof(ECustomerOrderStatus));

                var customerOrderStatusesDicts = EnumUtils.GetDictObjectsForStaticListData <ECustomerOrderStatus>(
                    ResourceFilePath.CustomerOrderStatus, ORM_ORD_CUO_CustomerOrder_Status.TableName, languagesISOs);

                var count = 1;
                ORM_ORD_CUO_CustomerOrder_Status customerOrderStatus;
                foreach (var status in customerOrderStatuses)
                {
                    customerOrderStatus = new ORM_ORD_CUO_CustomerOrder_Status();
                    customerOrderStatus.GlobalPropertyMatchingID = EnumUtils.GetEnumDescription((ECustomerOrderStatus)status);
                    customerOrderStatus.Status_Code  = count++;
                    customerOrderStatus.Status_Name  = customerOrderStatusesDicts[EnumUtils.GetEnumDescription((ECustomerOrderStatus)status)];
                    customerOrderStatus.Tenant_RefID = tenantID;

                    customerOrderStatus.Save(Connection, Transaction);
                }
                #endregion
            }

            returnValue.Result = true;
            return(returnValue);

            #endregion UserCode
        }
예제 #13
0
        protected static FR_L5TS_GTOSFT_1419_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode

            var returnValue = new FR_L5TS_GTOSFT_1419_Array();

            //Put your code here
            List <L5TS_GTOSFT_1419> retValList = new List <L5TS_GTOSFT_1419>();

            ORM_CMN_BPT_EMP_SalaryType.Query salaryTypeQuery = new ORM_CMN_BPT_EMP_SalaryType.Query();
            salaryTypeQuery.Tenant_RefID = securityTicket.TenantID;
            salaryTypeQuery.IsDeleted    = false;
            List <ORM_CMN_BPT_EMP_SalaryType> salaryTypeList = ORM_CMN_BPT_EMP_SalaryType.Query.Search(Connection, Transaction, salaryTypeQuery);

            ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion salaryEconomicRegion;
            ORM_CMN_EconomicRegion economicRegion;
            FR_Base economicRegionRes;
            ORM_CMN_Country_2_EconomicRegion countryEconomicRegion;
            ORM_CMN_Country  country;
            FR_Base          countryRes;
            L5TS_GTOSFT_1419 retValItem;
            foreach (var salaryType in salaryTypeList)
            {
                salaryEconomicRegion = ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query.Search(Connection, Transaction,
                                                                                                new ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    IsDeleted    = false,
                    CMN_BPT_EMP_SalaryType_RefID = salaryType.CMN_BPT_EMP_SalaryTypeID
                }).FirstOrDefault();

                retValItem = new L5TS_GTOSFT_1419();
                retValItem.CMN_BPT_EMP_SalaryTypeID = salaryType.CMN_BPT_EMP_SalaryTypeID;
                retValItem.GlobalPropertyMatchingID = salaryType.GlobalPropertyMatchingID;
                retValItem.SalaryType_Code          = salaryEconomicRegion != null ? salaryEconomicRegion.SalaryType_Code : "";
                retValItem.SalaryType_Name          = salaryType.SalaryType_Name;
                retValItem.SalaryTypeStatus         = salaryType.SalaryTypeStatus;

                if (salaryEconomicRegion == null)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                economicRegion    = new ORM_CMN_EconomicRegion();
                economicRegionRes = economicRegion.Load(Connection, Transaction, salaryEconomicRegion.CMN_EconomicRegion_RefID);

                if (economicRegionRes.Status != FR_Status.Success || economicRegion.CMN_EconomicRegionID == Guid.Empty)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                countryEconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction,
                                                                                      new ORM_CMN_Country_2_EconomicRegion.Query()
                {
                    Tenant_RefID             = securityTicket.TenantID,
                    IsDeleted                = false,
                    CMN_EconomicRegion_RefID = economicRegion.CMN_EconomicRegionID
                }).FirstOrDefault();

                if (countryEconomicRegion == null)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                country    = new ORM_CMN_Country();
                countryRes = country.Load(Connection, Transaction, countryEconomicRegion.CMN_Country_RefID);

                if (countryRes.Status != FR_Status.Success || country.CMN_CountryID == Guid.Empty)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                retValItem.Country_ISOCode_Alpha2 = country.Country_ISOCode_Alpha2;
                retValList.Add(retValItem);
            }

            returnValue.Result = retValList.ToArray();

            return(returnValue);

            #endregion UserCode
        }
예제 #14
0
        protected static FR_L5TN_STCL_1439 Execute(DbConnection Connection, DbTransaction Transaction, P_L5TN_STCL_1439 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5TN_STCL_1439();
            returnValue.Result = new L5TN_STCL_1439();

            List <L5CM_GCWRfT_0938> countriesResult = new List <L5CM_GCWRfT_0938>();

            //Put your code here
            ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
            countryQuery.IsDeleted    = false;
            countryQuery.Tenant_RefID = securityTicket.TenantID;
            List <ORM_CMN_Country> countryList = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery);

            ORM_CMN_Country  country;
            L5CM_GCWRfT_0938 countryResultItem;
            foreach (var countryWithoutTenant in Parameter.CountriesWithoutTenant)
            {
                bool isCountryWithoutTenantInNewList = Parameter.NewListOfCountries.Any(i => i.Country_ISOCode_Alpha2 == countryWithoutTenant.Country_ISOCode_Alpha2);

                country = countryList.FirstOrDefault(i => i.Country_ISOCode_Alpha2 == countryWithoutTenant.Country_ISOCode_Alpha2);

                if (country == null)
                {
                    if (isCountryWithoutTenantInNewList)
                    {
                        country = new ORM_CMN_Country();
                        country.Tenant_RefID            = securityTicket.TenantID;
                        country.Country_ISOCode_Alpha2  = countryWithoutTenant.Country_ISOCode_Alpha2;
                        country.Country_ISOCode_Alpha3  = countryWithoutTenant.Country_ISOCode_Alpha3;
                        country.Country_ISOCode_Numeric = countryWithoutTenant.Country_ISOCode_Numeric;

                        Dict countryName = new Dict(countryWithoutTenant.Country_Name.SourceTable);
                        countryName.DictionaryID = Guid.NewGuid();

                        List <DictEntry> entryItems = new List <DictEntry>();
                        entryItems.AddRange(countryWithoutTenant.Country_Name.Contents.Select(entry => new DictEntry()
                        {
                            Content    = entry.Content,
                            LanguageID = entry.LanguageID,
                            DictID     = countryName.DictionaryID,
                            EntityID   = Guid.NewGuid()
                        }));

                        countryName.Contents = entryItems;

                        country.Country_Name           = countryName;
                        country.Default_Currency_RefID = countryWithoutTenant.Default_Currency_RefID;
                        country.Default_Language_RefID = countryWithoutTenant.Default_Language_RefID;
                        country.Save(Connection, Transaction);
                    }
                }
                else
                {
                    country.IsDeleted = !isCountryWithoutTenantInNewList;
                    country.Save(Connection, Transaction);
                }

                if (country != null && !country.IsDeleted)
                {
                    countryResultItem = new L5CM_GCWRfT_0938();
                    countryResultItem.CMN_CountryID           = country.CMN_CountryID;
                    countryResultItem.Country_ISOCode_Alpha2  = country.Country_ISOCode_Alpha2;
                    countryResultItem.Country_ISOCode_Alpha3  = country.Country_ISOCode_Alpha3;
                    countryResultItem.Country_ISOCode_Numeric = country.Country_ISOCode_Numeric;
                    countryResultItem.Country_Name            = country.Country_Name;
                    countryResultItem.Default_Currency_RefID  = country.Default_Currency_RefID;
                    countryResultItem.Default_Language_RefID  = country.Default_Language_RefID;
                    countriesResult.Add(countryResultItem);
                }
            }

            returnValue.Result.Countries = countriesResult.ToArray();

            return(returnValue);

            #endregion UserCode
        }
예제 #15
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5TS_STS_1503 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            //Put your code here
            var type = new ORM_CMN_BPT_EMP_SalaryType();
            if (Parameter.CMN_BPT_EMP_SalaryTypeID != Guid.Empty)
            {
                var result = type.Load(Connection, Transaction, Parameter.CMN_BPT_EMP_SalaryTypeID);
                if (result.Status != FR_Status.Success || type.CMN_BPT_EMP_SalaryTypeID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }

            type.SalaryType_Name          = Parameter.SalaryType_Name;
            type.GlobalPropertyMatchingID = Parameter.GlobalPropertyMatchingID;
            type.SalaryTypeStatus         = Parameter.SalaryTypeStatus;
            type.Tenant_RefID             = securityTicket.TenantID;
            type.Save(Connection, Transaction);

            returnValue.Result = type.CMN_BPT_EMP_SalaryTypeID;

            if (Parameter.Country_ISO != "")
            {
                ORM_CMN_Country.Query countryQuery = new ORM_CMN_Country.Query();
                countryQuery.Country_ISOCode_Alpha2 = Parameter.Country_ISO;
                countryQuery.Tenant_RefID           = securityTicket.TenantID;
                countryQuery.IsDeleted = false;

                ORM_CMN_Country country = ORM_CMN_Country.Query.Search(Connection, Transaction, countryQuery).FirstOrDefault();

                ORM_CMN_Country_2_EconomicRegion.Query country2EconomicRegionQuery = new ORM_CMN_Country_2_EconomicRegion.Query();
                country2EconomicRegionQuery.CMN_Country_RefID = country.CMN_CountryID;
                country2EconomicRegionQuery.IsDeleted         = false;
                country2EconomicRegionQuery.Tenant_RefID      = securityTicket.TenantID;

                List <ORM_CMN_Country_2_EconomicRegion> country2EconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction, country2EconomicRegionQuery);

                Guid economicRegionID;

                if (country2EconomicRegion.Count == 0)
                {
                    P_L3ER_SERAC_1621 param = new P_L3ER_SERAC_1621();
                    param.Country_ISO = Parameter.Country_ISO;
                    economicRegionID  = cls_Save_EconomicRegion_As_Country.Invoke(Connection, Transaction, param, securityTicket).Result;
                }
                else
                {
                    economicRegionID = country2EconomicRegion.FirstOrDefault().CMN_EconomicRegion_RefID;
                }

                if (Parameter.CMN_BPT_EMP_SalaryTypeID != Guid.Empty)
                {
                    ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query salaryType2EconomicRegionQuery = new ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query();
                    salaryType2EconomicRegionQuery.CMN_BPT_EMP_SalaryType_RefID = type.CMN_BPT_EMP_SalaryTypeID;
                    salaryType2EconomicRegionQuery.CMN_EconomicRegion_RefID     = economicRegionID;
                    salaryType2EconomicRegionQuery.IsDeleted    = false;
                    salaryType2EconomicRegionQuery.Tenant_RefID = securityTicket.TenantID;

                    var existingSalaryType2EconomicRegion = ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query.Search(Connection, Transaction, salaryType2EconomicRegionQuery).FirstOrDefault();

                    if (existingSalaryType2EconomicRegion != null)
                    {
                        existingSalaryType2EconomicRegion.SalaryType_Code = Parameter.SalaryType_Code;
                        existingSalaryType2EconomicRegion.Save(Connection, Transaction);
                    }
                    else
                    {
                        ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion salaryType2EconomicRegion = new ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion();
                        salaryType2EconomicRegion.CMN_BPT_EMP_SalaryType_RefID = type.CMN_BPT_EMP_SalaryTypeID;
                        salaryType2EconomicRegion.CMN_EconomicRegion_RefID     = economicRegionID;
                        salaryType2EconomicRegion.SalaryType_Code = Parameter.SalaryType_Code;
                        salaryType2EconomicRegion.Tenant_RefID    = securityTicket.TenantID;
                        salaryType2EconomicRegion.Save(Connection, Transaction);
                    }
                }
                else
                {
                    ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion salaryType2EconomicRegion = new ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion();
                    salaryType2EconomicRegion.CMN_BPT_EMP_SalaryType_RefID = type.CMN_BPT_EMP_SalaryTypeID;
                    salaryType2EconomicRegion.CMN_EconomicRegion_RefID     = economicRegionID;
                    salaryType2EconomicRegion.SalaryType_Code = Parameter.SalaryType_Code;
                    salaryType2EconomicRegion.Tenant_RefID    = securityTicket.TenantID;
                    salaryType2EconomicRegion.Save(Connection, Transaction);
                }
            }
            else if (Parameter.CMN_BPT_EMP_SalaryTypeID != Guid.Empty)
            {
                ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query salaryType2EconomicRegionQuery = new ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query();
                salaryType2EconomicRegionQuery.CMN_BPT_EMP_SalaryType_RefID = type.CMN_BPT_EMP_SalaryTypeID;
                salaryType2EconomicRegionQuery.IsDeleted    = false;
                salaryType2EconomicRegionQuery.Tenant_RefID = securityTicket.TenantID;

                var existingSalaryType2EconomicRegion = ORM_CMN_BPT_EMP_SalaryType_2_EconomicRegion.Query.Search(Connection, Transaction, salaryType2EconomicRegionQuery).FirstOrDefault();

                if (existingSalaryType2EconomicRegion != null)
                {
                    existingSalaryType2EconomicRegion.SalaryType_Code = Parameter.SalaryType_Code;
                    existingSalaryType2EconomicRegion.Save(Connection, Transaction);
                }
            }

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_L5RL_GRFT_0942_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode

            var returnValue = new FR_L5RL_GRFT_0942_Array();
            List <L5RL_GRFT_0942> retValList = new List <L5RL_GRFT_0942>();

            //Put your code here
            ORM_CMN_PER_Religion.Query religionQuery = new ORM_CMN_PER_Religion.Query();
            religionQuery.Tenant_RefID = securityTicket.TenantID;
            religionQuery.IsDeleted    = false;
            List <ORM_CMN_PER_Religion> religionList = ORM_CMN_PER_Religion.Query.Search(Connection, Transaction, religionQuery);

            ORM_CMN_PER_Religion_2_EconomicRegion religionEconomicRegion;
            ORM_CMN_EconomicRegion economicRegion;
            FR_Base economicRegionRes;
            ORM_CMN_Country_2_EconomicRegion countryEconomicRegion;
            ORM_CMN_Country country;
            FR_Base         countryRes;
            L5RL_GRFT_0942  retValItem;
            foreach (var religion in religionList)
            {
                religionEconomicRegion = ORM_CMN_PER_Religion_2_EconomicRegion.Query.Search(Connection, Transaction,
                                                                                            new ORM_CMN_PER_Religion_2_EconomicRegion.Query()
                {
                    Tenant_RefID           = securityTicket.TenantID,
                    IsDeleted              = false,
                    CMN_PER_Religion_RefID = religion.CMN_PER_ReligionID
                }).FirstOrDefault();

                retValItem = new L5RL_GRFT_0942();
                retValItem.CMN_PER_ReligionID       = religion.CMN_PER_ReligionID;
                retValItem.GlobalPropertyMatchingID = religion.GlobalPropertyMatchingID;
                retValItem.Religion_Name            = religion.Religion_Name;
                retValItem.Religion_Code            = religionEconomicRegion != null ? religionEconomicRegion.Religion_Code : "";

                if (religionEconomicRegion == null)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                economicRegion    = new ORM_CMN_EconomicRegion();
                economicRegionRes = economicRegion.Load(Connection, Transaction, religionEconomicRegion.CMN_EconomicRegion_RefID);

                if (economicRegionRes.Status != FR_Status.Success || economicRegion.CMN_EconomicRegionID == Guid.Empty)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                countryEconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction,
                                                                                      new ORM_CMN_Country_2_EconomicRegion.Query()
                {
                    Tenant_RefID             = securityTicket.TenantID,
                    IsDeleted                = false,
                    CMN_EconomicRegion_RefID = economicRegion.CMN_EconomicRegionID
                }).FirstOrDefault();

                if (countryEconomicRegion == null)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                country    = new ORM_CMN_Country();
                countryRes = country.Load(Connection, Transaction, countryEconomicRegion.CMN_Country_RefID);

                if (countryRes.Status != FR_Status.Success || country.CMN_CountryID == Guid.Empty)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                retValItem.Country_ISOCode_Alpha2 = country.Country_ISOCode_Alpha2;
                retValList.Add(retValItem);
            }

            returnValue.Result = retValList.ToArray();

            return(returnValue);

            #endregion UserCode
        }
예제 #17
0
        protected static FR_L5CS_GCSSFT_1319_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode

            var returnValue = new FR_L5CS_GCSSFT_1319_Array();

            //Put your code here
            List <L5CS_GCSSFT_1319> retValList = new List <L5CS_GCSSFT_1319>();

            ORM_CMN_PER_CompulsorySocialSecurityStatus.Query socialSecurityQuery = new ORM_CMN_PER_CompulsorySocialSecurityStatus.Query();
            socialSecurityQuery.Tenant_RefID = securityTicket.TenantID;
            socialSecurityQuery.IsDeleted    = false;
            List <ORM_CMN_PER_CompulsorySocialSecurityStatus> socialSecurityList = ORM_CMN_PER_CompulsorySocialSecurityStatus.Query.Search(Connection, Transaction, socialSecurityQuery);

            ORM_CMN_EconomicRegion economicRegion;
            FR_Base economicRegionRes;
            ORM_CMN_Country_2_EconomicRegion countryEconomicRegion;
            ORM_CMN_Country  country;
            FR_Base          countryRes;
            L5CS_GCSSFT_1319 retValItem;
            foreach (var socialSecurity in socialSecurityList)
            {
                retValItem = new L5CS_GCSSFT_1319();
                retValItem.CMN_EconomicRegion_RefID = socialSecurity.CMN_EconomicRegion_RefID;
                retValItem.CMN_PER_CompulsorySocialSecurityStatusID = socialSecurity.CMN_PER_CompulsorySocialSecurityStatusID;
                retValItem.GlobalPropertyMatchingID         = socialSecurity.GlobalPropertyMatchingID;
                retValItem.SocialSecurityStatus_Code        = socialSecurity.SocialSecurityStatus_Code;
                retValItem.SocialSecurityStatus_Description = socialSecurity.SocialSecurityStatus_Description;
                retValItem.SocialSecurityStatus_Name        = socialSecurity.SocialSecurityStatus_Name;

                economicRegion    = new ORM_CMN_EconomicRegion();
                economicRegionRes = economicRegion.Load(Connection, Transaction, socialSecurity.CMN_EconomicRegion_RefID);

                if (economicRegionRes.Status != FR_Status.Success || economicRegion.CMN_EconomicRegionID == Guid.Empty)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                countryEconomicRegion = ORM_CMN_Country_2_EconomicRegion.Query.Search(Connection, Transaction,
                                                                                      new ORM_CMN_Country_2_EconomicRegion.Query()
                {
                    Tenant_RefID             = securityTicket.TenantID,
                    IsDeleted                = false,
                    CMN_EconomicRegion_RefID = economicRegion.CMN_EconomicRegionID
                }).FirstOrDefault();

                if (countryEconomicRegion == null)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                country    = new ORM_CMN_Country();
                countryRes = country.Load(Connection, Transaction, countryEconomicRegion.CMN_Country_RefID);

                if (countryRes.Status != FR_Status.Success || country.CMN_CountryID == Guid.Empty)
                {
                    retValItem.Country_ISOCode_Alpha2 = "";
                    retValList.Add(retValItem);
                    continue;
                }

                retValItem.Country_ISOCode_Alpha2 = country.Country_ISOCode_Alpha2;
                retValList.Add(retValItem);
            }

            returnValue.Result = retValList.ToArray();

            return(returnValue);

            #endregion UserCode
        }