コード例 #1
0
        /// <summary>
        /// Fetches the configuration by name.
        /// </summary>
        /// <param name="configurationSectionName">Name of the configuration section.</param>
        /// <returns></returns>
        public virtual object FetchConfigurationByName(string configurationSectionName)
        {
            Validator.ValidateStringArgumentIsNotNullOrEmptyString(configurationSectionName, CONFIGURATION_SECTION_NAME);

              ConfigurationDatum configurationDatum =
            new ConfigurationDatumController().FetchConfigurationByName(configurationSectionName);

              object obj = null;

              if (configurationDatum != null) {
            Serializer serializer = new Serializer();
            obj = serializer.DeserializeObject(configurationDatum.ValueX, configurationDatum.Type);
              }
              return obj;
        }
コード例 #2
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     try {
     SetPercentOffConfigurationProperties();
     couponId = Utility.GetIntParameter("couponId");
     if(couponId > 0) {
       Coupon coupon = new Coupon(couponId);
       Serializer serializer = new Serializer();
       PercentOffCouponProvider percentOffCouponProvider = serializer.DeserializeObject(coupon.ValueX, coupon.Type) as PercentOffCouponProvider;
       lblCouponId.Text = coupon.CouponId.ToString();
       txtCouponCode.Text = coupon.CouponCode;
       txtExpirationDate.Text = coupon.ExpirationDate.ToString();
       txtPercentOff.Text = percentOffCouponProvider.PercentOff.ToString();
       chkIsSingleUse.Checked = coupon.IsSingleUse;
     }
       }
       catch(Exception ex) {
     Logger.Error(typeof(percentoffconfiguration).Name + ".Page_Load", ex);
     base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
       }
 }
コード例 #3
0
 /// <summary>
 /// New from XML.
 /// </summary>
 /// <param name="xml">The XML.</param>
 /// <returns></returns>
 public object NewFromXml(string xml)
 {
     Serializer serializer = new Serializer();
       return serializer.DeserializeObject(xml, typeof(ExtendedProperties).AssemblyQualifiedName);
 }