Exemple #1
0
        public Int16 AddAdon(Adon adon)
        {
            #region Parameters

            IParameter[] parameters = new Parameter[] {
                new Parameter("@AdOnName", adon.AdOnName),
                new Parameter("@AdonType", adon.AdonType),
                new Parameter("@ImageName", adon.ImageName)
            };

            #endregion

            object result = DBHandler.ExecuteScalar(System.Data.CommandType.StoredProcedure, "[Adon_AddAdon]", parameters);
            return(Convert.ToInt16(result.ToString()));
        }
Exemple #2
0
 protected void grdAdons_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridDataItem)
     {
         Adon adon = e.Item.DataItem as Adon;
         if (atPObj != null)
         {
             ProductAdon PAdon = atPObj.ProductAdons.Where(pa => pa.AdonID == adon.AdOnID).FirstOrDefault();
             if (PAdon != null)
             {
                 CheckBox chk = e.Item.FindControl("txtSelected") as CheckBox;
                 chk.Checked = true;
                 RadComboBox combo = e.Item.FindControl("txtCbDefault") as RadComboBox;
                 combo.SelectedValue = PAdon.DefaultSelected.ToString();
                 if (!txtCbDisplayFormat.SelectedValue.Equals("1") && !txtCbDisplayFormat.SelectedValue.Equals("4"))
                 {
                     combo.Enabled = false;
                 }
             }
         }
     }
 }
