Beispiel #1
0
        //////////////////////////////////////////////////
        /// @brief Récupère la configuration du visiteur
        //////////////////////////////////////////////////
        public void Visiteur_Configuration()
        {
            string       req   = "SELECT config_id FROM wmsUSERAGENT WHERE config_useragent=@USERAGENT";
            DataServices oData = new DataServices(VisiteurDsn, req);

            oData.AddParameter("@USERAGENT", SqlDbType.NVarChar, 1000, ParameterDirection.Input, VisiteurUserAgent, "config_useragent");
            oData.GetStructures();

            if (!oData.UtilityDataExiste)
            {
                req = "INSERT INTO wmsUSERAGENT (config_OS,config_navigateur,config_version,config_screen,config_cookies,config_crawler, config_useragent) VALUES (@PLATFORM,@NAVIGATEUR,@VERSION,@SCREENW,@COOKIE,@CRAWLER,@USERAGENT)";
                oData.UtilitySqlCommand = new SqlCommand(req, oData.UtilitySqlConnection);
                oData.AddParameter("@PLATFORM", SqlDbType.VarChar, 50, ParameterDirection.Input, VisiteurBrowser.Platform, "config_OS");
                oData.AddParameter("@NAVIGATEUR", SqlDbType.VarChar, 50, ParameterDirection.Input, VisiteurBrowser.Type, "config_navigateur");
                oData.AddParameter("@VERSION", SqlDbType.VarChar, 50, ParameterDirection.Input, VisiteurBrowser.Version, "config_version");
                oData.AddParameter("@SCREENW", SqlDbType.Int, 0, ParameterDirection.Input, VisiteurBrowser.ScreenPixelsWidth, "config_screen");
                oData.AddParameter("@COOKIE", SqlDbType.Int, 0, ParameterDirection.Input, VisiteurBrowser.Cookies, "config_cookies");
                oData.AddParameter("@CRAWLER", SqlDbType.Int, 0, ParameterDirection.Input, VisiteurBrowser.Crawler, "config_crawler");
                oData.AddParameter("@USERAGENT", SqlDbType.NVarChar, 1000, ParameterDirection.Input, VisiteurUserAgent, "config_useragent");
                oData.Execute(DataServices.ExecutionMode.INSERT);
                _config_id = (int)oData.UtilityDataId;
            }
            else
            {
                _config_id = (int)oData.UtilityDataField;
            }

            oData.Dispose();
        }
Beispiel #2
0
 //////////////////////////////////////////////////
 /// @brief Change la variable pour le site actif
 //////////////////////////////////////////////////
 private void ChangeVariable(string _var, int _site)
 {
     oData = new DataServices(_dsn, DBQuery.QVariable);
     oData.AddParameter("@VAR", SqlDbType.VarChar, 50, ParameterDirection.Input, _var, "var_nom");
     oData.AddParameter("@SITE", SqlDbType.Int, 0, ParameterDirection.Input, _site, "var_site");
     oData.Execute(DataServices.ExecutionMode.UPDATE);
     oData.Dispose();
 }
