コード例 #1
0
 /// <summary>
 /// Delete  for User object
 /// if excepion happeneds during Table operation it must be cought in calling method.
 /// </summary>
 /// <param name="obj">instance of User class to be inserted </param>
 /// <param name="AddToContext">bool paremeter  tell the Context to attach object if it is not tracked by this instance of the Context </param>
 public void DeleteObject(User obj, bool AddToContext)
 {
     if (AddToContext)
          servCtx.AttachTo(TableName, obj.InternalEntity, "*");
     servCtx.DeleteObject(obj.InternalEntity);
     servCtx.SaveChangesWithRetries();
 }
コード例 #2
0
ファイル: UserModel.cs プロジェクト: hooookmeup/hookmeup
        internal static User FromModel(UserModel model, User user)
        {
            if (!String.IsNullOrEmpty(model.UserName))
                user.UserName = model.UserName;

            if (!String.IsNullOrEmpty(model.Password))
            user.Password = model.Password;

            user.IsActive = model.IsActive;

            user.IsAdmin = model.IsAdmin;

            if (!String.IsNullOrEmpty(model.Gender))
                user.Gender = model.Gender;

            user.Latitude = model.Latitude;
            user.Longitude = model.Longitude;

            if (!String.IsNullOrEmpty(model.ChatId))
                user.ChatId = model.ChatId;

            if (!String.IsNullOrEmpty(model.DeviceId))
                user.DeviceId = model.DeviceId;

            if (!String.IsNullOrEmpty(model.DeviceName))
                user.DeviceName = model.DeviceName;
            if (!String.IsNullOrEmpty(model.DeviceVersion))
                user.DeviceVersion = model.DeviceVersion;
            if (!String.IsNullOrEmpty(model.DevicePlatform))
                user.DevicePlatform = model.DevicePlatform;
            if (!String.IsNullOrEmpty(model.DevicePhGapVersion))
                user.DevicePhGapVersion = model.DevicePhGapVersion;

            if (!string.IsNullOrEmpty(model.FacebookId))
                user.FacebookId = model.FacebookId;

            user.IsOnline = model.IsOnline;

            if (model.AppState != AppStateType.NoState)
                user.AppState = model.AppState;

            user.AgeCheck = (model.AppState == AppStateType.AgeCheckComplete) ? user.AgeCheck = true : user.AgeCheck = false;
            user.TCCheck = (model.AppState == AppStateType.TCComplete) ? user.TCCheck = true : user.TCCheck = false;

            return user;
        }
コード例 #3
0
ファイル: UserModel.cs プロジェクト: hooookmeup/hookmeup
 internal static UserModel FromEntity(User user)
 {
     return new UserModel { UserId = user.UserId, UserName = user.UserName, IsAdmin = user.IsAdmin, Gender = user.Gender,
         IsActive = user.IsActive, Latitude = user.Latitude, Longitude = user.Longitude, ChatId = user.ChatId , DeviceId = user.DeviceId , DeviceName = user.DeviceName,
                 DeviceVersion = user.DeviceVersion , DevicePlatform = user.DevicePlatform ,
                 DevicePhGapVersion = user.DevicePhGapVersion , IsOnline = user.IsOnline , FacebookId= user.FacebookId , AppState = user.AppState , FirstName = user.FirstName,
                 LastName = user.LastName , Locale =  user.Locale};
 }
コード例 #4
0
ファイル: UserRepository.cs プロジェクト: hooookmeup/hookmeup
 private void UpdateUserDevices(User user)
 {
     UserDeviceContext udCtx = new UserDeviceContext();
     UserDevice userDev = udCtx.GetById(user.UserId , user.DeviceId);
     if (userDev == null)
         udCtx.AddObject(new UserDevice { UserId = user.UserId, DeviceId = user.DeviceId, DeviceName = user.DeviceName, DevicePlatform = user.DevicePlatform, DevicePhGapVersion = user.DevicePhGapVersion, DeviceVersion = user.DeviceVersion });
     else
     {
         userDev.DeviceName = user.DeviceName;
         userDev.DevicePlatform = user.DevicePlatform;
         userDev.DevicePhGapVersion = user.DevicePhGapVersion;
         userDev.DeviceVersion = user.DeviceVersion;
         udCtx.UpdateObject(userDev,false);
     }
 }
コード例 #5
0
ファイル: UserRepository.cs プロジェクト: hooookmeup/hookmeup
 private bool IsLocationChanged(UserModel model, User user)
 {
     return (model.Longitude != user.Longitude || model.Latitude != user.Latitude);
 }
コード例 #6
0
ファイル: UserRepository.cs プロジェクト: hooookmeup/hookmeup
 private bool IsDeviceIdChanged(UserModel model, User user)
 {
     return (model.DeviceId != user.DeviceId);
 }
コード例 #7
0
ファイル: UserRepository.cs プロジェクト: hooookmeup/hookmeup
 private bool IsChatIdChanged(UserModel model, User user)
 {
     return (model.ChatId != user.ChatId);
 }
コード例 #8
0
ファイル: UserRepository.cs プロジェクト: hooookmeup/hookmeup
 private static bool DoesFacebookUserExists(UserModel model, User user)
 {
     if (user!=null && !string.IsNullOrEmpty(user.FacebookId) && user.FacebookId == model.FacebookId)
     {
         return true;
     }
     return false;
 }
コード例 #9
0
 /// <summary>
 /// Insert  for User object 
 /// if excepion happeneds during Table operation it must be cought in calling method.
 /// </summary>
 /// <param name="obj">instance of User class to be inserted </param>
 public void AddObject(User obj )
 {
     servCtx.AddObject(TableName, obj.InternalEntity);
     servCtx.SaveChangesWithRetries();
 }