示例#1
0
        public STR_MSG CreateUser(STR_MSG oMsg)
        {
            string nom = (string)oMsg.Data[0];
            string prenom = (string)oMsg.Data[1];
            string adresse = (string)oMsg.Data[2];
            DateTime DOB = (DateTime)oMsg.Data[3]; // date of birth
            string telFixe = (string)oMsg.Data[4];
            string telPortable = (string)oMsg.Data[5];
            string mail = (string)oMsg.Data[6];
            string numeroSecuSociale = (string)oMsg.Data[7];
            string mutuelle = (string)oMsg.Data[8];
            string loginUtilisateur = (string)oMsg.Data[9];
            string mdp = (string)oMsg.Data[10];

            OracleCommand cmd = new OracleCommand();
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.CommandText = "pc_createuser";
            cmd.Parameters.Add("nom", OracleDbType.Varchar2, 255).Value = nom;
            cmd.Parameters.Add("prenom", OracleDbType.Varchar2, 255).Value = prenom;
            cmd.Parameters.Add("adresse", OracleDbType.Varchar2, 255).Value = adresse;
            cmd.Parameters.Add("DOB", OracleDbType.Date).Value = DOB;
            cmd.Parameters.Add("telFixe", OracleDbType.Varchar2, 255).Value = telFixe;
            cmd.Parameters.Add("telPortable", OracleDbType.Varchar2, 255).Value = telPortable;
            cmd.Parameters.Add("mail", OracleDbType.Varchar2, 255).Value = mail;
            cmd.Parameters.Add("numeroSecuSociale", OracleDbType.Varchar2, 255).Value = numeroSecuSociale;
            cmd.Parameters.Add("mutuelle", OracleDbType.Varchar2, 255).Value = mutuelle;
            cmd.Parameters.Add("loginUtilisateur", OracleDbType.Varchar2, 255).Value = loginUtilisateur;
            cmd.Parameters.Add("password", OracleDbType.Varchar2, 255).Value = mdp;
            cmd.Parameters.Add("profile", OracleDbType.Varchar2, 255).Value = "CLIENT";

            this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { cmd }, "", "", "", true, "");

            return this.oMsg;
        }
示例#2
0
        /// <summary>
        /// Créé la commande. Ne permet pas le remplissage des médicaments.
        /// </summary>
        /// <param name="oMsg"></param>
        /// <returns></returns>
        public STR_MSG CreerCommandeCliente(STR_MSG oMsg)
        {
            char status = '1'; // commande OK
            char prescription = '0'; // commande sans prescription
            char hasRead = '1'; //
            int prescription_id = 1;
            int patientID = (int)oMsg.Data[1];

            OracleCommand cmd = new OracleCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "PHARMAWEB.Create_Commande";

            OracleParameter RV = new OracleParameter();
            RV.Direction = ParameterDirection.ReturnValue; // indique si c'est un paramètre entrant, ou de retour
            RV.OracleDbType = OracleDbType.Int32;
            RV.ParameterName = "id";

            cmd.Parameters.Add(RV);

            cmd.Parameters.Add("statut", OracleDbType.Char).Value = status;
            cmd.Parameters.Add("prescription", OracleDbType.Char).Value = prescription;
            cmd.Parameters.Add("hasRead", OracleDbType.Char).Value = hasRead;
            cmd.Parameters.Add("prescription_id", OracleDbType.Int32, 255).Value = prescription_id;
            cmd.Parameters.Add("patientID", OracleDbType.Int32, 255).Value = patientID;

            this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { cmd }, "", "", "", true, "");

            return this.oMsg;
        }
        public STR_MSG exec(STR_MSG oMsg)
        {
            map = new CL_MAP();
            STR_MSG req = map.UnpaidOrder(oMsg);

            object[] data = new object[] { (string)oMsg.Data[0], (string)req.Data[0] } ;

            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");
            this.oMsg = CL_DATA_ACCES.ExecuteAndReturn(msg);

            /*
             * if(((DataSet)this.oMsg.Data[0]).Rows.Count > 0)
             * {
             *      data = new object[] { ((DataSet)this.oMsg.Data[0]).Rows.Count } ;
             *      msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");
             * }
             * else
             * {
             *      data = new object[] { 0 } ;
             *      msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");
             * }
             *
             *
             * */

            return this.oMsg;
        }
