//private void ValidationDemande(CsDemandeReclamation _LaDemande)
        //{
        //    try
        //    {

        //        _LaDemande.LaDemande = new Galatee.Silverlight.ServiceReclamation.CsDemandeBase();
        //        Galatee.Silverlight.ServiceAccueil.CsTdem leTydemande = new Galatee.Silverlight.ServiceAccueil.CsTdem();
        //        leTydemande = SessionObject.LstTypeDemande.FirstOrDefault(t => t.CODE == SessionObject.Enumere.DemandeFraude);

        //        _LaDemande.LaDemande.TYPEDEMANDE = (string)leTydemande.CODE;
        //        _LaDemande.LaDemande.FK_IDTYPEDEMANDE = (int)leTydemande.PK_ID;
        //        _LaDemande.LaDemande.FK_IDADMUTILISATEUR = UserConnecte.PK_ID;
        //        _LaDemande.LaDemande.CENTRE = UserConnecte.Centre;
        //        _LaDemande.LaDemande.FK_IDCENTRE = UserConnecte.FK_IDCENTRE;
        //        _LaDemande.LaDemande.USERCREATION = UserConnecte.matricule;
        //        _LaDemande.LaDemande.DATECREATION = DateTime.Now;

        //        //Lancer la transaction de mise a jour en base
        //        Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service1 = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
        //        service1.ValiderInitReclamationCompleted += (sr, res) =>
        //        {
        //            if (res != null && res.Cancelled)
        //                return;
        //            if (!string.IsNullOrEmpty(res.Result))
        //            {
        //                string Retour = res.Result;
        //                string[] coupe = Retour.Split('.');
        //                Shared.ClasseMEthodeGenerique.InitWOrkflow(coupe[0], _LaDemande.LaDemande.FK_IDCENTRE, coupe[1], _LaDemande.LaDemande.FK_IDTYPEDEMANDE);
        //            }
        //            //if (Closed != null)
        //            //    Closed(this, new EventArgs());
        //            this.DialogResult = false;
        //        };
        //        service1.ValiderInitReclamationAsync(_LaDemande);
        //        service1.CloseAsync();
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;

        //    }


        //}

        private void ValidationDemande(CsDemandeReclamation _LaDemande)
        {
            try
            {
                //Lancer la transaction de mise a jour en base
                Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service1 = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
                service1.ValiderReclamationCompleted += (sr, b) =>
                {
                    if (b.Cancelled || b.Error != null)
                    {
                        string error = b.Error.Message;
                        Message.ShowError(error, Silverlight.Resources.Devis.Languages.txtDevis);
                        return;
                    }
                    if (b.Result != null)
                    {
                        List <int> Listid = new List <int>();
                        Listid.Add(LaDemande.LaDemande.PK_ID);
                        EnvoyerDemandeEtapeSuivante(Listid);
                    }
                    else
                    {
                        Message.ShowError("Erreur a la cloture de la demande", "Cloturedemande");
                    }
                };
                service1.ValiderReclamationAsync(_LaDemande);
                service1.CloseAsync();
            }
            catch (Exception ex)
            {
                this.DialogResult = false;
                Message.Show(ex.Message, "Transmit");
            }
        }
 private void MiseAJourRejet(CsDemandeReclamation _LaDemande)
 {
     try
     {
         Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service1 = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
         service1.ValiderReclamationCompleted += (sr, b) =>
         {
             if (b.Cancelled || b.Error != null)
             {
                 string error = b.Error.Message;
                 Message.ShowError(error, "Rejet");
                 return;
             }
             if (b.Result != null)
             {
                 List <int> Listid = new List <int>();
                 Listid.Add(LaDemande.LaDemande.PK_ID);
                 EnvoyerDemandeEtapeprecedente(Listid);
             }
             else
             {
                 Message.ShowError("Erreur à la mise à jour de la demande", "Rejet");
             }
         };
         service1.ValiderReclamationAsync(_LaDemande);
         service1.CloseAsync();
     }
     catch (Exception ex)
     {
         this.DialogResult = false;
         Message.Show(ex.Message, "Erreur");
     }
 }
