Ejemplo n.º 1
0
        public ProfileData LoadProfile(string fileName, string profileName, ProfileExtension profileExtension, ProfileType profileType)
        {
            string content = new StreamReader(fileName).ReadToEnd();

            if (profileExtension == ProfileExtension.XML)
            {
                content = ConvertXmlToJson(profileName, content, profileType);
            }
            return(JsonConvert.DeserializeObject <ProfileData>(content));
        }
Ejemplo n.º 2
0
        public ProfileData LoadProfile(string fileName, string profileName, ProfileExtension profileExtension, ProfileType profileType)
        {
            string content = new StreamReader(fileName).ReadToEnd();

            if (profileExtension == ProfileExtension.XML)
            {
                throw new Exception("unsuported xml");
            }
            Console.WriteLine("converting to OBject");
            return(JsonConvert.DeserializeObject <ProfileData>(content));
        }
Ejemplo n.º 3
0
        //---------------------------------------------------------------------------------------------------------------------

        public override void Delete()
        {
            if (ProfileExtension != null && !IgnoreExtensions)
            {
                ProfileExtension.OnDeleting(context, this);
            }
            base.Delete();
            if (ProfileExtension != null && !IgnoreExtensions)
            {
                ProfileExtension.OnDeleted(context, this);
            }
        }
Ejemplo n.º 4
0
        //---------------------------------------------------------------------------------------------------------------------

        public void StorePassword(string newPassword)
        {
            if (ProfileExtension != null && !IgnoreExtensions)
            {
                ProfileExtension.OnPasswordChanging(context, this, newPassword);
            }
            context.Execute(String.Format("UPDATE usr SET password=PASSWORD({1}) WHERE id={0}", Id, StringUtils.EscapeSql(newPassword)));
            if (ProfileExtension != null && !IgnoreExtensions)
            {
                ProfileExtension.OnPasswordChanged(context, this, newPassword);
            }
        }
Ejemplo n.º 5
0
        //---------------------------------------------------------------------------------------------------------------------

        public override void Store()
        {
            bool isNew = !Exists;

            if (ProfileExtension != null && !IgnoreExtensions)
            {
                if (isNew)
                {
                    ProfileExtension.OnCreating(context, this);
                }
                ProfileExtension.OnChanging(context, this);
            }
            //int appendix = 0;
            if (emailChanged)
            {
                NeedsEmailConfirmation = true;
                if (context.AutomaticUserMails)
                {
                    SendMail(UserMailType.EmailChanged, true);
                }
            }
            if (NeedsEmailConfirmation)
            {
                AccountStatus = AccountStatus | AccountFlags.NeedsEmailConfirmation;
            }
            base.Store();
            AccountStatus = (AccountStatus & 7);
            if (ProfileExtension != null && !IgnoreExtensions)
            {
                if (isNew)
                {
                    ProfileExtension.OnCreated(context, this);
                }
                ProfileExtension.OnChanged(context, this);
            }
        }
Ejemplo n.º 6
0
 public async Task <ProfileData> LoadProfileAsync(string fileName, string profileName, ProfileExtension profileExtension, ProfileType profileType)
 => await Task.Run(() => LoadProfile(fileName, profileName, profileExtension, profileType));