Exemple #1
0
        /// <summary>
        /// Deseralizes the settings.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public object DeseralizeSettings(Type type)
        {
            if (_PromotionDto != null && _PromotionDto.Promotion.Count != 0)
            {
                PromotionDto.PromotionRow row = _PromotionDto.Promotion[0];
                if (!row.IsParamsNull())
                {
                    XmlSerializer serializer = new XmlSerializer(type);
                    MemoryStream  stream     = new MemoryStream(row.Params);
                    return(serializer.Deserialize(stream));
                }
            }

            return(null);
        }
Exemple #2
0
        /// <summary>
        /// Deseralizes the settings binary.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns></returns>
        public object DeseralizeSettingsBinary(Type type)
        {
            if (_PromotionDto != null && _PromotionDto.Promotion.Count != 0)
            {
                PromotionDto.PromotionRow row = _PromotionDto.Promotion[0];
                if (!row.IsParamsNull())
                {
                    IFormatter   formatter = new BinaryFormatter();
                    MemoryStream stream    = new MemoryStream(row.Params);
                    return(formatter.Deserialize(stream));
                }
            }

            return(null);
        }