Exemplo n.º 1
0
        public RALTProfile GetRALTProfile(string UserName)
        {
            try
            {
                //Get the profile data from HTTPContext
                dynamic profile = GetProfileCommon(UserName);

                //RALT strongly typed profile
                RALTProfile MyRALTProfile = new RALTProfile();

                //Fill typed data
                MyRALTProfile.CopyFlag        = profile.CopyFlag;
                MyRALTProfile.Email           = profile.Email;
                MyRALTProfile.FirstName       = profile.FirstName;
                MyRALTProfile.IsAnonymous     = profile.IsAnonymous;
                MyRALTProfile.Language        = profile.Language;
                MyRALTProfile.LastName        = profile.LastName;
                MyRALTProfile.LastUpdatedDate = profile.LastUpdatedDate;
                MyRALTProfile.SpanishLevel    = profile.SpanishLevel;
                MyRALTProfile.UserName        = profile.UserName;
                MyRALTProfile.LastVisitedDate = profile.LastVisitDate;
                MyRALTProfile.ProfileType     = profile.ProfileType;

                //return strongly typed profile
                return(MyRALTProfile);
            }

            catch (Exception ex)
            {
                //Return Null error
                return(null);
            }
        }
Exemplo n.º 2
0
        public void SaveRALTProfile(RALTProfile MyRALTProfile)
        {
            //Save the strongly type RALTProfile in the profileCommon
            try
            {
                //get the profileCommon
                dynamic profile = GetProfileCommon(MyRALTProfile.UserName);

                //Transfer Data to profileCommon
                profile.ProfileType   = MyRALTProfile.ProfileType;
                profile.Email         = MyRALTProfile.Email;
                profile.FirstName     = MyRALTProfile.FirstName;
                profile.CopyFlag      = MyRALTProfile.CopyFlag;
                profile.Language      = MyRALTProfile.Language;
                profile.LastName      = MyRALTProfile.LastName;
                profile.LastVisitDate = MyRALTProfile.LastVisitedDate;
                profile.SpanishLevel  = MyRALTProfile.SpanishLevel;

                //Save
                profile.Save();
            }

            catch (Exception ex)
            {
                //Throw exception
                throw ex;
            }
        }
        public static string JoinEmailList(string FirstName, string LastName, string Email, int SpanishLevel)
        {
            try
            {
                //user EmailListUser = new user();

                //EmailListUser.account_status = "Email List";
                //EmailListUser.email = Email;
                //EmailListUser.first_name = FirstName;
                //EmailListUser.last_name = LastName;

                //UserService.SaveNewUser(EmailListUser);

                App_Code.RALTProfile MyProfile = new App_Code.RALTProfile();

                MyProfile = MyProfile.GetRALTProfile();

                MyProfile.Email = Email;

                MyProfile.FirstName       = FirstName;
                MyProfile.Language        = "EN";
                MyProfile.LastName        = LastName;
                MyProfile.SpanishLevel    = SpanishLevel;
                MyProfile.LastVisitedDate = DateTime.UtcNow;

                Guid UN;

                if (Guid.TryParse(MyProfile.UserName, out UN))
                {
                    MyProfile.ProfileType = "EmailList";
                }
                else
                {
                    MyProfile.ProfileType = "Account";
                }


                MyProfile.SaveRALTProfile(MyProfile);

                return("Success");
            }

            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        public static string DismissEmailList()
        {
            try
            {
                App_Code.RALTProfile MyProfile = new App_Code.RALTProfile();

                MyProfile = MyProfile.GetRALTProfile();

                MyProfile.ProfileType     = "Dismiss";
                MyProfile.Language        = "EN";
                MyProfile.LastVisitedDate = DateTime.UtcNow;

                MyProfile.SaveRALTProfile(MyProfile);

                return("Success");
            }

            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        void Profile_MigrateAnonymous(object sender, ProfileMigrateEventArgs e)
        {
            try
            {
                App_Code.RALTProfile annProfile = new App_Code.RALTProfile();

                annProfile = annProfile.GetRALTProfile(e.AnonymousID);

                if (annProfile.CopyFlag == false)
                {
                    App_Code.RALTProfile MyProfile = new App_Code.RALTProfile();

                    MyProfile = MyProfile.GetRALTProfile();

                    //CopyData
                    MyProfile.CopyFlag        = true;
                    MyProfile.Email           = annProfile.Email;
                    MyProfile.FirstName       = annProfile.FirstName;
                    MyProfile.Language        = annProfile.Language;
                    MyProfile.LastName        = annProfile.LastName;
                    MyProfile.LastUpdatedDate = annProfile.LastUpdatedDate;
                    MyProfile.LastVisitedDate = annProfile.LastVisitedDate;
                    MyProfile.ProfileType     = "Account";
                    MyProfile.SpanishLevel    = annProfile.SpanishLevel;
                    MyProfile.IsAnonymous     = false;

                    MyProfile.SaveRALTProfile(MyProfile);

                    annProfile.CopyFlag    = true;
                    annProfile.ProfileType = "Account";
                    annProfile.SaveRALTProfile(annProfile);

                    // AnonymousIdentificationModule.ClearAnonymousIdentifier();
                }
            }
            catch { }
        }