Example #1
0
        /// <summary>
        /// Enregistre le texte d'une langue, sur le serveur OpenERP
        /// </summary>
        /// <param name="clientOpenERP">Client OpenERP déjà connecté</param>
        /// <param name="codeLangue">Code de la langue à enregistrer</param>
        /// <returns></returns>
        public bool sauveLangue(Clients.clientOpenERP clientOpenERP, string codeLangue)
        {
            if (!_changed.ContainsKey(codeLangue))
            {
                return(false);
            }

            string libelle;
            bool   retour;

            [email protected] context;
            [email protected] fields;
            if ((bool)_changed[codeLangue])
            {
                libelle = (string)_listeChaines[codeLangue];
                fields  = new [email protected]();
                fields.add(_nomChamps, libelle);
                context = new [email protected]();
                context.add("lang", codeLangue);
                retour = clientOpenERP.update(fields, _classeParente.GetType(), (int)(_classeParente.listProperties.value("id", [email protected]_TYPE.INTEGER)), context);
                if (!retour)
                {
                    throw new Exception("Update return False");
                }

                _changed[codeLangue] = false;
            }
            return(true);
        }
Example #2
0
        public bool sauveData(Clients.clientOpenERP clientOpenERP, [email protected] context)
        {
            bool result;

            try
            {
                if ((!listProperties.ContainsKey("id")) ||
                    ((int)listProperties.value("id", aField.FIELD_TYPE.INTEGER) == 0))
                {
                    listProperties.setValue("id", clientOpenERP.insert(this, context));
                    result = ((int)listProperties.value("id") > 0);
                }
                else
                {
                    result = clientOpenERP.update(this, context);
                }
                if (result)
                {
                    foreach (System.Reflection.PropertyInfo prop in listeProprieteMultilangue())
                    {
                        ((IMDEV.OpenERP.models.fields.texteMultilangue)(prop.GetValue(this, null))).sauveLangues(clientOpenERP);
                    }
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw new Systeme.exceptionOpenERP(IMDEV.OpenERP.Systeme.exceptionOpenERP.ERRORS.ERR_SAVE_OBJECT, ex.Message);
            }
            finally
            {
                clientOpenERP = null;
            }
            return(false);
        }