示例#4
0
        public STR_MSG ListStock(STR_MSG oMsg)
        {
            string req = "execute ListerStock()"; // TODO Unpaid Order
            this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { req }, "", "", "", true, "");

            return this.oMsg;
        }
示例#5
0
        public STR_MSG UnpaidOrder(STR_MSG oMsg)
        {
            string req = "execute ListerCommandesImpayees2Mois('" + (string)oMsg.Data[0] + "')"; // TODO Unpaid Order
            this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { req }, "", "", "", true, "");

            return this.oMsg;
        }
        public STR_MSG AppelCommunication(string invoke, object[] data)
        {
            if (this.Authentification == "Fournisseur")
            {
                this.Token = "C##FOURNISSEUR";
            }
            else if (this.Authentification == "Pharmacien")
            {
                this.Token = "C##PHARMACIEN";
            }
            else if (this.Authentification == "Preparateur")
            {
                this.Token = "DEFAULT";
            }
            else // client
            {
                this.Token = "C##CLIENT";
            }

            this.oMsg = CL_MESSAGE_Factory.msg_factory(this.ClientName, data, "", invoke,
                                                        this.ClientID, true, this.Token);

            // créer un thread pour le SERVICE
            servComp = new CL_SERVER_COMPONENT();
            Thread th = new Thread(new ParameterizedThreadStart(servComp.Service));
            th.Start((object)this.oMsg);
            th.Join(); // en attente du retour
            this.oMsg = servComp.iMsg;

            return this.oMsg;
        }
        public STR_MSG AppelCommunication(string invoke, object[] data)
        {
            if (this.Authentification == "Fournisseur")
            {
                this.Token = "C##FOURNISSEUR";
            }
            else if (this.Authentification == "Pharmacien")
            {
                this.Token = "C##PHARMACIEN";
            }
            else if (this.Authentification == "Preparateur")
            {
                this.Token = "DEFAULT";
            }
            else // client
            {
                this.Token = "C##CLIENT";
            }

            this.oMsg = CL_MESSAGE_Factory.msg_factory(this.ClientName, data, "", invoke,
                                                        this.ClientID, true, this.Token);
            this.oMsg = servComp.Service(this.oMsg);

            return this.oMsg;
        }
示例#8
0
        //===================================================
        //===================================================
        //===================================================
        //===================================================
        //===================================================
        /// <summary>
        /// 
        /// </summary>
        /// <param name="oMsg">Data[0] doit contenir le nom d'utilisateur -- Data[1] doit contenir le mot de passe</param>
        /// <returns></returns>
        public static STR_MSG Connect(STR_MSG oMsg)
        {
            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "", "", "", true, "");

            string username = (string)oMsg.Data[0];

            // vérification du nombre de connexion
            if (connexions.Count >= NB_MAX_CONNECTION && (string)oMsg.Data[0] != "sysdba")
            {
                msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Trop de connexions existantes", "", "", true, "");
            }
            else
            {
                string connexionString = @"Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL = TCP)(HOST = 192.168.1.5)(PORT = 1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME = pharmadb)));User id=" + username + ";Password="******"", new object[] { }, "OK", "", "", true, "");
                }
                catch(Exception e)
                {
                    msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Erreur lors de la connexion : " + e.Message, "", "", true, "");
                }

            }

            return msg;
        }
        public STR_MSG exec(STR_MSG oMsg)
        {
            map = new CL_MAP();

            //char status = (char)oMsg.Data[0];
            //char prescription = (char)oMsg.Data[1];
            //char hasRead = (char)oMsg.Data[2];
            //int patientID = (int)oMsg.Data[3];
            STR_MSG retour = map.CreerCommandeCliente(oMsg);

            object[] data = new object[] { oMsg.Data[0], retour.Data[0] }; // le nom de l'utilisateur + la commande
            this.iMsg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");
            this.iMsg = CL_DATA_ACCES.ExecuteAndReturn(this.iMsg);

            // si la commande s'est créée correctement
            // on récupère l'ID de la commande
            if (this.iMsg.Info == "OK")
            {
                OracleParameterCollection ds = (OracleParameterCollection)this.iMsg.Data[0];
                int ID_COMMANDE = int.Parse(ds["id"].Value.ToString());
                data = new object[] { ID_COMMANDE };
                this.iMsg = CL_MESSAGE_Factory.msg_factory("", data, "OK", "", "", true, "");
            }

            return this.iMsg;
        }
