Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
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);
            }
        }