Пример #1
0
 protected void btnDeleteImage_Click(object sender, EventArgs e)
 {
     Products ps = new Products();
     if(ps.DeleteImageByGroupID(this.GroupID))
         btnDeleteImage.Visible = false;
 }
Пример #2
0
 private void Save()
 {
     foreach (RepeaterItem item in RepeaterLang.Items)
     {
         if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
         {
             ProductEditor editor = (ProductEditor)item.FindControl("editor");
             editor.CategoryID = Int32.Parse(ddlCategory.SelectedValue);
             editor.SaveItem();
         }
     }
     if(fuImage.HasFile)
     {
         Products ps = new Products();
         Product p = new Product();
         p.Image = fuImage.FileBytes;
         p.ImageName = Path.GetFileName(fuImage.FileName);
         p.ImageType = fuImage.PostedFile.ContentType;
         p.GroupID = this.GroupID;
         if(ps.UpdateImageByGroupID(p))
             btnDeleteImage.Visible = true;
     }
     GridViewItemsList.DataBind();
     //add new after saving
     //if (Convert.ToInt32(GridViewItemsList.SelectedValue) == 0)
     //    GroupID = Categories.GetNextCategoryGroupID();
     //RepeaterLang.DataBind();
 }
Пример #3
0
        protected void GridViewItemsList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Products dao = new Products();

            if (e.CommandName == "MoveUp")
            {
                int id = int.Parse((string)e.CommandArgument);
                int category = int.Parse(DdlCategoryFilter.SelectedValue);
                dao.MoveUp(id, category);
            }
            else if (e.CommandName == "MoveDown")
            {
                int id = int.Parse((string)e.CommandArgument);
                int category = int.Parse(DdlCategoryFilter.SelectedValue);
                dao.MoveDown(id, category);
            }

            GridViewItemsList.DataBind();
        }
Пример #4
0
        private void InitCategory()
        {
            Products ps = new Products();
            Product p = ps.GetByLangGroup("ru", this.GroupID);

            if (p != null)
            {
                ListItem item = ddlCategory.Items.FindByValue(p.CategoryID.ToString());
                if (item != null && item.Value == p.CategoryID.ToString())
                {
                    ddlCategory.SelectedValue = p.CategoryID.ToString();
                }
                if(p.ImageLenght > 0)
                {
                    btnDeleteImage.Visible = true;
                }
                else
                {
                    btnDeleteImage.Visible = false;
                }
            }
        }
Пример #5
0
 public CascadingDropDownNameValue[] GetProducts(string knownCategoryValues, string category)
 {
     List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
     try
     {
         List<Product> all = new Products().GetAllByLanguage(Globals.CurrentLanguage);
         if (all.Count == 0)
             return null;
         foreach (Product p in all)
         {
             values.Add(new CascadingDropDownNameValue(p.Name, p.GroupID.ToString()));
         }
     }
     catch { }
     return values.ToArray();
 }