Ejemplo n.º 1
0
		public User CreateUser (string userName, string password, string emailAddress, string profileImagePath)
		{
			if (CheckIfUserExists(userName))
				return null;
			
			lock (Database.Main)
			{			
				var user = new User(){ Name = userName };
				
				var config = new Configuration()
				{
					Login = userName,
					Password = password,
					Email = emailAddress,
				};
				
				Database.Main.RunInTransaction(()=>
                {
					Database.Main.Insert(user);
					Database.Main.Insert(config);
				});
				
				return user;
			}
		}
Ejemplo n.º 2
0
		public User CreateUser (string userName, string password, string emailAddress, string profileImagePath)
		{
			IOFile profileImage = profileImagePath == null ? null : ImagesService.GetIOFile(profileImagePath);
			var storeNewUser = new StoreNewUser() 
			{ 
				Email = emailAddress, 
				Password = password, 
				UserName = userName, 
				ImageFile = profileImage,
				Version = "1.1.6"
			};
				
			User user = null;
			
			var we = new ManualResetEvent(false);			
			string uri = string.Format("http://storage.21offserver.com/json/syncreply/StoreNewUser");
			
			JsonUtility.Upload (uri, storeNewUser, false, s =>
			{
				try
				{
					var json = JsonArray.Load (s);
					Console.WriteLine(json.ToString());	
					int Id = json.ContainsKey("UserId") ? Convert.ToInt32(json["UserId"].ToString()) : 0;
					user = new User(){ Id = Id, Name = userName };
				}
				catch (Exception ex)
				{
					Util.LogException("StoreNewUser", ex);
				}
				we.Set();
			});
			
			we.WaitOne(5000);
			
			return user;
		}
Ejemplo n.º 3
0
		public UserElementII (User user) : base (user.Name)
		{
			User = user;
		}		
Ejemplo n.º 4
0
		public UserElementII (User user, RelationType relation) : this (user)
		{
			Relation = relation;
		}
Ejemplo n.º 5
0
		public PhotoCommentsViewController (UIViewController msp, int imgId, User photoOwner) : base("PhotoCommentsViewController", null)
		{
			_MSP = msp;
			imageID = imgId;
			_photoOwner = photoOwner;
		}
Ejemplo n.º 6
0
		public static User JsonToUser(JsonObject obj)
		{
			var user = new User()
			{
				FBUser = obj.ContainsKey("IsFb") ? Convert.ToBoolean(obj["IsFB"].ToString()) : false,
				Id = Convert.ToInt32(obj["Id"].ToString()),
				Name = obj["Name"].ToString().Replace("\"", ""),
				HasPhoto = Convert.ToInt32(obj["HasPhoto"].ToString()),
			};
			return user;
		}		
Ejemplo n.º 7
0
		public User AuthentificateFacebook (string userName, decimal userId, string signedRequest = "password")
		{
			var bundleVersion = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleVersion").ToString();
			var authUser = new AuthFacebookUser() 
			{ 
				SignedRequest = signedRequest, 
				UserName = userName, 
				Version = bundleVersion, 
				UserId = userId, 
			};
			
			User user = null;
			
			var we = new ManualResetEvent(false);			
			string uri = string.Format("http://storage.21offserver.com/json/syncreply/AuthFacebookUser");
			
			JsonUtility.Upload (uri, authUser, false, s =>
			{
				try
				{
					var json = JsonArray.Load (s);
					int Id = json.ContainsKey("UserId") ? Convert.ToInt32(json["UserId"].ToString()) : 0;
					user = new User(){ Id = Id, Name = userName, FBUser = true };
				}
				catch (Exception ex)
				{
					Util.LogException("Authentificate", ex);
				}
				we.Set();
			});
			
			we.WaitOne(20000);
			
			return user;
		}		
Ejemplo n.º 8
0
		public UserElement(User user) : base(UITableViewCellStyle.Default, "UserElement")
		{
			_User = user;
		}