public TeamDetailsFragment(VBTeam team, VBTeamrole teamrole, List<VBRequest> listRequests, List<VBUser> listMember) {
			this.team = team;
			this.teamrole = teamrole;
			this.listRequests = listRequests;
			this.listMember = listMember;
		}
			/**
			 * Updates the user with the teamrole in the response
			 * Doesn't affect the view!
			 * To refresh the GUI call refreshTeamDetailsFragment();
			 **/
			private void updateTeamrole(string response) {
				JsonValue json = JsonValue.Parse(response);

				if(DB_Communicator.getInstance().wasSuccesful(json)) {
					//createTeamroleFromResponse
					VBTeamrole newTeamrole = new VBTeamrole(json["data"]["TeamRole"]);
					user.listTeamRole.Add(newTeamrole);
					
					//StoreUserInPreferencess
					user.StoreUserInPreferences(ViewController.getInstance().mainActivity, user);

					ViewController vc = ViewController.getInstance();
					vc.toastJson(vc.mainActivity, json,ToastLength.Long, "Successfully updated teamrole");
				}
			}
		public TeamDetailsProfileFragment(VBTeam team, VBTeamrole teamrole, List<VBRequest> listRequests) {
			this.team = team;
			this.teamrole = teamrole;
			this.listRequests = listRequests;
		}
		public void refreshTeamDetailsFragment() {
			this.teamrole = VBUser.GetUserFromPreferences().getTeamroleForTeam(this.team.id);

			ViewController.getInstance().refreshFragment(ViewController.TEAM_DETAILS_FRAGMENT);
		}
Ejemplo n.º 5
0
		public static VBUser GetUserFromPreferences() {
			ISharedPreferences prefs = VBUser.context.GetSharedPreferences("userinformation", FileCreationMode.Private);
			VBUser vbuser =  new VBUser(prefs.GetInt("idUser", 0),
				prefs.GetString("name", ""),
				prefs.GetString("email", ""),
				prefs.GetString("state", ""),
				prefs.GetString("password", ""),
				prefs.GetString("userType", ""));

			if(prefs.Contains("idUser")) {
				for(int i = 0; i < count; i++) {
					VBTeamrole teamRole = new VBTeamrole(prefs.GetInt("teamId"+i, 0), prefs.GetString("userType"+i, ""), prefs.GetString("role"+i, ""), 
						prefs.GetInt("number"+i, 0),prefs.GetString("position"+i, ""));
					vbuser.listTeamRole.Add(teamRole);
				}


				return vbuser;
			} else {
				return null;
			}
		}