Ejemplo n.º 1
0
        protected void lbDeleteSelected_Click(object sender, EventArgs e)
        {
            GridView activeGridView = mvGridViews.GetActiveView() == vwGridViewsNotFound ? gvNotFound : gvUrlTracker;

            foreach (GridViewRow row in activeGridView.Rows.OfType <GridViewRow>().Where(x => x.RowType == DataControlRowType.DataRow))
            {
                CheckBox cbSelect = (CheckBox)row.FindControl("cbSelect");
                if (cbSelect.Checked)
                {
                    HiddenField hfId = row.FindControl("hfId") as HiddenField;
                    if (hfId != null)
                    {
                        UrlTrackerRepository.DeleteUrlTrackerEntry(int.Parse(hfId.Value));
                    }
                    else
                    {
                        HiddenField hfOldUrl = row.FindControl("hfOldUrl") as HiddenField;
                        if (hfOldUrl != null)
                        {
                            UrlTrackerRepository.DeleteNotFoundEntriesByOldUrl(hfOldUrl.Value);
                        }
                    }
                }
            }
            activeGridView.DataBind();
            if (activeGridView == gvNotFound && !UrlTrackerRepository.HasNotFoundEntries())
            {
                lbUrlTrackerView_Click(this, EventArgs.Empty);
                mvSwitchButtons.Visible = false;
            }
        }
Ejemplo n.º 2
0
 public void Save()
 {
     UrlTrackerModel.Is404    = false;
     UrlTrackerModel.Referrer = string.Empty;
     if (!string.IsNullOrEmpty(cpRedirectNode.Value))
     {
         UrlTrackerModel.RedirectNodeId = int.Parse(cpRedirectNode.Value);
     }
     else
     {
         UrlTrackerModel.RedirectNodeId = null;
     }
     UrlTrackerModel.RedirectUrl      = tbRedirectUrl.Text;
     UrlTrackerModel.RedirectHttpCode = rbPermanent.Checked ? 301 : 302;
     UrlTrackerModel.RedirectPassThroughQueryString = cbRedirectPassthroughQueryString.Checked;
     UrlTrackerModel.Notes = tbNotes.Text;
     UrlTrackerRepository.UpdateUrlTrackerEntry(UrlTrackerModel);
     UrlTrackerRepository.DeleteNotFoundEntriesByOldUrl(UrlTrackerModel.OldUrl);
 }