Exemple #3
0
        public static void ValiderReclamation(CsDemandeReclamation pDemandeRecl, galadbEntities pContext)
        {
            try
            {
                galadbEntities  contextinter = new galadbEntities();
                RCL_Reclamation _Reclamation = new RCL_Reclamation();
                if (pDemandeRecl.ReclamationRcl != null)
                {
                    _Reclamation = Entities.ConvertObject <RCL_Reclamation, CsReclamationRcl>(pDemandeRecl.ReclamationRcl);
                }
                Entities.UpdateEntity <RCL_Reclamation>(_Reclamation, pContext);
            }

            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                //var errorMessages = ex.EntityValidationErrors
                //        .SelectMany(x => x.ValidationErrors)
                //        .Select(x => x.ErrorMessage);

                //// Join the list to a single string.
                //var fullErrorMessage = string.Join("; ", errorMessages);

                //// Combine the original exception message with the new one.
                //var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);

                ////return exceptionMessage;
                //// Throw a new DbEntityValidationException with the improved exception message.
                //throw new System.Data.Entity.Validation.DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
                throw ex;
            }
        }
 public bool  ValiderReclamation(CsDemandeReclamation LaDemande)
 {
     try
     {
         string DemandeID         = string.Empty;
         int    resultTransaction = -1;
         using (galadbEntities transaction = new galadbEntities())
         {
             try
             {
                 ReclamationProcedure.ValiderReclamation(LaDemande, transaction);
                 resultTransaction = transaction.SaveChanges();
                 return(resultTransaction == -1 ? false : true);
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         };
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 private void Recupere(CsDemandeReclamation LaDemande)
 {
     LaDemande.ReclamationRcl.NonConformite   = check_NonConforme.IsChecked;
     LaDemande.ReclamationRcl.DateRetour      = Convert.ToDateTime(Date_Retour.SelectedDate);
     LaDemande.ReclamationRcl.DateValidation  = Convert.ToDateTime(Date_Retour.SelectedDate);
     LaDemande.ReclamationRcl.LettreReponse   = txt_lettrereponse.Text;
     LaDemande.ReclamationRcl.Fk_IdValidation = ((CsRclValidation)this.Cbo_Apreciation.SelectedItem).PK_ID;
 }
Exemple #6
0
        public CsDemandeReclamation RetourneLaDemande(int fk_demande)
        {
            //cmd.CommandText = "SPX_GUI_RETOURNE_DEMANDE";
            CsDemandeReclamation _LaDemande = new CsDemandeReclamation();

            try
            {
                galadbEntities        transaction  = new galadbEntities();
                CsReclamationRcl      _Reclamation = new CsReclamationRcl();
                List <ADMUTILISATEUR> lstUser      = transaction.ADMUTILISATEUR.ToList();
                DEMANDE _DEMANDE = new DEMANDE();
                _LaDemande.LaDemande = Entities.ConvertObject <CsDemandeBase, DEMANDE>(transaction.DEMANDE.FirstOrDefault(p => p.PK_ID == fk_demande));

                try
                {
                    DataTable dt = Galatee.Entity.Model.ReclamationProcedure.RetourneListeReclamationbyDemande(fk_demande);
                    _Reclamation = Entities.GetEntityFromQuery <CsReclamationRcl>(dt);
                    if (!string.IsNullOrEmpty(_Reclamation.AgentEmetteur))
                    {
                        _Reclamation.NOMAGENTCREATION = lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentEmetteur) != null?
                                                        lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentEmetteur).LIBELLE : string.Empty;
                    }

                    if (!string.IsNullOrEmpty(_Reclamation.AgentRecepteur))
                    {
                        _Reclamation.NOMAGENTRECEPTEUR = lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentRecepteur) != null?
                                                         lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentRecepteur).LIBELLE : string.Empty;
                    }

                    if (!string.IsNullOrEmpty(_Reclamation.AgentValidation))
                    {
                        _Reclamation.NOMAGENTVALIDATEUR = lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentValidation) != null?
                                                          lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentValidation).LIBELLE : string.Empty;
                    }


                    _LaDemande.ReclamationRcl = _Reclamation;


                    DataTable dtDoc = DevisProcedures.DEVIS_DOCUMENTSCANNE_RETOURNEByIdDemande(_LaDemande.LaDemande.PK_ID);
                    _LaDemande.DonneDeDemande = Entities.GetEntityListFromQuery <ObjDOCUMENTSCANNE>(dtDoc);
                }
                catch (Exception)
                {
                    _LaDemande.ReclamationRcl = null;
                }
                transaction.Dispose();
                return(_LaDemande);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #7
