コード例 #1
0
        private void ShoppingCartGrid_RentalsItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                var           cartDetail      = (CartDetail)e.Item.DataItem;
                RadDatePicker startDatePicker = (RadDatePicker)e.Item.FindControl("startDatePicker");
                RadDatePicker endDatePicker   = (RadDatePicker)e.Item.FindControl("endDatePicker");

                //Hide the date pickers if it's not a notebook
                ProductType notebook = CatalogManager.GetProductTypes().Where(pt => pt.Title == "Notebook").SingleOrDefault();
                Product     product  = CatalogManager.GetProduct(cartDetail.ProductId);

                if (product.ClrType != notebook.ClrType)
                {
                    startDatePicker.Visible = false;
                    endDatePicker.Visible   = false;
                }
                else
                {
                    DateTime startDate;
                    DateTime endDate;
                    if (DateTime.TryParse(DataExtensions.GetValue <string>(cartDetail, "startDate"), out startDate))
                    {
                        startDatePicker.SelectedDate = startDate;
                    }

                    if (DateTime.TryParse(DataExtensions.GetValue <string>(cartDetail, "endDate"), out endDate))
                    {
                        endDatePicker.SelectedDate = startDate;
                    }
                }
            }
        }
コード例 #2
0
        public override IQueryable <IShippingResponse> GetApplicableShippingMethods(CheckoutState checkoutState, CartOrder cartOrder)
        {
            var allApplicableShippingMethods = base.GetApplicableShippingMethods(checkoutState, cartOrder);

            bool upSellCriteriaMet = DataExtensions.GetValue <bool>(cartOrder, "UpsellCriteriaMet");

            if (!upSellCriteriaMet)
            {
                return(allApplicableShippingMethods.Where(sr => sr.ServiceName != "Free Shipping"));
            }

            return(allApplicableShippingMethods);
        }
コード例 #3
0
        protected void ChangeCustomField_Click(object sender, EventArgs e)
        {
            NewslettersManager manager    = NewslettersManager.GetManager();
            Subscriber         subscriber = manager.GetSubscriber(new Guid(SubscriberList.SelectedValue));

            DataExtensions.SetValue((IDynamicFieldsContainer)subscriber, "Company", ComboBoxValueField.Text);

            SubscriberField.Text = String.Format("User {0} now works for Company {1}", SubscriberList.SelectedItem.Text, DataExtensions.GetValue <String>(subscriber, "Company"));
        }