/////////////////////////////////////////////////////////////////////////////////////
// CODE BEHIND FOR THE MONTGOMERY
COUNTY
AREA COURTS DOCKETS //
// WRITTEN BY JIM DUNNE
//
// JIM@DUNNES.NET
//
// COPYRIGHT 2006 - 2007
//
////////////////////////////////////////////////////////////////////////////////////
using System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Oxford.Web;
using
System.Web.Configuration;
using
System.Drawing;
using
System.Drawing.Text;
using
System.IO;
using
AjaxControlToolkit;
public
partial class
Pages_GBS_Reports_CaseSchedules_Index :
System.Web.UI.Page
{
//DECLARE GLOBAL OBJECTS
private System.Data.OracleClient.OracleConnection oconn_CaseHear;
private System.Data.OracleClient.OracleCommand oscomm_CaseHear;
private System.Data.OracleClient.OracleDataAdapter oda_CaseHear;
private ds_CaseHear ds_CaseHearDS;
protected System.Configuration.Configuration cnf_Config;
protected
ConnectionStringsSection css_Connection;
private System.Data.OracleClient.OracleConnection oconn_CaseSchedule;
private System.Data.OracleClient.OracleCommand oscomm_Select;
private System.Data.OracleClient.OracleDataAdapter oda_CaseSchedule;
private ds_CaseSchedule ds_CaseScheduleSet;
//GET A REFERENCE TO JDunneCoCMakeWebControls
JDunneCoCMakeWebControls cls_JDMWC = new
JDunneCoCMakeWebControls();
protected void
Page_Load(object sender,
EventArgs e)
{
//CALLED IF THIS IS THE INITIAL PAGE LOAD. SETS
UP THE USER INTERFACE FOR INITIAL USE
if (!IsPostBack)
{
//SET THE PAGE TITLE DEPENDING ON WHICH COURT
IS CONNECTING
Page.Title = "Judge's Docket - Area "
+ Request.QueryString["CourtID"].ToString();
//CREATE A NEW FONT COLLECTION
InstalledFontCollection installedFonts
= new
InstalledFontCollection();
//ITERATE THROUGH EACH FONT
foreach (FontFamily
fontFamily in installedFonts.Families)
{
//ADD THE FONT FAMILY TO THE "FONT" DROPDOWN
LIST
ddl_FontFamily.Items.Add(new
ListItem(fontFamily.GetName(0),
fontFamily.GetName(0)));
//IF VERDANA IS ONE OF THE FONT FAMILIES
if (fontFamily.GetName(0) ==
"Verdana")
//MAKE IT THE SELECTION IN THE DROPDOWN LIST
ddl_FontFamily.Items.FindByText("Verdana").Selected
= true;
//fontFamily.GetName(0);
}
//MAKE THE MOUSE ARROW A POINTER WHEN HOVERING
OVER THE "RESET" BUTTON
btn_ResetHearingTypes.Attributes.Add("onmouseover",
"this.style.cursor='pointer'");
//SET THE TITLE OF THE APPLICATION, DEPENDING
ON THE COURT
lbl_Court.Text = "Judges' Docket - Area " +
Request.QueryString["CourtID"].ToString();
//SET THE "Date To: (optional)" LABEL TEXT
lbl_DateToHeader.Text = "Date To: <font
size='1'>(optional)</font> ";
//CREATE NEW LISTITEMCOLLECTIONS TO POPULATE
DROPDOWN LISTS
ListItemCollection lic_Judges =
new
ListItemCollection();
ListItemCollection lic_Prosecutors =
new
ListItemCollection();
//ADD "All" TO THE TOP OF THE COLLECTIONS
lic_Judges.Add(new
ListItem("All",
"%"));
lic_Prosecutors.Add(new
ListItem("All",
"All"));
//GET A REFERENCE TO WEB.CONFIG
cnf_Config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
//GET A REFERENCE TO THE "CONNECTIONSTRINGS"
SECTION
css_Connection =
(ConnectionStringsSection)cnf_Config.GetSection("connectionStrings");
//IF THIS IS A REQUEST FOR AREA 2
if (Request.QueryString["CourtID"].ToString() ==
"2")
{
//SET THE CASE HEARINGS CONNECTION TO THE AREA
2 CONNECTION
oconn_CaseHear.ConnectionString =
css_Connection.ConnectionStrings["******"].ConnectionString;
//ADD AREA 2 JUDGES TO THE COLLECTION
lic_Judges.Add(new
ListItem("James
D. Piergies", "2"));
lic_Judges.Add(new
ListItem("James
A. Hensley, Jr.", "3"));
lic_Judges.Add(new
ListItem("Required",
"4"));
//ADD AREA 2 PROSECUTORS TO THE COLLECTION
lic_Prosecutors.Add(new
ListItem("Brunk",
"Brunk"));
lic_Prosecutors.Add(new
ListItem("Coughlin",
"Coughlin"));
lic_Prosecutors.Add(new
ListItem("Dundes",
"Dundes"));
lic_Prosecutors.Add(new
ListItem("Fleming",
"Fleming"));
lic_Prosecutors.Add(new
ListItem("McGinnis",
"McGinnis"));
lic_Prosecutors.Add(new
ListItem("Spears",
"Spears"));
}
//ELSE, IF THIS IS A REQUEST FOR AREA 1
else if
(Request.QueryString["CourtID"].ToString() ==
"1")
{
//SET THE CASE HEARINGS CONNECTION TO THE AREA
1 CONNECTION
oconn_CaseHear.ConnectionString =
css_Connection.ConnectionStrings["*****"].ConnectionString;
//ADD AREA 1 JUDGES TO THE COLLECTION
lic_Judges.Add(new
ListItem("James
L. Manning", "2"));
lic_Judges.Add(new
ListItem("Connie
S. Price", "4"));
lic_Judges.Add(new
ListItem("Adele
Riley", "65"));
lic_Judges.Add(new
ListItem("James
A. Hensley, Sr.", "3"));
lic_Judges.Add(new
ListItem("Required",
"5"));
//ADD AREA 1 PROSECUTORS TO THE COLLECTION
lic_Prosecutors.Add(new
ListItem("Brinkman",
"Brinkman"));
lic_Prosecutors.Add(new
ListItem("Brunk",
"Brunk"));
lic_Prosecutors.Add(new
ListItem("Coughlin",
"Coughlin"));
lic_Prosecutors.Add(new
ListItem("Dundes",
"Dundes"));
lic_Prosecutors.Add(new
ListItem("McGinnis",
"McGinnis"));
lic_Prosecutors.Add(new
ListItem("Nortman",
"Nortman"));
lic_Prosecutors.Add(new
ListItem("Spears",
"Spears"));
lic_Prosecutors.Add(new
ListItem("Startzman",
"Startzman"));
}
//SET THE JUDGES' DROPDOWN LIST DATA SOURCE TO
THE JUDGES LISTITEMCOLLECTION
ddl_Judges.DataSource = lic_Judges;
ddl_Judges.DataTextField = "text";
ddl_Judges.DataValueField = "value";
//BIND THE DROPDOWN LIST TO THE DATASOURCE
ddl_Judges.DataBind();
//SELECT "All" AS THE DEFAULT ITEM
ddl_Judges.Items.FindByText("All").Selected
= true;
//ADD "None" TO THE SECOND JUDGE DROPDOWN LIST
ddl_SecondJudge.Items.Add(new
ListItem("None",
""));
//APPEND DATBOUND ITEMS TO THE END OF THE LIST
ddl_SecondJudge.AppendDataBoundItems = true;
//SET THE SECOND JUDGES' DROPDOWN LIST DATA
SOURCE TO THE JUDGES LISTITEMCOLLECTION
ddl_SecondJudge.DataSource = lic_Judges;
ddl_SecondJudge.DataTextField = "text";
ddl_SecondJudge.DataValueField = "value";
//BIND THE DROPDOWN LIST TO THE DATASOURCE
ddl_SecondJudge.DataBind();
//REMOVE THE "All" ITEM FROM THE DROPDOWN LIST
ddl_SecondJudge.Items.Remove(ddl_SecondJudge.Items.FindByText("All"));
//SELECT "None" AS THE DEFAULT ITEM
ddl_SecondJudge.Items.FindByText("None").Selected
= true;
//SET THE PROSECUTOR'S DROPDOWN LIST DATA
SOURCE TO THE PROSECUTORS LISTITEMCOLLECTION
ddl_Prosecutor.DataSource = lic_Prosecutors;
ddl_Prosecutor.DataTextField = "text";
ddl_Prosecutor.DataValueField = "value";
//BIND THE DROPDOWN LIST TO THE DATASOURCE
ddl_Prosecutor.DataBind();
//SELECT "All" AS THE DEFAULT ITEM
ddl_Prosecutor.Items.FindByText("All").Selected = true;
//FILL THE ORACLE DATA ADAPTER FOR THE HEARING
TYPES
oda_CaseHear.Fill(ds_CaseHearDS);
//ADD "All" TO THE TOP OF THE DROPDOWN LIST
ddl_HearingType.Items.Insert(0, new
ListItem("All",
"%"));
//APPEND DATBOUND ITEMS TO THE END OF THE LIST
ddl_HearingType.AppendDataBoundItems = true;
//SET THE HEARING TYPE DROPDOWN LIST DATA
SOURCE TO THE "HEARINGS" TABLE IN THE DATASET
ddl_HearingType.DataSource = ds_CaseHearDS.Tables["HEARINGS"];
//SET THE DATA FIELDS THAT WILL POPULATE THE
TEXT AND VALUE FIELDS
ddl_HearingType.DataTextField = "HEARING";
ddl_HearingType.DataValueField = "HEARING_ID";
//BIND THE DROPDOWN LIST TO THE DATASOURCE
ddl_HearingType.DataBind();
//SELECT "All" AS THE DEFAULT ITEM
ddl_HearingType.Items.FindByText("All").Selected
= true;
//ADD "None" TO THE TOP OF THE SECOND HEARING
DROPDOWN LIST
ddl_SecondHearingType.Items.Insert(0, new
ListItem("None",
""));
ddl_SecondHearingType.AppendDataBoundItems =
true;
ddl_SecondHearingType.DataSource = ds_CaseHearDS.Tables["HEARINGS"];
ddl_SecondHearingType.DataTextField =
"HEARING";
ddl_SecondHearingType.DataValueField =
"HEARING_ID";
ddl_SecondHearingType.DataBind();
//SELECT "None" AS THE DEFAULT ITEM
ddl_SecondHearingType.Items.FindByText("None").Selected
= true;
//ADD "None" TO THE TOP OF THE THIRD HEARING
DROPDOWN LIST
ddl_ThirdHearingType.Items.Insert(0, new
ListItem("None",
""));
ddl_ThirdHearingType.AppendDataBoundItems = true;
ddl_ThirdHearingType.DataSource = ds_CaseHearDS.Tables["HEARINGS"];
ddl_ThirdHearingType.DataTextField =
"HEARING";
ddl_ThirdHearingType.DataValueField =
"HEARING_ID";
ddl_ThirdHearingType.DataBind();
//SELECT "None" AS THE DEFAULT ITEM
ddl_ThirdHearingType.Items.FindByText("None").Selected
= true;
//ADD "None" TO THE TOP OF THE FOURTH HEARING
DROPDOWN LIST
ddl_FourthHearingType.Items.Insert(0, new
ListItem("None",
""));
ddl_FourthHearingType.AppendDataBoundItems =
true;
ddl_FourthHearingType.DataSource = ds_CaseHearDS.Tables["HEARINGS"];
ddl_FourthHearingType.DataTextField =
"HEARING";
ddl_FourthHearingType.DataValueField =
"HEARING_ID";
ddl_FourthHearingType.DataBind();
//SELECT "None" AS THE DEFAULT ITEM
ddl_FourthHearingType.Items.FindByText("None").Selected
= true;
//ADD "None" TO THE TOP OF THE FIFTH HEARING
DROPDOWN LIST
ddl_FifthHearingType.Items.Insert(0, new
ListItem("None",
""));
ddl_FifthHearingType.AppendDataBoundItems = true;
ddl_FifthHearingType.DataSource = ds_CaseHearDS.Tables["HEARINGS"];
ddl_FifthHearingType.DataTextField =
"HEARING";
ddl_FifthHearingType.DataValueField =
"HEARING_ID";
ddl_FifthHearingType.DataBind();
//SELECT "None" AS THE DEFAULT ITEM
ddl_FifthHearingType.Items.FindByText("None").Selected
= true;
//SELECT "All" AS THE DEFAULT ITEM IN THE "Case
Type:" DROPDOWN LIST
ddl_CaseType.Items.FindByText("All").Selected
= true;
//DON'T SHOW ADDRESS
chkbx_Address.Checked = false;
//DON't SHOW VIOLATION CODE
chkbx_ViolationCode.Checked = false;
//IF THE REQUEST COMES FROM AREA 1
if (cls_JDMWC.GetCourtIDByIP(this) == 1)
//DON'T SHOW "Room:"
chkbx_Room.Checked = false;
else
//ALL OTHER REQUESTS
//SHOW "Room:"
chkbx_Room.Checked = true;
//CLEAR ANY SELECTED DATES IN THE "Date From:"
CALENDAR
cal_DateTo.SelectedDates.Clear();
//SET THE SELECTED DATE TO TODAY
cal_DateFrom.SelectedDate = DateTime.Now;
//PUT TODAY'S DATE IN THE TEXTBOX ABOVE THE
CALENDAR
tb_FromDate.Text = DateTime.Now.ToString("dd MMM yyyy");
//THE INITIAL PAGE LOAD...GET TODAY'S DOCKET
GetReport();
}
}
//CALLED WHEN A DIFFERENT DATE IS SELECTED ON THE
"Date From:" CALENDAR
protected void
cal_DateFrom_SelectionChanged(object sender,
EventArgs e)
{
//PUT THAT DATE IN THE TEXTBOX ABOVE THE
CALENDAR
tb_FromDate.Text = cal_DateFrom.SelectedDate.ToString("dd MMM yyyy");
//GET THAT DAY'S DOCKET
GetReport();
}
//CALLED WHEN A DIFFERENT DATE IS SELECTED ON THE
"Date To:" CALENDAR
protected void
cal_DateTo_SelectionChanged(object sender,
EventArgs e)
{
//PUT THAT DATE IN THE TEXTBOX ABOVE THE
CALENDAR
tb_DateTo.Text = cal_DateTo.SelectedDate.ToString("dd MMM yyyy");
//PUT THAT DATE INTO THE POPUP CONTROL EXTENDER
FOR THE TEXTBOX ABOVE THE CALENDAR
puce_DateTo.Commit(cal_DateTo.SelectedDate.ToString("dd MMM yyyy"));
//IF A
DATE
RANGE IS SELECTED, DISABLE THE TIME
RANGE DROPDOWNS
ddl_FromTime.Enabled = false;
ddl_ToTime.Enabled = false;
//GET THE DOCKET FOR THAT
DATE RANGE
GetReport();
}
//CREATES THE REPORT HEADER BASED ON USER INPUT, THEN
GETS THE DOCKET
//AND FINISHES CREATING THE HEADER
protected void
GetReport()
{
//MAKE THE "NO RESULTS" ERROR LABEL INVISIBLE
lbl_NoResults.Visible = false;
//IF THERE IS A DATE SELECTED IN THE "Date To:"
CALENDAR
if (cal_DateTo.SelectedDates.Count != 0)
{
//IF THE DATE IN THE "Date To:" CALENDAR IS
LESS THAN THE
//DATE IN THE "Date From:" CALENDAR
if
(cal_DateTo.SelectedDate.CompareTo(cal_DateFrom.SelectedDate) <= 0)
{
//SHOW THE MODAL POPUP DIALOG WITH THE ERROR
MESSAGE
mpe_Dates.Show();
//STOP GETTING THE DOCKET AND RETURN
return;
}
}
string str_CaseTypeName =
"";
//IF THE CASE TYPE DROPDOWN LIST IS SET TO
"Civil"
if (ddl_CaseType.SelectedValue ==
"CIVIL")
//SET str_CaseTypeName
str_CaseTypeName = "Civil";
//ELSE IF THE CASE TYPE DROPDOWN LIST IS SET TO
"Traffic Criminal"
else if
(ddl_CaseType.SelectedValue == "TRCR")
//SET str_CaseTypeName
str_CaseTypeName = "Traffic/Criminal";
else
//ELSE, str_CaseTypeName IS THE VALUE SELECTED
IN THE DROPDOWN LIST
str_CaseTypeName = ddl_CaseType.SelectedValue;
//IF THIS IS A REQUEST FOR AREA 1
if (Request.QueryString["CourtID"].ToString() ==
"1")
//SET THE REPORT HEADER
lbl_CourtHeader.Text = "Montgomery County
Court Area 1";
//ELSE IF THIS IS A REQUEST FOR AREA 2
else if
(Request.QueryString["CourtID"].ToString() ==
"2")
//SET THE REPORT HEADER
lbl_CourtHeader.Text = "Montgomery County
Court Area 2";
//SET str_HearingTypes TO THE VALUE OF THE
HEARING TYPE DROPDOWN LIST
string str_HearingTypes =
ddl_HearingType.SelectedItem.ToString();
//IF "None" IS NOT SELECTED IN THE SECOND
HEARING TYPE DROPDOWN LIST
if
(ddl_SecondHearingType.SelectedItem.ToString() !=
"None")
//ADD A COMMA AND THE HEARING TYPE TO THE END
OF str_HearingTypes
str_HearingTypes = str_HearingTypes + ", "
+ ddl_SecondHearingType.SelectedItem.ToString();
//IF "None" IS NOT SELECTED IN THE THIRD
HEARING TYPE DROPDOWN LIST
if
(ddl_ThirdHearingType.SelectedItem.ToString() !=
"None")
//ADD A COMMA AND THE HEARING TYPE TO THE END
OF str_HearingTypes
str_HearingTypes = str_HearingTypes + ", "
+ ddl_ThirdHearingType.SelectedItem.ToString();
//IF "None" IS NOT SELECTED IN THE FOURTH
HEARING TYPE DROPDOWN LIST
if
(ddl_FourthHearingType.SelectedItem.ToString() !=
"None")
//ADD A COMMA AND THE HEARING TYPE TO THE END
OF str_HearingTypes
str_HearingTypes = str_HearingTypes + ", "
+ ddl_FourthHearingType.SelectedItem.ToString();
//IF "None" IS NOT SELECTED IN THE FIFTH
HEARING TYPE DROPDOWN LIST
if
(ddl_FifthHearingType.SelectedItem.ToString() !=
"None")
//ADD A COMMA AND THE HEARING TYPE TO THE END
OF str_HearingTypes
str_HearingTypes = str_HearingTypes + ", "
+ ddl_FifthHearingType.SelectedItem.ToString();
//IF THE WORD "Hearing" APPEARS IN THE HEARING
TYPE,
//REPLACE IT WITH A ", ", DON'T WANT IT
str_HearingTypes = str_HearingTypes.Replace("Hearing",
"");
string str_Judges =
"";
//IF THERE IS A SECOND JUDGE SELECTED
if (ddl_SecondJudge.SelectedValue !=
"")
//str_Judges IS FIRST JUDGE'S NAME, SECOND
JUDGE'S NAME
str_Judges = ddl_Judges.SelectedItem.ToString() +
", " +
ddl_SecondJudge.SelectedItem.ToString();
else
//str_Judges IS JUST THE FIRST JUDGE'S NAME
str_Judges = ddl_Judges.SelectedItem.ToString();
//FORMAT THE "Judge: Hearing Type: Prosecutor:"
LINE
lbl_Judge.Text = "Judge: <b>" +
str_Judges +
"</b> Hearing Type:
<b>" + str_HearingTypes + "</b>" +
"</b> Prosecutor: <b>"
+
ddl_Prosecutor.SelectedValue + "</b>";
;
//FORMAT THE DATE HEADER LINE
//IF NO "TO:" DATE HAS BEEN SELECTED
if (tb_DateTo.Text ==
"")
//DROP DOWN A LINE, ADD THE DATE AND A LINE
BREAK
lbl_Dates.Text = "<b>" +
DateTime.Parse(tb_FromDate.Text).ToString("MMMM dd, yyyy") +
"</b>";
else //A "TO:"
DATE IS SELECTED
//DATE HEADER REFLECTS THE DATE RANGE
lbl_Dates.Text = "From: <b>" +
tb_FromDate.Text +
"</b> to <b>" + tb_DateTo.Text +
"</b>";
//GET THE DOCKET DATA AND FORMAT THE GRIDVIEW
BindGrid();
//IF NO DATA WAS RETURNED
if (gv_CaseSchedule.Rows.Count == 0)
{
//THE REPORT SECTION OF THE PAGE IS INVISIBLE
tbl_Report.Visible = false;
//NO RESULTS MESSAGE IS VISIBLE
lbl_NoResults.Visible = true;
}
else
//ELSE, DATA WAS RETURNED
//THE REPORT SECTION IS VISIBLE
tbl_Report.Visible = true;
//IF "All" IS NOT SELECTED IN THE "Case Type:"
DROPDOWN LIST
if (ddl_CaseType.SelectedValue !=
"%")
//FORMAT THE SCHEDULED CASES LINE, SHOWING TYPE
OF CASE SELECTED AND NUMBER OF CASES
lbl_ScheduledCases.Text = "Scheduled <b>"
+ str_CaseTypeName +
"</b> Cases <font size=2>(<b>" +
gv_CaseSchedule.Rows.Count.ToString() +
" Cases)</b></font>";
else
//"All" IS SELECTED IN THE "Case Type:"
DROPDOWN LIST
//FORMAT THE SCHEDULED CASES LINE, SHOWING "All
Scheduled Cases" AND NUMBER OF CASES
lbl_ScheduledCases.Text = "<b>All</b>
Scheduled Cases <font size=2>(<b>" +
gv_CaseSchedule.Rows.Count.ToString() +
" Cases)</b></font>";
}
//GETS THE INPUT PARAMETERS FROM VARIOUS CONTROLS,
FORMATS THE GRIDVIEW BASED ON
//USER CHOICES, AND GETS THE DATA FROM THE DATABASE
AND FORMATS IT FOR THE GRIDVIEW
private void
BindGrid()
{
//GET A REFERENCE TO WEB.CONFIG
cnf_Config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
//GET A REFERENCE TO THE "CONNECTIONSTRINGS"
SECTION
css_Connection =
(ConnectionStringsSection)cnf_Config.GetSection("connectionStrings");
//IF THIS IS A REQUEST FOR AREA 1
if (Request.QueryString["CourtID"].ToString() ==
"1")
//SET THE CASE HEARINGS CONNECTION TO THE AREA
1 CONNECTION
oconn_CaseSchedule.ConnectionString =
css_Connection.ConnectionStrings["*****"].ConnectionString;
//ELSE IF THIS IS A REQUEST FOR AREA 2
else if
(Request.QueryString["CourtID"].ToString() ==
"2")
//SET THE CASE HEARINGS CONNECTION TO THE AREA
2 CONNECTION
oconn_CaseSchedule.ConnectionString =
css_Connection.ConnectionStrings["*****"].ConnectionString;
//SET THE JUDGEID PARAMETER TO THE VALUE OF THE
JUDGES DROPDOWN LIST
oscomm_Select.Parameters["JUDGEID"].Value
=
ddl_Judges.SelectedValue;
//SET THE SECONDJUDGEID PARAMETER TO THE VALUE
OF THE SECOND JUDGE DROPDOWN LIST
oscomm_Select.Parameters["SECONDJUDGEID"].Value
=
ddl_SecondJudge.SelectedValue;
//SET THE PROSECUTORINPUT PARAMETER TO THE
VALUE OF THE PROSECUTOR DROPDOWN LIST
oscomm_Select.Parameters["PROSECUTORINPUT"].Value
=
ddl_Prosecutor.SelectedValue;
//SET THE TIMETO PARAMETER TO THE VALUE OF
"TO:" DROPDOWN LIST
oscomm_Select.Parameters["TIMETO"].Value
=
ddl_ToTime.SelectedValue;
//SET THE TIMEFROM PARAMETER TO THE VALUE OF
"FROM:" DROPDOWN LIST
oscomm_Select.Parameters["TIMEFROM"].Value
=
ddl_FromTime.SelectedValue;
//SET THE CASETYPE PARAMETER TO THE VALUE OF
THE "Case Type:" DROPDOWN LIST
oscomm_Select.Parameters["CASETYPE"].Value
=
ddl_CaseType.SelectedValue;
//SET THE HEARINGID PARAMETER TO THE VALUE OF
THE "Hearing Type:" DROPDOWN LIST
oscomm_Select.Parameters["HEARINGID"].Value
=
ddl_HearingType.SelectedValue;
//SET THE SECONDHEARINGID PARAMETER TO THE
VALUE OF THE SECOND "Hearing Type:" DROPDOWN LIST
oscomm_Select.Parameters["SECONDHEARINGID"].Value
=
ddl_SecondHearingType.SelectedValue;
//SET THE THIRDHEARINGID PARAMETER TO THE VALUE
OF THE THIRD "Hearing Type:" DROPDOWN LIST
oscomm_Select.Parameters["THIRDHEARINGID"].Value
=
ddl_ThirdHearingType.SelectedValue;
//SET THE FOURTHHEARINGID PARAMETER TO THE
VALUE OF THE FOURTH "Hearing Type:" DROPDOWN LIST
oscomm_Select.Parameters["FOURTHHEARINGID"].Value
=
ddl_FourthHearingType.SelectedValue;
//SET THE FIFTHHEARINGID PARAMETER TO THE VALUE
OF THE FIFTH "Hearing Type:" DROPDOWN LIST
oscomm_Select.Parameters["FIFTHHEARINGID"].Value
=
ddl_FifthHearingType.SelectedValue;
//SET THE DATEFROM PARAMETER TO THE VALUE OF
THE "Date From:" TEXTBOX
oscomm_Select.Parameters["DATEFROM"].Value
= tb_FromDate.Text;
//IF THE "Date To:" TEXTBOX IS BLANK
if (tb_DateTo.Text ==
"")
//SET THE DATETO PARAMETER EQUAL TO THE VALUE
OF THE "Date From:" TEXTBOX
oscomm_Select.Parameters["DATETO"].Value
= tb_FromDate.Text;
else
//THE "Date To:" TEXTBOX IS NOT BLANK
{
//SET THE DATETO PARAMETER EQUAL TO THE VALUE
OF THE "Date To:" TEXTBOX
oscomm_Select.Parameters["DATETO"].Value
= tb_DateTo.Text;
//TIME RANGE VALUES ARE NULL WHEN A
DATE RANGE
IS ASSIGNED
oscomm_Select.Parameters["TIMETO"].Value
= "";
oscomm_Select.Parameters["TIMEFROM"].Value
= "";
}
//SET THE ADDRESSYN PARAMETER EQUAL TO THE
VALUE OF THE chkbx_Address CHECKBOX
oscomm_Select.Parameters["ADDRESSYN"].Value
= chkbx_Address.Checked.ToString();
//IF "All" IS NOT SELECTED IN THE "Judge:"
DROPDOWN LIST
if (ddl_Judges.SelectedValue.ToString()
!= "%")
//HIDE THE "Judge" COLUMN ON THE GRIDVIEW
gv_CaseSchedule.Columns[8].Visible = false;
//IF "All" IS NOT SELECTED IN THE "Hearing
Type:" DROPDOWN LIST AND
//THE SECOND "Hearing Type:" DROPDOWN LIST IS
NULL
if ((ddl_HearingType.SelectedValue !=
"%") &&
ddl_SecondHearingType.SelectedValue == "")
//ONLY ONE HEARING TYPE...HIDE THE "Hearing
Type" COLUMN ON THE GRIDVIEW
gv_CaseSchedule.Columns[7].Visible = false;
else
//MULTIPLE HEARING TYPES...SHOW THE "Hearing
Type" COLUMN ON THE GRIDVIEW
gv_CaseSchedule.Columns[7].Visible = true;
//IF "All" IS SELECTED IN THE "Case Type:"
DROPDOWN LIST
if (ddl_CaseType.SelectedValue ==
"%")
//BOTH CASE TYPES LISTED...SET THE HEADER OF
THE PARTIES
//COLUMN TO "Defendant/Parties"
gv_CaseSchedule.Columns[2].HeaderText =
"Defendant/Parties";
//ELSE IF "TRCR" IS SELECTED IN THE "Case
Type:" DROPDOWN LIST
else if
(ddl_CaseType.SelectedValue == "TRCR")
//TR/CR CASE...SET THE HEADER OF THE PARTIES
COLUMN TO "Defendant"
gv_CaseSchedule.Columns[2].HeaderText =
"Defendant";
//ELSE IF "CIVIL" IS SELECTED IN THE "Case
Type:" DROPDOWN LIST
else if
(ddl_CaseType.SelectedValue == "CIVIL")
//CIVIL CASE...SET THE HEADER OF THE PARTIES
COLUMN TO "Parties"
gv_CaseSchedule.Columns[2].HeaderText =
"Parties";
//IF THE chkbx_ViolationCode CHECKBOX IS
CHECKED
if (chkbx_ViolationCode.Checked)
//SHOW THE "Code" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[5].Visible = true;
else
//THE chkbx_ViolationCode CHECKBOX IS NOT
CHECKED
//HIDE THE "Code" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[5].Visible = false;
//IF THE chkbx_Violation CHECKBOX IS CHECKED
if (chkbx_Violation.Checked)
//SHOW THE "Violation" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[6].Visible = true;
else
//THE chkbx_Violation CHECKBOX IS NOT CHECKED
//HIDE THE "Violation" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[6].Visible = false;
//IF THE chkbx_Officer CHECKBOX IS CHECKED
if (chkbx_Officer.Checked)
//SHOW THE "Officer" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[12].Visible = true;
else
//THE chkbx_Officer CHECKBOX IS NOT CHECKED
//HIDE THE "Officer" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[12].Visible = false;
//IF THE "Date To:" TEXTBOX IS BLANK
if (tb_DateTo.Text ==
"")
//HIDE THE "Date:" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[0].Visible = false;
else
//THE "Date To:" TEXTBOX IS NOT BLANK
//SHOW THE "Date:" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[0].Visible = true;
//IF THE chkbx_Attorney CHECKBOX IS CHECKED
if (chkbx_Attorney.Checked)
//SHOW THE "Attorney" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[11].Visible = true;
else
//THE chkbx_Attorney CHECKBOX IS NOT CHECKED
//HIDE THE "Attorney" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[11].Visible = false;
//IF THE chkbx_Defendant CHECKBOX IS CHECKED
if (chkbx_Defendant.Checked)
//SHOW THE "Defendant" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[2].Visible = true;
else
//THE chkbx_Defendant CHECKBOX IS NOT CHECKED
//HIDE THE "Defendant" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[2].Visible = false;
//IF THE chkbx_Prosecutor CHECKBOX IS CHECKED
if (chkbx_Prosecutor.Checked)
//SHOW THE "Prosecutor" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[10].Visible = true;
else
//THE chkbx_Prosecutor CHECKBOX IS NOT CHECKED
//HIDE THE "Prosecutor" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[10].Visible = false;
//IF THE chkbx_Room CHECKBOX IS CHECKED
if (chkbx_Room.Checked)
//SHOW THE "Room" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[9].Visible = true;
else //THE chkbx_Room CHECKBOX IS NOT CHECKED
//HIDE THE "Room" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[9].Visible = false;
//IF THE chkbx_Judge CHECKBOX IS CHECKED
if (chkbx_Judge.Checked)
//SHOW THE "Judge" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[8].Visible = true;
else
//THE chkbx_Judge CHECKBOX IS NOT CHECKED
//HIDE THE "Judge" GRIDVIEW COLUMN
gv_CaseSchedule.Columns[8].Visible = false;
//CLEAR THE DATASET
ds_CaseScheduleSet.Clear();
//FILL THE DATASET USING THE ORACLE DATA
ADAPTER
oda_CaseSchedule.Fill(ds_CaseScheduleSet);
//CREATE A NEW DATATABLE BY CLONING THE
STRUCTURE OF THE
//CASESCHEDULE DATATABLE IN THE DATASET
DataTable dt_Combine =
ds_CaseScheduleSet.Tables["CaseSchedule"].Clone();
//IF THE CASESCHEDULE TABLE IN THE DATASET HAS
ANY ROWS
if(ds_CaseScheduleSet.Tables["CaseSchedule"].Rows.Count > 0)
{
//FOR EACH DATAROW IN THE CASESCHEDULE
DATATABLE
foreach (DataRow
dr_Results in ds_CaseScheduleSet.Tables["CaseSchedule"].Rows)
{
//CREATE AN EMPTY STRING
string str_Breaks =
"";
//FORMAT THE CASENUMBER COLUMN IN THE CURRENT
DATROW
dr_Results["CASENUMBER"] =
FormatCaseNumber(dr_Results["CASENUMBER"].ToString());
//IF THE USER DOESN'T WANT THE DEFENDANT NAME
IN BOLD,
//AND THE DEFENDANT NAME ISN'T EMPTY
if (!chkbx_DefendantBold.Checked &&
(dr_Results["DEFENDANTNAME"].ToString() !=
""))
{
//REMOVE ANY "BOLD" OPENING AND CLOSING HTML
TAGS IN THE DEFENDANT NAME
dr_Results["DEFENDANTNAME"]
= dr_Results["DEFENDANTNAME"].ToString().Replace("<B>", "");
dr_Results["DEFENDANTNAME"] =
dr_Results["DEFENDANTNAME"].ToString().Replace("</B>", "");
}
//CREATE A DATAROW ARRAY AND FILL IT WITH ROWS
FROM THE CLONED DATASET WHERE THE
//DEFENDANT'S NAME AND THE "From:" TIME ARE
EQUAL TO THOSE IN THE CURRENT DATAROW
//IN THE DATASET (CREATING A SUBSET OF CASES
WITH THE SAME DEFENDANT AND COURT TIME)
//BECAUSE WE DON'T WANT TO LIST CASES FOR THE
SAME DEFENDANT SEPARATELY
DataRow[] dra_Combine =
dt_Combine.Select("DEFENDANTNAME='" +
dr_Results["DEFENDANTNAME"] +
"'"
+ "AND FROMTIME='" + dr_Results["FROMTIME"] + "'");
//IF THERE WERE NO ROWS ALREADY IN dt_Combine
MATCHING THE QUERY PARAMETERS IN dr_Results
if(dra_Combine.Length == 0)
//THIS IS NOT A DUPLICATE, IMPORT THE CURRENT DATASET
ROW INTO dt_Combine
dt_Combine.ImportRow(dr_Results);
//ELSE, THERE ARE ROWS ALREADY IN dt_Combine
THAT MATCH THE QUERY PARAMETERS IN dr_Results
else
{
//IF THIS IS THE SAME CASE FOR A DEFENDANT,
IT'S A DUPLICATE
if (dra_Combine[0]["CASENUMBER"].ToString().Contains(dr_Results["CASENUMBER"].ToString()))
//SO, SKIP THE PROCESSING FOR DIFFERENT CASES
FOR THE SAME DEFENDANT
goto Duplicate;
//IF THE USER WANTS TO SEE THE VIOLATION
DESCRIPTION AND SECTION NUMBER
if (chkbx_Violation.Checked ||
chkbx_ViolationCode.Checked)
{
//CREATE A STRING CONTAINING THE VIOLATION
DESCRIPTION
string str_Violations = dra_Combine[0]["VIOLATIONDESCRIPTION"].ToString();
//CREATE A STRING CONTAINING THE CASE NUMBER
string str_CaseNumber = dra_Combine[0]["CASENUMBER"].ToString();
//CREATE INTEGER COUNTERS
int startIndexViolations = -1;
int startIndexCaseNumber = -1;
int hitCountViolations = 0;
int hitCountCaseNumber = 0;
//START LOOPING UNTIL A "break;" IS ENCOUNTERED
while (true)
{
//FIND ANY OCCURRENCES OF AN HTML LINE BREAK IN
THE VIOLATION DESCRIPTION STRING
//THIS INDICATES THERE ARE MULTIPLE VIOLATIONS
IN THIS STRING
startIndexViolations = str_Violations.IndexOf("<BR>", startIndexViolations + 1,
str_Violations.Length - startIndexViolations - 1);
//IF THERE ARE NO OCCURENCES
if (startIndexViolations < 0)
//BREAK OUT OF THE LOOP
break;
//ELSE, INCREMENT THE NUMBER OF VIOLATIONS
COUNTER
hitCountViolations++;
}
//START LOOPING UNTIL A "break;" IS ENCOUNTERED
while (true)
{
//FIND ANY OCCURRENCES OF AN HTML LINE BREAK IN
THE CASE NUMBER STRING
//THIS INDICATES THERE ARE
MULTIPLE CASE NUMBERS IN THIS STRING
startIndexCaseNumber = str_CaseNumber.IndexOf("<BR>", startIndexCaseNumber + 1,
str_CaseNumber.Length - startIndexCaseNumber - 1);
//IF THERE ARE NO OCCURENCES
if (startIndexCaseNumber < 0)
//BREAK OUT OF THE LOOP
break;
//ELSE, INCREMENT THE NUMBER OF CASE NUMBERS
COUNTER
hitCountCaseNumber++;
}
//SET AN INTEGER COUNTER
int n_Count = 0;
//WHILE THE COUNTER IS LESS
THAN THE VIOLATION COUNT MINUS THE CASE NUMBER COUNT
while (n_Count < (hitCountViolations -
hitCountCaseNumber))
{
//ADD AN HTML LINE BREAK TO THE END OF THE CASE
NUMBER
//IN THE FIRST ROW OF THE DATAROW ARRAY. THIS ADDS LINES IN THE "Case"
GRIDVIEW
//COLUMN UNDER THE CURRENT CASE NUMBER SO ALL
THE VIOLATIONS AND NUMBERS ON
//THAT CASE NUMBER WILL BE LISTED BEFORE THE
NEXT CASE NUMBER IS LISTED
dra_Combine[0]["CASENUMBER"] =
dra_Combine[0]["CASENUMBER"].ToString() +
"<BR>";
//INCREMENT THE COUNTER
n_Count++;
}
//MAKE str_Breaks AN HTML LINE BREAK
str_Breaks = "<BR>";
}
else
//THE USER DOESN'T WANT TO SEE THE VIOLATION
DESCRIPTIOIN AND SECTION NUMBER
//MAKE str_Breaks AN HTML LINE BREAK
str_Breaks = "<BR>";
//THE CASE NUMBER IN THE FIRST ROW OF THE
DATAROW ARRAY IS ITSELF PLUS
//AN HTML LINE BREAK PLUS THE CASE NUMBER IN
THE CURRENT ROW OF THE DATASET
dra_Combine[0]["CASENUMBER"] =
dra_Combine[0]["CASENUMBER"].ToString() +
str_Breaks +
dr_Results["CASENUMBER"].ToString();
//THE VIOLATION DESCRIPTION IN THE FIRST ROW OF
THE DATAROW ARRAY IS ITSELF PLUS
//AN HTML LINE BREAK PLUS THE VIOLATION
DESCRIPTION IN THE CURRENT ROW OF THE DATASET
dra_Combine[0]["VIOLATIONDESCRIPTION"]
= dra_Combine[0]["VIOLATIONDESCRIPTION"].ToString()
+
str_Breaks + dr_Results["VIOLATIONDESCRIPTION"].ToString();
//THE VIOLATION SECTION NUMBER IN THE FIRST ROW
OF THE DATAROW ARRAY IS ITSELF PLUS
//AN HTML LINE BREAK PLUS THE VIOLATION SECTION
NUMBER IN THE CURRENT ROW OF THE DATASET
dra_Combine[0]["VIOLATIONNUMBER"] =
dra_Combine[0]["VIOLATIONNUMBER"].ToString()
+
str_Breaks + dr_Results["VIOLATIONNUMBER"].ToString();
//IF THE PROSECUTOR LAST NAME FIELD IN THE
DATAROW ARRAY IS NOT NULL
if (dra_Combine[0]["PROSECUTORLASTNAME"].ToString() ==
"")
//THE PROSECUTOR LAST NAME FIELD IN THE DATAROW
ARRAY IS EQUAL TO
//THE PROSECUTOR LAST NAME IN THE CURRENT ROW
OF THE DATASET
dra_Combine[0]["PROSECUTORLASTNAME"] =
dr_Results["PROSECUTORLASTNAME"].ToString();
//IF THE ATTORNEY NAME FIELD IN THE DATAROW
ARRAY IS NOT NULL
if (dra_Combine[0]["ATTORNEY"].ToString() ==
"")
//THE ATTORNEY NAME FIELD IN THE DATAROW ARRAY
IS EQUAL TO
//THE ATTORNEY NAME IN THE CURRENT ROW OF
THE DATASET
dra_Combine[0]["ATTORNEY"] =
dr_Results["ATTORNEY"].ToString();
//IF THE OFFICER NAME FIELD IN THE DATAROW
ARRAY IS NOT NULL
if (dra_Combine[0]["OFFICERLASTNAME"].ToString() ==
"")
//THE OFFICER NAME FIELD IN THE DATAROW ARRAY
IS EQUAL TO
//THE OFFICER NAME IN THE CURRENT ROW OF THE
DATASET
dra_Combine[0]["OFFICERLASTNAME"] =
dr_Results["OFFICERLASTNAME"].ToString();
//"goto" LABEL
Duplicate:;
}
}
}
//CREATE A DATAVIEW FROM THE dt_Combine
DATATABLE DEFAULT VIEW
DataView dv_CaseSchedule =
dt_Combine.DefaultView;
//IF THE SORT EXPRESSION EXISTS
if (ViewState["SortExpression"] !=
null)
//SORT THE DATAVIEW BY THE SORT FIELD AND SORT
DIRECTION
dv_CaseSchedule.Sort = ViewState["SortExpression"].ToString()
+ " " +
ViewState["SortDirection"].ToString();
//SET THE DOCKET'S GRIDVIEW DATASOURCE TO THE
DATAVIEW
gv_CaseSchedule.DataSource = dv_CaseSchedule;
//BIND THE GRIDVIEW
gv_CaseSchedule.DataBind();
//SET THE GRIDVIEW'S HEADER FONT TO BOLD
gv_CaseSchedule.HeaderStyle.Font.Bold = true;
//SET THE GRIDVIEW'S HEADER FONT TO SIZE 10
gv_CaseSchedule.HeaderStyle.Font.Size =
FontUnit.Parse("10");
//SET THE GRIDVIEW'S HEADER BACKGROUND COLOR TO
SILVER
gv_CaseSchedule.HeaderStyle.BackColor = Color.Silver;
//SET THE GRIDVIEW'S FONT SIZE TO THE SIZE IN
THE "Size:" DROPDOWN LIST
gv_CaseSchedule.Font.Size = FontUnit.Point(Convert.ToInt32(ddl_FontSize.SelectedValue));
//SET THE GRIDVIEW'S FONT FAMILY NAME TO THE
NAME IN THE "Font:" DROPDOWN LIST
gv_CaseSchedule.Font.Name = ddl_FontFamily.SelectedValue;
lbl_CourtHeader.CssClass = "CourtHeader";
lbl_ScheduledCases.CssClass =
"CourtSubHeader";
}
//TAKES THE RAW CASE NUMBER AS AN ARGUMENT, FORMATS IT
FOR DISPLAY
//IN THE "Case" GRIDVIEW COLUMN, AND RETURNS THE
FORMATTED STRING
protected string
FormatCaseNumber(string str_TempCaseNumber)
{
int n_ZeroCount = -1;
//TAKE OFF THE FIRST TWO NUMBERS OF THE CASE
NUMBER YEAR
str_TempCaseNumber = str_TempCaseNumber.Substring(2, 10);
//INSERT AN HTML SPACE AFTER THE TWO-DIGIT YEAR
str_TempCaseNumber = str_TempCaseNumber.Insert(2,
" ");
//INSERT AN HTML SPACE AFTER THE CASE TYPE
str_TempCaseNumber = str_TempCaseNumber.Insert(11,
" ");
//WHILE THERE IS A ZERO AT THE BEGINNING NUMBER
PART OF THE CASE NUMBER
while (str_TempCaseNumber.Substring(17,
1) == "0")
{
//REMOVE THAT ZERO
str_TempCaseNumber = str_TempCaseNumber.Remove(17, 1);
//INCREMENT THE COUNTER THAT KEEPS TRACK OF HOW
MANY ZEROS WERE REMOVED
n_ZeroCount++;
}
//FOR THE NUMBER OF ZEROS REMOVED
for (int
i = 0; i < n_ZeroCount; i++)
//INSERT TWO HTML SPACES
str_TempCaseNumber = str_TempCaseNumber.Insert(17,
" ");
//ADD HTML TO MAKE THE CASE NUMBER RED AND BOLD
str_TempCaseNumber = "<font
color='#FF0000'><b>" + str_TempCaseNumber +
"</b></font>";
return str_TempCaseNumber;
}
//WHEN A ROW IS CREATED IN THE GRIDVIEW
protected void
gv_CaseSchedule_RowCreated(object sender,
GridViewRowEventArgs e)
{
//IF THIS IS A HEADER ROW
if (e.Row.RowType ==
DataControlRowType.Header)
{
//SET THE TOOLTIPS ON THE COLUMN HEADERS IN THE
GRIDVIEW
((LinkButton)e.Row.Cells[0].Controls[0]).ToolTip
= "Click Here To Sort By Date";
((LinkButton)e.Row.Cells[1].Controls[0]).ToolTip
= "Click Here To Sort By Time";
//IF "All" IS SELECTED IN THE "Case Type:"
DROPDOWN LIST
if (ddl_CaseType.SelectedValue ==
"%")
//SHOWING ALL CASES
((LinkButton)e.Row.Cells[2].Controls[0]).ToolTip
= "Click Here To Sort By Defendant/Parties";
//ELSE, IF "Traffic Criminal" IS SELECTED IN THE "Case
Type:" DROPDOWN LIST
else if
(ddl_CaseType.SelectedValue == "TRCR")
//SHOWING TRAFFIC/CRIMINAL CASES, USE
"Defendant"
((LinkButton)e.Row.Cells[2].Controls[0]).ToolTip
= "Click Here To Sort By Defendant";
//ELSE, IF "Civil" IS SELECTED IN THE "Case
Type:" DROPDOWN LIST
else if
(ddl_CaseType.SelectedValue == "CIVIL")
//SHOWING CIVIL CASES, USE "Parties"
((LinkButton)e.Row.Cells[2].Controls[0]).ToolTip
= "Click Here To Sort By Parties";
((LinkButton)e.Row.Cells[3].Controls[0]).ToolTip
= "Click Here To Sort By Case Number";
((LinkButton)e.Row.Cells[4].Controls[0]).ToolTip
= "Click Here To Sort By Case Description";
((LinkButton)e.Row.Cells[5].Controls[0]).ToolTip
= "Click Here To Sort By Violation Code";
((LinkButton)e.Row.Cells[6].Controls[0]).ToolTip
= "Click Here To Sort By Violation";
((LinkButton)e.Row.Cells[7].Controls[0]).ToolTip
= "Click Here To Sort By Hearing Type";
((LinkButton)e.Row.Cells[8].Controls[0]).ToolTip
= "Click Here To Sort By Judge";
((LinkButton)e.Row.Cells[9].Controls[0]).ToolTip
= "Click Here To Sort By Room Number";
((LinkButton)e.Row.Cells[10].Controls[0]).ToolTip
= "Click Here To Sort By Prosecutor";
((LinkButton)e.Row.Cells[11].Controls[0]).ToolTip
= "Click Here To Sort By Attorney";
((LinkButton)e.Row.Cells[12].Controls[0]).ToolTip
= "Click Here To Sort By Officer";
}
}
//CALLED WHEN DATA IS BOUND TO THE GRIDVIEW
protected void
gv_CaseSchedule_RowDataBound(object sender,
GridViewRowEventArgs e)
{
//IF THIS IS A DATAROW
if (e.Row.RowType ==
DataControlRowType.DataRow)
{
//IF THE "Time" TEXT STARTS WITH A ZERO
if (e.Row.Cells[1].Text.StartsWith("0"))
//TRIM THE ZERO OFF THE BEGINNING
e.Row.Cells[1].Text = e.Row.Cells[1].Text.TrimStart(new char[]{
'c', '0'
});
//REMOVE " Hearing" FROM THE "Hearing Type"
COLUMN
e.Row.Cells[7].Text = e.Row.Cells[7].Text.Replace(" Hearing", "");
//SHORTEN "Disposition/Sentencing" TO
"Disp/Sent" IN THE "Hearing Type" COLUMN
e.Row.Cells[7].Text = e.Row.Cells[7].Text.Replace("Disposition/Sentencing",
"Disp/Sent");
//REMOVE "Court Room " FROM THE "Room" GRIDVIEW
COLUMN
e.Row.Cells[9].Text = ((DataRowView)e.Row.DataItem)["ROOM"].ToString().Replace("Court Room ", "");
//REPLACE "Courtroom 1 " WITH "1" IN THE "Room"
GRIDVIEW COLUMN
e.Row.Cells[9].Text = e.Row.Cells[9].Text.Replace("Courtroom One", "1");
//IF THE "Defendant/Parties" GRIDVIEW COLUMN IS
NOT EMPTY
if (e.Row.Cells[2].Text !=
" ")
//DECODE THE TEXT INTO HTML
e.Row.Cells[2].Text = Server.HtmlDecode(e.Row.Cells[2].Text);
//IF THE "Attorney" GRIDVIEW COLUMN IS NOT
EMPTY
if (e.Row.Cells[11].Text !=
" ")
//DECODE THE TEXT INTO HTML
e.Row.Cells[11].Text = Server.HtmlDecode(e.Row.Cells[11].Text);
}
}
//CALLED WHEN THE HEADER SORT LINKBUTTONS ARE CLICKED
protected void
gv_CaseSchedule_Sorting(object sender,
GridViewSortEventArgs e)
{
//IF NO SORT FIELD HAS BEEN SET, THIS IS THE
FIRST SORT REQUEST
if (ViewState["SortExpression"] ==
null)
//WANT THE FIRST SORT TO BE ASCENDING, SO SET
THE SORT DIRECTION
ViewState["SortDirection"] =
"ASC";
//ELSE, IF THE SAME SORT HEADER IS BEING
CLICKED AGAIN
else if
(ViewState["SortExpression"].ToString() ==
e.SortExpression)
{
//IF NO SORT DIRECTION HAS BEEN SET
if (ViewState["SortDirection"] ==
null)
//SET THE SORT DIRECTION TO ASCENDING
ViewState["SortDirection"] =
"ASC";
else
//A SORT DIRECTION HAS BEEN SET
{
//IF THE SORT DIRECTION IS CURRENTLY ASCENDING
if (ViewState["SortDirection"].ToString() ==
"ASC")
//SET IT TO DESCENDING
ViewState["SortDirection"] =
"DESC";
else
//ELSE, THE SORT DIRECTION IS CURRENTLY
DESCENDING
//SET IT TO ASCENDING
ViewState["SortDirection"] =
"ASC";
}
}
//ELSE, A DIFFERENT SORT HEADER IS BEING
CLICKED
else if
(ViewState["SortExpression"].ToString() !=
e.SortExpression)
//SO SET THE SORT DIRECTION TO ASCENDING
ViewState["SortDirection"] =
"ASC";
//SET THE SORT FIELD TO THE SORT FIELD JUST
CLICKED
ViewState["SortExpression"] =
e.SortExpression;
//BIND THE GRIDVIEW
BindGrid();
}
//CALLED WHEN THE "Clear" BUTTON NEXT TO THE "Date
From:" TEXTBOX IS CLICKED
protected void
xpb_ClearDateFrom_Click(object sender,
ImageClickEventArgs e)
{
//CLEAR THE "Date From:" TEXTBOX
tb_FromDate.Text = "";
}
//CALLED WHEN THE "Clear" BUTTON NEXT TO THE "Date
To:" TEXTBOX IS CLICKED
protected void
xpb_ClearDateTo_Click(object sender,
ImageClickEventArgs e)
{
//CLEAR THE "Date To:" TEXTBOX
tb_DateTo.Text = "";
//NO DATE
RANGE IS REQUESTED, SO ENABLE THE
TIME RANGE
DROPDOWN LISTS
ddl_FromTime.Enabled = true;
ddl_ToTime.Enabled = true;
//CLEAR THE SELECTED DATE FORM THE DATE TO
CALENDAR
cal_DateTo.SelectedDates.Clear();
//REFRESH THE DOCKET
GetReport();
}
//CALLED WHEN THEN SELECTION IN THE "Hearing Type"
DROPDOWN LIST IS CHANGED
protected void
ddl_HearingType_SelectedIndexChanged(object
sender, EventArgs e)
{
//IF "All" IS SELECTED
if (ddl_HearingType.SelectedValue ==
"%")
{
//SET ALL THE OTHER "Hearing Type" DROPDOWN
LISTS TO "None"
//DE-SELECT THE SELECTION IN THE SECOND
"Hearing Type" DROPDOWN LIST
ddl_SecondHearingType.SelectedItem.Selected =
false;
//SELECT "None" IN THE SECOND "Hearing Type"
DROPDOWN LIST
ddl_SecondHearingType.Items.FindByText("None").Selected
= true;
//DO THE SAME FOR THE OTHER 3 "Hearing Type"
DROPDOWN LISTS
ddl_SecondHearingType.Enabled = false;
ddl_ThirdHearingType.SelectedItem.Selected =
false;
ddl_ThirdHearingType.Items.FindByText("None").Selected
= true;
ddl_ThirdHearingType.Enabled = false;
ddl_FourthHearingType.SelectedItem.Selected =
false;
ddl_FourthHearingType.Items.FindByText("None").Selected
= true;
ddl_FourthHearingType.Enabled = false;
ddl_FifthHearingType.SelectedItem.Selected =
false;
ddl_FifthHearingType.Items.FindByText("None").Selected
= true;
ddl_FifthHearingType.Enabled = false;
//CLEAR THE "Bench Docket:" CHECKBOX
chkbx_DRSS.Checked = false;
//ALL DONE, SKIP TO END
goto Finish;
}
else
//"All" IS NOT SELECTED
//ENABLE THE SECOND "Hearing Type:" DROPDOWN
LIST
ddl_SecondHearingType.Enabled = true;
//IF THE FIFTH "Hearing Type:" DROPDOWN LIST SELECTION
IS NOT "None"
//AND THE FOURTH "Hearing Type:" DROPDOWN LIST
SELECTION IS "None"
if
((ddl_FifthHearingType.SelectedItem.Text != "None")
&&
(ddl_FourthHearingType.SelectedItem.Text ==
"None"))
{
//DE-SELECT THE SELECTED ITEM IN THE FOURTH
DROPDOWN LIST
ddl_FourthHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE FOURTH DROPDOWN LIST
EQUAL TO THE SELECTION IN THE
//FIFTH DROPDOWN LIST
ddl_FourthHearingType.Items.FindByText(ddl_FifthHearingType.SelectedItem.Text).Selected
= true;
//DE-SELECT THE SELECTED ITEM IN THE FIFTH
DROPDOWN LIST
ddl_FifthHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE FIFTH DROPDOWN LIST
EQUAL TO "None"
ddl_FifthHearingType.Items.FindByText("None").Selected
= true;
}
//IF THE FOURTH "Hearing Type:" DROPDOWN LIST
SELECTION IS NOT "None"
//AND THE THIRD "Hearing Type:" DROPDOWN LIST
SELECTION IS "None"
if
((ddl_FourthHearingType.SelectedItem.Text != "None")
&&
(ddl_ThirdHearingType.SelectedItem.Text ==
"None"))
{
//DE-SELECT THE SELECTED ITEM IN THE THIRD
DROPDOWN LIST
ddl_ThirdHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE THIRD DROPDOWN LIST
EQUAL TO THE SELECTION IN THE
//FOURTH DROPDOWN LIST
ddl_ThirdHearingType.Items.FindByText(ddl_FourthHearingType.SelectedItem.Text).Selected
= true;
//DE-SELECT THE SELECTED ITEM IN THE FOURTH
DROPDOWN LIST
ddl_FourthHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE FOURTH DROPDOWN LIST
EQUAL TO "None"
ddl_FourthHearingType.Items.FindByText("None").Selected
= true;
}
//IF THE THIRD "Hearing Type:" DROPDOWN LIST
SELECTION IS NOT "None"
//AND THE SECOND "Hearing Type:" DROPDOWN LIST
SELECTION IS "None"
if
((ddl_ThirdHearingType.SelectedItem.Text != "None")
&&
(ddl_SecondHearingType.SelectedItem.Text ==
"None"))
{
//DE-SELECT THE SELECTED ITEM IN THE SECOND
DROPDOWN LIST
ddl_SecondHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE SECOND DROPDOWN LIST
EQUAL TO THE SELECTION IN THE
//THIRD DROPDOWN LIST
ddl_SecondHearingType.Items.FindByText(ddl_ThirdHearingType.SelectedItem.Text).Selected
= true;
//DE-SELECT THE SELECTED ITEM IN THE THIRD
DROPDOWN LIST
ddl_ThirdHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE THIRD DROPDOWN LIST
EQUAL TO "None"
ddl_ThirdHearingType.Items.FindByText("None").Selected
= true;
}
//IF THE SELECTED VALUE IN THE FIFTH DROPDOWN
LIST MATCHES THE SELECTED VALUE IN
//ANY OF THE OTHER FOUR DROPDOWN LISTS
if ((ddl_FifthHearingType.SelectedValue
== ddl_HearingType.SelectedValue)
|| (ddl_FifthHearingType.SelectedValue ==
ddl_SecondHearingType.SelectedValue)
|| (ddl_FifthHearingType.SelectedValue ==
ddl_ThirdHearingType.SelectedValue)
|| (ddl_FifthHearingType.SelectedValue ==
ddl_FourthHearingType.SelectedValue))
{
//REDUNDANT, DE-SELECT THE SELECTED ITEM IN THE
FIFTH DROPDOWN LIST
ddl_FifthHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE FIFTH DROPDOWN LIST
EQUAL TO "None"
ddl_FifthHearingType.Items.FindByText("None").Selected
= true;
}
//IF THE SELECTED VALUE IN THE FOURTH DROPDOWN
LIST MATCHES THE SELECTED VALUE IN
//DROPDOWN LISTS 1, 2, or 3
if ((ddl_FourthHearingType.SelectedValue
== ddl_HearingType.SelectedValue)
|| (ddl_FourthHearingType.SelectedValue ==
ddl_SecondHearingType.SelectedValue)
|| (ddl_FourthHearingType.SelectedValue ==
ddl_ThirdHearingType.SelectedValue))
{
//REDUNDANT, DE-SELECT THE SELECTED ITEM IN THE
FOURTH DROPDOWN LIST
ddl_FourthHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE FOURTH DROPDOWN LIST
EQUAL TO "None"
ddl_FourthHearingType.Items.FindByText("None").Selected
= true;
}
//IF THE SELECTED VALUE IN THE THIRD DROPDOWN
LIST MATCHES THE SELECTED VALUE IN
//DROPDOWN LISTS 1 or 2
if ((ddl_ThirdHearingType.SelectedValue
== ddl_HearingType.SelectedValue)
|| (ddl_ThirdHearingType.SelectedValue ==
ddl_SecondHearingType.SelectedValue))
{
//REDUNDANT, DE-SELECT THE SELECTED ITEM IN THE
THIRD DROPDOWN LIST
ddl_ThirdHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE THIRD DROPDOWN LIST
EQUAL TO "None"
ddl_ThirdHearingType.Items.FindByText("None").Selected
= true;
}
//IF THE SELECTED VALUE IN THE SECOND DROPDOWN LIST
MATCHES THE SELECTED VALUE IN
//DROPDOWN LIST 1
if (ddl_SecondHearingType.SelectedValue
== ddl_HearingType.SelectedValue)
{
//REDUNDANT, DE-SELECT THE SELECTED ITEM IN THE
SECOND DROPDOWN LIST
ddl_SecondHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE SECOND DROPDOWN LIST
EQUAL TO "None"
ddl_SecondHearingType.Items.FindByText("None").Selected
= true;
}
//IF "None" IS SELECTED IN THE FIFTH DROPDOWN
LIST
if
(ddl_FifthHearingType.SelectedItem.Text == "None")
//ENABLE IT
ddl_FifthHearingType.Enabled = true;
//IF "None" IS SELECTED IN THE FOURTH DROPDOWN
LIST
if
(ddl_FourthHearingType.SelectedItem.Text == "None")
{
//DE-SELECT THE SELECTED ITEM IN THE FIFTH
DROPDOWN LIST
ddl_FifthHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE FIFTH DROPDOWN LIST
EQUAL TO "None"
ddl_FifthHearingType.Items.FindByText("None").Selected
= true;
//DISABLE THE FIFTH DOPDOWN LIST
ddl_FifthHearingType.Enabled = false;
}
else
//"None" IS NOT SELECTED IN THE FOURTH DROPDOWN
LIST
//ENABLE THE FIFTH DOPDOWN LIST
ddl_FifthHearingType.Enabled = true;
//IF "None" IS SELECTED IN THE THIRD DROPDOWN
LIST
if
(ddl_ThirdHearingType.SelectedItem.Text == "None")
{
//DE-SELECT THE SELECTED ITEM IN THE FOURTH
DROPDOWN LIST
ddl_FourthHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE FOURTH DROPDOWN LIST
EQUAL TO "None"
ddl_FourthHearingType.Items.FindByText("None").Selected
= true;
//DISABLE THE FOURTH DOPDOWN LIST
ddl_FourthHearingType.Enabled = false;
}
else
//"None" IS NOT SELECTED IN THE THIRD DROPDOWN
LIST
//ENABLE THE FOURTH DOPDOWN LIST
ddl_FourthHearingType.Enabled = true;
//IF "None" IS SELECTED IN THE SECOND DROPDOWN
LIST
if
(ddl_SecondHearingType.SelectedItem.Text == "None")
{
//DE-SELECT THE SELECTED ITEM IN THE THIRD
DROPDOWN LIST
ddl_ThirdHearingType.SelectedItem.Selected =
false;
//SET THE SELECTION IN THE THIRD DROPDOWN LIST
EQUAL TO "None"
ddl_ThirdHearingType.Items.FindByText("None").Selected
= true;
//DISABLE THE THIRD DOPDOWN LIST
ddl_ThirdHearingType.Enabled = false;
}
else
//"None" IS NOT SELECTED IN THE SECOND DROPDOWN
LIST
//ENABLE THE THIRD DOPDOWN LIST
ddl_ThirdHearingType.Enabled = true;
//"goto" LABEL
Finish:
//REFRESH THE DOCKET
GetReport();
}
//CALLED WHEN THE SELECTION IN THE "Case Type:"
DROPDOWN LIST CHANGES
protected void
ddl_CaseType_SelectedIndexChanged(object sender,
EventArgs e)
{
//CLEAR THE "Officer:" CHECKBOX
chkbx_Officer.Checked = false;
//IF "All" IS SELECTED, SHOWING
TRAFFIC/CRIMINAL AND CIVIL CASES
if
(ddl_CaseType.SelectedValue.StartsWith("%"))
{
//SET VARIOUS CHECKBOXES BY DEFAULT FOR THIS
TYPE OF REPORT
chkbx_Defendant.Checked = true;
chkbx_Attorney.Checked = true;
chkbx_Prosecutor.Checked = true;
chkbx_Violation.Checked = true;
}
//IF "Civil" IS SELECTED, SHOWING CIVIL CASES
ONLY
else if
(ddl_CaseType.SelectedValue.StartsWith("C"))
{
//SET VARIOUS CHECKBOXES BY DEFAULT FOR THIS
TYPE OF REPORT
chkbx_Attorney.Checked = true;
//NO PROSECUTORS, VIOLATIONS, OR VIOLATIOIN
CODES IN CIVIL CASES
chkbx_Prosecutor.Checked = false;
chkbx_Violation.Checked = false;
chkbx_ViolationCode.Checked = false;
}
//IF "Traffic Criminal" IS SELECTED, SHOWING
TR/CR CASES ONLY
else if
(ddl_CaseType.SelectedValue.StartsWith("T"))
{
//SET VARIOUS CHECKBOXES BY DEFAULT FOR THIS
TYPE OF REPORT
chkbx_Defendant.Checked = true;
chkbx_Attorney.Checked = true;
chkbx_Prosecutor.Checked
= true;
chkbx_Violation.Checked = true;
}
//REFRESH THE DOCKET
GetReport();
}
//CALLED WHEN THE SELECTION IN THE "Prosecutor:"
DROPDOWN LIST CHANGES
protected void
ddl_Prosecutor_SelectedIndexChanged(object
sender, EventArgs e)
{
//IF "All" IS NOT SELECTED, SELECTING CASES FOR
A SINGLE PROSECUTOR
if (ddl_Prosecutor.SelectedValue !=
"All")
//DON'T NEED TO SHOW THE "Prosecutor" GRIDVIEW
COLUMN
chkbx_Prosecutor.Checked = false;
//ELSE, "All" IS SELECTED, SELECTING CASES FOR
ALL PROSECUTORS
else if
(ddl_Prosecutor.SelectedValue == "All")
//NEED TO SHOW THE "Prosecutor" GRIDVIEW COLUMN
chkbx_Prosecutor.Checked = true;
//REFRESH THE DOCKET
GetReport();
}
//CALLED WHEN THE SELECTION IN THE "Judge:" DROPDOWN
LIST CHANGES
protected void
ddl_Judges_SelectedIndexChanged(object sender,
EventArgs e)
{
//IF SELECTIONS IN BOTH JUDGE DROPDOWN LISTS
ARE THE SAME
if (ddl_Judges.SelectedValue ==
ddl_SecondJudge.SelectedValue)
{
//REDUNDANT, DE-SELECT THE SELECTED ITEM IN THE
SECOND JUDGE DROPDOWN LIST
ddl_SecondJudge.SelectedItem.Selected = false;
//SET THE SELECTION IN THE SECOND JUDGE
DROPDOWN LIST EQUAL TO "None"
ddl_SecondJudge.Items.FindByText("None").Selected
= true;
}
//IF "All" IS SELECTED, SELECTING CASES FOR ALL
JUDGES
if (ddl_Judges.SelectedValue ==
"%")
{
//SET THE "Judge:" CHECKBOX TO TRUE, NEED TO
SHOW "Judge" GRIDVIEW COLUMN
chkbx_Judge.Checked = true;
//DE-SELECT THE SELECTED ITEM IN THE SECOND
JUDGE DROPDOWN LIST
ddl_SecondJudge.SelectedItem.Selected = false;
//SET THE SELECTION IN THE SECOND JUDGE
DROPDOWN LIST EQUAL TO "None"
ddl_SecondJudge.Items.FindByText("None").Selected
= true;
//DISABLE THE SECOND JUDGE DROPDOWN
ddl_SecondJudge.Enabled = false;
}
else
//ELSE, "All" IS NOT SELECTED
{
//A SINGLE JUDGE ONLY, DON'T NEED TO SHOW THE
"Judge" GRIDVIEW COLUMN
chkbx_Judge.Checked = false;
//ENABLE THE SECOND JUDGE DROPDOWN IN CASE THE
USER WANTS TO SELECT ANOTHER JUDGE
ddl_SecondJudge.Enabled = true;
}
//IF "None" IS NOT SELECTED IN THE SECOND JUDGE
DROPDOWN LIST
if (ddl_SecondJudge.SelectedValue !=
"")
//2 JUDGES, NEED TO SHOW THE "Judge" GRIDVIEW
COLUMN
chkbx_Judge.Checked = true;
//REFRESH THE DOCKET
GetReport();
}
//GENERIC CHECKBOX HANDLER FOR THOSE WITHOUT A
SPECIFIC TASK
protected void
CheckBox_CheckedChanged(object sender,
EventArgs e)
{
//REFRESH THE DOCKET
GetReport();
}
//CALLED WHEN THE SELECTION IN THE "Font:" DROPDOWN
LIST CHANGES
protected void
ddl_FontFamily_SelectedIndexChanged(object
sender, EventArgs e)
{
//SET THE FONT ON THE GRIDVIEW EQUAL TO THE
FONT NAME IN THE DROPDOWN LIST
gv_CaseSchedule.Font.Name = ddl_FontFamily.SelectedValue;
//CHANGE THE FONT ON THE REPORT HEADER
ChangeHeaderFont();
}
//CALLED WHEN THE SELECTION IN THE "Size:" DROPDOWN
LIST CHANGES
protected void
ddl_FontSize_SelectedIndexChanged(object sender,
EventArgs e)
{
//SET THE FONT SIZE IN THE GRIDVIEW EQUAL TO
THE FONT SIZE IN THE DROPDOWN LIST
gv_CaseSchedule.Font.Size = FontUnit.Point(Convert.ToInt32(ddl_FontSize.SelectedValue));
}
//IF THE USER SELECTS A DIFFERENT FONT, SET THAT FONT
ON THE HEADER ITEMS IN THE REPORT
protected void
ChangeHeaderFont()
{
//CREATE A NEW FONT FAMILY BASED ON THE FONT
SELECTED IN THE DROPDOWN LIST
FontFamily ff_lblCourt =
new FontFamily(ddl_FontFamily.SelectedValue);
//SET THE FONT FOR THE HEADER ITEMS TO THE
CURRENTLY SELECTED FONT
lbl_CourtHeader.Font.Name = ff_lblCourt.GetName(0);
lbl_Judge.Font.Name = ff_lblCourt.GetName(0);
lbl_Dates.Font.Name = ff_lblCourt.GetName(0);
lbl_ScheduledCases.Font.Name = ff_lblCourt.GetName(0);
}
//GENERIC HANDLER FOR THOSE DROPDOWNLISTS THAT DON'T
DO A SPECIFIC TASK, BUT
//NEED TO UPDATE THE GRIDVIEW (EXAMPLE: "From:" TIME)
protected void
DropDownLists_SelectedIndexChanged(object
sender, EventArgs e)
{
//REFRESH THE DOCKET
GetReport();
}
//CALLED WHEN THE "Print Report" BUTTON IS PUSHED
protected void
xpb_Print_Click(object sender,
ImageClickEventArgs e)
{
//CALL THE Print_Frame() FUNCTION ON THE SCRIPT
SIDE
Response.Write("<SCRIPT>javascript:Print_Frame('Main')</SCRIPT>");
}
//CALLED WHEN THE USER CLICKS THE "Edit Report(Word)"
BUTTON
//THIS FUNCTION SENDS THE CONTENTS OF THE REPORT TABLE
tbl_Header
//TO THE CLIENT, WHERE IT IS RECOGNIZED AS A WORD
DOCUMENT TYPE
protected void
xpb_Word_Click(object sender,
ImageClickEventArgs e)
{
//MAKE THE
COUNTY
LOGO INVISIBLE...DON'T WANT TO SEND IT
img_MCLogo.Visible = false;
//CLEAR THE BUFFER STREAM
Response.ClearContent();
//ADD THE FILENAME TO THE RESPONSE HEADER
Response.AddHeader("content-disposition",
"attachment; filename=Docket" +
tb_FromDate.Text + ".doc");
//SET THE MIME TYPE OF THE OUTPUT STREAM
Response.ContentType = "application/word";
//CREATE A NEW STRINGWRITER
StringWriter sw =
new StringWriter();
//CREATE A NEW HTMLTEXTWRITER FROM THE
STREAMWRITER
HtmlTextWriter htw =
new HtmlTextWriter(sw);
//OUTPUT THE CONTROL CONTENT TO THE
HTMLTEXTWRITER OBJECT
tbl_Header.RenderControl(htw);
//WRITE THE STRINGWRITER TO THE RESPONSE OUTPUT
STREAM
Response.Write(sw.ToString());
//SEND THE OUTPUT TO THE CLIENT AND END THE
REQUEST
Response.End();
}
//NECESSARY FOR THE FUNCTION ABOVE'S
"RenderControl(htw)" TO WORK WITHOUT THE
//"Control 'gv_CaseSchedule' of type 'GridView' must
be placed inside
//a form tag with runat=server." ERROR APPEARING
public override
void VerifyRenderingInServerForm(Control control)
{
}
//CALLED WHEN THE "Bench Docket:" CHECKBOX IS CLICKED
protected void
chkbx_DRSS_CheckedChanged(object sender,
EventArgs e)
{
//IF THE CHECKBOX HAS BEEN CHECKED
if (chkbx_DRSS.Checked)
{
//UNCHECK THE "Prosecutor:" CHECKBOX..CAN'T
HAVE BOTH CHECKED
chkbx_ProsecutorSetup.Checked = false;
//COURTS HAVE DIFFERENT BENCH DOCKETS, SO...
//IF THE CourtID PART OF THE QUERY STRING = 1,
AREA 1
if (Request.QueryString["CourtID"].ToString() ==
"1")
{
//SET THE "Hearing Type:" DROPDOWN LIST TO
"Disposition"
ddl_HearingType.SelectedItem.Selected =
false;
ddl_HearingType.Items.FindByText("Disposition").Selected
= true;
//SET THE SECOND "Hearing Type:" DROPDOWN LIST
TO "Sentencing"
ddl_SecondHearingType.SelectedItem.Selected =
false;
ddl_SecondHearingType.Items.FindByText("Sentencing").Selected
= true;
//ENABLE THE SECOND "Hearing Type:" DROPDOWN
LIST
ddl_SecondHearingType.Enabled = true;
//SET THE THIRD "Hearing Type:" DROPDOWN LIST
TO "Probation Revocation"
ddl_ThirdHearingType.SelectedItem.Selected =
false;
ddl_ThirdHearingType.Items.FindByText("Probation
Revocation").Selected = true;
//ENABLE THE THIRD "Hearing Type:" DROPDOWN
LIST
ddl_ThirdHearingType.Enabled = true;
//SET THE FOURTH "Hearing Type:" DROPDOWN LIST
TO "Status"
ddl_FourthHearingType.SelectedItem.Selected =
false;
ddl_FourthHearingType.Items.FindByText("Status").Selected
= true;
//ENABLE THE FOURTH "Hearing Type:" DROPDOWN
LIST
ddl_FourthHearingType.Enabled = true;
//SET THE FIFTH "Hearing Type:" DROPDOWN LIST
TO "Show Cause"
ddl_FifthHearingType.SelectedItem.Selected =
false;
ddl_FifthHearingType.Items.FindByText("Show
Cause").Selected = true;
//ENABLE THE FIFTH "Hearing Type:" DROPDOWN
LIST
ddl_FifthHearingType.Enabled = true;
}
//ELSE IF THE CourtID PART OF THE QUERY STRING
= 2, AREA 2
else if
(Request.QueryString["CourtID"].ToString() ==
"2")
{
//SET THE "Hearing Type:" DROPDOWN LIST TO
"Disposition/Sentencing"
ddl_HearingType.SelectedItem.Selected = false;
ddl_HearingType.Items.FindByText("Disposition/Sentencing").Selected
= true; ;
//SET THE SECOND "Hearing Type:" DROPDOWN LIST
TO "Prob Revocation Hearing"
ddl_SecondHearingType.SelectedItem.Selected =
false;
ddl_SecondHearingType.Items.FindByText("Prob
Revocation Hearing").Selected = true;
//ENABLE THE SECOND "Hearing Type:" DROPDOWN
LIST
ddl_SecondHearingType.Enabled = true;
//SET THE THIRD "Hearing Type:" DROPDOWN LIST
TO "Status Hearing"
ddl_ThirdHearingType.SelectedItem.Selected =
false;
ddl_ThirdHearingType.Items.FindByText("Status
Hearing").Selected = true;
//ENABLE THE THIRD "Hearing Type:" DROPDOWN
LIST
ddl_ThirdHearingType.Enabled = true;
//SET THE FOURTH "Hearing Type:" DROPDOWN LIST
TO "Show Cause Hearing"
ddl_FourthHearingType.SelectedItem.Selected =
false;
ddl_FourthHearingType.Items.FindByText("Show
Cause Hearing").Selected = true;
//ENABLE THE FOURTH "Hearing Type:" DROPDOWN
LIST
ddl_FourthHearingType.Enabled = true;
//SET THE FIFTH "Hearing Type:" DROPDOWN LIST
TO "Motion Hearing"
ddl_FifthHearingType.SelectedItem.Selected =
false;
ddl_FifthHearingType.Items.FindByText("Motion
Hearing").Selected = true;
//ENABLE THE FIFTH "Hearing Type:" DROPDOWN
LIST
ddl_FifthHearingType.Enabled = true;
}
//SHOW "Attorney" GRIDVIEW COLUMN
chkbx_Attorney.Checked = true;
//DON'T SHOW THESE GRIDVIEW COLUMNS
chkbx_Officer.Checked = false;
chkbx_Prosecutor.Checked = false;
chkbx_ViolationCode.Checked = false;
chkbx_Address.Checked = false;
chkbx_Room.Checked = false;
}
//ELSE, IF THE CHECKBOX HAS NOT BEEN CHECKED
else if
(!chkbx_DRSS.Checked)
{
//SET THE "Hearing Type:" DROPDOWN LIST
SELECTION TO "All"
ddl_HearingType.SelectedItem.Selected = false;
ddl_HearingType.Items.FindByText("All").Selected
= true;
//SIMULATE THE DROPDOWN LIST SELECTION BEING
CHANGED
ddl_HearingType_SelectedIndexChanged(sender, e);
//RETURN, ddl_HearingType_SelectedIndexChanged
WILL UPDATE THE DOCKET
return;
}
//REFRESH THE DOCKET
GetReport();
}
//CALLED WHEN THE "Prosecutor:" CHECKBOX UNDER THE
HEARING TYPE DROPDOWNS IS CLICKED
protected void
chkbx_ProsecutorSetup_CheckedChanged(object
sender, EventArgs e)
{
//IF THE CHECKBOX IS NOW CHECKED
if (chkbx_ProsecutorSetup.Checked)
{
//MUST BE A TR/CR CASE, SO SET THE "Case
Type:" DROPDOWN LIST TO "Traffic Criminal"
ddl_CaseType.SelectedItem.Selected = false;
ddl_CaseType.Items.FindByText("Traffic
Criminal").Selected = true;
//SHOW THESE COLUMNS IN THE GRIDVIEW
chkbx_Officer.Checked = true;
chkbx_Violation.Checked = true;
chkbx_Attorney.Checked = true;
//HIDE THESE COLUMNS IN THE GRIDVIEW
chkbx_ViolationCode.Checked = false;
chkbx_Address.Checked = false;
chkbx_Room.Checked = false;
chkbx_DRSS.Checked = false;
//SET THE "Hearing Type:" DROPDOWN LIST TO
"Trial"
ddl_HearingType.SelectedItem.Selected = false;
ddl_HearingType.Items.FindByText("Trial").Selected
= true;
//SET THE SECOND "Hearing Type:" DROPDOWN LIST
TO "Pre-Trial"
ddl_SecondHearingType.SelectedItem.Selected =
false;
ddl_SecondHearingType.Items.FindByText("Pre-Trial").Selected
= true;
//ENABLE THE SECOND "Hearing Type:" DROPDOWN
LIST
ddl_SecondHearingType.Enabled = true;
//SET THE THIRD "Hearing Type:" DROPDOWN LIST
TO "None"
ddl_ThirdHearingType.SelectedItem.Selected =
false;
ddl_ThirdHearingType.Items.FindByText("None").Selected
= true;
//ENABLE THE THIRD "Hearing Type:" DROPDOWN
LIST
ddl_ThirdHearingType.Enabled = true;
//SET THE FOURTH "Hearing Type:" DROPDOWN LIST
TO "None"
ddl_FourthHearingType.SelectedItem.Selected =
false;
ddl_FourthHearingType.Items.FindByText("None").Selected
= true;
//ENABLE THE FOURTH "Hearing Type:" DROPDOWN
LIST
ddl_FourthHearingType.Enabled = false;
//SET THE FIFTH "Hearing Type:" DROPDOWN LIST
TO "None"
ddl_FifthHearingType.SelectedItem.Selected =
false;
ddl_FifthHearingType.Items.FindByText("None").Selected
= true;
//ENABLE THE FIFTH "Hearing Type:" DROPDOWN
LIST
ddl_FifthHearingType.Enabled = false;
}
//ELSE, IF THE CHECKBOX IS NOW NOT CHECKED
else if
(!chkbx_ProsecutorSetup.Checked)
{
//SET THE "Case Type:" DROPDOWN LIST TO "All"
ddl_CaseType.SelectedItem.Selected = false;
ddl_CaseType.Items.FindByText("All").Selected
= true;
//SET THE "Hearing Type:" DROPDOWN LIST
SELECTION TO "All"
ddl_HearingType.SelectedItem.Selected = false;
ddl_HearingType.Items.FindByText("All").Selected
= true;
//SIMULATE THE DROPDOWN LIST SELECTION BEING
CHANGED
ddl_HearingType_SelectedIndexChanged(sender, e);
//RETURN, ddl_HearingType_SelectedIndexChanged WILL
UPDATE THE DOCKET
return;
}
//REFRESH THE DOCKET
GetReport();
}
//CALLED WHEN THE "Reset" LINKBUTTON BY THE HEARING
TYPE DROPDOWN LISTS IS PRESSED
protected
void btn_ResetHearingTypes_Click(object sender,
EventArgs e)
{
//SET THE "Hearing Type:" DROPDOWN LIST
SELECTION TO "All"
ddl_HearingType.SelectedItem.Selected = false;
ddl_HearingType.Items.FindByText("All").Selected
= true;
//CLEAR THE "Bench Docket:" AND "Prosecutor:"
CHECKBOXES
chkbx_DRSS.Checked = false;
chkbx_ProsecutorSetup.Checked = false;
//SIMULATE THE DROPDOWN LIST SELECTION BEING
CHANGED TO FIRE THE HANDLER FUNCTION
ddl_HearingType_SelectedIndexChanged(sender, e);
}
//CALLED WHEN THE "Alternating Row Style:" CHECKBOX IS
CLICKED
protected void
chkbx_ShowAltRowStyle_CheckedChanged(object
sender, EventArgs e)
{
//IF THE CHECKBOX IS NOW CHECKED
if (chkbx_ShowAltRowStyle.Checked)
//SET THE ALTERNATING ROW STYLE BACKGROUND
COLOR FOR THE GRIDVIEW
gv_CaseSchedule.AlternatingRowStyle.BackColor =
Color.FromArgb(224, 224, 224);
//ELSE, IF THE CHECKBOX IS NOW NOT CHECKED
else if
(!chkbx_ShowAltRowStyle.Checked)
//SET THE ALTERNATING ROW STYLE BACKGROUND
COLOR TO WHITE
gv_CaseSchedule.AlternatingRowStyle.BackColor =
Color.White;
}
//MAKE SURE InitializeComponent() IS CALLED ON FIRST
PAGE LOAD
override protected
void OnInit(EventArgs
e)
{
InitializeComponent();
base.OnInit(e);
}
private void
InitializeComponent()
{
this.oconn_CaseSchedule =
new System.Data.OracleClient.OracleConnection();
this.oscomm_Select =
new System.Data.OracleClient.OracleCommand();
this.oda_CaseSchedule =
new System.Data.OracleClient.OracleDataAdapter();
this.ds_CaseScheduleSet =
new ds_CaseSchedule();
this.oconn_CaseHear =
new System.Data.OracleClient.OracleConnection();
this.oscomm_CaseHear =
new System.Data.OracleClient.OracleCommand();
this.oda_CaseHear =
new System.Data.OracleClient.OracleDataAdapter();
this.ds_CaseHearDS =
new ds_CaseHear();
((System.ComponentModel.ISupportInitialize)(this.ds_CaseScheduleSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ds_CaseHearDS)).BeginInit();
//
// oscomm_Select
//
this.oscomm_Select.CommandText =
"******";
this.oscomm_Select.CommandType =
System.Data.CommandType.StoredProcedure;
this.oscomm_Select.Connection =
this.oconn_CaseSchedule;
this.oscomm_Select.Parameters.AddRange(new System.Data.OracleClient.OracleParameter[] {
new System.Data.OracleClient.OracleParameter("DATEFROM",
System.Data.OracleClient.OracleType.VarChar,
11, System.Data.ParameterDirection.Input,
false, ((byte)(0)),
((byte)(0)), "",
System.Data.DataRowVersion.Current,
""),
new System.Data.OracleClient.OracleParameter("DATETO",
System.Data.OracleClient.OracleType.VarChar,
11, System.Data.ParameterDirection.Input,
false, ((byte)(0)),
((byte)(0)), "",
System.Data.DataRowVersion.Current,
""),
new System.Data.OracleClient.OracleParameter("JUDGEID",
System.Data.OracleClient.OracleType.VarChar,
3, System.Data.ParameterDirection.Input,
false, ((byte)(0)),
((byte)(0)), "",
System.Data.DataRowVersion.Current,
""),
new System.Data.OracleClient.OracleParameter("SECONDJUDGEID",
System.Data.OracleClient.OracleType.VarChar,
3),
new System.Data.OracleClient.OracleParameter("CASETYPE",
System.Data.OracleClient.OracleType.VarChar,
10, System.Data.ParameterDirection.Input,
false, ((byte)(0)),
((byte)(0)), "",
System.Data.DataRowVersion.Current,
""),
new System.Data.OracleClient.OracleParameter("HEARINGID",
System.Data.OracleClient.OracleType.VarChar,
10, System.Data.ParameterDirection.Input,
false, ((byte)(0)),
((byte)(0)), "",
System.Data.DataRowVersion.Current,
""),
new System.Data.OracleClient.OracleParameter("SECONDHEARINGID",
System.Data.OracleClient.OracleType.VarChar,
10),
new System.Data.OracleClient.OracleParameter("THIRDHEARINGID",
System.Data.OracleClient.OracleType.VarChar,
10),
new System.Data.OracleClient.OracleParameter("FOURTHHEARINGID",
System.Data.OracleClient.OracleType.VarChar,
10),
new System.Data.OracleClient.OracleParameter("FIFTHHEARINGID",
System.Data.OracleClient.OracleType.VarChar,
10),
new System.Data.OracleClient.OracleParameter("TIMEFROM",
System.Data.OracleClient.OracleType.VarChar,
5, System.Data.ParameterDirection.Input,
false, ((byte)(0)),
((byte)(0)), "",
System.Data.DataRowVersion.Current,
""),
new System.Data.OracleClient.OracleParameter("TIMETO",
System.Data.OracleClient.OracleType.VarChar,
5),
new System.Data.OracleClient.OracleParameter("PROSECUTORINPUT",
System.Data.OracleClient.OracleType.VarChar,
15),
new System.Data.OracleClient.OracleParameter("ADDRESSYN",
System.Data.OracleClient.OracleType.VarChar,
5),
new System.Data.OracleClient.OracleParameter("CUR_RETURNDATA",
System.Data.OracleClient.OracleType.Cursor,
0, System.Data.ParameterDirection.Output,
false, ((byte)(0)),
((byte)(0)), "",
System.Data.DataRowVersion.Current,
null)});
//
// oda_CaseSchedule
//
this.oda_CaseSchedule.SelectCommand =
this.oscomm_Select;
this.oda_CaseSchedule.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table",
"CaseSchedule", new
System.Data.Common.DataColumnMapping[0])});
//
// ds_CaseScheduleSet
//
this.ds_CaseScheduleSet.DataSetName =
"ds_CaseSchedule";
this.ds_CaseScheduleSet.SchemaSerializationMode
= System.Data.SchemaSerializationMode.IncludeSchema;
//
// oscomm_CaseHear
//
this.oscomm_CaseHear.CommandText =
"*****";
this.oscomm_CaseHear.CommandType =
System.Data.CommandType.StoredProcedure;
this.oscomm_CaseHear.Connection =
this.oconn_CaseHear;
this.oscomm_CaseHear.Parameters.AddRange(new System.Data.OracleClient.OracleParameter[] {
new System.Data.OracleClient.OracleParameter("CUR_HEARINGS",
System.Data.OracleClient.OracleType.Cursor,
0, System.Data.ParameterDirection.Output,
false, ((byte)(0)),
((byte)(0)), "",
System.Data.DataRowVersion.Current,
null)});
//
// oda_CaseHear
//
this.oda_CaseHear.SelectCommand =
this.oscomm_CaseHear;
this.oda_CaseHear.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table",
"HEARINGS", new
System.Data.Common.DataColumnMapping[0]),
new System.Data.Common.DataTableMapping("Table1",
"CASETYPES", new
System.Data.Common.DataColumnMapping[0])});
//
// ds_CaseHearDS
//
this.ds_CaseHearDS.DataSetName =
"ds_CaseHear";
this.ds_CaseHearDS.SchemaSerializationMode
= System.Data.SchemaSerializationMode.IncludeSchema;
((System.ComponentModel.ISupportInitialize)(this.ds_CaseScheduleSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ds_CaseHearDS)).EndInit();
}
}