Beispiel #3
0
        //////////////////////////////////////////////////
        /// @brief Enregistre la visite
        //////////////////////////////////////////////////
        public void Visiteur_Enregistre_Visite(string _session)
        {
            string       pays_nom;
            double       code_ip;
            string       req;
            DataServices oData;

            Visiteur_Configuration();
            try {
                string[] IP = VisiteurAddress.Split('.');
                code_ip = (16777216 * Convert.ToDouble((IP[0]))) + (65536 * Convert.ToDouble((IP[1]))) + (256 * Convert.ToDouble((IP[2]))) + Convert.ToDouble((IP[3]));
                req     = "SELECT TOP 1 iplocation_pays FROM wmsIPLOCATION WHERE iplocation_code_debut <=@DEBUT AND iplocation_code_fin >= @FIN";
                oData   = new DataServices(VisiteurDsn, req);
                oData.AddParameter("@DEBUT", SqlDbType.Float, 0, ParameterDirection.Input, code_ip, "iplocation_code_debut");
                oData.AddParameter("@FIN", SqlDbType.Float, 0, ParameterDirection.Input, code_ip, "iplocation_code_fin");
                oData.GetStructures();
                if (oData.UtilityDataExiste)
                {
                    pays_nom = oData.UtilityDataField.ToString();
                }
                else
                {
                    pays_nom = "N/A";
                    code_ip  = 0;
                }
            }
            catch
            {
                pays_nom = "N/A";
                code_ip  = 0;
            }

            req  = "INSERT INTO wmsVISITE (visite_date_debut,visite_session,visiteur_id,config_id,visite_host_ip,visite_site,visite_code,visite_pays,visite_debut,visite_fin,visite_duree,visite_pages,visite_pages_in) ";
            req += "values (@DATE,@SESSION,@VISITEUR,@CONFIG,@IP,@SITE,@VISITE,@PAYS,@DEBUT,@FIN,@DUREE,@PAGES,@PAGESINT)";

            oData = new DataServices(VisiteurDsn, req);
            oData.AddParameter("@DATE", SqlDbType.DateTime, 0, ParameterDirection.Input, DateTime.Now, "visite_date_debut");
            oData.AddParameter("@VISITEUR", SqlDbType.Int, 0, ParameterDirection.Input, VisiteurId, "visiteur_id");
            oData.AddParameter("@CONFIG", SqlDbType.Int, 0, ParameterDirection.Input, _config_id, "config_id");
            oData.AddParameter("@IP", SqlDbType.VarChar, 20, ParameterDirection.Input, VisiteurAddress, "visite_host_ip");
            oData.AddParameter("@SITE", SqlDbType.Int, 0, ParameterDirection.Input, VisiteurSite, "visite_site");
            oData.AddParameter("@VISITE", SqlDbType.Float, 0, ParameterDirection.Input, code_ip, "visite_code");
            oData.AddParameter("@PAYS", SqlDbType.VarChar, 50, ParameterDirection.Input, pays_nom, "visite_pays");
            oData.AddParameter("@SESSION", SqlDbType.VarChar, 50, ParameterDirection.Input, _session, "visite_session");
            oData.AddParameter("@DEBUT", SqlDbType.DateTime, 0, ParameterDirection.Input, DateTime.Now, "visite_debut");
            oData.AddParameter("@FIN", SqlDbType.DateTime, 0, ParameterDirection.Input, DateTime.Now, "visite_fin");
            oData.AddParameter("@DUREE", SqlDbType.Int, 0, ParameterDirection.Input, 0, "visite_duree");
            oData.AddParameter("@PAGES", SqlDbType.Int, 0, ParameterDirection.Input, 0, "visite_pages_in");
            oData.AddParameter("@PAGESINT", SqlDbType.Int, 0, ParameterDirection.Input, 0, "visite_pages");
            oData.Execute(DataServices.ExecutionMode.INSERT);
            VisiteurVisiteId = (int)oData.UtilityDataId;
            oData.Dispose();
        }
Beispiel #4
0
        //////////////////////////////////////////////////
        /// @brief Modifie la visite
        //////////////////////////////////////////////////
        public void Visiteur_Anonyme_To_Member(int memberid, int visiteid)
        {
            String       req   = "UPDATE wmsVISITE SET visiteur_id=@VISITEUR where visite_id=@SESSIONADN";
            DataServices oData = new DataServices(VisiteurDsn, req);

            oData.AddParameter("@SESSIONADN", SqlDbType.Int, 0, ParameterDirection.Input, visiteid, "visite_id");
            oData.AddParameter("@VISITEUR", SqlDbType.Int, 0, ParameterDirection.Input, memberid, "visiteur_id");
            oData.Execute(DataServices.ExecutionMode.UPDATE);
            oData.Dispose();

            req   = "UPDATE crmPUBLIC SET public_connexions =COALESCE(public_connexions, 0)+1, public_dernierevisite=@DATE WHERE public_id =@VISITEUR";
            oData = new DataServices(VisiteurDsn, req);
            oData.AddParameter("@VISITEUR", SqlDbType.Int, 0, ParameterDirection.Input, memberid, "public_id");
            oData.AddParameter("@DATE", SqlDbType.DateTime, 0, ParameterDirection.Input, DateTime.Now, "public_dernierevisite");
            oData.Execute(DataServices.ExecutionMode.UPDATE);
            oData.Dispose();
        }
Beispiel #5
0
 //////////////////////////////////////////////////
 /// @brief Desc
 //////////////////////////////////////////////////
 private void UpdateDatabase(string requete)
 {
     oData = new DataServices(_dsn, requete);
     oData.Execute(DataServices.ExecutionMode.UPDATE);
     oData.Dispose();
 }