Ejemplo n.º 1
0
 protected void ddlOrganization_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         UploadedNonMembers.Clear();
         UploadedMembers.Clear();
         ddlSearchMember.Items.Clear();
         ListItem select = new ListItem("Select For Member", "-1");
         ddlSearchMember.Items.Add(select);
         if (Convert.ToInt32(ddlOrganization.SelectedItem.Value) != -1)
         {
             int orgID = Convert.ToInt32(ddlOrganization.SelectedItem.Value);
             ddlSearchMember.DataSource     = IncidentDAO.getMembersByOrgID(orgID);
             ddlSearchMember.DataTextField  = "Name";
             ddlSearchMember.DataValueField = "Student_ID";
             ddlSearchMember.DataBind();
         }
         else
         {
             ddlSearchMember.SelectedIndex = -1;
         }
     }
     catch
     {
         lblMessage.Text = "Cannot load Members for the organization!!";
     }
 }
        private void PopulateInformationIncident()
        {
            try
            {
                pnlEditing.Visible   = true;
                pnlSelection.Visible = false;

                UploadedMembers.Clear();
                UploadedNonMembers.Clear();
                ddlSearchMember.Items.Clear();
                ListItem select = new ListItem("Select For Member", "-1");
                ddlSearchMember.Items.Add(select);

                if (Convert.ToInt32(ddlSelectOrganization.SelectedIndex) != -1)
                {
                    int orgID = Convert.ToInt32(ddlSelectOrganization.SelectedValue);
                    ddlSearchMember.DataSource     = IncidentDAO.getMembersByOrgID(orgID);
                    ddlSearchMember.DataTextField  = "Name";
                    ddlSearchMember.DataValueField = "Student_ID";
                    ddlSearchMember.DataBind();
                }
                else
                {
                    ddlSearchMember.SelectedIndex = -1;
                }
                //ddlSelectDate.Items.Clear();
                //ListItem selectdate = new ListItem("Select Date", "-1");
                //ddlSelectDate.Items.Add(selectdate);

                //ddlSelectDate.Visible = true;

                //ddlSelectDate.DataSource = IncidentDAO.getIncidentDateByOrgID(Convert.ToInt32(ddlSelectOrganization.SelectedValue));
                //ddlSelectDate.DataTextField = "SDate";
                //ddlSelectDate.DataValueField = "Date";
                //ddlSelectDate.DataBind();


                ////////////////////////////////////////////////////////////////////
                Incident incidentForEdit = getCurrentIncident();

                txtEditIncidentDate.Text = Convert.ToDateTime(incidentForEdit.Date).ToShortDateString();
                if (incidentForEdit.DateReported == null)
                {
                    txtEditIncidentDateReported.Text = string.Empty;
                }
                else
                {
                    txtEditIncidentDateReported.Text = Convert.ToDateTime(incidentForEdit.DateReported).ToShortDateString();
                }

                txtEditIncidentLocation.Text   = incidentForEdit.Location;
                txtEditIncidentTime.Text       = incidentForEdit.Time;
                txtEditIncidentReportedBy.Text = incidentForEdit.ReportedBy;
                txtFollowUp.Text = incidentForEdit.FollowUp;
                txtResult.Text   = incidentForEdit.Result;
                txtincident.Text = incidentForEdit.Incident1;

                //bind the grd to members for the incident
                UploadedMembers           = IncidentDAO.getPeopleInvoluvedForIncident(incidentForEdit.Incident_ID);
                grdPplInvolved.DataSource = UploadedMembers;
                grdPplInvolved.DataBind();

                //bind the grd with nonmembers
                UploadedNonMembers = IncidentDAO.getNonMembersInvoluvedForIncident(incidentForEdit.Incident_ID);
                grdNonMembersInvolved.DataSource = UploadedNonMembers;
                grdNonMembersInvolved.DataBind();

                ddlOrganization.SelectedValue = incidentForEdit.Organization_ID.ToString();

                //Bind Comments to grid
                grdComments.DataSource = IncidentDAO.getCommentsByIncidentID(incidentForEdit.Incident_ID);
                grdComments.DataBind();
            }
            catch (Exception)
            {
                lblMessage.Text = "Unable to retrieve the incidents data!!";
            }
        }