Beispiel #1
0
        static void Main(string[] args)
        {
            //Base class
            UserController userController = new UserController();
            userController.Login("John.Smith", "secret");
            //userController.SetPermissions("John.Smith");
            //inherits from userController so gets its methods
            AdminController adminController = new AdminController();
            adminController.Login("Jane.Doe", "pass123");
            adminController.SetPermissions("Jane.Doe");
            //inherits from adminController so get its methods and all the methods inherited from userController
            AdminController superAdminController = new SuperAdminController();
            superAdminController.Login("Joe.Bloggs", "password");
            superAdminController.SetPermissions("Joe.Bloggs");

            Admin admin = new Admin();
            admin.name = "Jane.Doe";
            admin.role = "admin";
            Seller seller = new Seller();
            seller.name = "John.Smith";
            seller.role = "Seller";
            //AbstractUser user = new AbstractUser(); // Oooops, no can do!

            //IDatabaseConnection connection1 = new IDatabaseConnection(); // Not possible!
            IDatabaseConnection connection2 = new MicrosoftDbConnection();

            Console.ReadLine();
        }
        // GET: Activate/Details/5
        public ActionResult Create(string usuario, string password, string token)
        {
            SuperAdminController sac = new SuperAdminController();
            SolicitudJuego       sol = sac.getSolicitudByParam(usuario, password, token);

            if (sol != null && sol.expirationTime.CompareTo(DateTime.Now) >= 0)
            {
                return(View());
            }
            else
            {
                return(RedirectToAction("Expired"));
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            UserController uc = new UserController();

            uc.Login("LS", "123");

            AdminController ac = new AdminController();

            ac.Login("HS", "456");

            SuperAdminController sc = new SuperAdminController();

            sc.Login("R2", "789");

            Console.ReadLine();
        }
Beispiel #4
0
        public ActionResult Create(SolicitudJuegoModel sjm)
        {
            SuperAdminController sac = new SuperAdminController();
            SolicitudJuego       sol = new SolicitudJuego();

            sol.email          = sjm.email;
            sol.expirationTime = sjm.expirationTime;
            sol.user           = Guid.NewGuid().ToString();
            sol.password       = Guid.NewGuid().ToString();
            sol.token          = Guid.NewGuid().ToString();
            sac.createSolicitud(sol);
            string activateUrl = sac.getActivateURL(sol);

            sendEmail(sol.email, activateUrl);
            return(RedirectToAction("Create"));
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            //Base class - most senior class
            UserController userController = new UserController();

            userController.Login("Bart Simpson", "EatMyShorts");

            //Inherits from UserController, so gets all it's methods
            AdminController adminController = new AdminController();

            adminController.Login("Homer Simpson", "Doh");
            adminController.SetPermissions("Maggie Simpson");

            //Inherits from AdminController, so gets all it's methods and the UserController Methods
            SuperAdminController superAdminController = new SuperAdminController();

            superAdminController.Login("Marge Simpson", "hmmm...");
            superAdminController.SetPermissions("Lisa Simpson");

            //Admin inherits name and id from User
            Admin admin = new Admin();

            admin.id       = 123;
            admin.name     = "batman";
            admin.password = "******";

            //Buyer inherits name and id from user
            Buyer buyer = new Buyer();

            buyer.id   = 456;
            buyer.name = "joker";

            //Can't instantantiate because this is an abstract class
            //User user = new User();

            //MSDBConnection inherited its method from DatabaseConnection Interface
            MicrosoftDatabaseConnection dbCon = new MicrosoftDatabaseConnection();

            dbCon.OpenConnectionToDatabase("Address");

            //Even though these are abstract and interaces we can still construct any object that inherits from them
            User user = new Admin();
            DatabaseConnection dbConnection = new OracleDatabaseConnection();

            Console.ReadLine();
        }
Beispiel #6
0
        // GET: ListarJuegos
        public ActionResult Listar()
        {
            SuperAdminController Sa = new SuperAdminController();

            return(View(Sa.ListarJuegos()));
        }