コード例 #1
0
        public static bool checkSession(STG msg, cl_cmp_session oCmpSession, cl_cad oCad)
        {
            Console.WriteLine("Checking de la session");
            System.Data.DataSet oDS = new DataSet();

            string email = "";

            oDS = oCad.getRows(oCmpSession.selectALLByEmail(msg.data[0].ToString()), "Session");

            foreach (DataRow pRow in oDS.Tables["Session"].Rows)
            {
                try
                {
                    email = pRow["email"].ToString();
                }
                catch
                {
                }
            }

            return((email == "") ? false : true);
        }
コード例 #2
0
        public STG auth(STG msg)
        {
            Console.WriteLine("Demande de service 'auth'");
            System.Data.DataSet oDS = new DataSet();

            string email = "";

            do
            {
                oDS = oCad.getRows(this.oCmpPerson.connectPerson(msg.data[0].ToString(), msg.data[1].ToString()), "Person");

                foreach (DataRow pRow in oDS.Tables["Person"].Rows)
                {
                    try
                    {
                        email = pRow["email"].ToString();
                    }
                    catch
                    {
                    }
                }

                if (email == "")
                {
                    oCad.ActionRows(this.oCmpPerson.createPerson(msg.data[0].ToString(), msg.data[1].ToString()));
                    Console.WriteLine("Utilisateur introuvable, création de l'utilisateur.");
                }
            } while (email == "");

            Console.WriteLine("connected");

            msg.info      = "13, user connected";
            msg.statut_op = true;
            msg.tokenUser = cl_cm_session.createSession(msg, this.oCmpSession, this.oCad);

            return(msg);
        }