示例#10
0
        public STR_MSG CreateUser(STR_MSG oMsg)
        {
            string req = "execute CreateUser('" + (string)oMsg.Data[0] + "','" +
                    (string)oMsg.Data[1] + "','" + (string)oMsg.Data[2] + "')";
            this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { req },
                                                            "", "", "", true, "");

            return this.oMsg;
        }
示例#11
0
        public STR_MSG Redirect(STR_MSG oMsg)
        {
            if (oMsg.token == "Pharmacien")
            {
                // services pharmaciens
            }
            else if (oMsg.token == "Fournisseur")
            {
                // services Fournisseurs
            }
            else if (oMsg.token == "Preparateur")
            {
                // services préparateur
            }
            else
            {

            }

            // SERVICES GÉNÉRAUX

            // Connexion à la BDD
            if ((oMsg.Invoke == "Connexion") && (oMsg.App_Name == "PharmaProject_v1"))
            {
                //// vérification des droits
                this.work = new CL_WF_VerificationDroits();
                this.oMsg = work.exec(oMsg);

                // Si la vérification est OK
                if ((string)this.oMsg.Data[0] == oMsg.token)
                {
                    this.work = new CL_WF_Connect();
                    this.oMsg = work.exec(oMsg);
                }
                else if ((string)this.oMsg.Data[0] == "Utilisateur Inexistant")
                {
                    this.oMsg = CL_MESSAGE_Factory.msg_factory("", null, "Utilisateur Inexistant", "", "", true, "");
                }

                else
                {
                    this.oMsg = CL_MESSAGE_Factory.msg_factory("", null, "Mauvais droits", "", "", true, "");
                }

            }

            else if ((oMsg.Invoke == "CreerUtilisateur") && (oMsg.App_Name == "PharmaProject_v1"))
            {

                this.work = new CL_WF_CreerUtilisateur();
                this.oMsg = work.exec(oMsg);

            }

            return this.oMsg;
        }
        STR_MSG IWorkflow.exec(STR_MSG oMsg)
        {
            map = new CL_MAP();

            STR_MSG retour = map.RecordMedic(oMsg);
            object[] data = new object[] { oMsg.Data[0], retour.Data[0] }; // le nom de l'utilisateur + la commande
            this.iMsg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");
            this.iMsg = CL_DATA_ACCES.Execute(this.iMsg);

            return this.iMsg;
        }
        public STR_MSG exec(STR_MSG oMsg)
        {
            // mappage
            map = new CL_MAP();

            STR_MSG retour = map.ListMedic(oMsg);

            object[] data = new object[] { oMsg.Data[0], retour.Data[0] }; // le nom de l'utilisateur + la commande

            this.iMsg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");

            this.iMsg = CL_DATA_ACCES.ExecuteAndReturn(this.iMsg);

            return this.iMsg;
        }
示例#14
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="oMsg">Data[0] doit contenir l'email de récéption, Data[1] le sujet, Data[2] le message</param>
        /// <returns></returns>
        public static STR_MSG Send(STR_MSG oMsg)
        {
            MailMessage mail = new MailMessage("*****@*****.**", (string)oMsg.Data[0]);
            SmtpClient client = new SmtpClient();

            client.Port = 25;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;

            client.Host = "smtp.google.com";
            mail.Subject = (string)oMsg.Data[1];
            mail.Body = (string)oMsg.Data[2];

            client.Send(mail);

            return oMsg;
        }
示例#15
0
        public STR_MSG exec(STR_MSG oMsg)
        {
            // mappage
            map = new CL_MAP();

            //oMsg = map.Test(oMsg);

            //cad = new CL_DATA_ACCES();

            // execution
            this.oMsg = CL_DATA_ACCES.Execute(oMsg); //cad.Execute(oMsg);

            this.oMsg = CL_MESSAGE_Factory.msg_factory("", this.oMsg.Data, this.oMsg.Info, "", "", true, "");

            // retour
            return this.oMsg;
        }