Exemple #3
0
        public OrderDetailSubProduct GetOrderDetailSubProduct()
        {
            Double productPrice = 0, toppingPrice = 0;
            bool   CalculateAdonPrice = false;
            List <OrderDetailSubProductAdon>   orderDetailAdonList    = new List <OrderDetailSubProductAdon>();
            List <OrderDetailSubProductOption> orderDetailOptionsList = new List <OrderDetailSubProductOption>();

            #region Order Detail Sub Product

            OrderDetailSubProduct orderDetailSubProduct = new OrderDetailSubProduct();
            orderDetailSubProduct.ProductId     = _product.ProductID;
            orderDetailSubProduct.Quantity      = 1;
            orderDetailSubProduct.ProductName   = _product.Name;
            orderDetailSubProduct.RecipientName = String.Empty;
            orderDetailSubProduct.Comments      = String.Empty;
            orderDetailSubProduct.OrderDetailSubProductAdons   = new List <OrderDetailSubProductAdon>();
            orderDetailSubProduct.OrderDetailSubProductOptions = new List <OrderDetailSubProductOption>();

            #endregion

            #region Options


            for (int i = 0; i < lbOptions.Items.Count; i++)
            {
                DependencyObject obj = lbOptions.ItemContainerGenerator.ContainerFromIndex(i);
                if (obj != null)
                {
                    ContentPresenter     optionTypeContentPresenter = FindVisualChild <ContentPresenter>(obj);
                    OptionTypesInProduct optionType = (OptionTypesInProduct)optionTypeContentPresenter.Content;
                    ListBox OptionList = FindVisualChild <ListBox>(obj);
                    if (optionType.IsSamePrice && !optionType.IsMultiSelect)
                    {
                        CalculateAdonPrice = true;
                        for (int j = 0; j < OptionList.Items.Count; j++)
                        {
                            DependencyObject obj1 = OptionList.ItemContainerGenerator.ContainerFromIndex(j);
                            // Getting the ContentPresenter of myListBoxItem
                            ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                            // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                            DataTemplate myDataTemplate = myContentPresenter.ContentTemplate;
                            RadioButton  selectedOption = (RadioButton)myDataTemplate.FindName("SelectedOption", myContentPresenter);
                            if (selectedOption.IsChecked.Value)
                            {
                                ProductOptions productOptions = (ProductOptions)myContentPresenter.Content;
                                OrderDetailSubProductOption orderdetailoption = new OrderDetailSubProductOption();
                                orderdetailoption.ProductOptionId   = productOptions.OptionID;
                                orderdetailoption.ProductOptionName = productOptions.OptionName;
                                orderdetailoption.Price             = Convert.ToDouble(productOptions.Price);

                                orderDetailSubProduct.OrderDetailSubProductOptions.Add(orderdetailoption);
                            }
                        }
                    }
                    else if (!optionType.IsSamePrice && !optionType.IsMultiSelect)
                    {
                        CalculateAdonPrice = true;
                        if (OptionList.Items.Count == 1)
                        {
                            DependencyObject obj1 = OptionList.ItemContainerGenerator.ContainerFromIndex(0);
                            // Getting the ContentPresenter of myListBoxItem
                            ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                            // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                            DataTemplate myDataTemplate = myContentPresenter.ContentTemplate;

                            ProductOptions productOptions = (ProductOptions)myContentPresenter.Content;
                            OrderDetailSubProductOption orderdetailoption = new OrderDetailSubProductOption();
                            orderdetailoption.ProductOptionId   = productOptions.OptionID;
                            orderdetailoption.ProductOptionName = productOptions.OptionName;
                            orderdetailoption.Price             = productOptions.Price;
                            orderDetailSubProduct.OrderDetailSubProductOptions.Add(orderdetailoption);
                            if (_defaultAdonPrice == 0)
                            {
                                _defaultAdonPrice = productOptions.ToppingPrice;
                            }
                        }
                        else
                        {
                            for (int j = 0; j < OptionList.Items.Count; j++)
                            {
                                DependencyObject obj1 = OptionList.ItemContainerGenerator.ContainerFromIndex(j);
                                // Getting the ContentPresenter of myListBoxItem
                                ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                                // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                                DataTemplate myDataTemplate = myContentPresenter.ContentTemplate;
                                RadioButton  selectedOption = (RadioButton)myDataTemplate.FindName("SelectedOption", myContentPresenter);
                                if (selectedOption.IsChecked.Value)
                                {
                                    ProductOptions productOptions = (ProductOptions)myContentPresenter.Content;
                                    OrderDetailSubProductOption orderdetailoption = new OrderDetailSubProductOption();
                                    orderdetailoption.ProductOptionId   = productOptions.OptionID;
                                    orderdetailoption.ProductOptionName = productOptions.OptionName;
                                    orderdetailoption.Price             = productOptions.Price;
                                    orderDetailSubProduct.OrderDetailSubProductOptions.Add(orderdetailoption);
                                }
                            }
                        }
                    }
                }
            }

            #endregion

            #region Toppings
            if (CalculateAdonPrice)
            {
                Int16 freeToppingCount = 0;

                for (int i = 0; i < lbToppings.Items.Count; i++)
                {
                    DependencyObject obj = lbToppings.ItemContainerGenerator.ContainerFromIndex(i);
                    if (obj != null)
                    {
                        ContentPresenter  adonTypeContentPresenter = FindVisualChild <ContentPresenter>(obj);
                        AdOnTypeInProduct adonType = (AdOnTypeInProduct)adonTypeContentPresenter.Content;
                        ListBox           AdonList = FindVisualChild <ListBox>(obj);
                        for (int j = 0; j < AdonList.Items.Count; j++)
                        {
                            DependencyObject obj1 = AdonList.ItemContainerGenerator.ContainerFromIndex(j);
                            // Getting the ContentPresenter of myListBoxItem
                            ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                            // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                            DataTemplate myDataTemplate  = myContentPresenter.ContentTemplate;
                            Int16        SelectedTopping = Convert.ToInt16(((TextBlock)myDataTemplate.FindName("SelectedTopping", myContentPresenter)).Text);
                            if (SelectedTopping != 0)
                            {
                                if (!adonType.IsFreeAdonType)
                                {
                                    Adon adon = (Adon)myContentPresenter.Content;

                                    OrderDetailSubProductAdon orderdetailadon = new OrderDetailSubProductAdon();
                                    orderdetailadon.AdOnId             = adon.AdOnID;
                                    orderdetailadon.AdonName           = adon.AdOnName;
                                    orderdetailadon.AdonTypeName       = adon.AdOnTypeName;
                                    orderdetailadon.SelectedAdonOption = SelectedTopping;

                                    orderDetailSubProduct.OrderDetailSubProductAdons.Add(orderdetailadon);
                                    if (freeToppingCount == _product.NumberOfFreeTopping)
                                    {
                                        if (adon.DefaultSelected != SelectedTopping)
                                        {
                                            if (_defaultAdonPrice > 0)
                                            {
                                                productPrice += _defaultAdonPrice;
                                            }
                                            else
                                            {
                                                productPrice += (Double)adonType.Price;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        freeToppingCount++;
                                    }
                                }
                                else
                                {
                                    Adon adon = (Adon)myContentPresenter.Content;

                                    OrderDetailSubProductAdon orderdetailadon = new OrderDetailSubProductAdon();
                                    orderdetailadon.AdOnId             = adon.AdOnID;
                                    orderdetailadon.AdonName           = adon.AdOnName;
                                    orderdetailadon.AdonTypeName       = adon.AdOnTypeName;
                                    orderdetailadon.SelectedAdonOption = SelectedTopping;

                                    orderDetailSubProduct.OrderDetailSubProductAdons.Add(orderdetailadon);
                                }
                            }
                        }
                    }
                }
            }

            #endregion

            orderDetailSubProduct.Price = productPrice;
            return(orderDetailSubProduct);
        }
Exemple #4
0
        public Double GetPrice()
        {
            Double productPrice = 0;


            if (_optionPrice == 0)
            {
                productPrice = _product.UnitPrice;
            }
            else
            {
                productPrice = _optionPrice;
            }
            for (int i = 0; i < lbOptions.Items.Count; i++)
            {
                DependencyObject obj = lbOptions.ItemContainerGenerator.ContainerFromIndex(i);
                if (obj != null)
                {
                    ContentPresenter     adonTypeContentPresenter = FindVisualChild <ContentPresenter>(obj);
                    OptionTypesInProduct optionType = (OptionTypesInProduct)adonTypeContentPresenter.Content;
                    ListBox Options = FindVisualChild <ListBox>(obj);

                    if (!optionType.IsMultiSelect && optionType.IsSamePrice)
                    {
                    }
                }
            }
            Int16 freeToppingCount = 0;

            for (int i = 0; i < lbToppings.Items.Count; i++)
            {
                DependencyObject obj = lbToppings.ItemContainerGenerator.ContainerFromIndex(i);
                if (obj != null)
                {
                    ContentPresenter  adonTypeContentPresenter = FindVisualChild <ContentPresenter>(obj);
                    AdOnTypeInProduct adonType = (AdOnTypeInProduct)adonTypeContentPresenter.Content;
                    ListBox           AdonList = FindVisualChild <ListBox>(obj);

                    for (int j = 0; j < AdonList.Items.Count; j++)
                    {
                        DependencyObject obj1 = AdonList.ItemContainerGenerator.ContainerFromIndex(j);
                        // Getting the ContentPresenter of myListBoxItem
                        ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                        // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                        DataTemplate myDataTemplate  = myContentPresenter.ContentTemplate;
                        Int16        SelectedTopping = Convert.ToInt16(((TextBlock)myDataTemplate.FindName("SelectedTopping", myContentPresenter)).Text);
                        if (SelectedTopping != 0)
                        {
                            if (!adonType.IsFreeAdonType)
                            {
                                if (freeToppingCount == _product.NumberOfFreeTopping)
                                {
                                    Adon adon = (Adon)myContentPresenter.Content;
                                    if (adon.DefaultSelected != SelectedTopping)
                                    {
                                        if (_defaultAdonPrice > 0)
                                        {
                                            productPrice += _defaultAdonPrice;
                                        }
                                        else
                                        {
                                            productPrice += (Double)adonType.Price;
                                        }
                                    }
                                }
                                else
                                {
                                    freeToppingCount++;
                                }
                            }
                        }
                    }
                }
            }
            return(productPrice);
        }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Button           btn        = (Button)sender;
        GridEditFormItem editedItem = (GridEditFormItem)btn.NamingContainer;// access the EditFormItem

        if (btn.CommandName == RadGrid.PerformInsertCommandName)
        {
            if (editedItem != null)
            {
                RadTextBox  name     = editedItem.FindControl("txtAdOnName") as RadTextBox;
                RadComboBox adonType = editedItem.FindControl("txtAdonType") as RadComboBox;
                FileUpload  txtImage = editedItem.FindControl("txtImage") as FileUpload;
                Label       error    = editedItem.FindControl("error") as Label;

                if (!string.IsNullOrEmpty(name.Text))
                {
                    try
                    {
                        Adon adon = new Adon();
                        adon.AdOnName = name.Text;
                        adon.AdonType = short.Parse(adonType.SelectedValue);
                        string filename = string.Empty;
                        if (txtImage.HasFile)
                        {
                            filename = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(txtImage.FileName);
                        }

                        adon.ImageName = filename;
                        Int16 result = _adonManager.AddAdon(adon);
                        if (result > 0)
                        {
                            if (txtImage.HasFile)
                            {
                                String path = Server.MapPath("~/Products/AdonImage/");
                                txtImage.SaveAs(path + filename);
                                ThumbImage(path + filename, path + filename, 60, 60);
                            }
                            name.Text = string.Empty;
                            ShowMessage("Adon has been added successfully.", MessageType.Success);
                        }
                    }
                    catch (Exception ex)
                    {
                        // RadAjaxManager1.Alert("Error occured while Adding new Record. Error Detail ->" + ex.Message);
                    }
                }
            }
        }
        else if (btn.CommandName == RadGrid.UpdateCommandName)
        {
            if (editedItem != null)
            {
                RadTextBox  name     = editedItem.FindControl("txtAdOnName") as RadTextBox;
                RadComboBox adonType = editedItem.FindControl("txtAdonType") as RadComboBox;
                FileUpload  txtImage = editedItem.FindControl("txtImage") as FileUpload;
                HiddenField hdAdonId = editedItem.FindControl("hdAdonId") as HiddenField;
                Label       error    = editedItem.FindControl("error") as Label;

                if (!string.IsNullOrEmpty(name.Text))
                {
                    try
                    {
                        Int16 adonId = 0;
                        Int16.TryParse(hdAdonId.Value, out adonId);
                        Adon adon = new Adon();
                        adon.AdOnID   = adonId;
                        adon.AdOnName = name.Text;
                        adon.AdonType = short.Parse(adonType.SelectedValue);
                        string filename = string.Empty;
                        if (txtImage.HasFile)
                        {
                            filename = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(txtImage.FileName);
                        }

                        adon.ImageName = filename;
                        Int32 result = _adonManager.UpdateAdon(adon);
                        if (result > 0)
                        {
                            if (txtImage.HasFile)
                            {
                                String path = Server.MapPath("~/Products/AdonImage/");
                                txtImage.SaveAs(path + filename);
                                ThumbImage(path + filename, path + filename, 60, 60);
                            }
                            name.Text = string.Empty;
                            ShowMessage("Adon has been updated successfully.", MessageType.Success);
                        }
                    }
                    catch (Exception ex)
                    {
                        error.Text = ex.Message;
                    }
                }
                BindData();
            }
        }
    }
        private void GetPrice()
        {
            Double productPrice = 0;

            Products product = (Products)lbProducts.SelectedItem;

            if (_optionPrice == 0)
            {
                productPrice = product.DefaultBranchProductPrice;
            }
            else
            {
                productPrice = _optionPrice;
            }
            for (int i = 0; i < lbOptions.Items.Count; i++)
            {
                DependencyObject obj = lbOptions.ItemContainerGenerator.ContainerFromIndex(i);
                ContentPresenter adonTypeContentPresenter = FindVisualChild <ContentPresenter>(obj);
                OptionType       optionType = (OptionType)adonTypeContentPresenter.Content;
                ListBox          Options    = FindVisualChild <ListBox>(obj);

                if (!optionType.IsMultiSelect && optionType.IsSamePrice)
                {
                }
            }

            for (int i = 0; i < lbToppings.Items.Count; i++)
            {
                DependencyObject obj = lbToppings.ItemContainerGenerator.ContainerFromIndex(i);
                ContentPresenter adonTypeContentPresenter = FindVisualChild <ContentPresenter>(obj);
                AdonType         adonType = (AdonType)adonTypeContentPresenter.Content;
                ListBox          AdonList = FindVisualChild <ListBox>(obj);

                for (int j = 0; j < AdonList.Items.Count; j++)
                {
                    DependencyObject obj1 = AdonList.ItemContainerGenerator.ContainerFromIndex(j);
                    // Getting the ContentPresenter of myListBoxItem
                    ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                    // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                    DataTemplate myDataTemplate  = myContentPresenter.ContentTemplate;
                    Int16        SelectedTopping = Convert.ToInt16(((TextBlock)myDataTemplate.FindName("SelectedTopping", myContentPresenter)).Text);
                    if (SelectedTopping != 0)
                    {
                        if (!adonType.IsFreeAdonType)
                        {
                            Adon adon = (Adon)myContentPresenter.Content;
                            if (adon.DefaultSelected != SelectedTopping)
                            {
                                if (_defaultAdonPrice > 0)
                                {
                                    productPrice += _defaultAdonPrice;
                                }
                                else
                                {
                                    productPrice += (Double)adonType.Price;
                                }
                            }
                        }
                    }
                }
            }
            Price.Content = productPrice.ToString("C", CultureInfo.CurrentCulture);
        }
        private void OrderNowButton_Click(object sender, RoutedEventArgs e)
        {
            Double   productPrice = 0;
            Products product      = (Products)lbProducts.SelectedItem;
            List <OrderDetailAdOns>   orderDetailAdonList    = new List <OrderDetailAdOns>();
            List <OrderDetailOptions> orderDetailOptionsList = new List <OrderDetailOptions>();

            if (UserOrder == null)
            {
                UserOrder = new Orders();
            }
            if (_optionPrice == 0)
            {
                productPrice = product.DefaultBranchProductPrice;
            }
            else
            {
                productPrice = _optionPrice;
            }

            if (UserOrder.OrderDetailsList == null)
            {
                UserOrder.OrderDetailsList = new List <BusinessEntities.OrderDetails>();
                //SessionOrderAdonList = new List<List<BusinessEntities.OrderDetailAdOns>>();
                //SessionOrderDetailOptionList = new List<List<BusinessEntities.OrderDetailOptions>>();
                UserOrder.OrderStatusID = BusinessEntities.OrderStatus.NewOrder;
            }
            BusinessEntities.OrderDetails orderdetail = new BusinessEntities.OrderDetails();
            if (!product.IsSpecial)
            {
                if (_optionPrice > 0)
                {
                    orderdetail.Price = _optionPrice;
                }
                else
                {
                    orderdetail.Price = Convert.ToDouble(product.DefaultBranchProductPrice);
                }
            }
            orderdetail.CategoryName = _category.Name;
            orderdetail.ProductName  = product.Name;
            orderdetail.ProductID    = product.ProductID;
            orderdetail.ProductImage = product.Image;
            orderdetail.Quantity     = 1;
            if (product.IsSpecial)
            {
                MultiPorductControl control = (MultiPorductControl)MultiProductPanel.Children[0];
                orderdetail.Price = control.GetPrice();
                orderdetail.OrderDetailSubProducts = control.GetOrderDetailSubProducts();
                orderdetail.IsGroupProduct         = true;
            }
            else
            {
                #region Get Selected Option


                for (int i = 0; i < lbOptions.Items.Count; i++)
                {
                    DependencyObject obj = lbOptions.ItemContainerGenerator.ContainerFromIndex(i);
                    ContentPresenter optionTypeContentPresenter = FindVisualChild <ContentPresenter>(obj);
                    OptionType       optionType = (OptionType)optionTypeContentPresenter.Content;
                    ListBox          OptionList = FindVisualChild <ListBox>(obj);
                    if (optionType.IsSamePrice && !optionType.IsMultiSelect)
                    {
                        for (int j = 0; j < OptionList.Items.Count; j++)
                        {
                            DependencyObject obj1 = OptionList.ItemContainerGenerator.ContainerFromIndex(j);
                            // Getting the ContentPresenter of myListBoxItem
                            ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                            // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                            DataTemplate myDataTemplate = myContentPresenter.ContentTemplate;
                            RadioButton  selectedOption = (RadioButton)myDataTemplate.FindName("SelectedOption", myContentPresenter);
                            if (selectedOption.IsChecked.Value)
                            {
                                ProductOptions     productOptions    = (ProductOptions)myContentPresenter.Content;
                                OrderDetailOptions orderdetailoption = new OrderDetailOptions();
                                orderdetailoption.ProductOptionId   = productOptions.OptionID;
                                orderdetailoption.ProductOptionName = productOptions.OptionName;
                                orderdetailoption.Price             = Convert.ToDouble(productOptions.Price);
                                orderDetailOptionsList.Add(orderdetailoption);
                                orderdetail.Price = productOptions.Price;
                            }
                        }
                    }
                    else if (!optionType.IsSamePrice && !optionType.IsMultiSelect)
                    {
                        for (int j = 0; j < OptionList.Items.Count; j++)
                        {
                            DependencyObject obj1 = OptionList.ItemContainerGenerator.ContainerFromIndex(j);
                            // Getting the ContentPresenter of myListBoxItem
                            ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                            // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                            DataTemplate myDataTemplate = myContentPresenter.ContentTemplate;
                            RadioButton  selectedOption = (RadioButton)myDataTemplate.FindName("SelectedOption", myContentPresenter);
                            if (selectedOption.IsChecked.Value)
                            {
                                ProductOptions     productOptions    = (ProductOptions)myContentPresenter.Content;
                                OrderDetailOptions orderdetailoption = new OrderDetailOptions();
                                orderdetailoption.ProductOptionId   = productOptions.OptionID;
                                orderdetailoption.ProductOptionName = productOptions.OptionName;
                                orderdetailoption.Price             = productOptions.Price;
                                orderDetailOptionsList.Add(orderdetailoption);
                                orderdetail.Price = productOptions.Price;
                            }
                        }
                    }
                }

                #endregion


                #region Get Selected Toppings


                for (int i = 0; i < lbToppings.Items.Count; i++)
                {
                    DependencyObject obj = lbToppings.ItemContainerGenerator.ContainerFromIndex(i);
                    ContentPresenter adonTypeContentPresenter = FindVisualChild <ContentPresenter>(obj);
                    AdonType         adonType = (AdonType)adonTypeContentPresenter.Content;
                    ListBox          AdonList = FindVisualChild <ListBox>(obj);
                    for (int j = 0; j < AdonList.Items.Count; j++)
                    {
                        DependencyObject obj1 = AdonList.ItemContainerGenerator.ContainerFromIndex(j);
                        // Getting the ContentPresenter of myListBoxItem
                        ContentPresenter myContentPresenter = FindVisualChild <ContentPresenter>(obj1);
                        // Finding textBlock from the DataTemplate that is set on that ContentPresenter
                        DataTemplate myDataTemplate  = myContentPresenter.ContentTemplate;
                        Int16        SelectedTopping = Convert.ToInt16(((TextBlock)myDataTemplate.FindName("SelectedTopping", myContentPresenter)).Text);
                        if (SelectedTopping != 0)
                        {
                            if (!adonType.IsFreeAdonType)
                            {
                                Adon adon = (Adon)myContentPresenter.Content;

                                OrderDetailAdOns orderdetailadon = new OrderDetailAdOns();
                                orderdetailadon.AdOnId             = adon.AdOnID;
                                orderdetailadon.AdonName           = adon.AdOnName;
                                orderdetailadon.AdonTypeName       = adon.AdOnTypeName;
                                orderdetailadon.SelectedAdonOption = (SelectedOption)SelectedTopping;

                                orderDetailAdonList.Add(orderdetailadon);
                                if (adon.DefaultSelected != SelectedTopping)
                                {
                                    if (_defaultAdonPrice > 0)
                                    {
                                        productPrice += _defaultAdonPrice;
                                    }
                                    else
                                    {
                                        productPrice += (Double)adonType.Price;
                                    }
                                }
                            }
                        }
                    }
                }

                #endregion
            }
            double discountPrice = 0;
            Double.TryParse(txtDiscount.Text, out discountPrice);
            if (discountPrice > 0)
            {
                orderdetail.Price = discountPrice;
            }
            else if (orderdetail.Price == 0)
            {
                orderdetail.Price = productPrice;
            }

            UserOrder.OrderDetailsList.Add(orderdetail);
            UserOrder.OrderTotal += orderdetail.Price;
            OrderDetailOptionList.Add(orderDetailOptionsList);
            OrderDetailAdonList.Add(orderDetailAdonList);

            lbOptions.ItemsSource  = null;
            lbToppings.ItemsSource = null;
            _defaultAdonPrice      = 0;
            _optionPrice           = 0;
            SelectedAdons.Text     = string.Empty;
            txtDiscount.Text       = String.Empty;
            Price.Content          = String.Empty;
            lbProducts.UnselectAll();
            this.Close();
        }