Suivez et participez au développement du nouvel OpenCellar : PLOC.co
> Open Cellar for Windows
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Developers resources
> Open Cellar for Mobile
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Open Cellar for Mac/Linux
> Help Center
> FAQ
> Download Center
> Enter the Forum
> Version history
> Developers resources
> My Account
> My Live services
> My pages
> My library
> My published wines
> My labels
> My posted messages
> Write a page
> Open Cellar Forum Index
> Windows Forum
> Mac/Linux Forum
> Mobile Forum
> Search for and import wines
> Search for labels
> Compare prices (Sniffer)
Search:
> Search with all engines
> Search in forums
> Search in personal pages
> Search on open-cellar.com
> Search in wine cards
> Search in labels
> Search in price comparison tool (Sniffer)
Welcome (
connect
-
create an account
)
Home
»
The forum
»
Open Cellar Home Edition (Windows)
Nuage de tags
Open Cellar
Scripts
Etiquette
PPP
Cellar book
Mac
Vista
Synchronisation
Excel export
vinoXml
usb
sniffer
backup
import
printing
chardonnet
palm
statistics
Linux
Mise a jour des pays
14/02/2008
Reply
Mise a jour des pays
Olivier75
6 posts
Bonjour,
j'ai essayé d'écrire un script pour inserer le pays quand ce dernier n'est pas renseigné.
En fait je veux mettre sur toutes les fiches "France", sauf si un pays est déjà saisie sur une fichier.
J'ai essayé le code suivant, mais sans succès
// vérifie qu'une cave est bien ouverte
if(App.ActiveCellar == null)
{
return;
}
// Ferme les fiches vins
WindowsCollection wc = App.Windows.GetWindows(WindowType.Wine);
for (int i = 0; i < wc.Count; i++)
{
wc[i].Close();
}
ObjectCollection oc = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine);
for (int i = 0; i < oc.Count; i++)
{
Wine w = (Wine)oc[i];
if(w.Country.Name == null)
{
w.Country.Name="France";
w.Save();
}
}
App.Commands["ApplyConfigCommand"].Execute();
15/02/2008
Reply
Re : Mise a jour des pays
Administrateur
3099 posts
Bonjour,
Vous n'étiez pas loin.
La future version du site embarquera avec elle un centre de dev une documentation
// vérifie qu'une cave est bien ouverte if(App.ActiveCellar == null) { return; } // Récupere l'objet France Country france = null; ObjectCollection items = App.ActiveCellar.GetCollection((ushort)ObjectType.Country); for (int i = 0; i < items.Count; i++) { Country country = (Country)items[i]; if(country.Name.Trim() == "France") { france = country; break; } } if(france == null){ MessageBox.Show("Pays non trouvé"); return; } // Ferme les fiches vins WindowsCollection wc = App.Windows.GetWindows(WindowType.Wine); for (int i = 0; i < wc.Count; i++) { wc[i].Close(); } ObjectCollection oc = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine); for (int i = 0; i < oc.Count; i++) { Wine w = (Wine)oc[i]; if(w.Country.Name.Trim() == String.Empty) { w.Country = france; w.Save(); } } App.Commands["ApplyConfigCommand"].Execute();
Matthieu
18/02/2008
Reply
Re : Mise a jour des pays
Olivier75
6 posts
Merci beaucoup, je vais me pencher sur ce code et essayer de le comprendre !!!!
© 2006-2014
Matthieu DUCROCQ
- All rights reserved - Last update: january 2014 |
|
Support Open Cellar
|
Contact
|
About