示例#16
0
 public static STR_MSG msg_factory(
     string App_name,
     object[] Data,
     string info,
     string Invoke,
     string P_security,
     bool statut,
     string token)
 {
     oMsg = new STR_MSG();
     oMsg.App_Name = App_name;
     oMsg.Data = Data;
     oMsg.Info = info;
     oMsg.Invoke = Invoke;
     oMsg.P_security = P_security;
     oMsg.Statut = statut;
     oMsg.token = token;
     return oMsg;
 }
        public STR_MSG Service(STR_MSG oMsg)
        {
            if (this.SecuriteAccesPlateforme(oMsg.P_security)) // si la clé de sécurité est OK
            {

                if (oMsg.Invoke == "Connexion")
                {
                    CL_PROCESS_CLIENT process = new CL_PROCESS_CLIENT();
                    this.oMsg = process.Connexion(oMsg);
                }
                else if (oMsg.Invoke == "PrevisionCA")
                {
                    CL_PROCESS_PHARMACIEN process = new CL_PROCESS_PHARMACIEN();
                    this.oMsg = process.Calcul(oMsg);
                }

            }

            return this.oMsg;
        }
        public STR_MSG exec(STR_MSG oMsg)
        {
            // exécute la vérification des droits (map)
            // ExecuteAndReturn
            map = new CL_MAP();
            STR_MSG verif = map.VerifDroits(oMsg); // on récupère la requete formatée

            object[] data = new object[] { oMsg.Data[0], (OracleCommand)verif.Data[0] };
            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");

            this.oMsg = CL_DATA_ACCES.ExecuteAndReturn(msg); // lancement de la requete

            // Créer un objet data et le remplir avec la réponse de la procédure
            DataSet ds = (DataSet)this.oMsg.Data[0];

            string value = (string)ds.Tables[0].Rows[0].ItemArray.GetValue(0); // on récupère le nom de son schéma, et donc, le nom de son type d'utilisateur
            this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { value }, "", "", "", true, "");

            // renvoyer le résultat
            return this.oMsg;
        }
        public STR_MSG exec(STR_MSG oMsg)
        {
            map = new CL_MAP();
            STR_MSG retour = map.SelectClientFromName(oMsg);

            object[] data = new object[] { oMsg.Data[0], retour.Data[0] }; // le nom de l'utilisateur + la commande
            this.iMsg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");
            this.iMsg = CL_DATA_ACCES.ExecuteAndReturn(this.iMsg);

            if (this.iMsg.Info == "OK")
            {
                DataSet ds = (DataSet)this.iMsg.Data[0];
                decimal id = (decimal)ds.Tables[0].Rows[0][0];
                //int ID_CLIENT = 1;
                int ID_CLIENT = (int)id;
                data = new object[] { ID_CLIENT };
                this.iMsg = CL_MESSAGE_Factory.msg_factory("", data, "OK", "", "", true, "");
            }

            return this.iMsg;
        }
示例#20
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="oMsg">Data[0] doit contenir le nom</param>
        /// <returns></returns>
        public static STR_MSG Disconnect(STR_MSG oMsg)
        {
            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "", "", "", true, "");

            if (connexions.ContainsKey((string)oMsg.Data[0]))
            {
                try
                {
                    connexions[(string)oMsg.Data[0]].Close();
                    connexions.Remove((string)oMsg.Data[0]);
                }
                catch
                {
                    connexions.Remove((string)oMsg.Data[0]);
                }

            }

            msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Déconnecté", "", "", true, "");

            return msg;
        }
示例#21
0
        //===================================================
        //===================================================
        //===================================================
        //===================================================
        //===================================================
        /// <summary>
        /// 
        /// </summary>
        /// <param name="oMsg">Data[0] doit contenir le nom d'utilisateur -- Data[1] doit contenir le mot de passe</param>
        /// <returns></returns>
        public static STR_MSG Connect(STR_MSG oMsg)
        {
            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "", "", "", true, "");

            // vérification du nombre de connexion
            if (connexions.Count >= NB_MAX_CONNECTION)
            {
                msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Trop de connexions existantes", "", "", true, "");
            }
            else
            {

                //string connexionString = @"Data Source=PharmaProject;User Id=" + (string)oMsg.Data[0] + ";Password="******";";

                string connexionString = @"Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL = TCP)(HOST = 192.168.1.5)(PORT = 1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME = ORCL)));User id=" + (string)oMsg.Data[0] + ";Password="******"", new object[] { }, "L'utilisateur " + (string)oMsg.Data[0] + " est à présent connecté", "", "", true, "");

                }
                catch(Exception e)
                {
                    msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Erreur lors de la connexion : " + e.Message, "", "", true, "");
                }

            }

            return msg;
        }
