protected void ddlOrganization_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         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!!";
     }
 }
 protected void btnCanel_Click(object sender, EventArgs e)
 {
     try
     {
         UploadedMembers.Clear();
         UploadedNonMembers.Clear();
         pnlEditing.Visible   = true;
         btnCanelAll.Visible  = true;
         btnSubmitAll.Visible = true;
         //ddlSelectDate.Enabled = false;
         PopulateInformationIncident();
     }
     catch (Exception)
     {
         lblMessage.Text = "Unable to retrieve the incidents data!!";
     }
 }
Esempio n. 3
0
        private void clearTextMain()
        {
            txtFollowUp.Text                = string.Empty;
            txtincident.Text                = string.Empty;
            txtNewIncidentDate.Text         = string.Empty;
            txtNewIncidentDateReported.Text = string.Empty;
            txtNewIncidentTime.Text         = string.Empty;
            txtNewIncidentReportedBy.Text   = string.Empty;
            txtNewIncidentLocation.Text     = string.Empty;
            txtResult.Text = string.Empty;

            ddlOrganization.SelectedIndex = -1;
            ddlSearchMember.SelectedIndex = -1;
            txtNonMemberName.Text         = string.Empty;
            txtNonMemberID.Text           = string.Empty;
            UploadedMembers.Clear();
            grdPplInvolved.DataBind();
            UploadedNonMembers.Clear();
            grdNonMembersInvolved.DataBind();
            lblMessage.Text = string.Empty;
        }
        protected void btnCanelAll_Click(object sender, EventArgs e)
        {
            pnlEditing.Visible   = false;
            pnlSelection.Visible = true;
            //ddlSelectOrganization.SelectedIndex = -1;

            //ddlSelectDate.Enabled = true;
            //ddlSelectDate.Visible = false;

            txtEditIncidentDate.Text         = string.Empty;
            txtEditIncidentDateReported.Text = string.Empty;
            txtEditIncidentLocation.Text     = string.Empty;
            txtEditIncidentReportedBy.Text   = string.Empty;
            txtEditIncidentTime.Text         = string.Empty;
            txtFollowUp.Text = string.Empty;
            txtincident.Text = string.Empty;
            txtResult.Text   = string.Empty;

            txtComments.Text   = string.Empty;
            lblIncidentId.Text = string.Empty;

            UploadedMembers.Clear();
            UploadedNonMembers.Clear();
        }
        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!!";
            }
        }