Advertisement
| Hall of Fame |
|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: |
/////////////////////////////Default.aspx//////////////////
<%@ Page Language="C#" MasterPageFile="~/masterpages/LeftColumn.master" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="Default" Title="Intake Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlace_Text" Runat="Server">
<style type="text/css">
.selectedPage a
{
font-weight:bold;
color:red;
}
</style>
<%--<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>--%>
<asp:TextBox ID="txtSearch" runat="server" />
<asp:Button ID="btnSearch" runat="server" onClick="btnSearching_Click" Text="Search" />
<asp:Label ID="lblError" Text="Leave Blank for now..." Font-Italic ="true" runat="server" /><br />
<asp:Label ID="Label2" runat="server" Text="Search by Intake Date?"></asp:Label>
<asp:CheckBox ID="chkDate" runat="server" /><br />
<asp:Label ID="lblBeginDate" width="70px" Text="Start Date:" runat="server" /><asp:TextBox ID="txtBegin" width="100px" runat="server" /><br />
<asp:Label ID="lblEndDate" width="70px" Text="End Date:" runat="server" /><asp:TextBox ID="txtEnd" width="100px" runat="server" /><br />
<asp:Label ID="Label1" text="Search by Offense?" runat="server"></asp:Label>
<asp:CheckBox ID="chkOffense" runat="server" /><br />
<asp:DropDownList ID="ddOffense" runat="server" DataSourceID="srcOffense"
DataTextField="Offense" DataValueField="OffenseID">
</asp:DropDownList>
<%--
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress
ID="progress1"
AssociatedUpdatePanelID="up1"
runat="server">
<ProgressTemplate>
<div class="progress">
<asp:Image
id="imgProgress"
ImageURL="~/Images/Progress.gif"
Runat="server" />
Retrieving content...
</div>
</ProgressTemplate>
</asp:UpdateProgress>--%>
<div style="float:right">
<asp:Calendar ID="Calendar1" runat="server" />
<asp:Calendar ID="Calendar2" runat="server" />
</div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<asp:GridView
ID="grdResults"
runat="server"
AllowPaging="True"
AllowSorting="true"
AutoGenerateColumns="False"
OnPageIndexChanging="grdResults_PageIndexChanging"
EmptyDataText = "No Matching Results..."
PageSize="8"
OnDataBound="grdResults_DataBound">
<PagerTemplate>
<table>
<tr><td>
<asp:LinkButton
id="lnkPrevious"
Text="< Prev"
CommandName="Page"
CommandArgument="Prev"
ToolTip="Previous Page"
Runat="server"/>
</td><td>
<asp:Menu
id="menuPager"
Orientation="Horizontal"
OnMenuItemClick="menuPager_MenuItemClick"
StaticSelectedStyle-CssClass="selectedPage"
CssClass="menu"
runat="server" />
</td><td>
<asp:LinkButton
id="lnkNext"
Text="Next >"
CommandName="Page"
CommandArgument="Next"
ToolTip="Next Page"
Runat="server" />
</td></tr>
</table>
</PagerTemplate>
<Columns>
<asp:HyperLinkField
DataNavigateUrlFields="StudentID"
DataNavigateUrlFormatString="StudentInfo.aspx?StudentID={0}"
Text="Details" />
<asp:BoundField DataField="FirstName"
HeaderText="First Name"
SortExpression="FirstName" />
<asp:BoundField DataField="LastName"
HeaderText="Last Name"
SortExpression="LastName" />
<asp:BoundField DataField="Offense"
HeaderText="Offense"
SortExpression="Offense" />
<asp:BoundField DataField="DateOfIntake"
HeaderText="Date Of Intake"
SortExpression="DateOfIntake" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:ObjectDataSource
ID="SearchDS"
EnableCaching="true"
runat="server"
SelectMethod="Searching"
TypeName="SearchDataDAL">
<SelectParameters>
<asp:Parameter Name="offenseID" Type="Int32" />
<asp:Parameter Name="queryID" Type="Int32" />
<asp:Parameter Name="intakeDateBegin" Type="String" />
<asp:Parameter Name="intakeDateEnd" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:SqlDataSource ID="srcOffense"
runat="server"
ConnectionString="<%$ ConnectionStrings:ProjectExcel_BAKConnectionString %>"
SelectCommand="sp_GetOffenses" SelectCommandType="StoredProcedure">
<%--<UpdateParameters>
<asp:Parameter Name="queryID" Type="Int32" />
<asp:Parameter Name="offenseID" Type="Int32" />
<asp:Parameter Name="intakeDateBegin" Type="DateTime" />
<asp:Parameter Name="intakeDateEnd" Type="DateTime" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="queryID" Type="Int32" />
<asp:Parameter Name="offenseID" Type="Int32" />
<asp:Parameter Name="intakeDateBegin" Type="DateTime" />
<asp:Parameter Name="intakeDateEnd" Type="DateTime" />
</InsertParameters>--%>
</asp:SqlDataSource>
</asp:Content>
/////////////////////////////////default.aspx.cs////////////////
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.Linq;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.Configuration;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using System.ComponentModel;
using System.Data.SqlClient;
public partial class Default : System.Web.UI.Page
{
int queryID = 0;
int offenseID = 0;
string intakeDateBegin = "";
string intakeDateEnd = "";
string lastName = "";
int gridID = 0;
DataView dvIntakes;
DataTable dtblIntakes;
protected void Page_PreInit(object sender, EventArgs e)
{
}
protected void Page_Load()
{
if (grdResults.PageCount == 0)
{
}
else
{
//grdResults.DataSource = GetIntakesFromDB();
//grdResults.DataMember = "items";
//grdResults.DataBind();
}
// DO NOT DELETE, THIS MAKES TABLE DYNAMICALLY
//// Create the DataTable columns
//DataTable newDataTable = new DataTable();
//newDataTable.Columns.Add("Details", typeof(int));
//newDataTable.Columns.Add("First Name", typeof(string));
//newDataTable.Columns.Add("Last Name", typeof(string));
//newDataTable.Columns.Add("Offense", typeof(string));
//newDataTable.Columns.Add("Date of Intake", typeof(DateTime));
//// mark the id column as an autoincrement column
//newDataTable.Columns["Details"].AutoIncrement = true;
//// add some data rows
//for (int i = 1; i < 11; i++)
//{
// DataRow newRow = newDataTable.NewRow();
// newRow["First Name"] = "Product " + i.ToString();
// newRow["Last Name"] = "Kinney";
// newDataTable.Rows.Add(newRow);
//}
//// Bind table to DataGrid
//grdResults.DataSource = newDataTable;
//grdResults.DataBind();
}
protected void btnSearching_Click(object sender, EventArgs e)
{
if (queryID > 0)
{
}
else
{
if (chkOffense.Checked == true)
{ queryID = 1;Session["queryID"] = queryID;}
if (chkDate.Checked == true)
{ queryID = 2; Session["queryID"] = queryID; }
if (chkOffense.Checked & chkDate.Checked == true)
{ queryID = 3; Session["queryID"] = queryID; }
if (txtSearch.Text.Length > 0)
{ queryID = 4; Session["queryID"] = queryID; }
if (txtSearch.Text.Length > 0 & chkOffense.Checked == true)
{ queryID = 5; Session["queryID"] = queryID; }
// declare session parameters for stored procedure
Session["offenseID"] = ddOffense.SelectedIndex;
Session["lastName"] = txtSearch.Text;
Session["intakeDateBegin"] = txtBegin.Text;
Session["intakeDateEnd"] =txtEnd.Text;
switch (Convert.ToInt32(Session["queryID"]))
{
case (0):
Response.Write("This is queryID0 speaking...");
break;
case (1):
Response.Write("This is queryID1 speaking...");
break;
case (2):
Response.Write("This is queryID2 speaking...");
break;
case (3):
Response.Write("This is queryID3 speaking...");
break;
case (4):
Response.Write("This is queryID4 speaking...");
break;
case (5):
Response.Write("This is queryID5 speaking...");
break;
}
dvIntakes = (DataView)Session["Intakes"];
SqlConnection myConn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ProjectExcel_BAKConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Parameters.AddWithValue("@queryID", Session["queryID"]);
SqlDataAdapter dad = new SqlDataAdapter("sp_Search", myConn);
dad.SelectCommand.CommandType = CommandType.StoredProcedure;
dad.SelectCommand.Parameters.Add(new SqlParameter("@queryID", Session["queryID"]));
dad.SelectCommand.Parameters.AddWithValue("@offenseID", Session["offenseID"]);
if (Session["intakeDateBegin"] == null)
dad.SelectCommand.Parameters.Add(new SqlParameter("@IntakeDateBegin", Session["intakeDateBegin"]));
else
dad.SelectCommand.Parameters.Add(new SqlParameter("@IntakeDateBegin", ""));
if (txtEnd.Text == null)
dad.SelectCommand.Parameters.Add(new SqlParameter("@IntakeDateEnd", ""));
else
dad.SelectCommand.Parameters.Add(new SqlParameter("@IntakeDateEnd", Session["intakeDateEnd"]));
if (Session["lastname"] == null)
dad.SelectCommand.Parameters.Add(new SqlParameter("@lastName", ""));
else
dad.SelectCommand.Parameters.Add(new SqlParameter("@lastName", Session["lastName"]));
DataTable dtblIntakes = new DataTable();
dad.Fill(dtblIntakes);
dvIntakes = new DataView(dtblIntakes);
Session["Intakes"] = dvIntakes;
grdResults.DataSource = dtblIntakes;
grdResults.DataBind();
}
}
protected void grdResults_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
if (!IsPostBack == true)
// handle out of bounds
grdResults.DataSource = dtblIntakes;
grdResults.PageIndex = e.NewPageIndex;
grdResults.DataBind();
}
protected DataView SortDataTable(DataTable dataTable, bool isPageIndexChanging)
{
if (dataTable != null)
{
DataView dataView = new DataView(dataTable);
if (GridViewSortExpression != string.Empty)
{
if (isPageIndexChanging)
{
dataView.Sort = string.Format("{0} {1}", GridViewSortExpression, GridViewSortDirection);
}
else
{
dataView.Sort = string.Format("{0} {1}", GridViewSortExpression, GetSortDirection());
}
}
return dataView;
}
else
{
return new DataView();
}
}
protected void menuPager_MenuItemClick(object sender, MenuEventArgs e)
{
grdResults.PageIndex = Int32.Parse(e.Item.Value);
}
private string GridViewSortExpression
{
get { return ViewState["SortExpression"] as string ?? string.Empty; }
set { ViewState["SortExpression"] = value; }
}
private string GridViewSortDirection
{
get { return ViewState["SortDirection"] as string ?? "ASC"; }
set { ViewState["SortDirection"] = value; }
}
private string GetSortDirection()
{
switch (GridViewSortDirection)
{
case "ASC":
GridViewSortDirection = "DESC";
break;
case "DESC":
GridViewSortDirection = "ASC";
break;
}
return GridViewSortDirection;
}
// produces numbering system for records
protected void grdResults_DataBound(object sender, EventArgs e)
{
if (grdResults.PageCount > 1)
{
Menu menuPager = (Menu)grdResults.BottomPagerRow.FindControl("menuPager");
for (int i = 0; i < grdResults.PageCount; i++)
{
MenuItem item = new MenuItem();
item.Text = String.Format("", i + 1);
item.Value = i.ToString();
if (grdResults.PageIndex == i)
item.Selected = true;
menuPager.Items.Add(item);
}
}
else
{
}
}
}
|