示例#22
0
        public STR_MSG VerifDroits(STR_MSG oMsg)
        {
            OracleCommand cmd = new OracleCommand();
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.CommandText = "DBCONNECT";

            OracleParameter RV = new OracleParameter();
            RV.Direction = ParameterDirection.ReturnValue;
            RV.OracleDbType = OracleDbType.RefCursor;
            RV.ParameterName = "curs";
            //RV.Size = 255;

            cmd.Parameters.Add(RV);

            cmd.Parameters.Add("login_name", OracleDbType.Varchar2, 255).Value = (string)oMsg.Data[0];
            //cmd.Parameters.Add("RV", OracleDbType.RefCursor).Direction = ParameterDirection.ReturnValue;

            this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { cmd }, "", "", "", true, "");

            return this.oMsg;
        }
        public STR_MSG exec(STR_MSG oMsg)
        {
            map = new CL_MAP();
            STR_MSG req = map.ListStock(oMsg);

            object[] data = new object[] { (string)oMsg.Data[0], (string)req.Data[0] };

            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");
            this.oMsg = CL_DATA_ACCES.ExecuteAndReturn(msg);

            //stock = new CL_CT_CalculValeurStock();
            //Thread thr = new Thread(new ParameterizedThreadStart(stock.Calcul));

            //factu = new CL_CT_CalculFacturationDateDate(); // a refaire
            //Thread thr2 = new Thread(new ParameterizedThreadStart(factu.Calcul));

            //{
            //    thr.Start();
            //    thr2.Start();
            //}

            return this.oMsg;
        }
        public STR_MSG exec(STR_MSG oMsg)
        {
            object[] data = new object[] { "C##PHARMAWEB", "PHARMA00" }; // données du compte faible
            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, ""); // pour la connexion avec le compte faible

            // Connect avec le compte faible
            STR_MSG verif = CL_DATA_ACCES.Connect(msg);

            // exécute la vérification des droits (map)
            // ExecuteAndReturn
            map = new CL_MAP();
            verif = map.VerifDroits(oMsg); // on récupère la requete formatée

            data = new object[] { "C##PHARMAWEB", (OracleCommand)verif.Data[0] };
            msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");

            this.oMsg = CL_DATA_ACCES.ExecuteAndReturn(msg); // lancement de la requete

            // Créer un objet data et le remplir avec la réponse de la procédure
            DataSet ds = (DataSet)this.oMsg.Data[0];

            if (ds.Tables[0].Rows.Count > 0)
            {
                string value = (string)ds.Tables[0].Rows[0].ItemArray.GetValue(0);
                this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { value }, "", "", "", true, "");
            }
            else
            {
                this.oMsg = CL_MESSAGE_Factory.msg_factory("", new object[] { "Utilisateur Inexistant" }, "", "", "", true, "");
            }

            // Deconnexion du compte faible
            CL_DATA_ACCES.Disconnect(msg);

            // renvoyer le résultat
            return this.oMsg;
        }
        public void Service(object obj)
        {
            STR_MSG oMsg = (STR_MSG)obj;

            if (this.SecuriteAccesPlateforme(oMsg.P_security)) // si la clé de sécurité est OK
            {

                if (oMsg.Invoke == "Connexion")
                {
                    CL_PROCESS_CLIENT process = new CL_PROCESS_CLIENT();
                    this.iMsg = process.Connexion(oMsg);
                }
                else if (oMsg.Invoke == "createUser")
                {
                    CL_PROCESS_CLIENT process = new CL_PROCESS_CLIENT();
                    this.iMsg = process.CreerUtilisateur(oMsg);
                }

                else if (oMsg.Invoke == "PrevisionCA")
                {
                    CL_PROCESS_PHARMACIEN process = new CL_PROCESS_PHARMACIEN();
                    this.iMsg = process.Calcul(oMsg);
                }

                else if (oMsg.Invoke == "ListerMedics")
                {
                    CL_PROCESS_CLIENT process = new CL_PROCESS_CLIENT();
                    this.iMsg = process.ListerMedics(oMsg);
                }
                else if (oMsg.Invoke == "CommandeClient")
                {
                    CL_PROCESS_CLIENT process = new CL_PROCESS_CLIENT();
                    this.iMsg = process.PasserCommande(oMsg);
                }

            }
        }
        public STR_MSG exec(STR_MSG oMsg)
        {
            // TODO vérification du niveau d'autorisation ?
            object[] data = new object[] { "PHARMAWEB", "Azerty64" }; // données du compte sys
            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, ""); // pour la connexion

            STR_MSG execution = CL_DATA_ACCES.Connect(msg); // Connexion avec sys

            if (execution.Info != "OK")
            {
                this.oMsg = CL_MESSAGE_Factory.msg_factory("", null, "Erreur", "", "", true, "");
                return this.oMsg;
            }

            map = new CL_MAP();
            execution = map.CreateUser(oMsg);

            data = new object[] { "PHARMAWEB", (OracleCommand)execution.Data[0] };
            msg = CL_MESSAGE_Factory.msg_factory("", data, "", "", "", true, "");

            STR_MSG retour = CL_DATA_ACCES.Execute(msg); // lancement de la requete

            // Deconnexion du compte sys
            CL_DATA_ACCES.Disconnect(msg);

            if (retour.Info != "OK")
            {
                this.oMsg = retour;
            }
            else
            {
                this.oMsg = CL_MESSAGE_Factory.msg_factory("", null, "OK", "", "", true, "");
            }

            return this.oMsg;
        }
