/// <summary>
        /// Loads the products.
        /// </summary>
        private void LoadProducts()
        {
            SetButtonState(ddlDisplayTypes.Items.Count > 0);
            if (ddlDisplayTypes.Items.Count <= 0)
            {
                return;
            }

            lbAllItems.DataSource = new Store.ProductCollection()
                                    .Where(Product.Columns.IsEnabled, true)
                                    .Load();
            lbAllItems.DataBind();

            _products = CustomizedProductDisplayType.GetProductCollection(int.Parse(ddlDisplayTypes.SelectedValue));
            foreach (Product item in _products)
            {
                lbAddedItems.Items.Add(new ListItem(item.Name, item.ProductId.ToString()));
                ListItem itemToRemove = null;
                foreach (ListItem litem in lbAllItems.Items)
                {
                    if (litem.Value == item.ProductId.ToString())
                    {
                        itemToRemove = litem;
                        break;
                    }
                }
                if (itemToRemove != null)
                {
                    lbAllItems.Items.Remove(itemToRemove);
                }
            }
        }
 /// <summary>
 /// Handles the Click event of the btnAddContent control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void btnAddContent_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtContent.Text))
     return;
       CustomizedProductDisplayType displayType = new CustomizedProductDisplayType();
       displayType.Name = txtContent.Text;
       displayType.Save();
       LoadDropDownMenu();
       ClearListBoxes();
       LoadProducts();
 }
        /// <summary>
        /// Handles the Click event of the btnAddContent control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnAddContent_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtContent.Text))
            {
                return;
            }
            CustomizedProductDisplayType displayType = new CustomizedProductDisplayType();

            displayType.Name = txtContent.Text;
            displayType.Save();
            LoadDropDownMenu();
            ClearListBoxes();
            LoadProducts();
        }
        /// <summary>
        /// Handles the Click event of the btnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //Select all the items in the Added list so that SaveProductMap will insert them into the the map table.
            foreach (ListItem item in lbAddedItems.Items)
            {
                item.Selected = true;
            }
            CustomizedProductDisplayType.SaveProductMap(int.Parse(ddlDisplayTypes.SelectedValue), lbAddedItems.Items);
            if (_currentDisplay == null)
            {
                _currentDisplay = LoadCustomizedProductDisplay();
            }

            try {
                _currentDisplay.RegionId = regionId;
                _currentDisplay.CustomizedProductDisplayTypeId = int.Parse(ddlDisplayTypes.SelectedValue);
                _currentDisplay.Save();
                MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblPageSaved"));
            }
            catch (Exception ex) {
                MasterPage.MessageCenter.DisplayFailureMessage(string.Format(LocalizationUtility.GetText("lblCriticalError"), ex.Message));
            }
        }
        public void Insert(string Name,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
        {
            CustomizedProductDisplayType item = new CustomizedProductDisplayType();

            item.Name = Name;

            item.CreatedBy = CreatedBy;

            item.CreatedOn = CreatedOn;

            item.ModifiedBy = ModifiedBy;

            item.ModifiedOn = ModifiedOn;

            item.Save(UserName);
        }
        public void Update(int CustomizedProductDisplayTypeId,string Name,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn)
        {
            CustomizedProductDisplayType item = new CustomizedProductDisplayType();

                item.CustomizedProductDisplayTypeId = CustomizedProductDisplayTypeId;

                item.Name = Name;

                item.CreatedBy = CreatedBy;

                item.CreatedOn = CreatedOn;

                item.ModifiedBy = ModifiedBy;

                item.ModifiedOn = ModifiedOn;

            item.MarkOld();
            item.Save(UserName);
        }