예제 #1
0
 public static void UpdateRedirectSeo(RedirectSeo redirectSeo)
 {
     SQLDataAccess.ExecuteNonQuery("UPDATE [Settings].[Redirect] SET RedirectFrom = @RedirectFrom, RedirectTo = @RedirectTo, ProductArtNo = @ProductArtNo WHERE ID = @ID", CommandType.Text,
                                   new SqlParameter("@ID", redirectSeo.ID),
                                   new SqlParameter("@RedirectFrom", redirectSeo.RedirectFrom),
                                   new SqlParameter("@RedirectTo", redirectSeo.RedirectTo),
                                   new SqlParameter("@ProductArtNo", redirectSeo.ProductArtNo)
                                   );
 }
예제 #2
0
 public static void UpdateRedirectSeo(RedirectSeo redirectSeo)
 {
     SQLDataAccess.ExecuteNonQuery("UPDATE [Settings].[Redirect] SET RedirectFrom = @RedirectFrom, RedirectTo = @RedirectTo, ProductArtNo = @ProductArtNo WHERE ID = @ID", CommandType.Text,
                                         new SqlParameter("@ID", redirectSeo.ID),
                                         new SqlParameter("@RedirectFrom", redirectSeo.RedirectFrom),
                                         new SqlParameter("@RedirectTo", redirectSeo.RedirectTo),
                                         new SqlParameter("@ProductArtNo", redirectSeo.ProductArtNo)
                                  );
 }
예제 #3
0
 public static void AddRedirectSeo(RedirectSeo redirectSeo)
 {
     redirectSeo.ID =
         SQLDataAccess.ExecuteScalar<int>(
             "INSERT INTO [Settings].[Redirect] ([RedirectFrom], [RedirectTo], [ProductArtNo]) VALUES (@RedirectFrom, @RedirectTo, @ProductArtNo); SELECT SCOPE_IDENTITY();",
             CommandType.Text,
             new SqlParameter("@RedirectFrom", redirectSeo.RedirectFrom),
             new SqlParameter("@RedirectTo", redirectSeo.RedirectTo),
             new SqlParameter("@ProductArtNo", redirectSeo.ProductArtNo)
             );
 }
예제 #4
0
 public static void AddRedirectSeo(RedirectSeo redirectSeo)
 {
     redirectSeo.ID =
         SQLDataAccess.ExecuteScalar <int>(
             "INSERT INTO [Settings].[Redirect] ([RedirectFrom], [RedirectTo], [ProductArtNo]) VALUES (@RedirectFrom, @RedirectTo, @ProductArtNo); SELECT SCOPE_IDENTITY();",
             CommandType.Text,
             new SqlParameter("@RedirectFrom", redirectSeo.RedirectFrom),
             new SqlParameter("@RedirectTo", redirectSeo.RedirectTo),
             new SqlParameter("@ProductArtNo", redirectSeo.ProductArtNo)
             );
 }
예제 #5
0
    protected void btnAddResirects_Click(object sender, EventArgs e)
    {
        string[] lines = redirects.Value.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

        foreach (var line in lines)
        {
            string[] words = line.Split(" \t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (words.Length == 2)
            {
                var redirect = new RedirectSeo
                {
                    RedirectFrom = (words[0][0] != '/') ? "/" + words[0] : words[0],
                    RedirectTo = (words[1][0] != '/') ? "/" + words[1] : words[1]
                };

                RedirectSeoService.AddRedirectSeo(redirect);
            }
        }
    }
예제 #6
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (grid.UpdatedRow != null)
            {
                var redirectSeo = new RedirectSeo
                    {
                        ID = SQLDataHelper.GetInt(grid.UpdatedRow["ID"]),
                        RedirectFrom = grid.UpdatedRow["RedirectFrom"].Trim().ToLower(),
                        RedirectTo = grid.UpdatedRow["RedirectTo"].Trim().ToLower(),
                        ProductArtNo = grid.UpdatedRow["ProductArtNo"]
                    };
                RedirectSeoService.UpdateRedirectSeo(redirectSeo);
            }

            DataTable data = _paging.PageItems;
            while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
            {
                _paging.CurrentPageIndex--;
                data = _paging.PageItems;
            }

            var clmn = new DataColumn("IsSelected", typeof(bool)) { DefaultValue = _inverseSelection };
            data.Columns.Add(clmn);
            if ((_selectionFilter != null) && (_selectionFilter.Values != null))
            {
                for (int i = 0; i <= data.Rows.Count - 1; i++)
                {
                    int intIndex = i;
                    if (Array.Exists(_selectionFilter.Values, c => c == data.Rows[intIndex]["ID"].ToString()))
                    {
                        data.Rows[i]["IsSelected"] = !_inverseSelection;
                    }
                }
            }

            if (data.Rows.Count < 1)
            {
                goToPage.Visible = false;
            }

            grid.DataSource = data;
            grid.DataBind();

            pageNumberer.PageCount = _paging.PageCount;
            lblFound.Text = _paging.TotalRowsCount.ToString();
        }
예제 #7
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;
            }
        }