Ejemplo n.º 1
0
        protected void btn_closeIncident_Click(object sender, EventArgs e)
        {
            TechSupportContext context = new TechSupportContext();

            if (Convert.ToInt32(ddl_openIncidents.SelectedValue) > 0)
            {
                context.closeIncident(Convert.ToInt32(ddl_openIncidents.SelectedValue));

                lbl_incident_close.ForeColor = System.Drawing.Color.Black;
                lbl_incident_close.Text      = "Indident " + ddl_openIncidents.SelectedValue + " closed";

                // The following code is for making sure that the open incident drop down list
                // and the accordion refresh when the data has been altered.
                // I feel like there must be a better way to handle this, but this is what I have for now.
                List <Incident> incident = context.returnIncidents(Convert.ToInt32(ddl_customers.SelectedValue));
                List <SportsPro.Models.Incident> openIncidents = context.getOpenIncidents();
                Accd_Incident_View.DataSource    = incident;
                ddl_openIncidents.DataSource     = openIncidents;
                ddl_openIncidents.DataValueField = "IncidentID";
                ddl_openIncidents.DataTextField  = "IncidentID";

                ddl_openIncidents.DataBind();
                Accd_Incident_View.DataBind();
            }
            else
            {
                // If there is no data in the open incident drop down list, we display an error message
                lbl_incident_close.ForeColor = System.Drawing.Color.Red;
                lbl_incident_close.Text      = "No Incident Selected";
            }
        }