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!!"; } }
protected void btnAddNonMember_Click(object sender, EventArgs e) { try { nonMemberList = UploadedNonMembers; NonMemberList member = new NonMemberList(); member.Name = txtNonMemberName.Text; member.ID = txtNonMemberID.Text; UploadedNonMembers.Add(member); grdNonMembersInvolved.DataBind(); txtNonMemberID.Text = string.Empty; txtNonMemberName.Text = string.Empty; } catch { lblMessage.Text = "Was not able to add the non member!!"; } }
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 grdNonMembersInvolved_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { string ID = grdNonMembersInvolved.Rows[e.RowIndex].Cells[1].Text; nonMemberList = UploadedNonMembers; for (int i = 0; i < nonMemberList.Count; ++i) { if (nonMemberList[i].ID == ID) { //memberList.RemoveAt(i); UploadedNonMembers.RemoveAt(i); } } grdNonMembersInvolved.DataBind(); } catch { lblMessage.Text = "Was not able to remove the non member!!"; } }
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!!"; } }