0
        public string ValiderInitReclamation(CsDemandeReclamation LaDemande)
        {
            try
            {
                string DemandeID         = string.Empty;
                bool   Resultat          = false;
                int    resultTransaction = -1;
                using (galadbEntities transaction = new galadbEntities())
                {
                    try
                    {
                        LaDemande.LaDemande.NUMDEM = AccueilProcedures.GetNumDevis(LaDemande.LaDemande);
                        LaDemande.ReclamationRcl.NumeroReclamation = LaDemande.LaDemande.NUMDEM;
                        LaDemande.ReclamationRcl.FK_IDDEMANDE      = LaDemande.LaDemande.PK_ID;
                        //LaDemande.LeClient.NUMDEM  = LaDemande.LaDemande.NUMDEM;

                        ReclamationProcedure.InsertionInitReclamation(LaDemande, transaction);
                        resultTransaction = transaction.SaveChanges();
                        if (resultTransaction != -1)
                        {
                            LaDemande.LaDemande.PK_ID = transaction.DEMANDE.FirstOrDefault(d => d.NUMDEM == LaDemande.LaDemande.NUMDEM && d.CENTRE == LaDemande.LaDemande.CENTRE).PK_ID;
                            if (LaDemande.LaDemande.PK_ID == 0)
                            {
                                using (galadbEntities tctx = new galadbEntities())
                                {
                                    DEMANDE laDem = tctx.DEMANDE.FirstOrDefault(t => t.NUMDEM == LaDemande.LaDemande.NUMDEM);
                                    if (laDem != null)
                                    {
                                        DemandeID = laDem.PK_ID + "." + LaDemande.LaDemande.NUMDEM;
                                    }
                                };
                            }
                            else
                            {
                                DemandeID = LaDemande.LaDemande.PK_ID + "." + LaDemande.LaDemande.NUMDEM;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                };
                return(DemandeID);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        private void ChargeDonneDemande(int pk_id)
        {
            Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
            service.RetourDemandeReclamationCompleted += (s, args) =>
            {
                try
                {
                    if (args != null && args.Cancelled)
                    {
                        return;
                    }
                    LaDemande = args.Result;

                    if (LaDemande != null)
                    {
                        Txt_Nom.Text                       = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NomClient) ? string.Empty : LaDemande.ReclamationRcl.NomClient;
                        Txt_Portable.Text                  = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NumeroTelephonePortable) ? string.Empty : LaDemande.ReclamationRcl.NumeroTelephonePortable;
                        Txt_DateOuverture.Text             = LaDemande.ReclamationRcl.DateOuverture == null  ? string.Empty : LaDemande.ReclamationRcl.DateOuverture.Value.ToShortDateString();
                        Txt_NumeroFixe.Text                = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NumeroTelephoneFixe) ? string.Empty : LaDemande.ReclamationRcl.NumeroTelephoneFixe;
                        Txt_TypeReclamation.Text           = string.IsNullOrEmpty(LaDemande.ReclamationRcl.LIBELLETYPERECLAMATION) ? string.Empty : LaDemande.ReclamationRcl.LIBELLETYPERECLAMATION;
                        Txt_Adress.Text                    = string.IsNullOrEmpty(LaDemande.ReclamationRcl.Adresse) ? string.Empty : LaDemande.ReclamationRcl.Adresse;
                        Txt_Email.Text                     = string.IsNullOrEmpty(LaDemande.ReclamationRcl.Email) ? string.Empty : LaDemande.ReclamationRcl.Email;
                        Txt_Object.Text                    = string.IsNullOrEmpty(LaDemande.ReclamationRcl.ObjetReclamation) ? string.Empty : LaDemande.ReclamationRcl.ObjetReclamation;
                        Txt_Observation.Text               = string.IsNullOrEmpty(LaDemande.ReclamationRcl.Observation) ? string.Empty : LaDemande.ReclamationRcl.Observation;
                        Txt_Client.Text                    = string.IsNullOrEmpty(LaDemande.ReclamationRcl.Client) ? string.Empty : LaDemande.ReclamationRcl.Client;
                        Txt_DateRendezVous.Text            = LaDemande.ReclamationRcl.DateRdv == null ? string.Empty : LaDemande.ReclamationRcl.DateRdv.Value.ToShortDateString();
                        Txt_DateRetourSouhaiter.Text       = LaDemande.ReclamationRcl.DateRetourSouhaite == null ? string.Empty : LaDemande.ReclamationRcl.DateRetourSouhaite.Value.ToShortDateString();
                        Dtp_DateTraitement.SelectedDate    = System.DateTime.Today;
                        Txt_NumDemande.Text                = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NumeroReclamation) ? string.Empty : LaDemande.ReclamationRcl.NumeroReclamation;
                        Txt_EtablirPar.Text                = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NOMAGENTCREATION) ? string.Empty : LaDemande.ReclamationRcl.NOMAGENTCREATION + " (" + LaDemande.ReclamationRcl.AgentEmetteur + ")";
                        Txt_AgentTraiteur.Text             = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NOMAGENTRECEPTEUR) ? string.Empty : LaDemande.ReclamationRcl.NOMAGENTRECEPTEUR + " (" + LaDemande.ReclamationRcl.AgentRecepteur + ")";
                        Txt_ActionMennes.Text              = string.IsNullOrEmpty(LaDemande.ReclamationRcl.ActionMenees) ? string.Empty : LaDemande.ReclamationRcl.ActionMenees;
                        Dtp_DateTraitement.SelectedDate    = LaDemande.ReclamationRcl.DateTransmission == null ? null  : LaDemande.ReclamationRcl.DateTransmission;
                        Date_Retour.SelectedDate           = DateTime.Now;
                        this.tbControleClient.SelectedItem = this.tabItemValidation;

                        #region DocumentScanne
                        if (LaDemande.DonneDeDemande != null && LaDemande.DonneDeDemande.Count != 0)
                        {
                            //isPreuveSelectionnee = true;
                            LstPiece.Clear();
                            foreach (var item in LaDemande.DonneDeDemande)
                            {
                                LstPiece.Add(item);
                            }
                            dgListePiece.ItemsSource = this.LstPiece;
                        }
                        //else
                        //{
                        //    isPreuveSelectionnee = false;
                        //}
                        #endregion

                        if (this.IsConsultation == true)
                        {
                            //Cbo_Apreciation.SelectedValue =Cbo_Apreciation.ItemsSource!=null?((List<CsRclValidation>)Cbo_Apreciation.ItemsSource).FirstOrDefault(c=>c.PK_ID LaDemande.ReclamationRcl.Fk_IdValidation;
                            Cbo_Apreciation.SelectedValue = LaDemande.ReclamationRcl.Fk_IdValidation;
                            Date_Retour.SelectedDate      = LaDemande.ReclamationRcl.DateRetour;
                            check_NonConforme.IsChecked   = LaDemande.ReclamationRcl.NonConformite;
                            txt_lettrereponse.Text        = LaDemande.ReclamationRcl.LettreReponse;
                            OKButton.Visibility           = Visibility.Collapsed;
                            CancelButton.Visibility       = Visibility.Collapsed;
                        }
                        //txtCentre.Text   = _listeDesCentreExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.Fk_IdCentre)!= null ?
                        //    _listeDesCentreExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.Fk_IdCentre).LIBELLE :string.Empty ;

                        //txt_Commune.Text = _listeDesCommuneExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDCOMMUNE) != null ?
                        //    _listeDesCommuneExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDCOMMUNE).LIBELLE : string.Empty ;

                        //txt_Quartier.Text = _listeDesQuartierExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDQUARTIER) != null ?
                        //    _listeDesQuartierExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDQUARTIER).LIBELLE : string.Empty;

                        //txt_NumSecteur.Text = SessionObject.LstSecteur.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDSECTEUR) != null ?
                        //    SessionObject.LstSecteur.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDSECTEUR).LIBELLE : string.Empty;

                        //txt_NumRue.Text =SessionObject.LstRues.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDRUE)!= null ?
                        //    SessionObject.LstRues.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDRUE).LIBELLE : string.Empty ;
                    }
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, "Erreur");
                }
            };
            service.RetourDemandeReclamationAsync(pk_id);
        }
