Beispiel #1
0
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteRedirectSeo")
            {
                RedirectSeoService.DeleteRedirectSeo(SQLDataHelper.GetInt(e.CommandArgument));
            }
            if (e.CommandName == "AddRedirectSeo")
            {
                GridViewRow footer             = grid.FooterRow;
                var         txtNexRedirectFrom = ((TextBox)footer.FindControl("txtNexRedirectFrom")).Text.Trim().ToLower();
                var         txtNewRedirectTo   = ((TextBox)footer.FindControl("txtNewRedirectTo")).Text.Trim().ToLower();
                var         txtNewProductArtNo = ((TextBox)footer.FindControl("txtNewProductArtNo")).Text.Trim();

                if (string.IsNullOrEmpty(txtNexRedirectFrom) || (string.IsNullOrEmpty(txtNewRedirectTo) && string.IsNullOrEmpty(txtNewProductArtNo)))
                {
                    grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ffcccc");
                    return;
                }

                var redirectSeo = new RedirectSeo
                {
                    RedirectFrom = txtNexRedirectFrom,
                    RedirectTo   = txtNewRedirectTo,
                    ProductArtNo = txtNewProductArtNo
                };

                RedirectSeoService.AddRedirectSeo(redirectSeo);
                grid.ShowFooter = false;
            }
            if (e.CommandName == "CancelAdd")
            {
                grid.FooterStyle.BackColor = System.Drawing.Color.FromName("#ccffcc");
                grid.ShowFooter            = false;
            }
        }
Beispiel #2
0
    protected void btnDelete_Click(object sender, System.EventArgs e)
    {
        int id = Int32.Parse(hiddenID.Value);

        RedirectSeoService.DeleteRedirectSeo(id);

        hiddenID.Value = "";
    }
Beispiel #3
0
 protected void lbDeleteSelected_Click(object sender, EventArgs e)
 {
     if ((_selectionFilter != null) && (_selectionFilter.Values != null))
     {
         if (!_inverseSelection)
         {
             foreach (var id in _selectionFilter.Values)
             {
                 RedirectSeoService.DeleteRedirectSeo(SQLDataHelper.GetInt(id));
             }
         }
         else
         {
             var itemsIds = _paging.ItemsIds <int>("ID");
             //  List<int> ids = CountryService.GetAllCountryID();
             foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture))))
             {
                 RedirectSeoService.DeleteRedirectSeo(id);
             }
         }
     }
 }