Ejemplo n.º 1
0
        //Costruttori
        //Da valutare se rendere privato -> nuovo user solo attraverso la funzione di Login
        private User(string nome, string password)
            : base()
        {
            //Console.Write("Creo un utente: nome ->"+nome+"; pass->"+password+"\n");
            string[][] parameters = new string[2][];
            parameters[0] = new string[2] {
                "@nome", nome
            };
            parameters[1] = new string[2] {
                "@password", password
            };
            int quantita = 0;

            this.ExecuteQuery(sql_get_user_data, parameters);
            //Get the data
            foreach (int i in this.GetResults())
            {
                this.__nome = (string)(this.ResultGetValue("nome"));
                quantita    = i;
            }
            //i contiene il numero di risultati;
            if (quantita < 1)
            {
                throw new DatabaseException("Utente non trovato", DatabaseErrorCode.UserNonEsistente);
            }
            else if (quantita > 1)
            {
                throw new DatabaseException("Panic! More than one user with same password and name or sql wrong", DatabaseErrorCode.UserNonEsistente);
            }
            //Create the snapshot list
            __s_list = new FileUtenteList(this.__nome);
        }
Ejemplo n.º 2
0
 //Costruttori
 //Da valutare se rendere privato -> nuovo user solo attraverso la funzione di Login
 private User(string nome, string password)
     : base()
 {
     //Console.Write("Creo un utente: nome ->"+nome+"; pass->"+password+"\n");
     string[][] parameters = new string[2][];
     parameters[0] = new string[2] { "@nome", nome };
     parameters[1] = new string[2] { "@password", password };
     int quantita = 0;
     this.ExecuteQuery(sql_get_user_data, parameters);
     //Get the data
     foreach (int i in this.GetResults())
     {
         this.__nome = (string)(this.ResultGetValue("nome"));
         quantita = i;
     }
     //i contiene il numero di risultati;
     if(quantita < 1){
         throw new DatabaseException("Utente non trovato",DatabaseErrorCode.UserNonEsistente);
     }
     else if (quantita > 1) {
         throw new DatabaseException("Panic! More than one user with same password and name or sql wrong", DatabaseErrorCode.UserNonEsistente);
     }
     //Create the snapshot list
     __s_list = new FileUtenteList(this.__nome);
 }
Ejemplo n.º 3
0
 //Metodi
 internal void Logout()
 {
     //Logout...
     this.__nome     = null;
     this.__password = null;
     this.__s_list   = null;
 }
Ejemplo n.º 4
0
 //Metodi
 internal void Logout()
 {
     //Logout...
     this.__nome = null;
     this.__password = null;
     this.__s_list = null;
 }