public void MiseAjourPoste() { try { string machine = this.txtMomMachine.Text; if (this.Cbo_Centre.SelectedItem != null && !string.IsNullOrEmpty(this.txtMomMachine.Text)) { ServiceCaisse.CsCaisse laCaisseSelect = new ServiceCaisse.CsCaisse(); if (this.Cbo_Caisse.SelectedItem != null) { laCaisseSelect = (ServiceCaisse.CsCaisse)Cbo_Caisse.SelectedItem; } Galatee.Silverlight.ServiceAccueil.CsCentre leCentre = Cbo_Centre.SelectedItem as Galatee.Silverlight.ServiceAccueil.CsCentre; CsPoste lePoste = new CsPoste() { CODECENTRE = leCentre.CODE, FK_IDCENTRE = leCentre.PK_ID, NOMPOSTE = this.txtMomMachine.Text.ToUpper().Trim(), NUMCAISSE = (laCaisseSelect == null ? string.Empty : laCaisseSelect.NUMCAISSE), }; lePoste.FK_IDCAISSE = null; if (laCaisseSelect != null && !string.IsNullOrEmpty(laCaisseSelect.NUMCAISSE)) { lePoste.FK_IDCAISSE = laCaisseSelect.PK_ID; /** ZEG 29/08/2017 **/ if (SessionObject.iDCaisseDeclaree == null && lePoste.FK_IDCAISSE != null) { SessionObject.iDCaisseDeclaree = lePoste.FK_IDCAISSE; } } Galatee.Silverlight.ServiceAdministration.AdministrationServiceClient service = new Galatee.Silverlight.ServiceAdministration.AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration")); service.InsertPosteCompleted += (s, args) => { if (args != null && args.Cancelled) { return; } Classes.IsolatedStorage.storeMachine(lePoste.NOMPOSTE); Classes.IsolatedStorage.storeCentre(lePoste.CODECENTRE); /** ZEG 29/08/2017 **/ if (SessionObject.iDCaisseDeclaree == null && lePoste.FK_IDCAISSE != null) { SessionObject.iDCaisseDeclaree = lePoste.FK_IDCAISSE; } }; service.InsertPosteAsync(lePoste); service.CloseAsync(); } } catch (Exception) { throw; } }
public void UpdatePoste() { try { if (this.Cbo_Centre.SelectedItem != null && !string.IsNullOrEmpty(lePosteModif.NOMPOSTE)) { ServiceCaisse.CsCaisse laCaisseSelect = new ServiceCaisse.CsCaisse(); if (this.Cbo_Caisse.SelectedItem != null) { laCaisseSelect = (ServiceCaisse.CsCaisse)Cbo_Caisse.SelectedItem; } Galatee.Silverlight.ServiceAccueil.CsCentre leCentre = Cbo_Centre.SelectedItem as Galatee.Silverlight.ServiceAccueil.CsCentre; lePosteModif.CODECENTRE = leCentre.CODE; lePosteModif.FK_IDCENTRE = leCentre.PK_ID; lePosteModif.NOMPOSTE = lePosteModif.NOMPOSTE; lePosteModif.NUMCAISSE = (laCaisseSelect == null ? string.Empty : laCaisseSelect.NUMCAISSE); lePosteModif.FK_IDCAISSE = null; if (laCaisseSelect != null && !string.IsNullOrEmpty(laCaisseSelect.NUMCAISSE)) { lePosteModif.FK_IDCAISSE = laCaisseSelect.PK_ID; } /** ZEG 29/08/2017 **/ if (SessionObject.iDCaisseDeclaree == null && lePosteModif.FK_IDCAISSE != null) { SessionObject.iDCaisseDeclaree = lePosteModif.FK_IDCAISSE; } Galatee.Silverlight.ServiceAdministration.AdministrationServiceClient service = new Galatee.Silverlight.ServiceAdministration.AdministrationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Administration")); service.UpdatePosteCompleted += (s, args) => { if (args != null && args.Cancelled) { return; } SessionObject.ListePoste = args.Result; }; service.UpdatePosteAsync(lePosteModif); service.CloseAsync(); } } catch (Exception) { throw; } }