public bool MoveItemDown(string bvin, string listName)
        {
            List <ContentBlockSettingListItem> current = FindList(listName);

            int  next         = 1;
            int  currentSort  = 0;
            bool foundCurrent = false;

            foreach (ContentBlockSettingListItem item in current)
            {
                if (foundCurrent)
                {
                    next           = item.SortOrder;
                    item.SortOrder = currentSort;
                    break;
                }

                if (item.Id == bvin)
                {
                    currentSort  = item.SortOrder;
                    foundCurrent = true;
                }
            }

            if (next > 1)
            {
                ContentBlockSettingListItem cur = FindSingleItem(bvin);
                if (cur != null)
                {
                    cur.SortOrder = next;
                }
            }

            return(true);
        }
        public bool MoveItemUp(string bvin, string listName)
        {
            List <ContentBlockSettingListItem> current = FindList(listName);

            int    previous    = 1;
            int    currentSort = 0;
            string previousId  = string.Empty;

            foreach (ContentBlockSettingListItem item in current)
            {
                if (item.Id == bvin)
                {
                    currentSort    = item.SortOrder;
                    item.SortOrder = previous;
                    break;
                }
                else
                {
                    previous   = item.SortOrder;
                    previousId = item.Id;
                }
            }

            ContentBlockSettingListItem prev = FindSingleItem(previousId);

            if (prev != null)
            {
                prev.SortOrder = currentSort;
            }

            return(true);
        }
 public bool AddItem(ContentBlockSettingListItem item)
 {
     int maxSort = FindMaxSort(item.ListName);
     item.SortOrder = maxSort + 1;
     Items.Add(item);
     return true;
 }
Exemplo n.º 4
0
        protected void AddImageButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);
            if (b != null)
            {

                List<ContentBlockSettingListItem> settings = b.Lists.FindList("Categories");

                foreach (string category in CategoryPicker1.SelectedCategories)
                {
                    bool @add = true;
                    foreach (ContentBlockSettingListItem item in settings)
                    {
                        if (item.Setting1 == category)
                        {
                            @add = false;
                            break;
                        }
                    }
                    if (@add)
                    {
                        ContentBlockSettingListItem c = new ContentBlockSettingListItem();
                        c.Setting1 = category;
                        c.ListName = "Categories";
                        b.Lists.AddItem(c);
                        MyPage.MTApp.ContentServices.Columns.UpdateBlock(b);
                    }
                }
                BindCategoryGridView(b);
            }
        }
Exemplo n.º 5
0
        protected void btnNew_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);
            if (b != null)
            {

                //Inserting
                //SettingsManager.GetSettingList("ProductGrid");
                foreach (string product in ProductPicker1.SelectedProducts)
                {
                    ContentBlockSettingListItem c = new ContentBlockSettingListItem();
                    Product p = MyPage.MTApp.CatalogServices.Products.Find(product);
                    c.Setting1 = product;
                    c.Setting2 = p.Sku;
                    c.Setting3 = p.ProductName;
                    c.Setting4 = Page.ResolveUrl(ImageHelper.GetValidImage(p.ImageFileSmall, true));
                    c.Setting5 = UrlRewriter.BuildUrlForProduct(p, this.Page);
                    c.Setting6 = p.SitePrice.ToString();
                    c.ListName = "ProductGrid";
                    b.Lists.AddItem(c);
                    MyPage.MTApp.ContentServices.Columns.UpdateBlock(b);
                }
                LoadItems(b);
            }
        }
        public bool AddItem(ContentBlockSettingListItem item)
        {
            int maxSort = FindMaxSort(item.ListName);

            item.SortOrder = maxSort + 1;
            Items.Add(item);
            return(true);
        }
Exemplo n.º 7
0
 private void SetProducts(ContentBlockSettingListItem data)
 {
     string bvin = data.Setting1;
     Product p = MyPage.MTApp.CatalogServices.Products.Find(bvin);
     StringBuilder sb = new StringBuilder();
     UserSpecificPrice price = MyPage.MTApp.PriceProduct(p, MyPage.MTApp.CurrentCustomer, null, MyPage.MTApp.CurrentlyActiveSales);
     HtmlRendering.RenderSingleProduct(ref sb, p, false, false, this.Page, price);
     this.litMain.Text = sb.ToString();
 }
        public bool RemoveItem(string bvin)
        {
            ContentBlockSettingListItem item = FindSingleItem(bvin);

            if (item != null)
            {
                return(Items.Remove(item));
            }

            return(false);
        }
Exemplo n.º 9
0
 private SideMenuItem AddSingleLink(ContentBlockSettingListItem l)
 {
     SideMenuItem result = new SideMenuItem();
     result.Title = l.Setting4;
     result.Name = l.Setting1;
     result.Url = l.Setting2;
     if (l.Setting3 == "1")
     {
         result.OpenInNewWindow = true;
     }
     result.CssClass = l.Setting5;
     return result;
 }
