示例#1
0
        protected void gvFeaturedProducts_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int brandId          = GetIntState(BRAND_ID);
            int featuredItemType = Convert.ToInt32(ddlFeaturedItemTypeFilter.SelectedValue);

            switch (e.CommandName)
            {
            case "savePriority":
                if (brandId != AppConstant.DEFAULT_BRAND)
                {
                    int         productId = Convert.ToInt32(e.CommandArgument);
                    GridViewRow row       = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
                    int         priority  = 0;
                    int.TryParse(((TextBox)row.FindControl("txtFeaturedProductPriority")).Text.Trim(), out priority);

                    BrandService.UpdateBrandFeaturedItemForPriority(productId, brandId, featuredItemType, priority);
                    LoadFeaturedProducts(featuredItemType: featuredItemType);

                    enbNotice.Message = "Priority for featured product was successfully updated.";
                }
                break;

            case "remove":
                if (brandId != AppConstant.DEFAULT_BRAND)
                {
                    int productId = Convert.ToInt32(e.CommandArgument);
                    BrandService.DeleteBrandFeaturedItem(productId: productId, brandId: brandId, featuredItemType: featuredItemType);
                    LoadFeaturedProducts(featuredItemType: featuredItemType);
                    enbNotice.Message = "Featured item was successfully removed.";
                }
                break;

            default:
                break;
            }

            hfCurrentPanel.Value = "featured";
        }