Exemple #9
0
 public bool  ValiderReclamation(CsDemandeReclamation LaDemande)
 {
     return(new DBRECLAMATION().ValiderReclamation(LaDemande));
 }
Exemple #10
0
 public string ValiderInitReclamation(CsDemandeReclamation LaDemande)
 {
     return(new DBRECLAMATION().ValiderInitReclamation(LaDemande));
 }
 private void Recupere(CsDemandeReclamation LaDemande)
 {
     LaDemande.ReclamationRcl = GetInformationsFromScreen(LaDemande.ReclamationRcl);
 }
        private void ChargeDonneDemande(int pk_id)
        {
            Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
            service.RetourDemandeReclamationCompleted += (s, args) =>
            {
                try
                {
                    if (args != null && args.Cancelled)
                    {
                        return;
                    }
                    LaDemande = args.Result;

                    if (LaDemande != null)
                    {
                        Txt_Nom.Text                    = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NomClient) ? string.Empty : LaDemande.ReclamationRcl.NomClient;
                        Txt_Portable.Text               = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NumeroTelephonePortable) ? string.Empty : LaDemande.ReclamationRcl.NumeroTelephonePortable;
                        Txt_DateOuverture.Text          = LaDemande.ReclamationRcl.DateOuverture == null  ? string.Empty : LaDemande.ReclamationRcl.DateOuverture.Value.ToShortDateString();
                        Txt_NumeroFixe.Text             = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NumeroTelephoneFixe) ? string.Empty : LaDemande.ReclamationRcl.NumeroTelephoneFixe;
                        Txt_TypeReclamation.Text        = string.IsNullOrEmpty(LaDemande.ReclamationRcl.LIBELLETYPERECLAMATION) ? string.Empty : LaDemande.ReclamationRcl.LIBELLETYPERECLAMATION;
                        Txt_Adress.Text                 = string.IsNullOrEmpty(LaDemande.ReclamationRcl.Adresse) ? string.Empty : LaDemande.ReclamationRcl.Adresse;
                        Txt_Email.Text                  = string.IsNullOrEmpty(LaDemande.ReclamationRcl.Email) ? string.Empty : LaDemande.ReclamationRcl.Email;
                        Txt_Object.Text                 = string.IsNullOrEmpty(LaDemande.ReclamationRcl.ObjetReclamation) ? string.Empty : LaDemande.ReclamationRcl.ObjetReclamation;
                        Txt_Observation.Text            = string.IsNullOrEmpty(LaDemande.ReclamationRcl.Observation) ? string.Empty : LaDemande.ReclamationRcl.Observation;
                        Txt_Client.Text                 = string.IsNullOrEmpty(LaDemande.ReclamationRcl.Client) ? string.Empty : LaDemande.ReclamationRcl.Client;
                        Txt_DateRendezVous.Text         = LaDemande.ReclamationRcl.DateRdv == null ? string.Empty : LaDemande.ReclamationRcl.DateRdv.Value.ToShortDateString();
                        Txt_DateRetourSouhaiter.Text    = LaDemande.ReclamationRcl.DateRetourSouhaite == null ? string.Empty : LaDemande.ReclamationRcl.DateRetourSouhaite.Value.ToShortDateString();
                        Dtp_DateTraitement.SelectedDate = System.DateTime.Today;
                        Txt_NumDemande.Text             = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NumeroReclamation) ? string.Empty : LaDemande.ReclamationRcl.NumeroReclamation;
                        Txt_EtablirPar.Text             = string.IsNullOrEmpty(LaDemande.ReclamationRcl.NOMAGENTCREATION) ? string.Empty : LaDemande.ReclamationRcl.NOMAGENTCREATION + " (" + LaDemande.ReclamationRcl.AgentEmetteur + ")";
                        Txt_AgentTraiteur.Text          = UserConnecte.nomUtilisateur + " (" + UserConnecte.matricule + ")";

                        this.tbControleClient.SelectedItem = this.tabItemtraitement;

                        Txt_MotifRejet.Text = string.IsNullOrEmpty(LaDemande.ReclamationRcl.MotifRejet) ? string.Empty : LaDemande.ReclamationRcl.MotifRejet;

                        if (!string.IsNullOrEmpty(LaDemande.ReclamationRcl.MotifRejet))
                        {
                            this.labMotif.Visibility       = System.Windows.Visibility.Visible;
                            this.Txt_MotifRejet.Visibility = System.Windows.Visibility.Visible;
                        }



                        #region DocumentScanne
                        if (LaDemande.DonneDeDemande != null && LaDemande.DonneDeDemande.Count != 0)
                        {
                            //isPreuveSelectionnee = true;
                            foreach (var item in LaDemande.DonneDeDemande)
                            {
                                LstPiece.Add(item);
                            }
                            dgListePiece.ItemsSource = this.LstPiece;
                        }
                        //else
                        //{
                        //    isPreuveSelectionnee = false;
                        //}
                        #endregion
                        //txtCentre.Text   = _listeDesCentreExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.Fk_IdCentre)!= null ?
                        //    _listeDesCentreExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.Fk_IdCentre).LIBELLE :string.Empty ;

                        //txt_Commune.Text = _listeDesCommuneExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDCOMMUNE) != null ?
                        //    _listeDesCommuneExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDCOMMUNE).LIBELLE : string.Empty ;

                        //txt_Quartier.Text = _listeDesQuartierExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDQUARTIER) != null ?
                        //    _listeDesQuartierExistant.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDQUARTIER).LIBELLE : string.Empty;

                        //txt_NumSecteur.Text = SessionObject.LstSecteur.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDSECTEUR) != null ?
                        //    SessionObject.LstSecteur.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDSECTEUR).LIBELLE : string.Empty;

                        //txt_NumRue.Text =SessionObject.LstRues.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDRUE)!= null ?
                        //    SessionObject.LstRues.FirstOrDefault(t => t.PK_ID == LaDemande.ReclamationRcl.FK_IDRUE).LIBELLE : string.Empty ;
                    }
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, "Erreur");
                }
            };
            service.RetourDemandeReclamationAsync(pk_id);
        }