Exemplo n.º 10
0
 private void AddSingleLink(ContentBlockSettingListItem l)
 {
     this.MenuControl.Controls.Add(new LiteralControl("<li>"));
     HyperLink m = new HyperLink();
     m.ToolTip = l.Setting4;
     m.Text = l.Setting1;
     m.NavigateUrl = l.Setting2;
     if (l.Setting3 == "1")
     {
         m.Target = "_blank";
     }
     m.EnableViewState = false;
     this.MenuControl.Controls.Add(m);
     this.MenuControl.Controls.Add(new LiteralControl("</li>"));
 }
Exemplo n.º 11
0
        protected void btnNew_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            ContentBlockSettingListItem c = new ContentBlockSettingListItem();

            if (this.EditBvinField.Value != string.Empty)
            {
                //Updating
                c = b.Lists.FindSingleItem(EditBvinField.Value);
                c.Setting1 = this.LinkTextField.Text.Trim();
                c.Setting2 = this.LinkField.Text.Trim();
                if (this.OpenInNewWindowField.Checked == true)
                {
                    c.Setting3 = "1";
                }
                else
                {
                    c.Setting3 = "0";
                }
                c.Setting4 = this.AltTextField.Text.Trim();
                c.Setting5 = this.CssClassField.Text.Trim();
                MyPage.MTApp.ContentServices.Columns.UpdateBlock(b);
                ClearEditor();
            }
            else
            {
                //Inserting
                c.Setting1 = this.LinkTextField.Text.Trim();
                c.Setting2 = this.LinkField.Text.Trim();
                if (this.OpenInNewWindowField.Checked == true)
                {
                    c.Setting3 = "1";
                }
                else
                {
                    c.Setting3 = "0";
                }
                c.Setting4 = this.AltTextField.Text.Trim();
                c.Setting5 = this.CssClassField.Text.Trim();
                c.ListName = SettingListName;
                b.Lists.AddItem(c);
                MyPage.MTApp.ContentServices.Columns.UpdateBlock(b);
            }
            LoadItems(b);
        }
        public ContentBlockSettingListItem Clone()
        {
            ContentBlockSettingListItem clone = new ContentBlockSettingListItem();

            //clone.Id = System.Guid.NewGuid().ToString();
            clone.ListName  = this.ListName;
            clone.Setting1  = this.Setting1;
            clone.Setting2  = this.Setting2;
            clone.Setting3  = this.Setting3;
            clone.Setting4  = this.Setting4;
            clone.Setting5  = this.Setting5;
            clone.Setting6  = this.Setting6;
            clone.Setting7  = this.Setting7;
            clone.Setting8  = this.Setting8;
            clone.Setting9  = this.Setting9;
            clone.Setting10 = this.Setting10;
            clone.SortOrder = this.SortOrder;

            return(clone);
        }
        public ContentBlockSettingListItem Clone()
        {
            ContentBlockSettingListItem clone = new ContentBlockSettingListItem();

            //clone.Id = System.Guid.NewGuid().ToString();
            clone.ListName = this.ListName;
            clone.Setting1 = this.Setting1;
            clone.Setting2 = this.Setting2;
            clone.Setting3 = this.Setting3;
            clone.Setting4 = this.Setting4;
            clone.Setting5 = this.Setting5;
            clone.Setting6 = this.Setting6;
            clone.Setting7 = this.Setting7;
            clone.Setting8 = this.Setting8;
            clone.Setting9 = this.Setting9;
            clone.Setting10 = this.Setting10;
            clone.SortOrder = this.SortOrder;

            return clone;
        }
Exemplo n.º 14
0
        protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            ContentBlock b = MyPage.MTApp.ContentServices.Columns.FindBlock(this.BlockId);

            string bvin = string.Empty;
            bvin = ((GridView)sender).DataKeys[e.NewEditIndex].Value.ToString();

            ContentBlockSettingListItem c = new ContentBlockSettingListItem();
            c = b.Lists.FindSingleItem(bvin);

            if (c.Id != string.Empty)
            {
                            this.EditBvinField.Value = c.Id;
                            this.ImageLinkField.Text = c.Setting2;
                            this.ImageUrlField.Text = c.Setting1;
                            if (c.Setting3 == "1")
                            {
                                this.chkOpenInNewWindow.Checked = true;
                            } else {                            
                                this.chkOpenInNewWindow.Checked = false;
                            }
                            this.AltTextField.Text = c.Setting4;
                            this.btnNew.ImageUrl = "~/BVAdmin/Images/Buttons/SaveChanges.png";
            }

        }