Exemplo n.º 1
0
        protected Customer CreateCustomer(string name, Profile profile, Profile connectedProfile = null, Gender gender = Gender.Male, string email = null, string phone = null, DateTime?birthday = null)
        {
            Customer customer = new Customer();

            customer.FirstName        = customer.LastName = name;
            customer.Profile          = profile;
            customer.Settings         = new CustomerSettings();
            customer.ConnectedAccount = connectedProfile;
            customer.Gender           = gender;
            customer.Birthday         = birthday;
            customer.Email            = email;
            customer.PhoneNumber      = phone;
            insertToDatabase(customer);
            return(customer);
        }
Exemplo n.º 2
0
        public static Profile CreateProfile(ISession session, string username, Country country = null, Gender gender = Gender.NotSet, AccountType accountType = AccountType.Instructor)
        {
            Profile profile1 = new Profile();

            if (country != null)
            {
                profile1.CountryId = country.GeoId;
            }
            profile1.Licence.AccountType            = accountType;
            profile1.Licence.LastPointOperationDate = DateTime.UtcNow;
            profile1.Privacy    = new ProfilePrivacy();
            profile1.Settings   = new ProfileSettings();
            profile1.Gender     = gender;
            profile1.UserName   = username;
            profile1.Email      = username + "@wfg.pl";
            profile1.DataInfo   = new DataInfo();
            profile1.Birthday   = DateTime.Now.Date;
            profile1.Statistics = new ProfileStatistics();
            session.SaveOrUpdate(profile1.Statistics);
            session.SaveOrUpdate(profile1);
            ProfileDTO dto = profile1.Map <ProfileDTO>();

            profile1.Tag = dto;

            MyPlace defaultPlace = new MyPlace();

            defaultPlace.IsDefault = true;
            defaultPlace.IsSystem  = true;
            defaultPlace.Profile   = profile1;
            defaultPlace.Color     = Color.Aqua.ToColorString();
            defaultPlace.Name      = "Default";
            session.Save(defaultPlace);
            session.Flush();
            return(profile1);
        }
Exemplo n.º 3
0
        public static Profile CreateProfile(ISession session, string username, Country country = null, Gender gender = Gender.NotSet)
        {
            Profile profile1 = new Profile();

            if (country != null)
            {
                profile1.CountryId = country.GeoId;
            }
            profile1.Privacy    = new ProfilePrivacy();
            profile1.Settings   = new ProfileSettings();
            profile1.Gender     = gender;
            profile1.UserName   = username;
            profile1.Email      = username + "@wfg.pl";
            profile1.Birthday   = DateTime.Now;
            profile1.Statistics = new ProfileStatistics();
            session.SaveOrUpdate(profile1.Statistics);
            session.SaveOrUpdate(profile1);
            ProfileDTO dto = new ProfileDTO();

            dto.Id          = profile1.Id;
            dto.UserName    = profile1.UserName;
            dto.Birthday    = profile1.Birthday;
            dto.Email       = profile1.Email;
            dto.Settings    = new ProfileSettingsDTO();
            dto.Settings.Id = profile1.Settings.Id;
            UnitTestHelper.SetProperty(dto, "Version", profile1.Version);
            profile1.Tag = dto;
            return(profile1);
        }