Exemple #13
0
        public static void InsertionInitReclamation(CsDemandeReclamation pDemandeRecl, galadbEntities pContext)
        {
            try
            {
                galadbEntities  contextinter = new galadbEntities();
                RCL_Reclamation _Reclamation = new RCL_Reclamation();

                List <DOCUMENTSCANNE> lstDocumentScan = new List <DOCUMENTSCANNE>();
                if (pDemandeRecl.DonneDeDemande != null && pDemandeRecl.DonneDeDemande.Count != 0)
                {
                    lstDocumentScan = Entities.ConvertObject <DOCUMENTSCANNE, ObjDOCUMENTSCANNE>(pDemandeRecl.DonneDeDemande);
                }


                if (pDemandeRecl.ReclamationRcl != null)
                {
                    _Reclamation = Entities.ConvertObject <RCL_Reclamation, CsReclamationRcl>(pDemandeRecl.ReclamationRcl);
                }

                DEMANDE _DEMANDE = new DEMANDE();
                if (pDemandeRecl.LaDemande != null)
                {
                    _DEMANDE = Entities.ConvertObject <DEMANDE, CsDemandeBase>(pDemandeRecl.LaDemande);
                }

                foreach (DOCUMENTSCANNE item in lstDocumentScan)
                {
                    if (pContext.DOCUMENTSCANNE.FirstOrDefault(d => d.PK_ID == item.PK_ID) == null)
                    {
                        item.PK_ID = Guid.NewGuid();
                        _DEMANDE.DOCUMENTSCANNE.Add(item);
                    }
                }

                //DCLIENT _Dclient= new DCLIENT();
                //if (pDemandeRecl.LeClient  != null)
                //    _Dclient = Entities.ConvertObject<DCLIENT, CsClient>(pDemandeRecl.LeClient);

                //_DEMANDE.DCLIENT.Add(_Dclient);

                if (_DEMANDE.PK_ID == 0)
                {
                    _DEMANDE.RCL_Reclamation.Add(_Reclamation);
                    Entities.InsertEntity <DEMANDE>(_DEMANDE, pContext);
                }
                else
                {
                    Entities.UpdateEntity <DEMANDE>(_DEMANDE, pContext);
                    Entities.UpdateEntity <RCL_Reclamation>(_Reclamation, pContext);
                }
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                //var errorMessages = ex.EntityValidationErrors
                //        .SelectMany(x => x.ValidationErrors)
                //        .Select(x => x.ErrorMessage);

                //// Join the list to a single string.
                //var fullErrorMessage = string.Join("; ", errorMessages);

                //// Combine the original exception message with the new one.
                //var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);

                ////return exceptionMessage;
                //// Throw a new DbEntityValidationException with the improved exception message.
                //throw new System.Data.Entity.Validation.DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
                throw ex;
            }
        }