Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AlertRepository alertRepo = new AlertRepository();

            // Check if we're supposed to delete an alert
            if (!string.IsNullOrEmpty(Request.QueryString["DELETEALERT"]))
            {
                int parsedAlertID = Parsers.ParseInt(Request.QueryString["DELETEALERT"].ToString().Trim());

                if (parsedAlertID > 0)
                {
                    alertRepo.Delete(parsedAlertID);
                }

                Response.Redirect(Request.Url.GetLeftPart(UriPartial.Path));
            }


            // Populate date fields
            if (!IsPostBack)
            {
                ResetInputFields();
            }

            // Load all alerts from the database
            List <Alert> AllAlerts = alertRepo.GetAll();

            foreach (Alert alert in AllAlerts)
            {
                tblAlerts.Rows.Add(addAlertRow(alert));
            }
        }