private void AddToCartRentalButton_Command(object sender, CommandEventArgs e)
        {
            var cartDetails = OrdersManager.GetCartDetails().Where(cd => cd.ProductId == ProductId);

            Tuple <DateTime, DateTime> selectedRentalDates = GetRentalDateTimes();

            foreach (CartDetail cartDetail in cartDetails)
            {
                DataExtensions.SetValue((IDynamicFieldsContainer)cartDetail, "startDate", selectedRentalDates.Item1);
                DataExtensions.SetValue((IDynamicFieldsContainer)cartDetail, "endDate", selectedRentalDates.Item2);

                TimeSpan?timeSpan = (selectedRentalDates.Item2 - selectedRentalDates.Item1);
                var      days     = timeSpan.Value.Days;

                if (days < 7)
                {
                    //cartDetail.Variations.
                }

                if (days > 0)
                {
                    cartDetail.Quantity = days;
                }
            }

            OrdersManager.SaveChanges();
        }
Esempio n. 2
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"));
        }