コード例 #1
0
        public static AccountModel Convert(string encryptKey, AccountEntity entity)
        {
            AccountModel tmpAccountModel = null;

            if (entity != null)
            {
                tmpAccountModel = new AccountModel();

                tmpAccountModel.AccountId   = entity.AccountId;
                tmpAccountModel.AccountGuid = entity.AccountGuid;
                tmpAccountModel.CatalogId   = entity.CatalogId;
                tmpAccountModel.Name        = entity.Name;
                tmpAccountModel.URL         = entity.URL;
                tmpAccountModel.Order       = entity.Order;
                tmpAccountModel.TopMost     = entity.TopMost;
                tmpAccountModel.Deleted     = entity.Deleted;
                tmpAccountModel.VersionNo   = entity.VersionNo;

                if (System.Enum.IsDefined(typeof(SecretRank), entity.SecretRank))
                {
                    tmpAccountModel.SecretRank = (SecretRank)entity.SecretRank;
                }

                tmpAccountModel.Email     = EncryptorHelper.DESDecrypt(encryptKey, entity.Email);
                tmpAccountModel.Mobile    = EncryptorHelper.DESDecrypt(encryptKey, entity.Mobile);
                tmpAccountModel.LoginName = EncryptorHelper.DESDecrypt(encryptKey, entity.LoginName);
                tmpAccountModel.Password  = EncryptorHelper.DESDecrypt(encryptKey, entity.Password);

                tmpAccountModel.CreateTime = entity.CreateTime;
                tmpAccountModel.UpdateTime = entity.UpdateTime;
                tmpAccountModel.Comment    = entity.Comment;
            }

            return(tmpAccountModel);
        }
コード例 #2
0
        public static AccountAttribute ConvertAttribute(string encryptKey, AccountAttributeEntity entity)
        {
            AccountAttribute tmpAttribute = null;

            if (entity != null)
            {
                tmpAttribute             = new AccountAttribute();
                tmpAttribute.AttributeId = entity.AttributeId;
                tmpAttribute.Order       = entity.Order;
                tmpAttribute.Name        = entity.Name;
                tmpAttribute.AccountId   = entity.AccountId;
                tmpAttribute.Encrypted   = entity.Encrypted;

                if (!tmpAttribute.Encrypted)
                {
                    tmpAttribute.Value = entity.Value;
                }
                else
                {
                    tmpAttribute.Value = EncryptorHelper.DESDecrypt(encryptKey, entity.Value);
                }
            }

            return(tmpAttribute);
        }