private void ListeScelleExistant() { try { IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.SCELLES_RETOURNE_Pour_ScellageCptCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.Quartier); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } else { ListdesScelles = args.Result; } }; client.SCELLES_RETOURNE_Pour_ScellageCptAsync(UserConnecte.PK_ID); } catch (Exception ex) { throw ex; } }
private void ListeScelleExistant(int PK_Agt, int SatutScelle) { try { IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.RetourneListScelleByStatusCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.Quartier); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } donnesDatagridRemise.Clear(); if (args.Result != null) { foreach (var item in args.Result) { donnesDatagridRemise.Add(item); } } dgScelle.ItemsSource = donnesDatagridRemise; }; client.RetourneListScelleByStatusAsync(PK_Agt, SatutScelle); } catch (Exception ex) { throw ex; } }
private void SelectAllCompteurNonAffecte() { try { IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.SelectAllCompteurNonAffecteCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.Quartier); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } else { this.dtg_CompteurSaisie.ItemsSource = null; this.dtg_CompteurSaisie.ItemsSource = args.Result; } }; client.SelectAllCompteurNonAffecteAsync(); } catch (Exception ex) { throw ex; } }
private void RechercherCompteurByNumCptNumScelle(string NumCompteur, string NumScelle) { try { IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.RetourneCompteurBtaByNumCptNumScelleCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.Quartier); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } else { this.dtg_CompteurSaisie.ItemsSource = null; this.dtg_CompteurSaisie.ItemsSource = args.Result; leCptGenerale = args.Result; } }; client.RetourneCompteurBtaByNumCptNumScelleAsync(NumCompteur, NumScelle); } catch (Exception ex) { throw ex; } }
private void DeleteCompteur(CsCompteurBta listForCompteur) { try { var service = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); if (listForCompteur != null) { service.DeleteCompteurCompleted += (snder, UpdateR) => { if (UpdateR.Cancelled || UpdateR.Error != null) { Message.ShowError(UpdateR.Error.Message, Languages.EtatDuCompteur); return; } if (UpdateR.Result == false) { Message.ShowError(Languages.ErreurMiseAJourDonnees, Languages.EtatDuCompteur); return; } else { } }; service.DeleteCompteurAsync(listForCompteur); } } catch (Exception ex) { Message.Show(ex.Message, Languages.Commune); } }
private void RemplirListeCmbDesModelesMarqueExistant() { try { IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.RetourneListMarque_ModeleCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.Quartier); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } else { ListdesModelesfonctMarq = args.Result; ChargerDonneByProduit(laDemande.LaDemande.FK_IDPRODUIT.Value); } }; client.RetourneListMarque_ModeleAsync(); } catch (Exception ex) { throw ex; } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { try { if (DonnesDatagrid.Count == 0) { throw new Exception(Languages.AucuneDonneeASupprimer); } if (dtgrdRetourScelle.SelectedItems.Count > 0) { var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.LibelleReceptionScelle, Languages.QuestionSuppressionDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question); messageBox.OnMessageBoxClosed += (_, result) => { if (messageBox.Result == MessageBoxResult.OK) { if (dtgrdRetourScelle.SelectedItem != null) { var selected = dtgrdRetourScelle.SelectedItem as CsRetourScelles; if (selected != null) { IScelleServiceClient delete = new IScelleServiceClient(Utility.Protocole(), Utility.EndPoint("Scelles")); delete.DeleteRetoursCompleted += (del, argDel) => { if (argDel.Cancelled || argDel.Error != null) { Message.ShowError(argDel.Error.Message, Languages.LibelleReceptionScelle); return; } if (argDel.Result == false) { Message.ShowError(Languages.ErreurSuppressionDonnees, Languages.LibelleReceptionScelle); return; } donnesDatagrid.Remove(selected); }; delete.DeleteRetoursAsync(selected); } } } else { return; } }; messageBox.Show(); } else { throw new Exception(Languages.SelectionnerUnElement); } } catch (Exception ex) { Message.ShowError(ex.Message, Languages.LibelleCodeDepart); } }
private void btnPrint_Click(object sender, RoutedEventArgs e) { var dictionaryParam = new Dictionary <string, string>(); try { dictionaryParam.Add("RptParam_Code", Languages.Code.ToUpper()); dictionaryParam.Add("RptParam_Libelle", Languages.Libelle.ToUpper()); dictionaryParam.Add("RptParam_DateCreation", Languages.DateCreation); dictionaryParam.Add("RptParam_DateModification", Languages.DateModification); dictionaryParam.Add("RptParam_UserCreation", Languages.UserCreation); dictionaryParam.Add("RptParam_UserModification", Languages.UserModification); dictionaryParam.Add("RptParam_Title", Languages.ListeCodeDepart.ToUpper()); if (DonnesDatagrid.Count == 0) { throw new Exception(Languages.AucuneDonneeAImprimer); } var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.LibelleCodeDepart, Languages.QuestionImpressionDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question); messageBox.OnMessageBoxClosed += (_, result) => { if (messageBox.Result == MessageBoxResult.OK) { string key = Utility.getKey(); var service = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); //service.EditerListeCodeDepartCompleted += (snder, print) => //{ // if (print.Cancelled || print.Error != null) // { // Message.ShowError(print.Error.Message, Languages.LibelleCodeDepart); // return; // } // if (!print.Result) // { // Message.ShowError(Languages.ErreurImpressionDonnees, Languages.LibelleCodeDepart); // return; // } // Utility.ActionImpressionDirect(null, key, "CodeDepart", "Parametrage"); //}; //service.EditerListeCodeDepartAsync(key, dictionaryParam); } else { return; } }; messageBox.Show(); } catch (Exception ex) { Message.ShowError(ex.Message, Languages.LibelleCodeDepart); } }
private void RemplirListeCmbDesEtatCompteursExistant() { try { IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.RetourneEtatCompteurCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.Quartier); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } else { lstEtatCompteur = args.Result; this.Cbo_Etat_cmpt.ItemsSource = lstEtatCompteur; this.Cbo_Etat_cmpt.DisplayMemberPath = "Libelle_ETAT"; this.Cbo_Etat_cmpt.SelectedValuePath = "EtatCompteur_ID"; if (ObjetSelectionnee != null) { foreach (CsRefEtatCompteur marqModl in Cbo_Etat_cmpt.ItemsSource) { if (marqModl.EtatCompteur_ID != null) { Cbo_Etat_cmpt.SelectedItem = marqModl; break; } } } } }; client.RetourneEtatCompteurAsync(); } catch (Exception ex) { throw ex; } }
private void GetData() { try { //UcRetourScelle ctrl = new UcRetourScelle(); //ctrl.Closed += new EventHandler(RafraichirList); //ctrl.Show(); IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.SelectAllRetourScelleCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.LibelleReceptionScelle); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } donnesDatagrid.Clear(); if (args.Result != null) { foreach (var item in args.Result) { if (item.Date_Retour.Date == DateTime.Now.Date) { donnesDatagrid.Add(item); } } } dtgrdRetourScelle.ItemsSource = donnesDatagrid; }; client.SelectAllRetourScelleAsync(); } catch (Exception ex) { throw ex; } }
//private void GetDatascelle(int PK_Agt,int SatutScelle) //{ // try // { // //UcReceptionLotScellesMagasinGeneral ctrl = new UcReceptionLotScellesMagasinGeneral(); // //ctrl.Closed += new EventHandler(RafraichirList); // //ctrl.Show(); // IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); // client.SelectAllRetourScelleCompleted += (ssender, args) => // { // if (args.Cancelled || args.Error != null) // { // string error = args.Error.Message; // Message.ShowError(error, Languages.LibelleReceptionScelle); // return; // } // if (args.Result == null) // { // Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); // return; // } // donnesDatagridScelle.Clear(); // if (args.Result != null) // { // foreach (var item in args.Result.Where(x => x.Status_ID == SatutScelle && x.Receveur_Mat == PK_Agt.ToString().Trim())) // { // //if(item.DateReception==DateTime.Now) // donnesDatagridScelle.Add(item); // } // } // dgScelleR.ItemsSource = donnesDatagridScelle; // }; // client.SelectAllRetourScelleAsync(); // } // catch (Exception ex) // { // throw ex; // } //} private void RemplirListeCmbDesStatutScelles() { try { IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.SelectAllStatutsScellesCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.Scelles); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } else { this.Cbo_Motif.ItemsSource = args.Result; this.Cbo_Motif.DisplayMemberPath = "Status"; this.Cbo_Motif.SelectedValuePath = "Status_ID"; foreach (CsRefStatutsScelles OgSll in Cbo_Motif.ItemsSource) { if (OgSll.Status_ID != null && OgSll.Status_ID != SessionObject.Enumere.StatusScelleDisponible) { Cbo_Motif.SelectedItem = OgSll; break; } } } }; client.SelectAllStatutsScellesAsync(); } catch (Exception ex) { throw ex; } }
private void DeleteCompteur(CsCompteurBta listForCompteur) { try { var service = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); if (listForCompteur != null) { service.DeleteCompteurCompleted += (snder, UpdateR) => { if (UpdateR.Cancelled || UpdateR.Error != null) { Message.ShowError(UpdateR.Error.Message, Languages.EtatDuCompteur); return; } if (UpdateR.Result == false) { Message.ShowError(Languages.ErreurMiseAJourDonnees, Languages.EtatDuCompteur); return; } else { //Message.ShowInformation("Compteur modifié avec succès", Languages.EtatDuCompteur); //RazEcran(); //SelectAllCompteurNonAffecte(); //return; } //OnEvent(null); //DialogResult = true; }; service.DeleteCompteurAsync(listForCompteur); } } catch (Exception ex) { Message.Show(ex.Message, Languages.Commune); } }
private void GetDataLot(int fk_Centre) { try { //UcReceptionLotScellesMagasinGeneral ctrl = new UcReceptionLotScellesMagasinGeneral(); //ctrl.Closed += new EventHandler(RafraichirList); //ctrl.Show(); IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.RetourneListScelleByCentreCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.LibelleReceptionScelle); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } DonnesDatagridLot.Clear(); if (args.Result != null) { foreach (var item in RetourneDistinctLot(args.Result)) { DonnesDatagridLot.Add(item); } } dgLotScelle.ItemsSource = DonnesDatagridLot; }; client.RetourneListScelleByCentreAsync(fk_Centre); } catch (Exception ex) { throw ex; } }
private void RemplirListeCmbDesModelesMarqueExistant() { try { if (SessionObject.LstMarqueModele.Count != 0) { ListdesModelesfonctMarq = SessionObject.LstMarqueModele; return; } IScelleServiceClient client = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); client.RetourneListMarque_ModeleCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.Quartier); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Scelles); return; } else { SessionObject.LstMarqueModele = args.Result; ListdesModelesfonctMarq = args.Result; } }; client.RetourneListMarque_ModeleAsync(); } catch (Exception ex) { throw ex; } }
private void OKButton_Click(object sender, RoutedEventArgs e) { try { var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.Commune, Languages.QuestionEnregistrerDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question); messageBox.OnMessageBoxClosed += (_, result) => { if (messageBox.Result == MessageBoxResult.OK) { listForInsertOrUpdate = GetInformationsFromScreen(); var service = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); if (listForInsertOrUpdate != null && listForInsertOrUpdate.Count > 0) { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation) { service.VerifieCompteurExisteCompleted += (snder, insertR) => { if (insertR.Cancelled || insertR.Error != null) { Message.ShowError(insertR.Error.Message, Languages.EtatDuCompteur); return; } if (insertR.Result) { Message.ShowError(Languages.ErreurInsertionDonnees, Languages.EtatDuCompteur); return; } else { service.InsertCompteurCompleted += (sndere, insertRe) => { if (insertRe.Cancelled || insertRe.Error != null) { Message.ShowError(insertR.Error.Message, Languages.EtatDuCompteur); return; } if (!string.IsNullOrEmpty(insertRe.Result)) { Message.ShowError(Languages.ErreurInsertionDonnees, Languages.EtatDuCompteur); return; } else { Message.ShowInformation("Compteur ajouté avec succès", Languages.EtatDuCompteur); RazEcran(); SelectAllCompteurNonAffecte(); OKButton.IsEnabled = true; btn_Annuler.IsEnabled = true; CancelButton.IsEnabled = true; btn_Modifier.IsEnabled = true; return; } }; service.InsertCompteurAsync(listForInsertOrUpdate); } }; service.VerifieCompteurExisteAsync(listForInsertOrUpdate.First()); } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { service.UpdateCompteurCompleted += (snder, UpdateR) => { if (UpdateR.Cancelled || UpdateR.Error != null) { Message.ShowError(UpdateR.Error.Message, Languages.EtatDuCompteur); return; } if (UpdateR.Result == 0) { Message.ShowError(Languages.ErreurMiseAJourDonnees, Languages.EtatDuCompteur); return; } else { Message.ShowInformation("Compteur modifié avec succès", Languages.EtatDuCompteur); RazEcran(); SelectAllCompteurNonAffecte(); return; } //OnEvent(null); //DialogResult = true; }; service.UpdateCompteurAsync(listForInsertOrUpdate); } } } else { return; } }; messageBox.Show(); } catch (Exception ex) { Message.Show(ex.Message, Languages.Commune); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { try { var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.Commune, Languages.QuestionEnregistrerDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question); messageBox.OnMessageBoxClosed += (_, result) => { if (messageBox.Result == MessageBoxResult.OK) { listForInsertOrUpdate = GetInformationsFromScreen(); var service = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); if (listForInsertOrUpdate != null && listForInsertOrUpdate.Count > 0) { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation) { if (listForInsertOrUpdate != null && listForInsertOrUpdate.Count > 0) { service.InsertRetoursCompleted += (snder, insertR) => { if (insertR.Cancelled || insertR.Error != null) { Message.ShowError(insertR.Error.Message, Languages.Commune); return; } if (insertR.Result == 0) { Message.ShowError(Languages.ErreurInsertionDonnees, Languages.Commune); return; } //UpdateParentList(listForInsertOrUpdate[0]); OnEvent(null); DialogResult = true; }; service.InsertRetoursAsync(listForInsertOrUpdate); } } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { service.UpdateRetourseCompleted += (snder, UpdateR) => { if (UpdateR.Cancelled || UpdateR.Error != null) { Message.ShowError(UpdateR.Error.Message, Languages.Commune); return; } if (!UpdateR.Result) { Message.ShowError(Languages.ErreurMiseAJourDonnees, Languages.Commune); return; } // UpdateRemise(listForInsertOrUpdate[0]); OnEvent(null); DialogResult = true; }; service.UpdateRetourseAsync(listForInsertOrUpdate); } } } else { return; } }; messageBox.Show(); } catch (Exception ex) { Message.Show(ex.Message, Languages.Commune); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { try { var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.Commune, Languages.QuestionEnregistrerDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question); messageBox.OnMessageBoxClosed += (_, result) => { if (messageBox.Result == MessageBoxResult.OK) { listForInsertOrUpdate = GetInformationsFromScreen(); if (AncCompteur != this.txt_NumCpteur.Text) { var service = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); service.VerifierEtatCompteurCompleted += (snder, UpdateR) => { if (UpdateR.Cancelled || UpdateR.Error != null) { Message.ShowError(UpdateR.Error.Message, Languages.EtatDuCompteur); return; } if (UpdateR.Result) { Message.ShowInformation("Ce compteur est déja lié a une demande", Languages.EtatDuCompteur); return; } else { var services = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); if (listForInsertOrUpdate != null && listForInsertOrUpdate.Count > 0) { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { services.UpdateCompteurSuiteModifCompleted += (snders, UpdateRs) => { if (UpdateRs.Cancelled || UpdateRs.Error != null) { Message.ShowError(UpdateRs.Error.Message, Languages.EtatDuCompteur); return; } if (UpdateRs.Result == 0) { Message.ShowError(Languages.ErreurMiseAJourDonnees, Languages.EtatDuCompteur); return; } leCompteurModier = listForInsertOrUpdate.FirstOrDefault(); IsOKclic = true; DialogResult = false; }; services.UpdateCompteurSuiteModifAsync(listForInsertOrUpdate); } } } }; service.VerifierEtatCompteurAsync(listForInsertOrUpdate.FirstOrDefault()); } else { var services = new IScelleServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Scelles")); if (listForInsertOrUpdate != null && listForInsertOrUpdate.Count > 0) { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { services.UpdateCompteurSuiteModifCompleted += (snders, UpdateRs) => { if (UpdateRs.Cancelled || UpdateRs.Error != null) { Message.ShowError(UpdateRs.Error.Message, Languages.EtatDuCompteur); return; } if (UpdateRs.Result == 0) { Message.ShowError(Languages.ErreurMiseAJourDonnees, Languages.EtatDuCompteur); return; } leCompteurModier = listForInsertOrUpdate.FirstOrDefault(); IsOKclic = true; DialogResult = false; }; services.UpdateCompteurSuiteModifAsync(listForInsertOrUpdate); } } } } }; messageBox.Show(); } catch (Exception ex) { Message.Show(ex.Message, Languages.Commune); } }