Exemple #1
0
    public MemoryStream Load_Data(MemoryStream xml)
    {
        Dictionary<Object, Object> param = null;
        MemoryStream mresult = null;
        bool demo = false;

        OperationContext.Current.OperationCompleted += new EventHandler(delegate(object sender, EventArgs e) { if (mresult != null) mresult.Dispose(); });

        try
        {
            param = Serializer.READC<Dictionary<Object, Object>>(xml);

            demo = ((param.Keys.Any(x => x.Equals("DEMO"))) && (param["DEMO"] != null)) ? Convert.ToBoolean(param["DEMO"]) : false;

            using (var CONTEXT = new dbAbisEntities((!demo) ? CS : CS_DEMO))
            {
                switch (param["commandName"].ToString())
                {
                    case "item":
                        List<ITEMS> listItem = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<ITEMS>("ITEMSgetDataByIdCommande", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<List<ITEMS>>(listItem);
                        break;
                    case "itemdetail":
                        DataTable listItemDetail = CONTEXT.EXECUTE_DATATABLE_STORED_PROCEDURE("ITEMS_DETAILget", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<DataTable>(listItemDetail);
                        break;
                    case "valeur":
                        break;
                    case "REPONSES":
                        DataTable listReponse = CONTEXT.EXECUTE_DATATABLE_STORED_PROCEDURE("REPONSESget", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<DataTable>(listReponse);
                        break;
                    case "REPONSES_HISTORIQUE":
                        List<REPONSES_HISTORIQUE> lReponseHistorique = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<REPONSES_HISTORIQUE>("REPONSES_HISTORIQUEget", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<List<REPONSES_HISTORIQUE>>(lReponseHistorique);
                        break;
                    case "SEANCE_INSCRIPTION":
                        List<SEANCES_INSCRIPTIONS> lSEANCES_INSCRIPTIONS = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<SEANCES_INSCRIPTIONS>("SEANCES_INSCRIPTIONSget", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<List<SEANCES_INSCRIPTIONS>>(lSEANCES_INSCRIPTIONS);
                        break;         
                }
            }
            return mresult;
        }
        catch (Exception ex)
        {
            File.AppendAllText(@"C:\Users\Public\s.txt", ex.ToString());
            throw new ApplicationException(String.Empty, ex);
        }
    }
Exemple #2
0
    public MemoryStream GET_PRESTATIONS(MemoryStream xml)
    {
        Dictionary<object, Object> param = null;
        MemoryStream mresult = null;
        bool demo = false;
        List<PRESTATIONS> result = null;

        OperationContext.Current.OperationCompleted += new EventHandler(delegate(object sender, EventArgs args)
        {
            if (mresult != null)
                mresult.Dispose();
        });

        try
        {
            param = Serializer.READC<Dictionary<object, object>>(xml);

            demo = ((param.Keys.Any(x => x.Equals("DEMO"))) && (param["DEMO"] != null)) ? Convert.ToBoolean(param["DEMO"]) : false;

            using (var CONTEXT = new dbAbisEntities((!demo) ? CS : CS_DEMO))
            {
                result =
                    CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<PRESTATIONS>("PRESTATIONSget", param, new List<string> { "DEMO" });
            }

            mresult = Serializer.WRITEC<List<PRESTATIONS>>(result);

            return mresult;
        }
        catch (Exception ex)
        {
            throw new ApplicationException(String.Empty, ex);
        }
    }
Exemple #3
0
 private void GET_PRESTATIONS_UNITE_SPEC(Dictionary<object, object> param, bool demo, out IEnumerable<object> res)
 {
     try
     {
         using (var CONTEXT = new dbAbisEntities((!demo) ? CS : CS_DEMO))
         {
             res =
                 CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<PRESTATIONS_UNITE>("PRESTATIONS_UNITEget", param).Cast<object>();
         }
     }
     catch (Exception ex)
     {
         throw new ApplicationException(String.Empty, ex);
     }
 }
Exemple #4
0
    public MemoryStream commande_loader(MemoryStream xml)
    {
        Dictionary<Object, Object> param = null;
        MemoryStream mresult = null;
        bool demo = false;
        List<COMMANDES_ESSAIS> result = null;

        try
        {
            OperationContext.Current.OperationCompleted += new EventHandler(delegate(object sender, EventArgs e) { if (mresult != null) mresult.Dispose(); });
            param = Serializer.READC<Dictionary<Object, Object>>(xml);

            demo = ((param.Keys.Any(x => x.Equals("DEMO"))) && (param["DEMO"] != null)) ? Convert.ToBoolean(param["DEMO"]) : false;

            string cn = param["commandName"].ToString();

            using (var CONTEXT = new dbAbisEntities((!demo) ? CS : CS_DEMO))
            {
                switch (param["commandName"].ToString())
                {
                    case "Traduction":
                        /*List<PROJETS_LANGUES_TRADUCTION> listTraduction = EXECUTE_ENTITY_STORED_PROCEDURE<PROJETS_LANGUES_TRADUCTION>("PROJETS_LANGUES_TRADUCTIONgetByIdCommande", param);
                        mresult = Serializer.WRITEC<List<PROJETS_LANGUES_TRADUCTION>>( listTraduction);*/
                        break;

                    case "SpeakIn":
                        bool b = Convert.ToBoolean(CONTEXT.EXECUTE_INT_STORED_PROCEDURE("LANGUESspeakIn", param, new List<string> { "DEMO", "commandName" }));
                        mresult = Serializer.WRITES<bool>(b);
                        break;
                    case "Langue":

                        List<LANGUE> listlANGUE = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<LANGUE>("LANGUESgetByIdPays", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<List<LANGUE>>(listlANGUE);
                        break;
                    case "CoefProjet":
                        DataTable resultCoefCout = CONTEXT.EXECUTE_DATATABLE_STORED_PROCEDURE("PROJETS_COUTSgetByIdCommande", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<DataTable>(resultCoefCout);
                        break;
                    case "CoefClient":
                        DataTable resultCoefClient = CONTEXT.EXECUTE_DATATABLE_STORED_PROCEDURE("getCoefClient", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<DataTable>(resultCoefClient);
                        break;
                    case "protocole":
                        DataTable resultProtocole = CONTEXT.EXECUTE_DATATABLE_STORED_PROCEDURE("FICHIER_DEVISgetByIdCommande", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<DataTable>(resultProtocole);
                        break;
                    case "filtre":
                        DataTable resultFiltre = CONTEXT.EXECUTE_DATATABLE_STORED_PROCEDURE("COMMANDES_ESSAIS_RAYONSgetByIdCommande", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<DataTable>(resultFiltre);
                        break;
                    case "produit":
                        List<PRODUITS> listProduit = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<PRODUITS>("PRODUITSgetByIdCommande", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<List<PRODUITS>>(listProduit);
                        break;
                    case "repartition":
                        List<PROJETS_SITES_REPARTITION> listRepartition = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<PROJETS_SITES_REPARTITION>("PROJETS_SITES_REPARTITIONgetByIdCommande", param, new List<string> { "DEMO", "commandName" });
                        foreach (var v in listRepartition)
                        {
                            CONTEXT.AttachToThis(v);
                            v.SITE_NOMReference.Load();
                        }
                        mresult = Serializer.WRITEC<List<PROJETS_SITES_REPARTITION>>(listRepartition);
                        break;
                    case "age":
                        List<PROJETS_AGE> listAge = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<PROJETS_AGE>("PROJETS_AGEget", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<List<PROJETS_AGE>>(listAge);
                        break;
                    case "sexe":
                        List<PROJETS_SEXE> listSexe = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<PROJETS_SEXE>("PROJETS_SEXEget", param, new List<string> { "DEMO", "commandName" });

                        mresult = Serializer.WRITEC<List<PROJETS_SEXE>>(listSexe);
                        break;
                    case "destinataire":
                        List<CLIENTS_CONTACTS> listDest = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<CLIENTS_CONTACTS>("PROJETS_DESTINATAIRESget", param, new List<string> { "DEMO", "commandName" });

                        mresult = Serializer.WRITEC<List<CLIENTS_CONTACTS>>(listDest);
                        break;
                    case "liste":
                        result = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<COMMANDES_ESSAIS>("COMMANDES_ESSAIS_GetByIdContact", param, new List<string> { "DEMO", "commandName" });
                        mresult = Serializer.WRITEC<List<COMMANDES_ESSAIS>>(result);
                        break;
                    case "commande":
                        result = CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<COMMANDES_ESSAIS>("COMMANDES_ESSAIS_GetByIdCommande", param, new List<string> { "DEMO", "commandName" });
                        if (result.Count() != 0)
                        {
                            COMMANDES_ESSAIS commande = result.First();
                            //CONTEXT.AttachToThis(commande);
                            //commande.PROJETSReference.Load();
                            mresult = Serializer.WRITEC<COMMANDES_ESSAIS>(commande);
                        }
                        break;
                }
            }
            return mresult;
        }
        catch (Exception ex)
        {
            throw new ApplicationException(String.Empty, ex);
        }
    }
Exemple #5
0
    public MemoryStream GetDataComboFiltre(MemoryStream xml)
    {
        Dictionary<Object, Object> param = null;
        MemoryStream mresult = null;
        bool demo = false;

        OperationContext.Current.OperationCompleted += new EventHandler(delegate(object sender, EventArgs e) { if (mresult != null) mresult.Dispose(); });

        try
        {
            param = Serializer.READC<Dictionary<Object, Object>>(xml);

            demo = ((param.Keys.Any(x => x.Equals("DEMO"))) && (param["DEMO"] != null)) ? Convert.ToBoolean(param["DEMO"]) : false;

            using (var CONTEXT = new dbAbisEntities((!demo) ? CS : CS_DEMO))
            {

                switch (Convert.ToInt32(param["niveau"]))
                {
                    case 0: List<RAYON0> listRay0 =
                                                    CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<RAYON0>("RAYON0get", param, (new string[] { "niveau", "DEMO" }).ToList());

                        mresult = Serializer.WRITEC<List<RAYON0>>(listRay0);
                        break;
                    case 1:
                        List<RAYON1> listRay1 =
                                                    CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<RAYON1>("RAYON1get", param, (new string[] { "niveau", "DEMO" }).ToList());
                        mresult = Serializer.WRITEC<List<RAYON1>>(listRay1);
                        break;
                    case 2:
                        List<RAYON2> listRay2 =
                                                    CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<RAYON2>("RAYON2get", param, (new string[] { "niveau", "DEMO" }).ToList());
                        mresult = Serializer.WRITEC<List<RAYON2>>(listRay2);
                        break;
                    case 3:
                        List<RAYON3> listRay3 =
                                                    CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<RAYON3>("RAYON3get", param, (new string[] { "niveau", "DEMO" }).ToList());
                        mresult = Serializer.WRITEC<List<RAYON3>>(listRay3);
                        break;
                    case 4:
                        List<RAYON3_REPONSES> listRay3Rep =
                                                    CONTEXT.EXECUTE_ENTITY_STORED_PROCEDURE<RAYON3_REPONSES>("RAYON3_REPONSESget", param, (new string[] { "niveau", "DEMO" }).ToList());
                        mresult = Serializer.WRITEC<List<RAYON3_REPONSES>>(listRay3Rep);
                        break;
                    default: break;
                }
            }
            return mresult;
        }
        catch (Exception ex)
        {
            throw new ApplicationException(String.Empty, ex);
        }

    }