protected void SetStatus(object sender, EventArgs e) { int caseID = -1; try { caseID = thisCase.CaseID; } catch { } if (caseID <= 0) thisCase = Case.Get(Convert.ToInt32(Session["CaseID"])); string newStatus = (((LinkButton)sender).CommandArgument).ToString(); thisCase.Status = newStatus; LoadHeader(); }
protected internal void LoadCase(object sender, EventArgs e) { int CaseID = -1; int.TryParse(((LinkButton)sender).CommandArgument, out CaseID); thisCase = Case.Get(CaseID); Session["CaseID"] = CaseID; BindData(); LoadHeader(); RightContainer.Attributes.CssStyle["display"] = "block"; UnloadCaseButton.CssClass = "undo show"; }
protected internal void SaveCase(object sender, EventArgs e) { int caseID = int.Parse(CaseID.Text); thisCase = Case.Get(caseID); thisCase.CourtID = Convert.ToInt32(CourtID.Text); if (!string.IsNullOrEmpty(ReferralDate.Text)) thisCase.ReferralDate = Convert.ToDateTime(ReferralDate.Text); else thisCase.ReferralDate = default(DateTime); thisCase.ReferralNumber = Convert.ToInt32(ReferralNumber.Text); if (!string.IsNullOrEmpty(CourtDate.Text)) thisCase.CourtDate = Convert.ToDateTime(CourtDate.Text); else thisCase.CourtDate = default(DateTime); if (!string.IsNullOrEmpty(DateFinalConference.Text)) thisCase.DateOfFinalConference = Convert.ToDateTime(DateFinalConference.Text); else thisCase.DateOfFinalConference = default(DateTime); if (!string.IsNullOrEmpty(DateCompletion.Text)) thisCase.DateOfCompletion = Convert.ToDateTime(DateCompletion.Text); else thisCase.DateOfCompletion = default(DateTime); thisCase.District = Convert.ToInt32(District.Text); thisCase.Status = Status.InnerText; thisCase.Update(); CaseUpdatedPanel.CssClass += " visible"; }
protected internal void DeleteDocument(object sender, EventArgs e) { int documentID = Convert.ToInt32(((LinkButton)sender).CommandArgument); int caseID = Convert.ToInt32(Session["CaseID"]); Case thisCase = Case.Get(caseID); thisCase.DeleteDocument(Document.Get(documentID)); thisCase = Case.Get(caseID); BindData(); }
protected internal void DeleteVictim(object sender, EventArgs e) { int PersonID = Convert.ToInt32(((LinkButton)sender).CommandArgument); Victim thisVictim = Victim.Get(PersonID); int CaseID = Convert.ToInt32(Session["CaseID"]); thisCase = Case.Get(CaseID); thisCase.DeleteVictim(thisVictim); thisCase = Case.Get(CaseID); BindData(); }
protected internal void DeleteCaseManager(object sender, EventArgs e) { int PersonID = Convert.ToInt32(((LinkButton)sender).CommandArgument); InternalUser thisEmployee = InternalUser.Get(PersonID); int CaseID = Convert.ToInt32(Session["CaseID"]); thisCase = Case.Get(CaseID); thisCase.DeleteCaseManager(thisEmployee); thisCase = Case.Get(CaseID); BindData(); }
protected internal void DeleteCharge(object sender, EventArgs e) { int ChargeID = Convert.ToInt32(((LinkButton)sender).CommandArgument); Charge thisCharge = Charge.Get(ChargeID); int CaseID = Convert.ToInt32(Session["CaseID"]); thisCase = Case.Get(CaseID); thisCase.DeleteCharge(thisCharge); thisCase = Case.Get(CaseID); BindData(); }
protected internal void CreateNewCase(object sender, EventArgs e) { if (ModalCourtID.Text.Length == 0) return; if (ModalStatus.Text.Length == 0) return; int newCaseID = Case.Add( Convert.ToInt32(ModalCourtID.Text), (ModalReferralDate.Text.Length > 0 ? Convert.ToDateTime(ModalReferralDate.Text) : default(DateTime)), (ModalReferralNumber.Text.Length > 0 ? Convert.ToInt32(ModalReferralNumber.Text) : 0), (ModalCourtDate.Text.Length > 0 ? Convert.ToDateTime(ModalCourtDate.Text) : default(DateTime)), ModalDistrict.Text, (ModalDateFinalConf.Text.Length > 0 ? Convert.ToDateTime(ModalDateFinalConf.Text) : default(DateTime)), (ModalDateCompletion.Text.Length > 0 ? Convert.ToDateTime(ModalDateCompletion.Text) : default(DateTime)), ModalStatus.Text); thisCase = Case.Get(newCaseID); SwitchCaseList(null, null); LoadHeader(); BindData(); Session["CaseID"] = CaseID; NewCaseModalPanel.CssClass = "modal-background"; }
protected internal void DeleteAffiliate(object sender, EventArgs e) { int PersonID = Convert.ToInt32(((LinkButton)sender).CommandArgument); Affiliate thisAffiliate = Affiliate.Get(PersonID); int CaseID = Convert.ToInt32(Session["CaseID"]); thisCase = Case.Get(CaseID); thisCase.DeleteAffiliate(thisAffiliate); thisCase = Case.Get(CaseID); BindData(); }
protected internal void AddManager(object Sender, EventArgs e) { thisCase = Case.Get(int.Parse(CaseID.Text)); LinkButton b = Sender as LinkButton; if (b != null) { DropDownList c = (DropDownList)b.Parent.FindControl("ManagerDropDown"); if (c != null) { if (c.SelectedItem.Text != "") { int personID = int.Parse(c.SelectedValue); InternalUser addedManager = InternalUser.Get(personID); thisCase.AddCaseManager(addedManager); } } } }
protected internal void BindData() { int caseID = -1; try { caseID = thisCase.CaseID; } catch { } if (caseID <= 0) thisCase = Case.Get(Convert.ToInt32(Session["CaseID"])); VictimsRepeater.DataSource = thisCase.Victims; VictimsRepeater.DataBind(); OffendersRepeater.DataSource = thisCase.Offenders; OffendersRepeater.DataBind(); AffiliatesRepeater.DataSource = thisCase.Affiliates; AffiliatesRepeater.DataBind(); NotesRepeater.DataSource = thisCase.Notes; NotesRepeater.DataBind(); ChargesRepeater.DataSource = thisCase.Charges; ChargesRepeater.DataBind(); DocumentsRepeater.DataSource = thisCase.Documents; DocumentsRepeater.DataBind(); CaseManagersRepeater.DataSource = thisCase.CaseManagers; CaseManagersRepeater.DataBind(); }
public static List<Case> GetCases(bool getBasics, int personID, string status) { List<Case> results = new List<Case>(); string sql = @" SELECT * FROM RJL_Case c INNER JOIN Case_Manager cm ON c.Case_ID = cm.Case_ID WHERE Person_ID = @PersonID AND Status LIKE @Status"; using (SqlConnection conn = new SqlConnection(Constants.DSN)) { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("Status", "%" + status + "%"); cmd.Parameters.AddWithValue("PersonID", personID); SqlDataReader read = cmd.ExecuteReader(); while (read.Read()) { Case newCase = new Case() { CaseID = Convert.ToInt32(read["Case_ID"]), CourtID = default(int), ReferralDate = read["Referral_Date"] as DateTime? ?? default(DateTime), ReferralNumber = Convert.ToInt32(read["Referral_Number"]), CourtDate = read["Court_Date"] as DateTime? ?? default(DateTime), DateOfFinalConference = read["Final_Conference_Date"] as DateTime? ?? default(DateTime), DateOfCompletion = read["Closure_Date"] as DateTime? ?? default(DateTime), Status = read["Status"].ToString() }; newCase.GetOffenders(); newCase.GetVictims(); newCase.GetAffiliates(); newCase.GetNotes(); newCase.GetCharges(); newCase.GetDocuments(); newCase.GetCaseManagers(); results.Add(newCase); } } return results; }
public static List<Case> GetCases(bool getBasics, int personID) { if (getBasics) { List<Case> results = new List<Case>(); string sql = @" SELECT c.Case_ID, Status FROM RJL_Case c INNER JOIN Case_Manager cm ON c.Case_ID = cm.Case_ID WHERE Person_ID = @PersonID"; using (SqlConnection conn = new SqlConnection(Constants.DSN)) { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("PersonID", personID); SqlDataReader read = cmd.ExecuteReader(); while (read.Read()) { Case newCase = new Case() { CaseID = Convert.ToInt32(read["Case_ID"]), Status = read["Status"].ToString() }; newCase.GetOffenders(); newCase.GetVictims(); results.Add(newCase); } } return results; } return null; }
public static List<Case> GetCases(bool getBasics) { if (getBasics) { List<Case> results = new List<Case>(); string sql = "SELECT Case_ID, Status FROM RJL_Case"; using (SqlConnection conn = new SqlConnection(Constants.DSN)) { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.CommandType = CommandType.Text; SqlDataReader read = cmd.ExecuteReader(); while (read.Read()) { Case newCase = new Case() { CaseID = Convert.ToInt32(read["Case_ID"]), Status = read["Status"].ToString() }; newCase.GetOffenders(); newCase.GetVictims(); results.Add(newCase); } } return results; } return null; }
public static List<Case> GetCases() { List<Case> results = new List<Case>(); string sql = "SELECT * FROM RJL_Case"; using (SqlConnection conn = new SqlConnection(Constants.DSN)) { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.CommandType = CommandType.Text; SqlDataReader read = cmd.ExecuteReader(); while (read.Read()) { Case newCase = new Case() { CaseID = Convert.ToInt32(read["Case_ID"]), CourtID = default(int), ReferralDate = read["Referral_Date"] as DateTime? ?? default(DateTime), ReferralNumber = Convert.ToInt32(read["Referral_Number"]), CourtDate = read["Court_Date"] as DateTime? ?? default(DateTime), DateOfFinalConference = read["Final_Conference_Date"] as DateTime? ?? default(DateTime), DateOfCompletion = read["Closure_Date"] as DateTime? ?? default(DateTime), Status = read["Status"].ToString(), District = Convert.ToInt32(read["District"]) }; newCase.GetOffenders(); newCase.GetVictims(); newCase.GetAffiliates(); newCase.GetNotes(); newCase.GetCharges(); newCase.GetDocuments(); newCase.GetCaseManagers(); results.Add(newCase); } } return results; }
public static Case Get(int caseID) { string sql = "SELECT * FROM RJL_Case WHERE Case_ID = @CaseID"; using (SqlConnection conn = new SqlConnection(Constants.DSN)) { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.CommandType = CommandType.Text; cmd.Parameters.AddWithValue("CaseID", caseID); SqlDataReader read = cmd.ExecuteReader(); if (read.Read()) { Case result = new Case() { CaseID = Convert.ToInt32(read["Case_ID"]), CourtID = Convert.ToInt32(read["Court_ID"]), ReferralDate = read["Referral_Date"] as DateTime? ?? default(DateTime), ReferralNumber = Convert.ToInt32(read["Referral_Number"]), CourtDate = read["Court_Date"] as DateTime? ?? default(DateTime), DateOfFinalConference = read["Final_Conference_Date"] as DateTime? ?? default(DateTime), DateOfCompletion = read["Closure_Date"] as DateTime? ?? default(DateTime), Status = read["Status"].ToString(), District = Convert.ToInt32(read["District"]) }; result.GetOffenders(); result.GetVictims(); result.GetAffiliates(); result.GetNotes(); result.GetCharges(); result.GetDocuments(); result.GetCaseManagers(); return result; } } return null; }