public async Task <int> Create(Profile profile)
        {
            // Generate password salt and hash
            ComputePasswordKeys(profile.Password, out byte[] passwordSalt, out byte[] passwordHash);

            // Store profile in database
            var profileData = new Data.Profile
            {
                UserName     = profile.Username,
                FirstName    = profile.FirstName,
                LastName     = profile.LastName,
                EmailAddress = profile.EmailAddress,
                PhoneNumber  = profile.PhoneNumber,
                DateOfBirth  = profile.DateOfBirth,
                PasswordSalt = passwordSalt,
                PasswordHash = passwordHash,
                CreatedTs    = DateTime.UtcNow
            };

            _dbConext.Profile.Add(profileData);

            await _dbConext.SaveChangesAsync();

            return(profileData.Id);

            // perform additional setup

            // Send confirmation email to user
        }
Exemple #2
0
        public Result(Data.Profile profile)
        {
            InitializeComponent();

            this._profile = profile;

            var vm = new Cars.VModel();

            this.BindingContext = vm;
        }
 public static Profile.Profile ToProfile(this Data.Profile input)
 {
     return new Profile.Profile
     {
         Id = input.Id,
         LogindId = input.LoginId,
         About = input.About,
         Name = input.Name,
         Image = input.Image.Toimage()
     };
 }
Exemple #4
0
        async void OnButtonClicked(object sender, EventArgs args)
        {
            var car      = this.ViewModel.Cars[this.cboCar.SelectedIndex] as Data.Car;
            var province = this.ViewModel.Provinces[this.cboProvince.SelectedIndex] as Data.Province;

            var profile = new Data.Profile();

            profile.CarId      = car?.Id ?? 0;
            profile.KMPerYear  = Convert.ToInt32(this.sldKilometer.Value);
            profile.ProvinceId = province?.Id ?? 0;

            await Navigation.PushAsync(new Views.Result(profile));
        }
Exemple #5
0
        public static int CreateNewProfile(Dto.Profile profile)
        {
            using (var db = new DrinkzAppBDDataContext())
            {
                var dbProfile = new Data.Profile()
                {
                    DEVICE_ID = profile.DEVICE_ID,
                    FACEBOOK_ID = profile.FACEBOOK_ID,
                    NAME = profile.NAME,
                    URL_IMAGE = profile.URL_IMAGE,
                    OS_ID = profile.OS_ID
                };

                db.Profiles.InsertOnSubmit(dbProfile);

                db.SubmitChanges();

                return dbProfile.PK_PROFILE;
            }
        }
Exemple #6
0
        /// <summary>
        /// Updates the LastActivityDate and LastUpdatedDate values when profile properties are accessed by the
        /// GetPropertyValues and SetPropertyValues methods. Passing true as the activityOnly parameter will update
        /// only the LastActivityDate.
        /// </summary>
        /// <param name="username">The username.</param>
        /// <param name="isAuthenticated">Is the user authenticated or anonymous.</param>
        /// <param name="activityOnly">Update activity date only; else update activity and updated dates.</param>
        private void UpdateActivityDates(string username, bool isAuthenticated, bool activityOnly)
        {
            // Is opposite; is anonymous then not authenticated.
            bool     isAnonymous  = !isAuthenticated;
            DateTime activityDate = DateTime.Now;

            Data.Profile profile = null;

            // Update activity only
            if (activityOnly)
            {
                // Add profile data.
                profile = new Data.Profile()
                {
                    LastActivityDate = activityDate
                };
            }
            else
            {
                // Add profile data.
                profile = new Data.Profile()
                {
                    LastActivityDate = activityDate,
                    LastUpdatedDate  = activityDate
                };
            }

            // Update the profile activity data.
            new Nequeo.DataAccess.CloudInteraction.Data.Extension.Profile().
            Update.UpdateItemPredicate(
                profile,
                u =>
                (u.Username == username) &&
                (u.ApplicationName == ApplicationName)
                );
        }
Exemple #7
0
 public void Add(Data.Profile profile)
 {
     GCContext.Profiles.Add(profile);
 }
        public void Read(IBitReader reader, ushort baseVersion, bool excludeProfiles, bool excludePresets)
        {
            this._Level    = reader.ReadInt32();
            this._Unknown1 = reader.ReadFloat32();
            this._Unknown2 = reader.ReadUInt32(); // skill points?

            if (baseVersion < 5)
            {
                return;
            }

            var version = reader.ReadUInt32();

            if (version > 6)
            {
                throw new SaveFormatException("unsupported version");
            }

            if (version >= 2 && version <= 3)
            {
                reader.SkipBits(32);
            }

            if (version >= 3)
            {
                this._Unknown3 = reader.ReadUInt32(); // skill points?
            }

            var skillGroupCount = reader.ReadUInt16();

            this._SkillGroups.Clear();
            for (int i = 0; i < skillGroupCount; i++)
            {
                var skillGroup = new Data.SkillGroup();
                skillGroup.Read(reader);
                this._SkillGroups.Add(skillGroup);
            }

            if (excludeProfiles == false)
            {
                this._CurrentProfileId = reader.ReadInt32();
                var profileCount = reader.ReadUInt16();
                this._Profiles.Clear();
                for (int i = 0; i < profileCount; i++)
                {
                    var profile = new Data.Profile();
                    profile.Read(reader, version);
                    this._Profiles.Add(profile);
                }
            }

            if (excludePresets == false)
            {
                this._CurrentPresetIndex = reader.ReadInt32();
                var presetCount = reader.ReadUInt16();
                this._Presets.Clear();
                for (int i = 0; i < presetCount; i++)
                {
                    var preset = new Data.Preset();
                    preset.Read(reader);
                    this._Presets.Add(preset);
                }
            }
        }