public void ImportCharacteristic(Model.Prestashop.PsProduct PsProduct, Model.Local.Article Article, bool ArticleExists) { Model.Local.ConfigRepository ConfigRepository = new Model.Local.ConfigRepository(); Model.Local.Config Config = ConfigRepository.ReadName(Global.ConfigLang); if (Config != null && Global.IsNumeric(Config.Con_Value)) { Model.Prestashop.PsFeatureProductRepository PsFeatureProductRepository = new Model.Prestashop.PsFeatureProductRepository(); Model.Prestashop.PsFeatureValueRepository PsFeatureValueRepository = new Model.Prestashop.PsFeatureValueRepository(); Model.Prestashop.PsFeatureValueLangRepository PsFeatureValueLangRepository = new Model.Prestashop.PsFeatureValueLangRepository(); Model.Local.CharacteristicRepository CharacteristicRepository = new Model.Local.CharacteristicRepository(); foreach (Model.Prestashop.PsFeatureProduct FeatureProduct in PsFeatureProductRepository.List(PsProduct.IDProduct)) { Model.Prestashop.PsFeatureValue PsFeatureValue = PsFeatureValueRepository.ReadFeatureValue(FeatureProduct.IDFeatureValue); Model.Prestashop.PsFeatureValueLang PsFeatureValueLang = PsFeatureValueLangRepository.ReadFeatureValueLang(FeatureProduct.IDFeatureValue, Convert.ToUInt32(Config.Con_Value)); Model.Local.Characteristic Characteristic = null; if (ArticleExists) { Characteristic = CharacteristicRepository.ReadFeatureArticle((int)FeatureProduct.IDFeature, Article.Art_Id); } if (!ArticleExists || Characteristic == null) { Characteristic = new Model.Local.Characteristic() { Art_Id = Article.Art_Id, Cha_Custom = Convert.ToBoolean(PsFeatureValue.Custom), Cha_IdFeature = (int)FeatureProduct.IDFeature, Cha_Value = PsFeatureValueLang.Value, Pre_Id = (int)FeatureProduct.IDFeatureValue, }; CharacteristicRepository.Add(Characteristic); } else { Characteristic.Cha_Custom = Convert.ToBoolean(PsFeatureValue.Custom); Characteristic.Cha_Value = PsFeatureValueLang.Value; Characteristic.Pre_Id = (int)FeatureProduct.IDFeatureValue; CharacteristicRepository.Save(); } } } }
public Boolean ImportValues(Model.Local.Article Article, string AR_Ref) { Boolean HasValue = false; try { Model.Sage.F_ARTICLERepository F_ARTICLERepository = new Model.Sage.F_ARTICLERepository(); #region Informations libre Article Model.Local.InformationLibreRepository InformationLibreRepository = new Model.Local.InformationLibreRepository(); foreach (Model.Local.InformationLibre InformationLibre in InformationLibreRepository.ListSync()) { // <JG> 21/08/2017 ajout filtre info libre pour automates if (Core.Temp.TaskImportStatInfoLibreFilter == null || Core.Temp.TaskImportStatInfoLibreFilter.Contains(Core.Global.EscapeArgumentSyntax(InformationLibre.Sag_InfoLibre))) { Model.Sage.cbSysLibreRepository.CB_Type TypeInfoLibre = new Model.Sage.cbSysLibreRepository().ReadTypeInformationLibre(InformationLibre.Sag_InfoLibre, Model.Sage.cbSysLibreRepository.CB_File.F_ARTICLE); switch (TypeInfoLibre) { case Model.Sage.cbSysLibreRepository.CB_Type.SageText: case Model.Sage.cbSysLibreRepository.CB_Type.SageTable: #region text if (F_ARTICLERepository.ExistArticleInformationLibreText(InformationLibre.Sag_InfoLibre, AR_Ref)) { if (!string.IsNullOrWhiteSpace(Core.Global.SageValueReplacement(F_ARTICLERepository.ReadArticleInformationLibreText(InformationLibre.Sag_InfoLibre, AR_Ref)))) { Model.Local.CharacteristicRepository CharacteristicRepository = new Model.Local.CharacteristicRepository(); Model.Local.Characteristic ArticleCharacteristic; if (CharacteristicRepository.ExistFeatureArticle(InformationLibre.Cha_Id, Article.Art_Id)) { ArticleCharacteristic = CharacteristicRepository.ReadFeatureArticle(InformationLibre.Cha_Id, Article.Art_Id); string temp_text = ArticleCharacteristic.Cha_Value; int? temp_id = ArticleCharacteristic.Pre_Id; ArticleCharacteristic.Cha_Value = Core.Global.SageValueReplacement(F_ARTICLERepository.ReadArticleInformationLibreText(InformationLibre.Sag_InfoLibre, AR_Ref));; switch (InformationLibre.Inf_Mode) { case (short)Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, InformationLibre.Cha_Id); break; case (short)Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Save(); if (temp_text != ArticleCharacteristic.Cha_Value || temp_id != ArticleCharacteristic.Pre_Id) { HasValue = true; } } else { HasValue = true; ArticleCharacteristic = new Model.Local.Characteristic() { Art_Id = Article.Art_Id, Cha_IdFeature = (int)InformationLibre.Cha_Id, Cha_Value = Core.Global.SageValueReplacement(F_ARTICLERepository.ReadArticleInformationLibreText(InformationLibre.Sag_InfoLibre, AR_Ref)), }; switch (InformationLibre.Inf_Mode) { case (short)Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, InformationLibre.Cha_Id); break; case (short)Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Add(ArticleCharacteristic); } } else if (Core.Global.GetConfig().ArticleSuppressionAutoCaracteristique) { DeleteFeatureProduct(InformationLibre, Article); } } #endregion break; case Model.Sage.cbSysLibreRepository.CB_Type.SageValeur: case Model.Sage.cbSysLibreRepository.CB_Type.SageMontant: #region decimal if (F_ARTICLERepository.ExistArticleInformationLibreNumerique(InformationLibre.Sag_InfoLibre, AR_Ref)) { if (F_ARTICLERepository.ReadArticleInformationLibreNumerique(InformationLibre.Sag_InfoLibre, AR_Ref) != null) { Model.Local.CharacteristicRepository CharacteristicRepository = new Model.Local.CharacteristicRepository(); Model.Local.Characteristic ArticleCharacteristic; if (CharacteristicRepository.ExistFeatureArticle(InformationLibre.Cha_Id, Article.Art_Id)) { ArticleCharacteristic = CharacteristicRepository.ReadFeatureArticle(InformationLibre.Cha_Id, Article.Art_Id); string temp_text = ArticleCharacteristic.Cha_Value; int? temp_id = ArticleCharacteristic.Pre_Id; ArticleCharacteristic.Cha_Value = F_ARTICLERepository.ReadArticleInformationLibreNumerique(InformationLibre.Sag_InfoLibre, AR_Ref).Value .ToString((TypeInfoLibre == Model.Sage.cbSysLibreRepository.CB_Type.SageMontant) ? "0.00####" : "0.######"); switch (InformationLibre.Inf_Mode) { case (short)Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, InformationLibre.Cha_Id); break; case (short)Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Save(); if (temp_text != ArticleCharacteristic.Cha_Value || temp_id != ArticleCharacteristic.Pre_Id) { HasValue = true; } } else { HasValue = true; ArticleCharacteristic = new Model.Local.Characteristic() { Art_Id = Article.Art_Id, Cha_IdFeature = (int)InformationLibre.Cha_Id, Cha_Value = F_ARTICLERepository.ReadArticleInformationLibreNumerique(InformationLibre.Sag_InfoLibre, AR_Ref).Value .ToString((TypeInfoLibre == Model.Sage.cbSysLibreRepository.CB_Type.SageMontant) ? "0.00####" : "0.######"), }; switch (InformationLibre.Inf_Mode) { case (short)Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, InformationLibre.Cha_Id); break; case (short)Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Add(ArticleCharacteristic); } } else if (Core.Global.GetConfig().ArticleSuppressionAutoCaracteristique) { DeleteFeatureProduct(InformationLibre, Article); } } #endregion break; case Model.Sage.cbSysLibreRepository.CB_Type.SageDate: case Model.Sage.cbSysLibreRepository.CB_Type.SageSmallDate: #region datetime if (F_ARTICLERepository.ExistArticleInformationLibreDate(InformationLibre.Sag_InfoLibre, AR_Ref)) { if (F_ARTICLERepository.ReadArticleInformationLibreDate(InformationLibre.Sag_InfoLibre, AR_Ref) != null) { Model.Local.CharacteristicRepository CharacteristicRepository = new Model.Local.CharacteristicRepository(); Model.Local.Characteristic ArticleCharacteristic; if (CharacteristicRepository.ExistFeatureArticle(InformationLibre.Cha_Id, Article.Art_Id)) { ArticleCharacteristic = CharacteristicRepository.ReadFeatureArticle(InformationLibre.Cha_Id, Article.Art_Id); string temp_text = ArticleCharacteristic.Cha_Value; int? temp_id = ArticleCharacteristic.Pre_Id; ArticleCharacteristic.Cha_Value = F_ARTICLERepository.ReadArticleInformationLibreDate(InformationLibre.Sag_InfoLibre, AR_Ref).ToString(); switch (InformationLibre.Inf_Mode) { case (short)Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, InformationLibre.Cha_Id); break; case (short)Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Save(); if (temp_text != ArticleCharacteristic.Cha_Value || temp_id != ArticleCharacteristic.Pre_Id) { HasValue = true; } } else { ArticleCharacteristic = new Model.Local.Characteristic() { Art_Id = Article.Art_Id, Cha_IdFeature = (int)InformationLibre.Cha_Id, Cha_Value = F_ARTICLERepository.ReadArticleInformationLibreDate(InformationLibre.Sag_InfoLibre, AR_Ref).ToString(), }; switch (InformationLibre.Inf_Mode) { case (short)Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, InformationLibre.Cha_Id); break; case (short)Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Add(ArticleCharacteristic); } } else if (Core.Global.GetConfig().ArticleSuppressionAutoCaracteristique) { DeleteFeatureProduct(InformationLibre, Article); } } #endregion break; case Model.Sage.cbSysLibreRepository.CB_Type.Deleted: default: break; } } } #endregion // traitement uniquement si absence de filtre sur l'automate if (Core.Temp.TaskImportStatInfoLibreFilter == null) { #region Statistiques Article Model.Local.StatistiqueArticleRepository StatistiqueArticleRepository = new Model.Local.StatistiqueArticleRepository(); foreach (Model.Local.StatistiqueArticle StatistiqueArticle in StatistiqueArticleRepository.ListSync()) { Model.Sage.P_INTSTATARTRepository P_INTSTATARTRepository = new Model.Sage.P_INTSTATARTRepository(); if (P_INTSTATARTRepository.ExistStatArt(StatistiqueArticle.Sag_StatArt)) { Model.Sage.P_INTSTATART P_INTSTATART = P_INTSTATARTRepository.ReadStatArt(StatistiqueArticle.Sag_StatArt); Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadReference(AR_Ref); String stat_value = null; switch (P_INTSTATART.cbMarq) { case 1: stat_value = F_ARTICLE.AR_Stat01; break; case 2: stat_value = F_ARTICLE.AR_Stat02; break; case 3: stat_value = F_ARTICLE.AR_Stat03; break; case 4: stat_value = F_ARTICLE.AR_Stat04; break; case 5: stat_value = F_ARTICLE.AR_Stat05; break; } if (!String.IsNullOrWhiteSpace(stat_value)) { Model.Local.CharacteristicRepository CharacteristicRepository = new Model.Local.CharacteristicRepository(); Model.Local.Characteristic ArticleCharacteristic; if (CharacteristicRepository.ExistFeatureArticle(StatistiqueArticle.Cha_Id, Article.Art_Id)) { ArticleCharacteristic = CharacteristicRepository.ReadFeatureArticle(StatistiqueArticle.Cha_Id, Article.Art_Id); string temp_text = ArticleCharacteristic.Cha_Value; int? temp_id = ArticleCharacteristic.Pre_Id; ArticleCharacteristic.Cha_Value = Core.Global.SageValueReplacement(stat_value); switch (StatistiqueArticle.Inf_Mode) { case (short)PRESTACONNECT.Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, StatistiqueArticle.Cha_Id); break; case (short)PRESTACONNECT.Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Save(); if (temp_text != ArticleCharacteristic.Cha_Value || temp_id != ArticleCharacteristic.Pre_Id) { HasValue = true; } } else { HasValue = true; ArticleCharacteristic = new Model.Local.Characteristic() { Art_Id = Article.Art_Id, Cha_IdFeature = (int)StatistiqueArticle.Cha_Id, Cha_Value = Core.Global.SageValueReplacement(stat_value), }; switch (StatistiqueArticle.Inf_Mode) { case (short)PRESTACONNECT.Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, StatistiqueArticle.Cha_Id); break; case (short)PRESTACONNECT.Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Add(ArticleCharacteristic); } } } } #endregion } #region Marque/Fabricant if (Core.Global.GetConfig().MarqueAutoStatistiqueActif&& Core.Temp.TaskImportStatInfoLibreFilter == null) { Model.Sage.P_INTSTATARTRepository P_INTSTATARTRepository = new Model.Sage.P_INTSTATARTRepository(); if (P_INTSTATARTRepository.ExistStatArt(Core.Global.GetConfig().MarqueAutoStatistiqueName)) { Model.Sage.P_INTSTATART P_INTSTATART = P_INTSTATARTRepository.ReadStatArt(Core.Global.GetConfig().MarqueAutoStatistiqueName); Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadReference(AR_Ref); String stat_value = null; switch (P_INTSTATART.cbMarq) { case 1: stat_value = F_ARTICLE.AR_Stat01; break; case 2: stat_value = F_ARTICLE.AR_Stat02; break; case 3: stat_value = F_ARTICLE.AR_Stat03; break; case 4: stat_value = F_ARTICLE.AR_Stat04; break; case 5: stat_value = F_ARTICLE.AR_Stat05; break; } if (!String.IsNullOrWhiteSpace(stat_value)) { int temp_id = Article.Art_Manufacturer; Article.Art_Manufacturer = CreateManufacturer(Core.Global.SageValueReplacement(stat_value)); if (temp_id != Article.Art_Manufacturer) { HasValue = true; } } } } else if (Core.Global.GetConfig().MarqueAutoInfolibreActif) { Model.Sage.cbSysLibreRepository.CB_Type TypeInfoLibre = new Model.Sage.cbSysLibreRepository().ReadTypeInformationLibre(Core.Global.GetConfig().MarqueAutoInfolibreName, Model.Sage.cbSysLibreRepository.CB_File.F_ARTICLE); switch (TypeInfoLibre) { case PRESTACONNECT.Model.Sage.cbSysLibreRepository.CB_Type.SageText: case PRESTACONNECT.Model.Sage.cbSysLibreRepository.CB_Type.SageTable: #region text if (F_ARTICLERepository.ExistArticleInformationLibreText(Core.Global.GetConfig().MarqueAutoInfolibreName, AR_Ref) && !string.IsNullOrWhiteSpace(Core.Global.SageValueReplacement(F_ARTICLERepository.ReadArticleInformationLibreText(Core.Global.GetConfig().MarqueAutoInfolibreName, AR_Ref)))) { int temp_id = Article.Art_Manufacturer; Article.Art_Manufacturer = CreateManufacturer(Core.Global.SageValueReplacement(F_ARTICLERepository.ReadArticleInformationLibreText(Core.Global.GetConfig().MarqueAutoInfolibreName, AR_Ref))); if (temp_id != Article.Art_Manufacturer) { HasValue = true; } } #endregion break; default: break; } } #endregion #region Fournisseur if (Core.Global.GetConfig().FournisseurAutoStatistiqueActif&& Core.Temp.TaskImportStatInfoLibreFilter == null) { Model.Sage.P_INTSTATARTRepository P_INTSTATARTRepository = new Model.Sage.P_INTSTATARTRepository(); if (P_INTSTATARTRepository.ExistStatArt(Core.Global.GetConfig().FournisseurAutoStatistiqueName)) { Model.Sage.P_INTSTATART P_INTSTATART = P_INTSTATARTRepository.ReadStatArt(Core.Global.GetConfig().FournisseurAutoStatistiqueName); Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadReference(AR_Ref); String stat_value = null; switch (P_INTSTATART.cbMarq) { case 1: stat_value = F_ARTICLE.AR_Stat01; break; case 2: stat_value = F_ARTICLE.AR_Stat02; break; case 3: stat_value = F_ARTICLE.AR_Stat03; break; case 4: stat_value = F_ARTICLE.AR_Stat04; break; case 5: stat_value = F_ARTICLE.AR_Stat05; break; } if (!String.IsNullOrWhiteSpace(stat_value)) { int temp_id = Article.Art_Supplier; Article.Art_Supplier = CreateSupplier(Core.Global.SageValueReplacement(stat_value)); if (temp_id != Article.Art_Supplier) { HasValue = true; } } } } else if (Core.Global.GetConfig().FournisseurAutoInfolibreActif) { Model.Sage.cbSysLibreRepository.CB_Type TypeInfoLibre = new Model.Sage.cbSysLibreRepository().ReadTypeInformationLibre(Core.Global.GetConfig().FournisseurAutoInfolibreName, Model.Sage.cbSysLibreRepository.CB_File.F_ARTICLE); switch (TypeInfoLibre) { case PRESTACONNECT.Model.Sage.cbSysLibreRepository.CB_Type.SageText: case PRESTACONNECT.Model.Sage.cbSysLibreRepository.CB_Type.SageTable: #region text if (F_ARTICLERepository.ExistArticleInformationLibreText(Core.Global.GetConfig().FournisseurAutoInfolibreName, AR_Ref) && !string.IsNullOrWhiteSpace(Core.Global.SageValueReplacement(F_ARTICLERepository.ReadArticleInformationLibreText(Core.Global.GetConfig().FournisseurAutoInfolibreName, AR_Ref)))) { int temp_id = Article.Art_Supplier; Article.Art_Supplier = CreateSupplier(Core.Global.SageValueReplacement(F_ARTICLERepository.ReadArticleInformationLibreText(Core.Global.GetConfig().FournisseurAutoInfolibreName, AR_Ref))); if (temp_id != Article.Art_Supplier) { HasValue = true; } } #endregion break; default: break; } } #endregion if (Core.Temp.TaskImportStatInfoLibreFilter == null) { #region Information Sage Model.Local.InformationArticleRepository InformationArticleRepository = new Model.Local.InformationArticleRepository(); foreach (Model.Local.InformationArticle InformationArticle in InformationArticleRepository.ListSync()) { { Model.Internal.SageInfoArticle SageInfoArticle = new Model.Internal.SageInfoArticle((Parametres.SageInfoArticle)InformationArticle.Sag_InfoArt); Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadReference(AR_Ref); String stat_value = null; switch (SageInfoArticle._SageInfoArticle) { case PRESTACONNECT.Core.Parametres.SageInfoArticle.Substitut: stat_value = F_ARTICLE.AR_Substitut; break; case PRESTACONNECT.Core.Parametres.SageInfoArticle.FamilleCode: stat_value = F_ARTICLE.FA_CodeFamille; break; case PRESTACONNECT.Core.Parametres.SageInfoArticle.FamilleIntitule: if (F_ARTICLE.F_FAMILLE != null && !string.IsNullOrEmpty(F_ARTICLE.F_FAMILLE.FA_Intitule)) { stat_value = F_ARTICLE.F_FAMILLE.FA_Intitule; } break; case PRESTACONNECT.Core.Parametres.SageInfoArticle.Garantie: if (F_ARTICLE.AR_Garantie != null) { stat_value = F_ARTICLE.AR_Garantie.Value.ToString(); } break; case PRESTACONNECT.Core.Parametres.SageInfoArticle.Pays: stat_value = F_ARTICLE.AR_Pays; break; case PRESTACONNECT.Core.Parametres.SageInfoArticle.PoidsNet: if (F_ARTICLE.AR_PoidsNet != null && F_ARTICLE.AR_PoidsNet != 0) { stat_value = F_ARTICLE.AR_PoidsNet.ToString(); } break; case PRESTACONNECT.Core.Parametres.SageInfoArticle.PoidsBrut: if (F_ARTICLE.AR_PoidsBrut != null && F_ARTICLE.AR_PoidsBrut != 0) { stat_value = F_ARTICLE.AR_PoidsBrut.ToString(); } break; } if (!String.IsNullOrWhiteSpace(stat_value)) { Model.Local.CharacteristicRepository CharacteristicRepository = new Model.Local.CharacteristicRepository(); Model.Local.Characteristic ArticleCharacteristic; if (CharacteristicRepository.ExistFeatureArticle(InformationArticle.Cha_Id, Article.Art_Id)) { ArticleCharacteristic = CharacteristicRepository.ReadFeatureArticle(InformationArticle.Cha_Id, Article.Art_Id); string temp_text = ArticleCharacteristic.Cha_Value; int? temp_id = ArticleCharacteristic.Pre_Id; ArticleCharacteristic.Cha_Value = Core.Global.SageValueReplacement(stat_value); switch (InformationArticle.Inf_Mode) { case (short)PRESTACONNECT.Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, InformationArticle.Cha_Id); break; case (short)PRESTACONNECT.Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Save(); if (temp_text != ArticleCharacteristic.Cha_Value || temp_id != ArticleCharacteristic.Pre_Id) { HasValue = true; } } else { HasValue = true; ArticleCharacteristic = new Model.Local.Characteristic() { Art_Id = Article.Art_Id, Cha_IdFeature = (int)InformationArticle.Cha_Id, Cha_Value = Core.Global.SageValueReplacement(stat_value), }; switch (InformationArticle.Inf_Mode) { case (short)PRESTACONNECT.Core.Parametres.InformationLibreValeursMode.Predefinies: ArticleCharacteristic.Cha_Custom = false; ArticleCharacteristic.Pre_Id = CreateFeatureValue(ArticleCharacteristic.Cha_Value, InformationArticle.Cha_Id); break; case (short)PRESTACONNECT.Core.Parametres.InformationLibreValeursMode.Personnalisees: ArticleCharacteristic.Cha_Custom = true; break; } CharacteristicRepository.Add(ArticleCharacteristic); } } } } #endregion } } catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); } return(HasValue); }