Example #1
0
 protected void txtPriceChangeYes_CheckedChanged(object sender, EventArgs e)
 {
     txtError.Text = string.Empty;
     try
     {
         if (!string.IsNullOrEmpty(txtCbBranch.SelectedValue) && !string.IsNullOrEmpty(txtCbProduct.SelectedValue))
         {
             int   branchid           = int.Parse(txtCbBranch.SelectedValue);
             int   productid          = int.Parse(txtCbProduct.SelectedValue);
             short optiontypeid       = short.Parse(txtCbOptionType.SelectedValue);
             OptionTypesInProduct OTP = (from otp in entities.OptionTypesInProducts
                                         join bp in entities.ProductsInBranches on otp.BranchProductID equals bp.BranchProductID
                                         where bp.BranchID == branchid && bp.ProductID == productid && otp.IsProductPriceChangeType == true && otp.OptionTypeID != optiontypeid
                                         select otp).FirstOrDefault();
             if (OTP != null)
             {
                 txtError.Text = "Another option type " + OTP.OptionType.OptionTypeName + " has property to change Product Price on selection of any Option. Selection of Yes will override it.";
             }
         }
     }
     catch (Exception ex)
     {
         txtError.Text = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
     }
 }
Example #2
0
    private void Set_OptionTypeInProducts_LocalObject()
    {
        if (!string.IsNullOrEmpty(txtCbBranch.SelectedValue) && !string.IsNullOrEmpty(txtCbProduct.SelectedValue) && !string.IsNullOrEmpty(txtCbOptionType.SelectedValue))
        {
            int   branchid     = int.Parse(txtCbBranch.SelectedValue);
            int   productid    = int.Parse(txtCbProduct.SelectedValue);
            short optiontypeid = short.Parse(txtCbOptionType.SelectedValue);

            otpObj = (from otp in entities.OptionTypesInProducts
                      join bp in entities.ProductsInBranches on otp.BranchProductID equals bp.BranchProductID
                      where otp.OptionType.OptionTypeID == optiontypeid && bp.BranchID == branchid && bp.ProductID == productid
                      select otp).FirstOrDefault();
            if (otpObj != null)
            {
                if (otpObj.IsMultiSelect)
                {
                    txtMultiYes.Checked = true;
                }
                else
                {
                    txtMultiNo.Checked = true;
                }
                if (otpObj.IsAdonPriceVary)
                {
                    txtAdonYes.Checked = true;
                }
                else
                {
                    txtAdonNo.Checked = true;
                }
                if (otpObj.IsSamePrice)
                {
                    txtYes.Checked = true;
                    txtPrice.Value = Convert.ToDouble(otpObj.ProductOptionsInProducts.ToList()[0].Price);
                }
                else
                {
                    txtNo.Checked = true;
                }
                if (otpObj.IsProductPriceChangeType)
                {
                    txtPriceChangeYes.Checked = true;
                }
                else
                {
                    txtPriceChangeNo.Checked = true;
                }
            }
        }
    }
        public Int32 AddProductOption(OptionTypesInProduct productOption)
        {
            #region Parameters

            IParameter[] parameters = new Parameter[] {
                new Parameter("@BranchId", productOption.BranchID),
                new Parameter("@ProductId", productOption.ProductID),
                new Parameter("@OptionTypeId", productOption.OptionTypeID),
                new Parameter("@IsMultiSelect", productOption.IsMultiSelect),
                new Parameter("@IsSamePrice", productOption.IsSamePrice),
                new Parameter("@IsAdonPriceVary", productOption.IsAdonPriceVary),
                new Parameter("@IsProductPriceChangeType", productOption.IsProductPriceChangeType),
                new Parameter("@ProductOptionInProductsXml", productOption.ProductOptionsXml)
            };

            #endregion
            object result = DBHandler.ExecuteScalar(System.Data.CommandType.StoredProcedure, "[ProductOptionsInProducts_AddProductOptionsInProducts ]", parameters);
            return(Convert.ToInt32(result.ToString()));
        }
 protected void txtOptions_ItemDataBound(object sender, RadListViewItemEventArgs e)
 {
     if (e.Item is RadListViewDataItem)
     {
         RadListViewDataItem  item       = e.Item as RadListViewDataItem;
         OptionTypesInProduct obj        = item.DataItem as OptionTypesInProduct;
         List <ProductOption> optionlist = (from po in entities.ProductOptions
                                            select po).ToList();
         var results = (from po in optionlist
                        join pop in obj.ProductOptionsInProducts on po.OptionID equals pop.ProductOptionID
                        orderby pop.DisplayOrder
                        select new { po.OptionName, pop.ProductOptionsInProductID }).ToList();
         if (obj.IsMultiSelect)
         {
             CheckBoxList chklist = item.FindControl("CheckBoxList") as CheckBoxList;
             if (obj.IsSamePrice)
             {
                 chklist.AutoPostBack = false;
             }
             chklist.DataSource = results;
             chklist.DataBind();
         }
         else
         {
             RadioButtonList        radiolist       = item.FindControl("RadioButtonList") as RadioButtonList;
             RequiredFieldValidator rfvOptionSelect = item.FindControl("rfvOptionSelect") as RequiredFieldValidator;
             if (obj.IsSamePrice)
             {
                 radiolist.AutoPostBack = false;
             }
             rfvOptionSelect.Visible = true;
             radiolist.DataSource    = results;
             radiolist.DataBind();
         }
     }
 }