示例#27
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="oMsg">Data[0] = le nom d'utilisateur ; Data[1] = la requete</param>
        /// <returns></returns>
        public static STR_MSG ExecuteAndReturn(STR_MSG oMsg)
        {
            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "", "", "", true, "");

            if (UserExists((string)oMsg.Data[0]))
            {
                try
                {
                    // Créer un objet pour lancer la requete
                    OracleCommand oCommand = (OracleCommand)oMsg.Data[1];
                    oCommand.Connection = connexions[(string)oMsg.Data[0]];

                    oCommand.ExecuteNonQuery();

                    OracleDataAdapter da = new OracleDataAdapter(oCommand);

                    // créer un objet pour récupérer le résultat
                    DataSet ds = new DataSet();
                    da.Fill(ds);

                    // mettre le résultat dans un objet[]
                    object[] data = new object[] { ds };

                    msg = CL_MESSAGE_Factory.msg_factory("", data, "OK", "", "", true, "");
                }
                catch(Exception e)
                {
                    Disconnect(oMsg);
                    msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Reconnexion", "", "", true, "");
                }

            }
            else
            {
                msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Erreur : non connecté", "", "", true, "");
            }

            return msg;
        }
示例#28
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="oMsg">Data[0] = le nom d'utilisateur ; Data[1] = la requete</param>
        /// <returns></returns>
        public static STR_MSG Execute(STR_MSG oMsg)
        {
            string exec = (string)oMsg.Data[1]; // la requete
            STR_MSG msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "", "", "", true, "");

            if (UserExists((string)oMsg.Data[0]))
            {
                try
                {
                    OracleCommand oCommand = new OracleCommand(exec, connexions[(string)oMsg.Data[0]]);

                    oCommand.ExecuteNonQuery();

                    msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "OK", "", "", true, "");
                }
                catch(Exception e)
                {
                    Disconnect(oMsg);
                    msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Reconnexion", "", "", true, "");
                }

            }
            else
            {
                msg = CL_MESSAGE_Factory.msg_factory("", new object[] { }, "Reconnexion", "", "", true, "");
            }

            return msg;
        }
示例#29
0
 //==========================================================
 //==========================================================
 //==========================================================
 //==========================================================
 public STR_MSG LancerTest(STR_MSG oMsg)
 {
     return this.oMsg = workflow.Redirect(oMsg);
 }
示例#30
0
 public STR_MSG Connexion(STR_MSG oMsg)
 {
     return this.oMsg = workflow.Redirect(oMsg);
 }