Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.LogIn);

            DB_Communicator db = new DB_Communicator();

            Button btnLogin = FindViewById<Button>(Resource.Id.btnLogin);

            btnLogin.Click += async (object sender, EventArgs e) => {
                EditText username = FindViewById<EditText>(Resource.Id.usernameText);
                EditText password = FindViewById<EditText>(Resource.Id.passwordText);

                user = await db.login(username.Text, password.Text);

                if(user != null) {
                    //storing user information for usage in other activities
                    user.StoreUserInPreferences(this, user);

                    Toast.MakeText(this, "Login successful!", ToastLength.Short).Show();
                    Intent i = new Intent(this, typeof(ListEventsActivity));
                    StartActivity(i);
                } else {
                    Toast.MakeText(this, "Login failed!", ToastLength.Long).Show();
                }
            };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.EventDetails);
            listView = FindViewById<ListView>(Resource.Id.EventDetails_ListUser);

            DB_Communicator db = new DB_Communicator();
            listUser = db.SelectUserForEvent(Convert.ToInt32(this.Intent.Extras.Get("idEvent")), null).Result;

            listView.Adapter = new ListUserAdapter(this, listUser);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.ListEvents);
            listView = FindViewById<ListView>(Resource.Id.listEvents);

            user = MySqlUser.GetUserFromPreferences(this);

            DB_Communicator db = new DB_Communicator();
            listEvents = db.SelectEventsForUser(user.idUser, null).Result;
            listView.Adapter = new ListEventsAdapter(this, listEvents);

            listView.ItemClick += OnListItemClick;
        }
		protected override void OnCreate(Bundle bundle) {
			base.OnCreate(bundle);
			SetContentView(Resource.Layout.ListEvents);

			//Get all events for the logged in user
			DB_Communicator db = new DB_Communicator();
			user = MySqlUser.GetUserFromPreferences(this);
			listEvents = db.SelectEventsForUser(user.idUser, null).Result;

			if(listEvents.Count == 0) {
				//display text that there are currently no events
			} else {
				listView = FindViewById<ListView>(Resource.Id.listEvents);
				listView.Adapter = new ListEventsAdapter(this, listEvents);
				listView.ItemClick += OnListItemClick;
			}
		}
		public DB_InsertEvent(DB_Communicator dbCommunicator) {
			this.dbCommunicator = dbCommunicator;
			this.debug = dbCommunicator.debug;
		}
		protected override void OnCreate(Bundle bundle) {
			base.OnCreate(bundle);
			db = DB_Communicator.getInstance();
		}
		public DB_Select(DB_Communicator dbCommunicator) {
			this.dbCommunicator = dbCommunicator;
			this.debug = dbCommunicator.debug;
		}
		public DB_Delete(DB_Communicator dbCommunicator) {
			this.dbCommunicator = dbCommunicator;
			this.debug = dbCommunicator.debug;
		}
		public DB_SelectUser(DB_Communicator dbCommunicator) : base(dbCommunicator) {}
		public DB_SelectEvent(DB_Communicator dbCommunicator) : base(dbCommunicator) {}
		public DB_Insert(DB_Communicator dbCommunicator) {
			this.dbCommunicator = dbCommunicator;
			this.client = dbCommunicator.client;
			this.debug = dbCommunicator.debug;
		}
		public VBStatistic(int userId, string season) {
			db = DB_Communicator.getInstance();
			this.season = season;
			this.userId = userId;
		}
		public DB_SelectTeam(DB_Communicator dbCommunicator) : base(dbCommunicator) {
			this.type = "DB_SelectTeam";
		}
		public static DB_Communicator getInstance() {
			if(db == null)
				db = new DB_Communicator();
			return db;
		}
		public DB_Update(DB_Communicator dbCommunicator) {
			this.dbCommunicator = dbCommunicator;
			this.client = dbCommunicator.client;
			this.debug = dbCommunicator.debug;
		}