Example #5
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);
        }
Example #6
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);
        }
Example #7
0
    private void CheckAvailbilityOfOptionsofProducts()
    {
        txtError.Text = string.Empty;
        try
        {
            if (!string.IsNullOrEmpty(txtCbBranch.SelectedValue) && !string.IsNullOrEmpty(txtCbProduct.SelectedValue) && !string.IsNullOrEmpty(txtCbOptionType.SelectedValue))
            {
                int   branchid     = int.Parse(txtCbBranch.SelectedValue);
                int   productid    = int.Parse(txtCbProduct.SelectedValue);
                short optiontypeid = short.Parse(txtCbOptionType.SelectedValue);

                OptionTypesInProduct optiontypeproduct = (from otp in entities.OptionTypesInProducts
                                                          join bp in entities.ProductsInBranches on otp.BranchProductID equals bp.BranchProductID
                                                          where otp.OptionType.OptionTypeID == optiontypeid && bp.BranchID == branchid && bp.ProductID == productid
                                                          select otp).FirstOrDefault();
                if (optiontypeproduct != null)
                {
                    if (optiontypeproduct.IsMultiSelect)
                    {
                        txtMultiYes.Checked = true;
                    }
                    else
                    {
                        txtMultiNo.Checked = true;
                    }
                    if (optiontypeproduct.IsAdonPriceVary)
                    {
                        txtAdonYes.Checked = true;
                    }
                    else
                    {
                        txtAdonNo.Checked = true;
                    }
                    if (optiontypeproduct.IsSamePrice)
                    {
                        txtYes.Checked = true;
                        txtPrice.Value = Convert.ToDouble(optiontypeproduct.ProductOptionsInProducts.ToList()[0].Price);
                    }
                    else
                    {
                        txtNo.Checked = true;
                    }
                    if (optiontypeproduct.IsProductPriceChangeType)
                    {
                        txtPriceChangeYes.Checked = true;
                    }
                    else
                    {
                        txtPriceChangeNo.Checked = true;
                    }
                }
                else
                {
                    txtPriceChangeYes.Checked = false;
                    txtPriceChangeNo.Checked  = false;
                    txtNo.Checked             = false;
                    txtMultiYes.Checked       = false;
                    txtMultiNo.Checked        = false;
                    txtYes.Checked            = false;
                    txtAdonYes.Checked        = false;
                    txtAdonNo.Checked         = false;
                }
            }
        }
        catch (Exception ex)
        {
            txtError.Text = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
        }
    }
    private decimal GetOrderOptions(BusinessEntities.OrderDetails orderdetail, decimal adonpricefromOptionType)
    {
        RadListViewDataItemCollection optioncollection  = txtOptions.Items;
        List <BusinessEntities.OrderDetailOptions> list = new List <BusinessEntities.OrderDetailOptions>();

        foreach (RadListViewDataItem item in optioncollection)
        {
            long id = (long)item.GetDataKeyValue("ProductsOptionTypeId");
            OptionTypesInProduct OTP = (from otp in entities.OptionTypesInProducts
                                        where otp.ProductsOptionTypeId == id
                                        select otp).FirstOrDefault();
            if (OTP.IsSamePrice && !OTP.IsMultiSelect)
            {
                RadioButtonList radioList = item.FindControl("RadioButtonList") as RadioButtonList;
                foreach (ListItem listitem in radioList.Items)
                {
                    if (listitem.Selected)
                    {
                        long POP_ID = long.Parse(listitem.Value); ////Product Option In Product ID
                        ProductOptionsInProduct POP_obj = (from pop in entities.ProductOptionsInProducts
                                                           where pop.ProductOptionsInProductID == POP_ID
                                                           select pop).FirstOrDefault();
                        if (OTP.IsProductPriceChangeType)
                        {
                            orderdetail.Price = Convert.ToDouble(POP_obj.Price);
                        }

                        if ((bool)OTP.IsProductPriceChangeType && OTP.IsAdonPriceVary)
                        {
                            if (POP_obj.ToppingPrice != null)
                            {
                                adonpricefromOptionType = (decimal)POP_obj.ToppingPrice;
                            }
                        }
                        BusinessEntities.OrderDetailOptions orderdetailoption = new BusinessEntities.OrderDetailOptions();
                        orderdetailoption.ProductOptionId       = POP_obj.ProductOptionID;
                        orderdetailoption.ProductOptionName     = POP_obj.ProductOption.OptionName;
                        orderdetailoption.ProductOptionTypeName =
                            POP_obj.OptionTypesInProduct.OptionType.OptionDisplayText;
                        if (OTP.IsProductPriceChangeType)
                        {
                            orderdetailoption.Price = Convert.ToDouble(POP_obj.Price.Value);
                        }
                        list.Add(orderdetailoption);
                    }
                }
            }
            else
            {
                if (OTP.IsMultiSelect)
                {
                    #region CheckBox List

                    CheckBoxList chkList = item.FindControl("CheckBoxList") as CheckBoxList;
                    foreach (ListItem listitem in chkList.Items)
                    {
                        if (listitem.Selected)
                        {
                            long POP_ID = long.Parse(listitem.Value); ////Product Option In Product ID
                            ProductOptionsInProduct POP_obj = (from pop in entities.ProductOptionsInProducts
                                                               where pop.ProductOptionsInProductID == POP_ID
                                                               select pop).FirstOrDefault();
                            orderdetail.Price += Convert.ToDouble(POP_obj.Price);

                            BusinessEntities.OrderDetailOptions orderdetailoption = new BusinessEntities.OrderDetailOptions();
                            orderdetailoption.ProductOptionId       = POP_obj.ProductOptionID;
                            orderdetailoption.ProductOptionName     = POP_obj.ProductOption.OptionName;
                            orderdetailoption.Price                 = Convert.ToDouble(POP_obj.Price.Value);
                            orderdetailoption.ProductOptionTypeName = POP_obj.OptionTypesInProduct.OptionType.OptionDisplayText;
                            list.Add(orderdetailoption);
                        }
                    }
                    #endregion
                }
                else
                {
                    RadioButtonList radioList = item.FindControl("RadioButtonList") as RadioButtonList;
                    foreach (ListItem listitem in radioList.Items)
                    {
                        #region

                        if (listitem.Selected)
                        {
                            long POP_ID = long.Parse(listitem.Value); ////Product Option In Product ID
                            ProductOptionsInProduct POP_obj = (from pop in entities.ProductOptionsInProducts
                                                               where pop.ProductOptionsInProductID == POP_ID
                                                               select pop).FirstOrDefault();
                            orderdetail.Price = Convert.ToDouble(POP_obj.Price);

                            if ((bool)OTP.IsProductPriceChangeType)
                            {
                                if (POP_obj.ToppingPrice != null)
                                {
                                    adonpricefromOptionType = (decimal)POP_obj.ToppingPrice;
                                }
                            }
                            BusinessEntities.OrderDetailOptions orderdetailoption = new BusinessEntities.OrderDetailOptions();
                            orderdetailoption.ProductOptionId       = POP_obj.ProductOptionID;
                            orderdetailoption.ProductOptionName     = POP_obj.ProductOption.OptionName;
                            orderdetailoption.ProductOptionTypeName =
                                POP_obj.OptionTypesInProduct.OptionType.OptionDisplayText;
                            orderdetailoption.Price = Convert.ToDouble(POP_obj.Price);
                            list.Add(orderdetailoption);
                        }
                        #endregion
                    }
                }
            }
        }
        SessionOrderDetailOptionList.Add(list);
        return(adonpricefromOptionType);
    }
    private void GetPrice()
    {
        try
        {
            long             branchproductid = long.Parse(Request.QueryString["BPID"]);
            ProductsInBranch bpObj           = (from bp in entities.ProductsInBranches
                                                where bp.BranchProductID == branchproductid
                                                select bp).FirstOrDefault();
            if (bpObj != null)
            {
                if (bpObj.AddToCheckOut != null && bpObj.AddToCheckOut.Value)
                {
                    productprice = (Decimal)bpObj.CheckOutPrice;
                }
                else
                {
                    productprice = (Decimal)bpObj.Price;
                }

                #region Options

                RadListViewDataItemCollection optioncollection = txtOptions.Items;
                decimal adonpricefromOptionType = 0;
                foreach (RadListViewDataItem item in optioncollection)
                {
                    long id = (long)item.GetDataKeyValue("ProductsOptionTypeId");
                    OptionTypesInProduct OTP = (from otp in entities.OptionTypesInProducts
                                                where otp.ProductsOptionTypeId == id
                                                select otp).FirstOrDefault();

                    if (OTP.IsSamePrice)
                    {
                        if (OTP.IsProductPriceChangeType)
                        {
                            productprice = (decimal)OTP.ProductOptionsInProducts.ToList()[0].Price;
                        }
                    }
                    else
                    {
                        if (OTP.IsMultiSelect)
                        {
                            CheckBoxList chkList = item.FindControl("CheckBoxList") as CheckBoxList;
                            foreach (ListItem listitem in chkList.Items)
                            {
                                if (listitem.Selected)
                                {
                                    long POP_ID = long.Parse(listitem.Value); ////Product Option In Product ID
                                    ProductOptionsInProduct POP_obj = (from pop in entities.ProductOptionsInProducts
                                                                       where pop.ProductOptionsInProductID == POP_ID
                                                                       select pop).FirstOrDefault();
                                    productprice += (decimal)POP_obj.Price;
                                }
                            }
                        }
                        else
                        {
                            RadioButtonList radioList = item.FindControl("RadioButtonList") as RadioButtonList;
                            foreach (ListItem listitem in radioList.Items)
                            {
                                if (listitem.Selected)
                                {
                                    long POP_ID = long.Parse(listitem.Value); ////Product Option In Product ID
                                    ProductOptionsInProduct POP_obj = (from pop in entities.ProductOptionsInProducts
                                                                       where pop.ProductOptionsInProductID == POP_ID
                                                                       select pop).FirstOrDefault();

                                    if ((bool)OTP.IsProductPriceChangeType)
                                    {
                                        productprice = (decimal)POP_obj.Price;
                                        if (POP_obj.ToppingPrice != null)
                                        {
                                            adonpricefromOptionType = (decimal)POP_obj.ToppingPrice;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                #endregion

                RadListViewDataItemCollection adoncollection = txtAdonsList.Items;
                foreach (RadListViewDataItem mainitem in adoncollection)
                {
                    RadListView       txtAdons          = mainitem.FindControl("txtAdons") as RadListView;
                    long              productadontypeid = (long)mainitem.GetDataKeyValue("ProductsAdOnTypeId");
                    AdOnTypeInProduct adontypeinproduct = (from ATP in entities.AdOnTypeInProducts
                                                           where ATP.ProductsAdOnTypeId == productadontypeid
                                                           select ATP).FirstOrDefault();

                    RadListViewDataItemCollection childadoncollection = txtAdons.Items;
                    foreach (RadListViewDataItem childitem in childadoncollection)
                    {
                        long        id             = (long)childitem.GetDataKeyValue("ProductAdOnID");
                        ProductAdon productadonObj = (from PA in entities.ProductAdons
                                                      where PA.ProductAdOnID == id
                                                      select PA).FirstOrDefault();
                        if (productadonObj != null)
                        {
                            if (productadonObj.AdOnTypeInProduct.DisplayFormat == 1)
                            {
                                HiddenField SelectedSize = childitem.FindControl("SelectedSize") as HiddenField;
                                HiddenField IsDouble = childitem.FindControl("IsDouble") as HiddenField;
                                short       selectedoption = 0, isDouble = 0;


                                selectedoption = short.Parse(SelectedSize.Value);
                                isDouble       = short.Parse(IsDouble.Value);

                                if (selectedoption != 0)
                                {
                                    if (productadonObj.DefaultSelected == 0 && (selectedoption == 1 || selectedoption == 2 || selectedoption == 3))
                                    {
                                        if (!productadonObj.Adon.AdonType1.IsFreeAdonType)
                                        {
                                            if (isDouble == 1)
                                            {
                                                if (adonpricefromOptionType > 0)
                                                {
                                                    productprice += 2 * adonpricefromOptionType;
                                                }
                                                else
                                                {
                                                    productprice += (2 * (decimal)adontypeinproduct.Price);
                                                }
                                            }
                                            else
                                            {
                                                if (adonpricefromOptionType > 0)
                                                {
                                                    productprice += adonpricefromOptionType;
                                                }
                                                else
                                                {
                                                    productprice += (decimal)adontypeinproduct.Price;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (isDouble == 1)
                                            {
                                                if (adonpricefromOptionType > 0)
                                                {
                                                    productprice += adonpricefromOptionType;
                                                }
                                                else
                                                {
                                                    productprice += (decimal)adontypeinproduct.Price;
                                                }
                                            }
                                        }
                                    }
                                    else if (isDouble == 1)
                                    {
                                        if (adonpricefromOptionType > 0)
                                        {
                                            productprice += adonpricefromOptionType;
                                        }
                                        else
                                        {
                                            productprice += (decimal)adontypeinproduct.Price;
                                        }
                                    }
                                }
                                else
                                {
                                    ImageButton Double = childitem.FindControl("Double") as ImageButton;
                                    IsDouble        = childitem.FindControl("IsDouble") as HiddenField;
                                    Double.ImageUrl = "~/image/Double_NotSelected.png";
                                    IsDouble.Value  = "0";
                                }
                                UnSelectOtherSize(childitem, selectedoption);
                            }
                            else if (productadonObj.AdOnTypeInProduct.DisplayFormat == 2 || productadonObj.AdOnTypeInProduct.DisplayFormat == 3)
                            {
                                if (!productadonObj.Adon.AdonType1.IsFreeAdonType)
                                {
                                    if (adonpricefromOptionType > 0)
                                    {
                                        productprice += adonpricefromOptionType;
                                    }
                                    else
                                    {
                                        productprice += (decimal)adontypeinproduct.Price;
                                    }
                                }
                            }
                            else if (productadonObj.AdOnTypeInProduct.DisplayFormat == 4)
                            {
                                HiddenField SelectedSize = childitem.FindControl("SelectedSize") as HiddenField;
                                HiddenField IsDouble = childitem.FindControl("IsDouble") as HiddenField;
                                short       selectedoption = 0, isDouble = 0;

                                selectedoption = short.Parse(SelectedSize.Value);
                                isDouble       = short.Parse(IsDouble.Value);

                                if (productadonObj.DefaultSelected == 0 && selectedoption == 1)
                                {
                                    if (!productadonObj.Adon.AdonType1.IsFreeAdonType)
                                    {
                                        productprice += (decimal)adontypeinproduct.Price;
                                    }
                                }
                                UnSelectOtherSize(childitem, selectedoption);
                            }
                        }
                    }
                }
                txtNetPrice.Text = Decimal.Round(productprice, 2).ToString();
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }