Пример #1
0
 private void BindOptions()
 {
     if (!string.IsNullOrEmpty(Request.QueryString["BPID"]))
     {
         long             branchproductid = long.Parse(Request.QueryString["BPID"]);
         ProductsInBranch productbranch   = (from bp in entities.ProductsInBranches
                                             where bp.BranchProductID == branchproductid
                                             select bp).FirstOrDefault();
         if (!IsPostBack)
         {
             txtNetPrice.Text = Decimal.Round((Decimal)productbranch.Price, 2).ToString();
         }
         List <OptionTypesInProduct> optiontypeslist = (from otp in entities.OptionTypesInProducts
                                                        join bp in entities.ProductsInBranches on otp.BranchProductID equals bp.BranchProductID
                                                        where bp.BranchProductID == branchproductid
                                                        select otp).ToList();
         if (optiontypeslist.Count > 0)
         {
             txtOptions.DataSource = optiontypeslist;
         }
         else
         {
             txtOptions.DataSource = null;
         }
     }
 }
Пример #2
0
    protected void grdProducts_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridEditableItem item = e.Item as GridEditableItem;

            long             id = (long)item.GetDataKeyValue("BranchProductID");
            ProductsInBranch pb = (from p in entities.ProductsInBranches
                                   where p.BranchProductID == id
                                   select p).FirstOrDefault();
            Label label  = item.FindControl("Label1") as Label;
            Label label2 = item.FindControl("Label2") as Label;
            if (pb != null)
            {
                Product pp = (from p in entities.Products
                              where p.ProductID == pb.ProductID
                              select p).FirstOrDefault();
                if (pp != null)
                {
                    label.Text = pp.Name;
                }

                Branch bb = (from b in entities.Branches
                             where b.BranchID == pb.BranchID
                             select b).FirstOrDefault();
                if (bb != null)
                {
                    label2.Text = bb.Title;
                }
            }
        }
    }
Пример #3
0
 private void BindAdons()
 {
     if (!string.IsNullOrEmpty(Request.QueryString["BPID"]))
     {
         long             branchproductid = long.Parse(Request.QueryString["BPID"]);
         ProductsInBranch productbranch   = (from bp in entities.ProductsInBranches
                                             where bp.BranchProductID == branchproductid
                                             select bp).FirstOrDefault();
         List <AdOnTypeInProduct> adontypeslist = (from otp in entities.AdOnTypeInProducts
                                                   join bp in entities.ProductsInBranches on otp.BrachProductID equals bp.BranchProductID
                                                   where bp.BranchProductID == branchproductid
                                                   select otp).ToList();
         if (adontypeslist.Count > 0)
         {
             txtAdonsList.DataSource = adontypeslist;
         }
         else
         {
             txtAdonsList.DataSource = null;
         }
     }
 }
Пример #4
0
    protected void grdProducts_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.InitInsertCommandName)
        {
            Response.Redirect("AddProductInBranch.aspx");
        }
        else if (e.CommandName == RadGrid.DeleteCommandName)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            if (editedItem != null)
            {
                Telerik.Web.UI.DataKey key = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex];
                long id = (long)key["BranchProductID"];
                using (TransactionScope transaction = new TransactionScope())
                {
                    List <ProductAdon> productAdonList = (from productAdon in entities.ProductAdons
                                                          join productTypeAdon in entities.AdOnTypeInProducts on productAdon.ProductAdonTypeID equals productTypeAdon.ProductsAdOnTypeId
                                                          where productTypeAdon.BrachProductID == id
                                                          select productAdon).ToList();
                    List <AdOnTypeInProduct> productAdonTypeList = (from productTypeAdon in entities.AdOnTypeInProducts
                                                                    where productTypeAdon.BrachProductID == id
                                                                    select productTypeAdon).ToList();
                    if (productAdonList.Count > 0)
                    {
                        foreach (ProductAdon productAdon in productAdonList)
                        {
                            entities.ProductAdons.Remove(productAdon);
                        }
                    }

                    if (productAdonTypeList.Count > 0)
                    {
                        foreach (AdOnTypeInProduct productAdonType in productAdonTypeList)
                        {
                            entities.AdOnTypeInProducts.Remove(productAdonType);
                        }
                    }

                    List <ProductOptionsInProduct> productOptionList = (from productOption in entities.ProductOptionsInProducts
                                                                        join productOptionType in entities.OptionTypesInProducts on productOption.ProductsOptionTypeId equals productOptionType.ProductsOptionTypeId
                                                                        where productOptionType.BranchProductID == id
                                                                        select productOption).ToList();
                    List <OptionTypesInProduct> productOptionTypeList = (from productOptionType in entities.OptionTypesInProducts
                                                                         where productOptionType.BranchProductID == id
                                                                         select productOptionType).ToList();
                    if (productOptionList.Count > 0)
                    {
                        foreach (ProductOptionsInProduct productAdon in productOptionList)
                        {
                            entities.ProductOptionsInProducts.Remove(productAdon);
                        }
                    }

                    if (productOptionTypeList.Count > 0)
                    {
                        foreach (OptionTypesInProduct productAdonType in productOptionTypeList)
                        {
                            entities.OptionTypesInProducts.Remove(productAdonType);
                        }
                    }
                    ProductsInBranch productInBranch = (from productBranch in entities.ProductsInBranches where productBranch.BranchProductID == id select productBranch).FirstOrDefault();
                    entities.ProductsInBranches.Remove(productInBranch);
                    entities.SaveChanges();
                    transaction.Complete();
                }
            }
        }
    }
Пример #5
0
    protected void SaveBtn_Click(object sender, EventArgs e)
    {
        if (checkValues())
        {
            int              branchid      = int.Parse(txtCbBranch.SelectedValue);
            int              productid     = int.Parse(txtCbProduct.SelectedValue);
            short            optiontypeid  = short.Parse(txtCbOptionType.SelectedValue);
            ProductsInBranch productbranch = (from pb in entities.ProductsInBranches
                                              where pb.BranchID == branchid && pb.ProductID == productid
                                              select pb).FirstOrDefault();
            if (productbranch != null)
            {
                BusinessEntities.OptionTypesInProduct optiontypeproduct = new BusinessEntities.OptionTypesInProduct();
                ICollection <BusinessEntities.ProductOptionsInProducts> ProductOptionList = new List <BusinessEntities.ProductOptionsInProducts>();

                optiontypeproduct.BranchID     = branchid;
                optiontypeproduct.ProductID    = productid;
                optiontypeproduct.OptionTypeID = Convert.ToInt16(txtCbOptionType.SelectedValue);


                GridItemCollection collection = grdOptions.Items;
                bool flag = true;

                foreach (GridItem item in collection)
                {
                    CheckBox         chk          = item.FindControl("txtSelected") as CheckBox;
                    GridEditableItem editableItem = item as GridEditableItem;
                    int productoptionid           = (int)editableItem.GetDataKeyValue("OptionID");
                    if (chk.Checked)
                    {
                        BusinessEntities.ProductOptionsInProducts productoption = new BusinessEntities.ProductOptionsInProducts();
                        productoption.ProductOptionID = productoptionid;
                        CheckBox enable = item.FindControl("txtEnabled") as CheckBox;
                        productoption.Enabled = enable.Checked;
                        RadNumericTextBox txtDisplayOrder = item.FindControl("txtDisplayOrder") as RadNumericTextBox;
                        productoption.DisplayOrder = Convert.ToInt16(txtDisplayOrder.Value.ToString());

                        if (txtNo.Checked)
                        {
                            RadNumericTextBox price = item.FindControl("txtOptionPrice") as RadNumericTextBox;
                            if (price.Value != null)
                            {
                                productoption.Price = Convert.ToDecimal(price.Value);
                            }
                            else
                            {
                                ShowMessage("You have not entered option price in selected row of Available Options Table.", MessageType.Error);
                                item.Selected = true;
                                flag          = false;
                                break;
                            }
                        }
                        else if (txtYes.Checked)
                        {
                            productoption.Price = Convert.ToDecimal(txtPrice.Value);
                        }

                        if (txtAdonYes.Checked)
                        {
                            RadNumericTextBox price1 = item.FindControl("txtAdonPrice") as RadNumericTextBox;
                            if (price1.Value != null)
                            {
                                productoption.ToppingPrice = Convert.ToDecimal(price1.Value);
                            }
                            else
                            {
                                ShowMessage("You have not entered Adon price in selected row of Available Options Table.", MessageType.Error);
                                item.Selected = true;
                                flag          = false;
                                break;
                            }
                        }
                        else
                        {
                            productoption.ToppingPrice = new Nullable <decimal>();
                        }
                        ProductOptionList.Add(productoption);
                    }
                }

                if (flag && ProductOptionList.Count > 0)
                {
                    try
                    {
                        if (txtYes.Checked)
                        {
                            optiontypeproduct.IsSamePrice = true;
                        }
                        else
                        {
                            optiontypeproduct.IsSamePrice = false;
                        }
                        if (txtMultiYes.Checked)
                        {
                            optiontypeproduct.IsMultiSelect = true;
                        }
                        else
                        {
                            optiontypeproduct.IsMultiSelect = false;
                        }
                        if (txtAdonYes.Checked)
                        {
                            optiontypeproduct.IsAdonPriceVary = true;
                        }
                        else
                        {
                            optiontypeproduct.IsAdonPriceVary = false;
                        }
                        if (txtPriceChangeYes.Checked)
                        {
                            optiontypeproduct.IsProductPriceChangeType = true;
                        }
                        else
                        {
                            optiontypeproduct.IsProductPriceChangeType = false;
                        }
                        optiontypeproduct.ProductOptionsXml = Utility.CollectionXml <BusinessEntities.ProductOptionsInProducts>(ProductOptionList, "ProductOptionsInProductsDataSet", "ProductOptionsInProductsDataTable");
                        int result = productOptionManager.AddProductOption(optiontypeproduct);
                        if (result > 0)
                        {
                            ShowMessage("Options have been saved successfully.", MessageType.Success);
                        }
                    }
                    catch (Exception ex)
                    {
                        txtError.Text = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
                    }
                }
                else if (flag)
                {
                    ShowMessage("You have selected no option. You must select option to proceed.", MessageType.Error);
                }
            }
        }
    }
Пример #6
0
    protected void AddToCartButton_Click(object sender, EventArgs e)
    {
        BusinessEntities.Orders order = SessionUserOrder;
        if (order == null)
        {
            order = new BusinessEntities.Orders();
        }


        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 (order.OrderDetailsList == null)
                {
                    order.OrderDetailsList       = new List <BusinessEntities.OrderDetails>();
                    SessionOrderAdonList         = new List <List <BusinessEntities.OrderDetailAdOns> >();
                    SessionOrderDetailOptionList = new List <List <BusinessEntities.OrderDetailOptions> >();
                    order.OrderStatusID          = BusinessEntities.OrderStatus.NewOrder;
                }
                BusinessEntities.OrderDetails orderdetail = new BusinessEntities.OrderDetails();

                if (bpObj.Product.CategoryID == PizzaCategoryId)
                {
                    string thinCrust = GetThinCrustValue();
                    orderdetail.CrustType = thinCrust;
                }
                orderdetail.Price        = Convert.ToDouble(bpObj.Price);
                orderdetail.CategoryName = bpObj.Product.ProductCategory.Name;
                orderdetail.ProductName  = txtProductName.Text;
                orderdetail.ProductID    = bpObj.ProductID;
                orderdetail.ProductImage = bpObj.Product.Image;
                orderdetail.Quantity     = Convert.ToInt32(txtQuantity.Value);
                if (!string.IsNullOrEmpty(txtRecipientName.Text))
                {
                    orderdetail.RecipientName = txtRecipientName.Text;
                }
                if (!string.IsNullOrEmpty(txtInstruction.Text))
                {
                    orderdetail.Comments = txtInstruction.Text;
                }
                decimal adonpricefromOptionType = 0;
                adonpricefromOptionType = GetOrderOptions(orderdetail, adonpricefromOptionType);

                GetOrderAdons(orderdetail, adonpricefromOptionType);

                orderdetail.ItemTotal     = orderdetail.Price * orderdetail.Quantity;
                orderdetail.OrderDetailID = order.OrderDetailsList.Count + 1;
                order.OrderDetailsList.Add(orderdetail);
                order.OrderTotal     += orderdetail.ItemTotal;
                SessionUserOrder      = order;
                SessionUserOrderTotal = order.OrderTotal;
                this.ClientScript.RegisterClientScriptBlock(this.GetType(), "CloseWindow", "<script type='text/javascript'>CloseOnReload()</script>");
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #7
0
    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;
        }
    }
Пример #8
0
    protected void SaveBtn_Click(object sender, EventArgs e)
    {
        if (checkValues())
        {
            int              branchid      = int.Parse(txtCbBranch.SelectedValue);
            int              productid     = int.Parse(txtCbProduct.SelectedValue);
            short            optiontypeid  = short.Parse(txtCbAdonType.SelectedValue);
            short            displayFormat = Convert.ToInt16(txtCbDisplayFormat.SelectedValue);
            ProductsInBranch productbranch = (from pb in entities.ProductsInBranches
                                              where pb.BranchID == branchid && pb.ProductID == productid
                                              select pb).FirstOrDefault();
            if (productbranch != null)
            {
                AdOnTypeInProduct adontypeproduct = null;
                if (atPObj != null)
                {
                    adontypeproduct = atPObj;
                }
                else
                {
                    adontypeproduct = new AdOnTypeInProduct();
                }
                GridItemCollection collection = grdAdons.Items;
                bool flag = true;
                if (atPObj == null)
                {
                    foreach (GridItem item in collection)
                    {
                        CheckBox         chk          = item.FindControl("txtSelected") as CheckBox;
                        GridEditableItem editableItem = item as GridEditableItem;
                        short            adonid       = (short)editableItem.GetDataKeyValue("AdOnID");
                        if (chk.Checked)
                        {
                            ProductAdon productadon = new ProductAdon();
                            productadon.AdonID = adonid;
                            CheckBox enable = item.FindControl("txtEnabled") as CheckBox;
                            productadon.Enable = enable.Checked;
                            RadComboBox defaultSeleted = item.FindControl("txtCbDefault") as RadComboBox;
                            productadon.DefaultSelected = short.Parse(defaultSeleted.SelectedValue);
                            adontypeproduct.ProductAdons.Add(productadon);
                        }
                    }
                }
                else
                {
                    foreach (GridItem item in collection)
                    {
                        CheckBox         chk          = item.FindControl("txtSelected") as CheckBox;
                        GridEditableItem editableItem = item as GridEditableItem;
                        short            adonid       = (short)editableItem.GetDataKeyValue("AdOnID");

                        if (chk.Checked)
                        {
                            ProductAdon productadon = null;
                            bool        isNew       = false;
                            productadon = atPObj.ProductAdons.Where(pa => pa.AdonID == adonid).FirstOrDefault();
                            if (productadon == null)
                            {
                                productadon        = new ProductAdon();
                                productadon.AdonID = adonid;
                                isNew = true;
                            }
                            CheckBox enable = item.FindControl("txtEnabled") as CheckBox;
                            productadon.Enable = enable.Checked;
                            RadComboBox defaultSeleted = item.FindControl("txtCbDefault") as RadComboBox;
                            productadon.DefaultSelected = short.Parse(defaultSeleted.SelectedValue);
                            if (isNew)
                            {
                                adontypeproduct.ProductAdons.Add(productadon);
                            }
                            else
                            {
                                adontypeproduct.ProductAdons.Remove(productadon);
                                adontypeproduct.ProductAdons.Add(productadon);
                            }
                        }
                        else
                        {
                            ProductAdon padon = atPObj.ProductAdons.Where(pa => pa.AdonID == adonid).FirstOrDefault();
                            if (padon != null)
                            {
                                atPObj.ProductAdons.Remove(padon);
                                entities.ProductAdons.Remove(padon);
                            }
                        }
                    }
                }

                if (adontypeproduct.ProductAdons.Count > 0)
                {
                    using (TransactionScope transaction = new TransactionScope())
                    {
                        try
                        {
                            if (txtPrice.Value != null)
                            {
                                adontypeproduct.Price = Convert.ToDecimal(txtPrice.Value);
                            }
                            else
                            {
                                adontypeproduct.Price = new Nullable <decimal>();
                            }
                            adontypeproduct.DisplayFormat = displayFormat;
                            if (atPObj == null)
                            {
                                adontypeproduct.AdonTypeID     = optiontypeid;
                                adontypeproduct.BrachProductID = productbranch.BranchProductID;
                                entities.AdOnTypeInProducts.Add(adontypeproduct);
                            }
                            entities.SaveChanges();
                            transaction.Complete();
                            ShowMessage("Product adons have been saved successfully. ", MessageType.Error);
                        }
                        catch (Exception ex)
                        {
                            txtError.Text = (ex.InnerException != null) ? ex.InnerException.Message : ex.Message;
                        }
                    }
                }
                else if (flag)
                {
                    ShowMessage("You have selected no Adon. You must select Adon to proceed.", MessageType.Error);
                }
            }
        }
    }