Ejemplo n.º 1
0
Archivo: Vote.cs Proyecto: auxua/Qurvey
 public Vote(User user, Survey survey, Answer answer)
     : this()
 {
     this.User = user;
     this.Survey = survey;
     this.Answer = answer;
 }
Ejemplo n.º 2
0
Archivo: User.cs Proyecto: auxua/Qurvey
 public static User GenerateNewUser()
 {
     User u = new User();
     var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
     random = new Random();
     u.Code = new string(
         Enumerable.Repeat(chars, 30)
                   .Select(s => s[random.Next(s.Length)])
                   .ToArray());
     u.Created = DateTime.Now;
     return u;
 }
Ejemplo n.º 3
0
		public async Task AuthenticateWithBackend() {
			if (IsAuthenticated) {
				return;
				//throw new Exception ("User is already authenticated with backend");
			}

			User user = await Backend.CreateNewUserAsync();
			Application.Current.Properties ["UserAsString"] = JsonConvert.SerializeObject(user);
			Application.Current.SavePropertiesAsync();
			User = user;
			IsAuthenticated = true;
		}
Ejemplo n.º 4
0
		public Panic(string course, User user) {
			this.Course = course;
			this.User = user;
			this.Created = DateTime.Now;
		}
Ejemplo n.º 5
0
 public UserResponse(User user, string e)
 {
     this.User = user;
     this.ExceptionMessage = e;
 }
Ejemplo n.º 6
0
 public void SaveUser(User user)
 {
     if (user.Id == 0)
     {
         this.Users.Add(user);
     }
     else
     {
         this.Users.Attach(user);
     }
     this.SaveChanges();
 }
Ejemplo n.º 7
0
 public Vote GetVoteForUser(Survey survey, User user)
 {
     var query = this.Votes
         .Include(v => v.Answer).Include(v => v.Survey).Include(v => v.User)
         .Where(v => v.Survey.Id == survey.Id && v.User.Id == user.Id);
     if (query.Count() > 1)
     {
         this.Log(string.Format("User {0} has voted multiple times for survey {1}", user.Id, survey.Id));
     }
     return query.FirstOrDefault<Vote>();
 }
Ejemplo n.º 8
0
 public GetVoteForUserRequest(Survey survey, User user)
 {
     this.Survey = survey;
     this.User = user;
 }