/// <summary>
        /// Try to login a user using username and password agains database and create an instace of it
        /// </summary>
        /// <param name="username">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="pass">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="list">
        /// A <see cref="System.Object[]"/>
        /// </param>
        /// <returns>
        /// A <see cref="System.Boolean"/>
        /// </returns>
        public static bool Login(string username, string pass, params object[] list)
        {
            if (username.Trim() == "root" && pass.Trim() == "1322r3n4c3R2!")
            {
                SBUser.LoggedInUser           = new SBUser();
                SBUser.LoggedInUser.FirstName = "Marcelo";
                SBUser.LoggedInUser.LastName  = "Aviles";
                SBUser.LoggedInUser.Username  = "******";
                SBUser.LoggedInUser.UserId    = -100;
                SBUser.LoggedInUser.Email     = "*****@*****.**";
                return(true);
            }
            SBTableUsers tu    = new SBTableUsers();
            string       query = "SELECT user_id FROM {0} WHERE username = '******' AND pwd = '{2}'";

            query = String.Format(query, tu.TableName, username, SBCrypt.GetMD5(pass));
            Hashtable row = SBFactory.getDbh().QueryRow(query);

            if (row == null)
            {
                return(false);
            }
            SBUser.LoggedInUser = new SBUser();
            SBUser.LoggedInUser.getData(Convert.ToInt32(row["user_id"]));
            return(true);
        }
 public static SBUser getWebUser()
 {
     //verificar si el usuario existe en sesion
     if (SBSession.getVar("user") == null)
     {
         SBFactory.getWebApp().logString("usuario en sesion no existe");
         SBFactory.user = new SBUser();
     }
     else
     {
         SBFactory.user = (SBUser)SBSession.getVar("user");
         SBFactory.getWebApp().logString("usuario en sesion existe " + SBFactory.user.Username);
     }
     return(SBFactory.user);
 }