Code Listing

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 521

K:\SpringDale\About.

aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="About.aspx.cs" Inherits="About" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div> <h1 style=" text-align:center;" class="defaultPageHeader">Project Created By Sudeep,Balmukund,Shadab,Shaheen For M.Tech Second Semester</h1> <table cellpadding="10px" cellspacing="3px" border="1" class="rowWithBorder"> <tr > <td> <img width="200px" height="140px" src="css//images//kungfupandap3.jpg" /> </td> <td> <p class="defaultPageHeader">Sudeep Mukherjee</p> <p class="defaultText">The brains and the brawn behind this endevour. Microsoft fanatic. ASP lover. Programmer Extraoridinaire.</p> </td> </tr> <tr> <td> <img width="200px" height="140px" src="css//images//Sh1.jpg" /> </td> <td> <p class="defaultPageHeader">Shadab Siddique</p> <p class="defaultText">The public face of the adventure. Excellent people's skill. Garullous and jovial. All the time.</p> </td> </tr>

<tr> <td> <img width="200px" height="140px" src="css/images/sh3.jpg" /> </td> <td> <p class="defaultPageHeader">Balmukund Maurya</p> <p class="defaultText">The silent assasin. Quite,down to earth and unassuming but carries lot of weight when he speaks.</p> </td> </tr> <tr> <td> <img width="200px" height="140px" src="css/images/sh4.png" /> </td> <td> <p class="defaultPageHeader">Shaheen Fatima</p> <p class="defaultText">Pretty & charming but extremely intelligent. Killer combo.</p> </td> </tr> </table> </div> </asp:Content>

K:\SpringDale\About.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class About : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

K:\SpringDale\Default.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ MasterType VirtualPath="~/MasterPage.master" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript"> function myPageLoad() { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" });

$("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#opener").button(); $("#opener").click(SearchClicked);

return false; } function SearchClicked() { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result);

}, function () { $("#dialog").html("Sorry! Functionality is not ready as of now. Please Check Back Some Time Later...!"); }) }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; } function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false; }

</script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/ManageUsersRoles.asmx"/> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Detailed Student Information" style="width:200px;height:300px;"> <p>This will show the record for the student you have selected</p> </div> <div style="width:100%;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:12px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:12px; text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> </div>

<div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div id="masterCtrl" style="float:left;width:74%; margin-top:5px;">

</div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Default.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(myPageLoad);", true); } }

K:\SpringDale\GetAttendanceTable.asmx
<%@ WebService Language="C#" CodeBehind="~/App_Code/GetAttendanceTable.cs" Class="GetAttendanceTable" %>

K:\SpringDale\GetTeachers.asmx
<%@ WebService Language="C#" CodeBehind="~/App_Code/GetTeachers.cs" Class="GetTeachers" %>

K:\SpringDale\HolidayList.asmx
<%@ WebService Language="C#" CodeBehind="~/App_Code/HolidayList.cs" Class="HolidayListSvc" %>

K:\SpringDale\LibraryManagement.asmx
<%@ WebService Language="C#" CodeBehind="~/App_Code/LibraryManagement.cs" Class="LibraryManagement" %>

K:\SpringDale\Login.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <style type="text/css"> table { border:0 none 0; border-bottom-style:none; border-top-style:none; border-right-style:none; border-left-style:none; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table width="100%" style="margin:0 auto;"> <tr> <td style="width:17%">&nbsp;</td> <td> <asp:Image ID="Image1" runat="server" ImageUrl="~/css/animated-gif-2.gif" /> </td> <td> <asp:Login ID="Login1" runat="server" BackColor="#ebebeb" BorderColor="#E6E2D8" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Bold="True" Font-Names="Verdana" Font-Size="Large" ForeColor="#333333" Height="367px"

Width="499px"> <InstructionTextStyle Font-Italic="True" ForeColor="Black" /> <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" /> <TextBoxStyle Font-Size="0.8em" /> <TitleTextStyle BackColor="#7d7d7d" Font-Bold="True" Font-Size="0.9em" ForeColor="White" /> </asp:Login> </td> <td style="width:10%">&nbsp;</td> </tr> </table>

</asp:Content>

K:\SpringDale\Login.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.IsAuthenticated && !string.IsNullOrEmpty(Request.QueryString["ReturnUrl"])) { // This is an unauthorized, authenticated request... Response.Redirect("~/UnauthorizedAccess.aspx"); } } } }

K:\SpringDale\ManageUsersRoles.asmx
<%@ WebService Language="C#" CodeBehind="~/App_Code/ManageUsersRoles.cs" Class="ManageUsersRoles" %>

K:\SpringDale\MarksWeb.asmx
<%@ WebService Language="C#" CodeBehind="~/App_Code/MarksWeb.cs" Class="MarksWeb" %>

K:\SpringDale\MasterPage.master
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>M.Tech Project</title> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <link type="text/css" href="css/custom-theme/jquery-ui-1.8.18.custom.css" rel="Stylesheet" /> <link type="text/css" href="css/MyTableStyle.css" rel="Stylesheet" /> <link href="css/MyMenu.css" rel="stylesheet" type="text/css" /> <link type="text/css" rel="Stylesheet" href="http://learnasp.in/css/GreyTableStyle.css" /> <asp:ContentPlaceHolder id="head" runat="server"> <script type="text/javascript"> </script> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat="server"> <div style="width:100%;"> <div style="margin:0 auto; width: 1045px; height:80px;"> <div style="width:59%;float:left;">

&nbsp; </div> <div style="width:40%;float:left; text-align:right;"> <asp:LoginView ID="LoginView1" runat="server" onviewchanged="LoginView1_ViewChanged"> <AnonymousTemplate> Hi! Stranger Please Login... </AnonymousTemplate> <LoggedInTemplate> </LoggedInTemplate> <RoleGroups> <asp:RoleGroup Roles="Students"> <ContentTemplate> <asp:Image ID="studentAvatar" runat="server" Width="50px" Height="50px" /> <asp:Label ID="studentMsg" runat="server" Text=""></asp:Label> <asp:LoginName ID="LoginName1" runat="server" /> </ContentTemplate> </asp:RoleGroup> <asp:RoleGroup Roles="Teachers"> <ContentTemplate> <asp:Image ID="teacherAvatar" runat="server" Width="50px" Height="50px" /> <asp:Label ID="teacherMsg" runat="server" Text=""></asp:Label> <asp:LoginName ID="LoginName3" runat="server" /> </ContentTemplate> </asp:RoleGroup> <asp:RoleGroup Roles="Administrators"> <ContentTemplate> <asp:Image ID="adminAvatar" runat="server" Width="50px" Height="50px" ImageUrl="http://learnasp.in/css/admin.png" /> <asp:Label ID="adminMsg" runat="server" Text=""></asp:Label>

<asp:LoginName ID="LoginName2" runat="server" /> </ContentTemplate> </asp:RoleGroup> </RoleGroups> </asp:LoginView> <br /> <div style="float:right; padding-right:10px;"> <asp:LoginStatus ID="LoginStatus1" runat="server" Font-Bold="true" LogoutAction="Redirect" LogoutPageUrl="http://learnasp.in/Default.aspx" /> </div>

</div> </div> <div style="margin:0 auto; width: 1045px;"> <ul id="nav"> <li><a href="http://learnasp.in/Default.aspx">Home</a></li> <li><a href="javascript:void(0);">Admin</a> <ul> <li><a href="javascript:void(0);">Manage Students</a> <ul> <li><a href="http://learnasp.in/Teacher/AttendanceCtrl.aspx">Attendance</a></li> <li><a href="http://learnasp.in/Admin/CreateStudent.aspx">Addmissions</a></li> <li><a href="http://learnasp.in/Reports/ShowReports.aspx">Reports</a></li> <li><a href="http://learnasp.in/Admin/StudentMaster.aspx">Master</a></li> <li><a href="http://learnasp.in/Admin/SRS.aspx">SRS</a></li> <li><a href="#">Transport</a></li>

</ul> </li> <li><a href="http://learnasp.in/Admin/ManageUsers.aspx">Manage Users</a></li> <li><a href="http://learnasp.in/Admin/ManageRoles.aspx">Manage Roles</a></li> <li><a href="http://learnasp.in/Admin/HolidayManager.aspx">Manage Holidays</a></li> <li><a href="http://learnasp.in/Admin/SubjectManager.aspx">Manage Subjects</a></li> <li><a href="javascript:void(0);">Manage TimeTables</a> <ul> <li><a href="http://learnasp.in/Admin/TimeTableMaster.aspx">Time Table Master</a></li> <li><a href="http://learnasp.in/Admin/TimeTableCreator.aspx">Time Table Builder</a></li> </ul> </li> <li><a href="javascript:void(0);">Manage Library</a> <ul> <li><a href="http://learnasp.in/Library/AddBooks.aspx">Add Books</a></li> <li><a href="http://learnasp.in/Library/AddMember.aspx">Add Members</a></li> </ul> </li> <li><a href="javascript:void(0);">Exams</a> <ul> <li><a href="http://learnasp.in/Admin/ExamSetting.aspx">Exam Settings</a></li> </ul> </li> </ul> </li> <li>

<a href="javascript:void(0);">Library</a> <ul> <li><a href="http://learnasp.in/Library/FindBooks.aspx">FindBooks</a></li> <li><a href="http://learnasp.in/Library/RoughPage2.aspx">Issue</a></li> <li><a href="http://learnasp.in/Library/BookReturn.aspx">Return</a></li>

</ul> </li> <li><a href="javascript:void(0);">Teachers</a> <ul> <li><a href="http://learnasp.in/Teacher/AttendanceCtrl.aspx">Attendance</a></li> <li><a href="http://learnasp.in/Teacher/AttendanceEmailMaster.aspx">Send Emails</a></li> <li><a href="http://learnasp.in/Teacher/EnterMarks.aspx">Marks</a></li> <li><a href="#">Profile</a></li> </ul> </li> <li><a href="javascript:void(0);">Students</a> <ul> <li><a href="http://learnasp.in/Student/StudentProfile.aspx">Profile</a></li>

</ul> </li> <li><a href="http://learnasp.in/About.aspx">About</a></li> <li><a href="javascript:void(0);">Contact Us</a></li> </ul> </div> </div> <div style="width:100%; padding-top:20px; clear:both; height:auto;">

<div id="centralGap" style="float:left;width:1%;">&nbsp;</div> <div id="centralColumn" style="margin-left:10px; padding-left:10px;float:left; width: 100%; margin-top:10px;" > <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </div> </div> </form> </body> </html>

K:\SpringDale\MasterPage.master.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Text.RegularExpressions; using System.Security.Authentication; using System.Web.UI.WebControls; public partial class MasterPage : System.Web.UI.MasterPage { private bool _addnew = false; public StudentRecord.StudentRecDataTable dt = null; private int _rownum = 0; public event CommandEventHandler BrowseData; public StudentRecord.StudentRecDataTable masterdata { get { return dt; }

} private string getMsg() { string ans = ""; DateTime dttime = DateTime.Now; if (dttime.Hour >= 0 && dttime.Hour < 12) ans = "Good Morning";

else if (dttime.Hour >= 12 && dttime.Hour < 17) ans = "Good Afternoon"; else if (dttime.Hour >= 17 && dttime.Hour < 24) ans = "Good Evening"; return ans; } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Image imgAvatar = ( Image)LoginView1.FindControl("studentAvatar"); LoginName lname = (LoginName)LoginView1.FindControl("LoginName1"); if (lname != null) { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(lname.Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value; imgAvatar.ImageUrl = "ShowImage.ashx?enroll=" + num.ToString(); Label lbl = (Label)LoginView1.FindControl("studentMsg"); lbl.Text = getMsg() + " Student "; } else { lname= (LoginName)LoginView1.FindControl("LoginName2"); if (lname != null) { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(lname.Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value;

//

imgAvatar.ImageUrl = "ShowImage.ashx?enroll=" + num.ToString();

Label lbl = (Label)LoginView1.FindControl("adminMsg"); lbl.Text = getMsg() + " Admin "; } else { lname = (LoginName)LoginView1.FindControl("LoginName3"); if (lname != null) { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(lname.Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value; // num.ToString(); imgAvatar.ImageUrl = "ShowImage.ashx?enroll=" +

Label lbl = (Label)LoginView1.FindControl("teacherMsg"); lbl.Text = getMsg() + " Teacher "; } } } } } protected void LoginView1_ViewChanged(object sender, EventArgs e) { } }

K:\SpringDale\ShowImage.ashx
<%@ WebHandler Language="VB" Class="ShowImage" Debug="true" %> Imports System Imports System.Web Imports System.Drawing Imports System.Configuration Imports System.IO Imports System.Data Imports System.Data.SqlClient Public Class ShowImage : Implements IHttpHandler Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest Dim enroll As Decimal If Not context.Request.QueryString("enroll") Is Nothing Then enroll = Decimal.Parse(context.Request.QueryString("enroll")) Else Throw New ArgumentException("No parameter specified") 'Return End If context.Response.ContentType = "image/jpeg" Dim strm As Stream = ShowEmpImage(enroll) 'Dim bmp As New Bitmap(strm) 'bmp.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif) Dim buffer As Byte() = New Byte(4095) {}

Dim byteSeq As Integer = strm.Read(buffer, 0, 4096) context.Response.Buffer = True context.Response.Charset = "" context.Response.ContentType = "image/jpeg" Do While byteSeq > 0 context.Response.BinaryWrite(buffer) 'context.Response.OutputStream.Write(buffer, 0, byteSeq) byteSeq = strm.Read(buffer, 0, 4096) Loop End Sub Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property Public Function ShowEmpImage(ByVal enroll As Decimal) As Stream Dim con As SqlConnection Dim str As String = ConfigurationManager.ConnectionStrings("springdaleConnectionString2").ConnectionString

con = New SqlConnection(str) '"Data Source=.\SQLExpress;Integrated Security=true; AttachDbFilename=|DataDirectory|\Database.mdf;User Instance=true;") Dim sql As String = "SELECT StudentImage FROM StudentRec WHERE EnrollNo = @ID" Dim cmd As SqlCommand = New SqlCommand(sql, con) cmd.CommandType = CommandType.Text cmd.Parameters.AddWithValue("@ID", enroll) con.Open() Dim img As Object = cmd.ExecuteScalar() Try Return New MemoryStream(CType(img, Byte()))

Catch Return Nothing Finally con.Close() End Try End Function End Class

K:\SpringDale\UnauthorizedAccess.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="UnauthorizedAccess.aspx.cs" Inherits="UnauthorizedAccess" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table width="100%"> <tr> <td style="width:15%"><asp:Image runat="server" ImageUrl="~/css/warning_1.gif" /></td> <td style="width:65%"> <h1>Unauthorized Access</h1> <h3>Sorry! you are not authorized to visit this page. Please be kind enough to navigate to an authorised section.</h3> <h2>Cheers</h2></td> <td style="width:10%"></td> </tr> </table> </asp:Content>

K:\SpringDale\UnauthorizedAccess.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class UnauthorizedAccess : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

K:\SpringDale\web.config
<?xml version="1.0"?> <!-For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <appSettings> <add key="ChartImageHandler" value="storage=memory;timeout=20;"/> </appSettings> <connectionStrings> <add name="springdaleConnectionString2" connectionString="Data Source=69.16.252.20;Initial Catalog=springdale;Persist Security Info=True;User ID=dbadmin;Password=sudeep" providerName="System.Data.SqlClient"/> <add name="springdaleConnectionString1" connectionString="Data Source=69.16.252.20;Initial Catalog=springdale;Persist Security Info=True;User ID=dbadmin;Password=sudeep;Current Language=British" providerName="System.Data.SqlClient"/> </connectionStrings> <location path="UnauthorizedAccess.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="Login.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web>

</location> <location path="Default.aspx"> <system.web> <authorization> <deny users="?"/> <allow users="*"/> </authorization> </system.web> </location> <system.web> <authorization> <deny users="?"/> <allow roles="Administrators"/> </authorization> <authentication mode="Forms"> <forms loginUrl="login.aspx" cookieless="AutoDetect" defaultUrl="Default.aspx"/> </authentication> <customErrors mode="Off"/> <httpHandlers> <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/> <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> </httpHandlers> <pages enableViewStateMac="false" enableEventValidation="false" clientIDMode="AutoID" controlRenderingCompatibilityVersion="4.0" validateRequest="false" viewStateEncryptionMode="Never"> <controls> <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </controls>

</pages> <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </assemblies> <buildProviders> <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </buildProviders> </compilation> <membership defaultProvider="SecurityTutorialsSqlMembershipProvider"> <providers> <!--Add a customized SqlMembershipProvider --> <add name="SecurityTutorialsSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="springdaleConnectionString1" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="SpringDale" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>

</providers> </membership> <roleManager enabled="true" defaultProvider="SecurityTutorialsSqlRoleProvider" cacheRolesInCookie="true" createPersistentCookie="false" cookieProtection="All"> <providers> <add name="SecurityTutorialsSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" applicationName="SecurityTutorials" connectionStringName="springdaleConnectionString1"/> </providers> </roleManager> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false"/> <handlers> <remove name="ChartImageHandler"/> <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </handlers> </system.webServer> </configuration>

K:\SpringDale\Admin\CreateStudent.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="CreateStudent.aspx.cs" Inherits="Admin_CreateStudent" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <%@ MasterType VirtualPath="~/MasterPage.master" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript"> function myPageLoad() { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" });

$("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#opener").button();

$("#opener").click(SearchClicked);

return false; } function SearchClicked() { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result);

}, function () { $("#dialog").html("Unable To Retrieve Data...!"); }) }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; } </script> <style type="text/css"> #myform td { padding-bottom:10px; font-size:medium; }

.style2 { width: 12%; } .style3 { width: 10%; } table { border:0 none 0; border-bottom-style:none; border-top-style:none; border-right-style:none; border-left-style:none; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/ManageUsersRoles.asmx"/> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> </Services> </asp:ScriptManager>

<div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Detailed Student Information" style="width:200px;height:300px;"> <p>This will show the record for the student you have selected</p>

</div> <div style="margin-top:20px; width:100%"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:12px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:12px; text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="font-size:small;width:74%; margin:0px auto; float:left;height:auto;"> <table> <tr> <td> <table border="0" style="width:100%;" id="myform" runat="server"> <tr> <td> <asp:Image ImageUrl="" ID="studentImg" runat="server" width="70px" Height="70px" />

</td> <td></td> <td></td> <td></td> </tr> <tr style="display:none;"> <td>Enroll No</td> <td><asp:TextBox ID="txtEnroll" runat="server" width="189px"></asp:TextBox></td> <td>Roll No</td> <td><asp:TextBox ID="txtRoll" runat="server" Height="22px" Width="188px"></asp:TextBox></td> </tr> <tr> <td>First Name</td> <td><asp:TextBox ID="txtFirstName" runat="server" Width="298px"></asp:TextBox></td> <td>Last Name</td> <td><asp:TextBox ID="txtLastName" runat="server" width="297px"></asp:TextBox></td> </tr> <tr> <td>Class</td> <td><asp:TextBox ID="txtClass" runat="server" Width="94px"></asp:TextBox></td> <td>Section</td> <td><asp:TextBox ID="txtSection" runat="server" Width="59px"></asp:TextBox></td> </tr> <tr> <td>Fathers Name</td> <td><asp:TextBox ID="txtFather" runat="server" Width="298px"></asp:TextBox></td> <td>Mothers Name</td>

<td><asp:TextBox ID="txtMother" runat="server" Width="298px"></asp:TextBox></td> </tr> <tr> <td>Address</td> <td><asp:TextBox ID="txtAddr" runat="server" Width="298px"></asp:TextBox></td> <td>City</td> <td><asp:TextBox ID="txtCity" runat="server" Width="198px"></asp:TextBox></td> </tr> <tr> <td>State</td> <td><asp:TextBox ID="txtState" runat="server" Width="150px"></asp:TextBox></td> <td>Home Phone</td> <td><asp:TextBox ID="txtHomePh" runat="server" Width="198px"></asp:TextBox></td> </tr> <tr> <td>Father's Designation</td> <td><asp:TextBox ID="txtDesig" runat="server" Width="90px"></asp:TextBox></td> <td>Company Name</td> <td><asp:TextBox ID="txtCompany" runat="server" Width="90px"></asp:TextBox></td> </tr> <tr> <td>Company Address</td> <td><asp:TextBox ID="txtCAddress" runat="server" Width="190px"></asp:TextBox></td> <td>Company Phone</td> <td><asp:TextBox ID="txtCompanyPhone" runat="server" Width="90px"></asp:TextBox></td> </tr>

<tr> <td>Last College</td> <td><asp:TextBox ID="txtLast" runat="server" Width="140px"></asp:TextBox></td> <td>Last Percentage</td> <td><asp:TextBox ID="txtPercentage" runat="server" Width="90px"></asp:TextBox></td> </tr> <tr> <td>Email </td> <td><asp:TextBox ID="txtEmail" runat="server" Width="140px"></asp:TextBox></td> <td>Image </td> <td> <asp:FileUpload ID="studentImage" runat="server" /> </td> </tr>

</table> </td></tr> <tr> <td > <table><tr> <td style="width:12%;"> <asp:Button ID="btnClear" runat="server" Text="Clear" AccessKey="P" width="61px" Visible="True" onclick="btnClear_Click" /> </td> <td style="width:12%;"> <asp:Button ID="btnAddNew" runat="server" Text="New" AccessKey="N" onclick="btnAddNew_Click" width="61px" /> </td>

<td style="width:12%;"> <asp:Button ID="btnUpdate" runat="server" Text="Update" AccessKey="U" onclick="btnUpdate_Click" /> </td> <td style="width:12%;"> <asp:Button ID="btnDelete" runat="server" Text="Delete" AccessKey="D" width="61px" /> </td> <td style="width:1%;"> <asp:Button ID="btnFirst" runat="server" Text="First" AccessKey="F" width="1px" onclick="btnFirst_Click" Visible="False" /> </td> <td style="width:1%;"> <asp:Button ID="btnPrev" runat="server" Text="Prev" AccessKey="P" width="1px" onclick="btnPrev_Click" Visible="False" /> </td> <td style="width:1%;"> <asp:Button ID="btnNext" runat="server" Text="Next" AccessKey="N" width="1px" onclick="btnNext_Click" Visible="False" /> </td> <td class="style3"> <asp:Button ID="btnLast" runat="server" Text="Last" AccessKey="L" width="0px" Visible="False" /> </td> <td style="width:18%;"> <asp:Label ID="Label1" runat="server" Text="" Width="110px"></asp:Label> </td>

</tr></table> </td> <td> </td> </tr> </table> </div> </div>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>

</asp:Content>

K:\SpringDale\Admin\CreateStudent.aspx.cs
using System; using System.Collections.Generic; using Microsoft.VisualBasic; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using StudentRecordTableAdapters; using ClassRecTableAdapters; public partial class Admin_CreateStudent : System.Web.UI.Page { private bool _addnew = false; StudentRecord.StudentRecDataTable dt = null; private int _rownum = 0; byte[] imageBinary; protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(myPageLoad);", true); }

protected void putData( int rownum) { try { if (!Convert.IsDBNull(dt[rownum].ClassName))

txtClass.Text = dt[rownum].ClassName; else txtClass.Text = ""; if (!Convert.IsDBNull(dt[rownum].FirstName)) txtFirstName.Text = dt[rownum].FirstName; else txtFirstName.Text = ""; if (!Convert.IsDBNull(dt[rownum].LastName)) txtLastName.Text = dt[rownum].LastName; else txtLastName.Text = ""; if (!Convert.IsDBNull(dt[rownum].ClassSection)) txtSection.Text = dt[rownum].ClassSection; else txtSection.Text = ""; txtEnroll.Text = dt[rownum].EnrollNo.ToString(); //txtSection.Text = dt[rownum].ClassSection.ToString(); txtRoll.Text = dt[rownum].RollNo.ToString(); } catch (Exception ex) { //Label1.Text = ex.Message; }

} protected void btnAddNew_Click(object sender, EventArgs e) {

StudentRecBLL obj = new StudentRecBLL(); ClassRecBLL obj1 = new ClassRecBLL(); int? classID=(int)obj1.GetClassID(txtClass.Text.ToUpper(),txtSection.Text.ToUpper()); StudentRecordTableAdapters.StudentRecAdapter _studentAdapter = new StudentRecAdapter(); decimal? ans = 1; decimal? _enroll = _studentAdapter.GetMaxEnrollNo(); if (_enroll == null) { _enroll = 1; } else { _enroll += 1; } decimal? _roll = _studentAdapter.GetMaxRollNo(); if (_roll == null) { _roll = 1; } else { _roll+= 1; } ClassRecBLL objClass = new ClassRecBLL(); ans = objClass.GetClassID(txtClass.Text , txtSection.Text ); if (ans == null) {

ans = objClass.GetMaxClassID() + 1; objClass.AddNewClass(txtClass.Text , txtSection.Text , (decimal)ans); }

//bool rowsaffected = obj.AddStudent(txtFirstName.Text, txtLastName.Text, txtClass.Text.ToUpper(), txtSection.Text.ToUpper(), txtEmail.Text); //imageBinary = new byte[imageLength]; System.IO.Stream inputStream = studentImage.PostedFile.InputStream; int imageLength = studentImage.PostedFile.ContentLength; imageBinary = new byte[imageLength]; int inputRead = inputStream.Read(imageBinary, 0, imageLength); bool rowsaffected = obj.AddStudent(txtFirstName.Text, txtLastName.Text, txtClass.Text.ToUpper(),txtSection.Text.ToUpper(), txtEmail.Text,txtFather.Text, txtMother.Text,txtAddr.Text,txtCity.Text,txtState.Text,txtHomePh.Text, txtCompany.Text,txtCAddress.Text,txtCompanyPhone.Text,txtDesig.Text,txtLast.Text, decimal.Parse(txtPercentage.Text),imageBinary); if (rowsaffected) { Label1.Text = "Student Addmission Success"; StudentRecord.StudentRecDataTable dt = obj.GetLatestStudent(); studentImg.ImageUrl = "http://learnasp.in/ShowImage.ashx?enroll=" + dt[0].EnrollNo; } else { Label1.Text = "Something has gone wrong"; } obj.Dispose(); obj1.Dispose();

} protected void btnUpdate_Click(object sender, EventArgs e) { /*Label1.Text = "Addnew hona chahiye " + _addnew.ToString(); if (_addnew) { Label1.Text = "Addnew mai baap"; } else { }*/ } protected void btnFirst_Click(object sender, EventArgs e) { _rownum=0; if (dt != null) putData(_rownum); } protected void btnPrev_Click(object sender, EventArgs e) { if (dt != null) { if (_rownum > 0) _rownum--; putData(_rownum); } } protected void btnNext_Click(object sender, EventArgs e) { if (dt != null) { if (_rownum < dt.Rows.Count-1)

_rownum++; putData(_rownum); } } private void Master_BrowseData(object sender, CommandEventArgs e) { // Rebind data to ProductsGrid /*StudentRecord.StudentRecDataTable dt = Master.masterdata;// (StudentRecord.StudentRecDataTable)e.CommandArgument; Label1.Text = dt.Rows.Count.ToString(); if (dt != null && dt.Rows.Count > 0) {

GridView1.DataSource = dt; GridView1.DataBind(); GridView1.Visible = true; //myform.Visible = false; }*/ } protected void btnClear_Click(object sender, EventArgs e) { txtClass.Text = ""; txtEnroll.Text = ""; txtFirstName.Text = ""; txtLastName.Text = ""; txtSection.Text = ""; txtRoll.Text = ""; studentImg.ImageUrl = "";

txtPercentage.Text = ""; txtMother.Text = ""; txtFather.Text = ""; txtEmail.Text = ""; txtLast.Text = ""; txtHomePh.Text = ""; txtCAddress.Text = ""; txtCompany.Text = ""; txtCompanyPhone.Text = ""; } protected void studentImage_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) { //imageData = imageBinary; //imgSave.Enabled = true; } }

K:\SpringDale\Admin\ExamSetting.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ExamSetting.aspx.cs" Inherits="Admin_ExamSetting" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; function addload() {

$("#opener").button(); // $("#btnLoadAttendance").button(); $("#opener").click(function () { return false; }); $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({

autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); });

</script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> <asp:ServiceReference Path="http://learnasp.in/GetTeachers.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3> <p> </p> <p> </p> </p> </div> <div style="width:98%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option>

<option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px; text-align:center;" id="fixed-div"><button id="opener">Search .......</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <div style="margin:auto 0;padding:0;width:100%;"> <div id="divClasses" style="width:100%; padding-top:5px;"> <div style="width:60%;margin:0 auto;"> <asp:Table ID="Table2" runat="server"> <asp:TableHeaderRow> <asp:TableHeaderCell>Classes</asp:TableHeaderCell> <asp:TableHeaderCell>No. Of Terms</asp:TableHeaderCell> <asp:TableHeaderCell></asp:TableHeaderCell> <asp:TableHeaderCell></asp:TableHeaderCell> </asp:TableHeaderRow> <asp:TableRow> <asp:TableCell> <asp:ListBox ID="lstClasses" runat="server" DataSourceID="SqlDataSource1" DataTextField="ClassName" DataValueField="ClassName" Width="70px" SelectionMode="Multiple"></asp:ListBox> </asp:TableCell>

<asp:TableCell> <asp:TextBox ID="txtNumTerms" runat="server" Width="100px"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:Button ID="btnShowDetails" runat="server" Text=" Next > >" onclick="btnShowDetails_Click" /> </asp:TableCell> <asp:TableCell> <asp:Button ID="btnSaveDetails" runat="server" Text="Save Details" onclick="btnSaveDetails_Click" /> </asp:TableCell> </asp:TableRow> </asp:Table>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:springdaleConnectionString2 %>" SelectCommand="SELECT DISTINCT ClassName FROM ClassRec"></asp:SqlDataSource> <br /> </div> </div> <div id="termdetails" style="width:100%; padding-top:5px;"> <asp:Panel ID="detailsHolder" runat="server"> <asp:Table ID="Table1" runat="server" Width="100%"> <asp:TableHeaderRow> <asp:TableHeaderCell HorizontalAlign="Center"> Term Name </asp:TableHeaderCell> <asp:TableHeaderCell HorizontalAlign="Center">

Maximum Marks </asp:TableHeaderCell> <asp:TableHeaderCell HorizontalAlign="Center"> Passing % </asp:TableHeaderCell> <asp:TableHeaderCell HorizontalAlign="Center"> Weight In Grand Total(%) </asp:TableHeaderCell> </asp:TableHeaderRow> <asp:TableRow HorizontalAlign="Center" ID="Row1" Visible="false"> <asp:TableCell> <asp:TextBox ID="txtTermName1" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks1" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass1" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtWeight1" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow HorizontalAlign="Center" ID="Row2" Visible="false"> <asp:TableCell> <asp:TextBox ID="txtTermName2" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks2" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass2" runat="server"></asp:TextBox> </asp:TableCell>

<asp:TableCell> <asp:TextBox ID="txtWeight2" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow HorizontalAlign="Center" ID="Row3" Visible="false"> <asp:TableCell> <asp:TextBox ID="txtTermName3" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks3" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass3" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtWeight3" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow HorizontalAlign="Center" ID="Row4" Visible="false"> <asp:TableCell> <asp:TextBox ID="txtTermName4" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks4" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass4" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtWeight4" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow HorizontalAlign="Center" ID="Row5" Visible="false">

<asp:TableCell> <asp:TextBox ID="txtTermName5" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks5" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass5" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtWeight5" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow HorizontalAlign="Center" ID="Row6" Visible="false"> <asp:TableCell> <asp:TextBox ID="txtTermName6" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks6" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass6" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtWeight6" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow HorizontalAlign="Center" ID="Row7" Visible="false"> <asp:TableCell> <asp:TextBox ID="txtTermName7" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks7" runat="server"></asp:TextBox>

</asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass7" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtWeight7" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow HorizontalAlign="Center" ID="Row8" Visible="false"> <asp:TableCell> <asp:TextBox ID="txtTermName8" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks8" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass8" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtWeight8" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow HorizontalAlign="Center" ID="Row9" Visible="false"> <asp:TableCell> <asp:TextBox ID="txtTermName9" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtMaxMarks9" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtPass9" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell>

<asp:TextBox ID="txtWeight9" runat="server"></asp:TextBox> </asp:TableCell> </asp:TableRow> </asp:Table> </asp:Panel> </div> </div> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Admin\ExamSetting.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Admin_ExamSetting : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); } protected void btnShowDetails_Click(object sender, EventArgs e) { int num = int.Parse(txtNumTerms.Text); Table tb = new Table(); for (int i = 1; i <= num; i++) { Table1.Rows[i].Visible = true; TextBox txtTermName =(TextBox) Table1.Rows[i].FindControl("txtTermName" + i.ToString()); if(txtTermName!=null) txtTermName.Text = "Term " + i.ToString(); } } protected void btnSaveDetails_Click(object sender, EventArgs e) {

int num = int.Parse(txtNumTerms.Text); Table tb = new Table(); ExamSettingBLL obj = new ExamSettingBLL();

//classes = classes.Substring(1, classes.Length-1); for (int j = 0; j < lstClasses.Items.Count; j++) { if (lstClasses.Items[j].Selected) { decimal tid = obj.ClassExists(lstClasses.Items[j].Text); if ( tid>= 0) { obj.RemoveData(tid); } for (int i = 1; i <= num; i++) { TextBox txtTermName = (TextBox)Table1.Rows[i].FindControl("txtTermName" + i.ToString()); TextBox txtMaxMarks = (TextBox)Table1.Rows[i].FindControl("txtMaxMarks" + i.ToString()); TextBox txtPass = (TextBox)Table1.Rows[i].FindControl("txtPass" + i.ToString()); TextBox txtWeight = (TextBox)Table1.Rows[i].FindControl("txtWeight" + i.ToString()); obj.InsertData(txtTermName.Text, decimal.Parse(txtMaxMarks.Text), decimal.Parse(txtPass.Text), decimal.Parse(txtWeight.Text), lstClasses.Items[j].Text); } } } }

K:\SpringDale\Admin\HolidayManager.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="HolidayManager.aspx.cs" Inherits="Admin_HolidayManager" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <style type="text/css"> table, .table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption, .caption { text-align: left; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot, .theader { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left;

height:30px; } thead th, tfoot th, .theader th { padding:5px; text-align:left } table a { color: #333333; text-decoration:none; } table a:hover { } tr.odd, .odd { background: #f1f1f1; text-align:left; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none;

} .callout { padding: 5px; border: 1px solid #7992B0; background-color: #8AA9B7; border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); } </style> <script type="text/javascript" language="javascript"> var currentrow; var pagecontent = 10; var currentpage = 1; function jsonFeedRecieved(result) { var i = 0; //myObject = JSON.parse(result); myObject = jQuery.parseJSON(result); var txt = "<table id='holidaytable' style='margin:0 auto;width:100%;border:none;'>"; txt += "<thead><tr><th><input id='headerchk' onclick='headerChecked();' type='checkbox' /></th><th>SNo</th>"; txt += "<th>Day</th><th>Month</th><th>Year</th><th>Description</th></tr></thead><tbody>"; //<th>Publisher</th><th>Avail</th> for (i = 0; i < myObject.length; i++) { if (i < 9) {

txt += "<tr name='" + (i+1).toString() + "' id='holidayrow" + (i + 1).toString() + "' class='hovereffect'><td><input id='chkRow" + (i + 1).toString() + "' value='" + myObject[i].Sno.toString(); txt += "' type='checkbox' onclick='rowChecked(" + myObject[i].Sno + ");'/></td>"; txt += "<td>" + myObject[i].Sno + "</td>"; txt += "<td>" + myObject[i].dt_dd + "</td>"; txt += "<td>" + myObject[i].dt_mm + "</td>"; txt += "<td>" + myObject[i].dt_yyyy + "</td>"; txt += "<td>" + myObject[i].dt_desc + "</td></tr>"; } else { txt += "<tr name='" + (i + 1).toString() + "' id='holidayrow" + (i + 1).toString() + "' style='display:none;' class='hovereffect'><td><input id='chkRow" + (i + 1).toString() + "' value='" + myObject[i].Sno.toString(); txt += "' type='checkbox' onclick='rowChecked(" + myObject[i].Sno + ");'/></td>"; txt += "<td>" + myObject[i].Sno + "</td>"; txt += "<td>" + myObject[i].dt_dd + "</td>"; txt += "<td>" + myObject[i].dt_mm + "</td>"; txt += "<td>" + myObject[i].dt_yyyy + "</td>"; txt += "<td>" + myObject[i].dt_desc + "</td></tr>"; } } txt += "</tbody>"; if (myObject.length > pagecontent) { var pages = myObject.length / pagecontent; var rem = myObject.length % pagecontent; if (rem > 0) pages += 1;

txt += "<tfoot><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbs p;</td><td>"; for (i = 1; i <= pages; i++) { txt += "<a href='javascript:void(0)' style ='padding:5px;' onclick='showpage(" + i.toString() + ");'>" + i.toString() + "</a>"; } } txt += "</td></tr></tfoot></table>";

$("#holidaylist").html(txt);

} function showpage(pagenum) { $('#holidaytable tbody tr:visible').hide(); var start = (pagenum - 1) * pagecontent; var j = 0; currentpage = pagenum; $('#holidaytable tr').each(function () { j = j + 1; if (j >= (start+1) && j <= (start + pagecontent)) { $(this).show(); } }); } function getJsonString() { $.fx.speeds._default = 1000;

// $("#ajaxloader").show(); //$("#showjson").hide(); $("#btnDelete").button(); //$("#btnDelete").click("deleteHolidays"); HolidayListSvc.GetAllHolidays(jsonFeedRecieved); } function deleteHolidays() { var i = 0; var chkbox=""; $('#holidaytable tr').each(function () { i = i + 1; chkbox = '#chkRow' + i; if ($(chkbox).is(':checked')) { var rowid = "#holidayrow" + i.toString(); //alert(); HolidayListSvc.DeleteSnoHolidays($(chkbox).val()); $(rowid).remove();

}); HolidayListSvc.GetAllHolidays(jsonFeedRecieved); return false; } function rowChecked(index) { } function headerChecked() { var i = 0; $('#holidaytable tr:visible').each(function () {

i = parseInt($(this).attr('name')); if (isNaN(i) == false) { chkbox = '#chkRow' + i; $(chkbox).attr('checked', $('#headerchk').is(':checked')); }

}); return false; }

</script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="HolidayPanel" runat="server"> <ContentTemplate> <table width="100%"> <tr> <td> <asp:Panel ID="Panel1" runat="server" Width="710px" > <asp:Table ID="Table1" runat="server" Width="100%" CssClass="table"> <asp:TableHeaderRow HorizontalAlign="Center"> <asp:TableHeaderCell Width="40%">Choose Date</asp:TableHeaderCell> <asp:TableHeaderCell Width="20%">Date</asp:TableHeaderCell> <asp:TableHeaderCell Width="37%">Description</asp:TableHeaderCell>

</asp:TableHeaderRow> <asp:TableRow HorizontalAlign="Center"> <asp:TableCell HorizontalAlign="Center"> <asp:Calendar ID="calDate" runat="server" OnSelectionChanged="CalDateChange"></asp:Calendar> </asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtDate" runat="server" FontSize="Medium"></asp:TextBox>

</asp:TableCell> <asp:TableCell> <asp:TextBox ID="txtDesc" runat="server" Font-Size="Medium" ></asp:TextBox> </asp:TableCell></asp:TableRow><asp:TableRow HorizontalAlign="Center"> <asp:TableCell HorizontalAlign="Center"> <asp:DropDownList ID="DaysList" runat="server"> <asp:ListItem Value="1">Monday</asp:ListItem> <asp:ListItem Value="2">Tuesday</asp:ListItem> <asp:ListItem Value="3">Wednesday</asp:ListItem> <asp:ListItem Value="4">Thursday</asp:ListItem> <asp:ListItem Value="5">Friday</asp:ListItem> <asp:ListItem Value="6">Saturday</asp:ListItem> <asp:ListItem Value="0">Sunday</asp:ListItem> </asp:DropDownList> </asp:TableCell><asp:TableCell> <asp:Button ID="btnSundays" runat="server" CssClass="ui-buttontext-icon ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" Text="Day Holiday For Year" OnClick="btnSundayClicked" OnClientClick="javascript:getJsonString();" />

</asp:TableCell><asp:TableCell> <asp:Button ID="btnUpdate" runat="server" CssClass="ui-button-texticon ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" Text="Add Holiday" OnClick="AddHoliday" OnClientClick="javascript:getJsonString();" /> </asp:TableCell></asp:TableRow></asp:Table></asp:Panel></td><td> <div style="width:710px;" id="holidaylist"> </div> <div> <input id='btnDelete' type='button' value='Delete' onclick="deleteHolidays();" /> </div> </td> </tr> </table>

</ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Admin\HolidayManager.aspx.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Admin_HolidayManager : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!ClientScript.IsStartupScriptRegistered("loadevent")) { ClientScript.RegisterStartupScript(this.GetType(), "loadevent", "Sys.Application.add_load(getJsonString)",true); } } protected void AddHoliday(object sender, EventArgs e) { HolidayListSvc svc = new HolidayListSvc(); if (calDate.SelectedDate.Year < 2000) calDate.SelectedDate = DateTime.Now.Date; if (txtDesc.Text == "" || txtDesc.Text.Length < 1) txtDesc.Text = "Undefined"; if (svc.InsertHoliday(calDate.SelectedDate.Day, calDate.SelectedDate.Month, calDate.SelectedDate.Year, txtDesc.Text)) {

} } protected void CalDateChange(object sender, EventArgs e) { txtDate.Text = calDate.SelectedDate.ToShortDateString();

} protected void btnSundayClicked(object sender, EventArgs e) { List<DateTime> Dates; if(calDate.SelectedDate.Year <2000) calDate.SelectedDate = DateTime.Now.Date;

Dates = GetAllDays(calDate.SelectedDate.Year, int.Parse(DaysList.SelectedValue)); HolidayListSvc svc = new HolidayListSvc(); foreach (DateTime dt in Dates) { svc.InsertHoliday(dt.Day, dt.Month, dt.Year, DaysList.SelectedItem.Text); }

List<DateTime> GetAllDays(int year,int weekday)

{ List<DateTime> Dates = new List<DateTime>();

DateTime Date = new DateTime(year, 1, 1); bool firstsundayfound = false; txtDesc.Text = year.ToString(); while (Date.Year == year) { if ((Convert.ToInt16(Date.DayOfWeek) == weekday)) { Dates.Add(Date); firstsundayfound = true; } if (firstsundayfound) { Date = Date.AddDays(7); continue; } Date = Date.AddDays(1); } return Dates; } }

K:\SpringDale\Admin\ManageRoles.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ManageRoles.aspx.cs" Inherits="Admin_ManageRoles" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript"> function myPageLoad() { findRoles(); $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" });

$("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#opener").button(); $("#opener").click(SearchClicked);

//$("#btnAddRole").button(); $("#btnAddRole").click(addRole); //$("#btnRemoveRole").button(); $("#btnRemoveRole").click(deleteRole); return false; } function SearchClicked() { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result);

}, function () { $("#dialog").html("Unable To Retrieve Data...!"); }) }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; } function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false;

} function findRoles() { $("#ajaxloader").show(); ManageUsersRoles.GetAllRoles(gotAllRoles); return false; } function gotAllRoles(result) { var i = 0; $("#ajaxloader").hide(); for (i = 0; i < result.length; i++) { $('#AllRoles').append("<option value='" + result[i] +"'>" + result[i] + "</option>"); } return false; } function deleteRole() { var str = ""; $("#AllRoles option:selected").each(function () { str = $(this).text(); ManageUsersRoles.removeRole(str, roleDeleted,roleDeleteError); }); return false; } function addRole() { $("#ajaxloader").show(); var obj = document.getElementById('txtRoleName'); ManageUsersRoles.addRole(obj.value, roleUpdated); return false; }

function roleDeleteError(result) { $('#msgText').html("<b>Unable To Update Role It Might Already Exist Or There May Be Users Attached</b>"); return false; } function roleDeleted(result) { $("#ajaxloader").hide(); if (result == true) { $('#msgText').html("<b>Role Deleted</b>"); $("#AllRoles option:selected").remove(); } else { $('#msgText').html("<b>Unable To Update Role It Might Already Exist </b>"); } return false; } function roleUpdated(result) { $("#ajaxloader").hide(); if (result == true) { $('#msgText').html("<b>Role Added</b>"); var obj = document.getElementById('txtRoleName'); $('#AllRoles').append("<option value='" + obj.value + "'>" + obj.value + "</option>"); } else { $('#msgText').html("<b>Unable To Update Role It Might Already Exist </b>"); } return false; } </script>

<style type="text/css"> #AllRoles { width: 429px; } table { border:0 none 0; border-bottom-style:none; border-top-style:none; border-right-style:none; border-left-style:none; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/ManageUsersRoles.asmx"/> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Detailed Student Information" style="width:200px;height:300px;"> <p>This will show the record for the student you have selected</p> </div> <div style="width:100%; z-index:9999;"> <div style="float:left;width:10%;">

<div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:12px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:12px; text-align:center;" id="fixed-div"><button id="opener" type="button" >Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div id="masterCtrl" style="height:43px;float:left;width:74%; margin-top:5px;"> <table width="100%"> <tr> <td> <table> <tr> <td><div style="float:left;"><input id="txtRoleName" type="text" onkeyup="" /></div></td> <td><div style="float:left;"><button id="btnAddRole" type="button" value="AddRole" style="z-index:9999;" >Add Role</button></div></td> <td><div style="float:left;"><button id="btnRemoveRole" type="button" value="DeleteRole" style="z-index:9999;">Delete Role</button></div></td> <td><div style="float:left; display:none;" id="ajaxloader">&nbsp;

<img src="../css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> </tr> </table> </td> </tr> <tr> <td> <div id="msgText">&nbsp;</div> </td> </tr> <tr> <td> <div id="RoleManager" > <select name="drop1" id="AllRoles" size="14">

</select> </div> </td> </tr> </table>

</div>

</div> </ContentTemplate> </asp:UpdatePanel>

</asp:Content>

K:\SpringDale\Admin\ManageRoles.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Admin_ManageRoles : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(myPageLoad);", true); } }

K:\SpringDale\Admin\ManageUsers.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ManageUsers.aspx.cs" Inherits="Admin_ManageUsers" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript"> function myOnLoad() { findUser(); } function openUserWizard() { $('#txtNewUserName').val(''); $('#txtPassword').val(''); $('#txtPassword2').val(''); $('#txtEmail').val(''); $('#txtErorr').val(''); $('#txtQuestion').val(''); $('#txtAnswer').val(''); $("#CreateUser").dialog("open"); return false; return false; } function createUser() { $("#ajaxLoader2").show(); var txtUserName = $('#txtNewUserName').val();

if (txtUserName == null || txtUserName == ''){ $('#txtErorr').text("Sorry! User Name field cannot be blank....."); $('#txtErorr').show(); $("#ajaxLoader2").hide(); return false; } var txtPassword = $('#txtPassword').val(); var txtPassword2 = $('#txtPassword2').val(); if ( txtPassword == null || txtPassword == '') { $('#txtErorr').show(); $('#txtErorr').text("Sorry! Password field cannot be blank....."); $("#ajaxLoader2").hide(); return false; } if (txtPassword != txtPassword2) { $('#txtErorr').text("Sorry the passwords do not match"); $('#txtErorr').show(); $("#ajaxLoader2").hide(); return false; } var txtEmail = $('#txtEmail').val(); if (txtEmail == undefined || txtEmail == null || txtEmail == '') { $('#txtErorr').text("Sorry! You must give a valid Email."); $('#txtErorr').show(); $("#ajaxLoader2").hide(); return false; } var txtSecurityQ = $('#txtQuestion').val(); if (txtSecurityQ == undefined || txtSecurityQ == null || txtSecurityQ == '') { $('#txtErorr').text("Sorry! Security Question Field Cannot be left blank.");

$('#txtErorr').show(); $("#ajaxLoader2").hide(); return; } var txtAnswer = $('#txtAnswer').val(); if (txtAnswer == undefined || txtAnswer == null || txtAnswer == '') { $('#txtErorr').text("Sorry! User Name field cannot be blank....."); $('#txtErorr').show(); $("#ajaxLoader2").hide(); return; } ManageUsersRoles.CreateNewUser(txtUserName, txtPassword, txtEmail, txtSecurityQ, txtAnswer, function (result) { $("#ajaxLoader2").hide(); $('#txtErorr').text("Congratulation! user " + txtUserName + " has been created "); $('#txtNewUserName').text(""); $('#Password').text(""); $('#Password2').text(""); $('#txtEmail').text(""); $('#txtQuestion').text(""); $('#txtAnswer').text(""); findUser(); $('#txtErorr').text('User Creation Successfull'); }, function (result) { $("#ajaxLoader2").hide(); $('#txtErorr').text(result.toString()); $("#CreateUser").dialog("close"); }, this); } function delUser(username) {

$("#ajaxloader").show(); ManageUsersRoles.DeleteUser(username, function (result) { if (result == true) { findUser(); } else { $("#ajaxloader").hide(); alert("Sorry! Unable to delete user"); } }, function () { $("#ajaxloader").hide(); }); } function UserRoles(userName, roleName, playerPPD) { this.PlayerID = playerID; this.PlayerName = playerName; this.PlayerPPD = parseFloat(playerPPD); } function findUser() { $("#ajaxloader").show(); var obj = document.getElementById('txtUserName'); if (obj.value == null || obj.value == undefined) obj.value = ""; ManageUsersRoles.GetUserRolesTable(obj.value, GotAllUsers, ErrorInFindUsers); $.fx.speeds._default = 1000; $("#dialog").dialog({ autoOpen: false, show: "blind",

hide: "explode" }); $("#CreateUser").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 800, height: 450 }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

//$("#btnNewUser").button(); $("#btnNewUser").click(openUserWizard); // $("#btnSearch").button(); $("#btnSearch").click(findUser); //$('#btnCreate').button(); $('#btnCreate').click(createUser);

$("#opener").button(); $("#opener").click(function () { $("#lstSearchItem option:selected").each(function () {

$("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); $("#AttendanceGrid").hide("slow"); return false; } function GotAllUsers(result) { $("#ajaxloader").hide(); $("#AttendanceGrid").show("slow"); $("#AttendanceGrid").html(result.toString()); } function ErrorInFindUsers(result) { } function updateUser(obj) { if (obj.checked) { ManageUsersRoles.putUserInRole(obj.name, obj.value, userUpdated); } else {

ManageUsersRoles.removeUserFromRole(obj.name, obj.value, userUpdated); } } function userUpdated(result) { if (result == true) { $('#msgText').html("<b>User Updated</b>"); } else { $('#msgText').html("<b>Unable To Update User>/b>"); } } function OpenWizard() { $('#CreateUserWizard').toggle('slow', function () { var txt = $('#openwizardhref').text(); txt = txt == 'Open User Creation Wizard' ? 'Close User Creation Wizard' : 'Open User Creation Wizard'; $('#openwizardhref').text(txt); }); } function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false; } </script> <style type="text/css"> .style1 { width: 34%;

} #txtQuestion { width: 390px; } #txtAnswer { width: 391px; } .style3 { font-family: Arial, Helvetica, sans-serif; font-size: medium; font-style: normal; font-weight: bold; color: #353133; letter-spacing: normal; width: 34%; height: 34px; } .style4 { font-family: Arial, Helvetica, sans-serif; font-size: medium; width: 50%; height: 34px; } .style5 { font-family: Arial, Helvetica, sans-serif; font-size: medium; font-style: normal; font-weight: bold;

color: #353133; letter-spacing: normal; width: 34%; } .style6 { height: 24px; width: 796px; } .style7 { width: 796px; } table { border:0 none 0; border-bottom-style:none; border-top-style:none; border-right-style:none; border-left-style:none; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/ManageUsersRoles.asmx"/> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>

<div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Detailed Student Information" style="width:200px;height:300px;"> <p>This will show the record for the student you have selected</p> </div> <div id="CreateUser" title="Create New User" style="width:847px; height:300px; zindex:9999;"> <table border="0" style="width: 823px"> <tr id="Row1"> <td class="style7"></td> </tr> <tr> <td class="style6"></td> </tr> <tr> <td class="style7"><table width="100%" border="0" style="height: 242px; width: 95%"> <tr> <td class="style5" >UserName</td> <td class="textbox1" ><input name="txtNewUserName" type="text" id="txtNewUserName" accesskey="t" tabindex="0" size="50" maxlength="100" /></td> </tr> <tr> <td class="style3">Password</td> <td class="style4" ><input name="txtPassword" type="password" id="txtPassword" accesskey="t" tabindex="0" size="25" maxlength="25" /></td> </tr> <tr> <td class="style5">Confirm Password</td> <td class="textbox1" ><input name="txtPassword2" type="password" id="txtPassword2" accesskey="t" tabindex="0" size="25" maxlength="25" /></td> </tr>

<tr> <td class="style5">Security Question</td> <td class="textbox1" ><input name="txtQuestion" type="text" id="txtQuestion" accesskey="t" tabindex="0" size="125" maxlength="125" /></td> </tr> <tr> <td class="style5">Security Answer</td> <td class="textbox1" ><input name="txtAnswer" type="text" id="txtAnswer" accesskey="t" tabindex="0" size="125" maxlength="125" /></td> </tr> <tr> <td class="style5">Email</td> <td class="textbox1" ><input name="txtEmail" type="text" id="txtEmail" accesskey="t" tabindex="0" size="50" maxlength="100" /></td> </tr> <tr> <td class="style1"><div style="float:left; display:none;" id="ajaxLoader2">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> <td class="textbox1"><label id="txtErorr" style="display:none; color:Red; fontweight:bolder;"></label>&nbsp;</td> </tr> </table></td> </tr> <tr> <td class="style7"><button name="btnCreate" id="btnCreate" value="Create User" >Creat User</button> </td> </tr> </table> </div> <div style="width:100%;">

<div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:12px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:12px; text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div id="masterCtrl" style="float:left;width:74%; margin-top:5px;"> <table style="width:100%"> <tr> <td> <table><tr><td><b>Enter UserName To Search&nbsp;&nbsp;&nbsp;</b><input id="txtUserName" type="text" onkeyup="findUser();" /></td> <td><button id="btnSearch" type="button" value="Search" >Search...</button></td> <td><button id="btnNewUser" value="CreateUser" onclick="openUserWizard();">Create New User</button></td> <td><div style="float:left; display:none;" id="ajaxloader">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div>

</td> </tr> </table> </td> </tr> <tr> <td> <div id="msgText">&nbsp;</div> </td> </tr> <tr> <td> <div id="AttendanceGrid" ></div> </td> </tr> </table>

</div>

</div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Admin\ManageUsers.aspx.cs
using System; using System.Collections.Generic; using System.Web.Security; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using ManageUsersTableAdapters; public partial class Admin_ManageUsers : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(myOnLoad);", true); } protected void txtUserNameSearch_TextChanged(object sender, EventArgs e) {

} protected void CreateUserWizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) {

e.Cancel = true; }

protected void CreateUserWizard1_ContinueButtonClick(object sender, EventArgs e) { } }

K:\SpringDale\Admin\StudentMaster.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="StudentMaster.aspx.cs" Inherits="Admin_StudentMaster" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <link type="text/css" href="http://learnasp.in/css/MyTableStyle.css" /> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript"> function myPageLoad() { findRoles(); $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" });

$("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#opener").button(); $("#opener").click(SearchClicked);

//$("#btnAddRole").button(); $("#btnAddRole").click(addRole); //$("#btnRemoveRole").button(); $("#btnRemoveRole").click(deleteRole); return false; } function SearchClicked() { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result);

}, function () { $("#dialog").html("Unable To Retrieve Data...!"); }) }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; } function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false;

} function findRoles() { $("#ajaxloader").show(); ManageUsersRoles.GetAllRoles(gotAllRoles); return false; } function gotAllRoles(result) { var i = 0; $("#ajaxloader").hide(); for (i = 0; i < result.length; i++) { $('#AllRoles').append("<option value='" + result[i] + "'>" + result[i] + "</option>"); } return false; } function deleteRole() { var str = ""; $("#AllRoles option:selected").each(function () { str = $(this).text(); ManageUsersRoles.removeRole(str, roleDeleted, roleDeleteError); }); return false; } function addRole() { $("#ajaxloader").show(); var obj = document.getElementById('txtRoleName'); ManageUsersRoles.addRole(obj.value, roleUpdated); return false; }

function roleDeleteError(result) { $('#msgText').html("<b>Unable To Update Role It Might Already Exist Or There May Be Users Attached</b>"); return false; } function roleDeleted(result) { $("#ajaxloader").hide(); if (result == true) { $('#msgText').html("<b>Role Deleted</b>"); $("#AllRoles option:selected").remove(); } else { $('#msgText').html("<b>Unable To Update Role It Might Already Exist </b>"); } return false; } function roleUpdated(result) { $("#ajaxloader").hide(); if (result == true) { $('#msgText').html("<b>Role Added</b>"); var obj = document.getElementById('txtRoleName'); $('#AllRoles').append("<option value='" + obj.value + "'>" + obj.value + "</option>"); } else { $('#msgText').html("<b>Unable To Update Role It Might Already Exist </b>"); } return false; } </script>

<style type="text/css"> #AllRoles { width: 429px; } table { border:0 none 0; border-bottom-style:none; border-top-style:none; border-right-style:none; border-left-style:none; } .simpletextbox { width:90%; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/ManageUsersRoles.asmx"/> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Detailed Student Information" style="width:200px;height:300px;">

<p>This will show the record for the student you have selected</p> </div> <div style="width:100%; z-index:9999;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:12px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:12px; text-align:center;" id="fixed-div"> <button id="opener" type="button" >Search...</button> </div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div id="masterCtrl" style="height:43px;float:left;width:74%; margintop:5px;"> <table border="0" style="width:100%;" > <tbody> <tr> <td> <table border="0" style="width:100%;" > <tr> <td style="width:20%; font-weight:bold;"> Search Student Name

</td> <td style="width:20%;"> <asp:TextBox ID="txtSearchStudent" runat="server" CssClass="simpletextbox"></asp:TextBox> </td> <td> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="http://learnasp.in/css/search.png" onclick="ImageButton1_Click" /> </td> </tr> </table> </td> </tr> <tr> <td> <asp:GridView ID="studentMaster" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="EnrollNo" DataSourceID="studentMasterSource" GridLines="None" > <Columns> <asp:BoundField DataField="EnrollNo" HeaderText="EnrollNo" ReadOnly="True" SortExpression="EnrollNo" /> <asp:BoundField DataField="RollNo" HeaderText="RollNo" SortExpression="RollNo" /> <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" /> <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" /> <asp:BoundField DataField="ClassID" HeaderText="ClassID" SortExpression="ClassID" />

<asp:BoundField DataField="ClassName" HeaderText="ClassName" ReadOnly="True" SortExpression="ClassName" /> <asp:BoundField DataField="ClassSection" HeaderText="ClassSection" ReadOnly="True" SortExpression="ClassSection" /> <asp:BoundField DataField="FathersName" HeaderText="FathersName" SortExpression="FathersName" /> <asp:BoundField DataField="MothersName" HeaderText="MothersName" SortExpression="MothersName" /> <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" /> <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" /> <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" /> <asp:BoundField DataField="HomePhone" HeaderText="HomePhone" SortExpression="HomePhone" /> <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" /> <asp:BoundField DataField="CompanyAddress" HeaderText="CompanyAddress" SortExpression="CompanyAddress" /> <asp:BoundField DataField="CompanyPhone" HeaderText="CompanyPhone" SortExpression="CompanyPhone" /> <asp:BoundField DataField="Designation" HeaderText="Designation" SortExpression="Designation" /> <asp:BoundField DataField="LastCollege" HeaderText="LastCollege" SortExpression="LastCollege" />

<asp:BoundField DataField="LastResult" HeaderText="LastResult" SortExpression="LastResult" /> </Columns> </asp:GridView> </td> </tr> </tbody> </table> <asp:SqlDataSource ID="studentMasterSource" runat="server" ConnectionString="<%$ ConnectionStrings:springdaleConnectionString2 %>" SelectCommand="SELECT EnrollNo, RollNo, FirstName, LastName, ClassID, (SELECT FROM WHERE (SELECT FROM ClassName ClassRec (ClassID = StudentRec.ClassID)) AS ClassName, ClassSection ClassRec AS ClassRec_1

WHERE (ClassID = StudentRec.ClassID)) AS ClassSection, FathersName, MothersName, Address, City, State, HomePhone, CompanyName, CompanyAddress, CompanyPhone, Designation, LastCollege, LastResult, StudentImage FROM '%'"> StudentRec where FirstName like @fname + '%' or LastName like @fname + <SelectParameters> <asp:ControlParameter ControlID="txtSearchStudent" Name="fname" PropertyName="Text" /> </SelectParameters> </asp:SqlDataSource> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Admin\StudentMaster.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Admin_StudentMaster : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(myPageLoad);", true); if (!IsPostBack) txtSearchStudent.Text = "%"; } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { //studentMaster.Columns.Clear();

studentMasterSource.DataBind(); } }

K:\SpringDale\Admin\SubjectManager.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="SubjectManager.aspx.cs" Inherits="Admin_SubjectManager" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; function addload() {

$("#opener").button(); $("#opener").click(function () { return false; }); $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" });

$("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); });

</script> <style type="text/css"> .sendback { z-index:-9999; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> <asp:ServiceReference Path="http://learnasp.in/GetTeachers.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3>

</p> </div>

<div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px; text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <div style="width:100%;margin:0 auto;padding:0;" class="ui-widget-header"><h2>Enter Subjects For Each Class</h2></div> <asp:Table runat="server" Width="100%" CssClass="sendback" BorderStyle="None" style="border:0;" > <asp:TableRow CssClass="sendback"> <asp:TableCell Width="20%" ><b>Enter Or Choose Subject Name</b> </asp:TableCell> <asp:TableCell Width="30%"> <table width="100%" border="0" style=" border-bottom-style:none; borderleft-style:none; border-right-style:none; border-top-style:none;"> <tr> <td style="width:30%; vertical-align:bottom;"> <asp:TextBox ID="txtSubName" runat="server"></asp:TextBox>

</td> <td style="width:10%"> &nbsp; </td> <td style="vertical-align:top;"> <asp:ComboBox ID="cmbSubName" runat="server" DataSourceID="DSSubjectName" DataTextField="SubjectName" DataValueField="SubjectID" AutoCompleteMode="SuggestAppend" AutoPostBack="true" DropDownStyle="DropDownList" Width="140px" OnSelectedIndexChanged="cmbSubName_SelChanged" CssClass="sendback" ontextchanged="cmbSubName_TextChanged" style="display:inline; vertical-align:top;" > </asp:ComboBox> </td> </tr> </table>

</asp:TableCell> <asp:TableCell Width="49%"> </asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="sendback"> <asp:TableCell Width="20%"><b>Choose Class</b></asp:TableCell> <asp:TableCell Width="50%"> <table border="0" style="border-bottom-style:none; border-top-style:none; border-left-style:none; border-right-style:none;z-index:-99999;"> <tr> <td class="sendback" style="width:30%;">

<asp:DropDownList ID="cmbClasses" runat="server" Width="80px" DataSourceID="DSClassRec" DataTextField="Class" DataValueField="ClassID" > </asp:DropDownList> </td> <td style="width:10%;"> <b>Subject Teacher</b> </td> <td class="sendback" style="width:20%;"> <asp:DropDownList ID="cmbTeacher" runat="server" CssClass="sendback" DataSourceID="DSTeachers" DataValueField="TeacherID" DataTextField="TeacherName" style="vertical-align:bottom;z-index:-99999;"> </asp:DropDownList> </td> <td style="width:10%;"> <b>Periods/Week</b> </td> <td style="width:10%;"> <asp:TextBox ID="txtNumPeriods" runat="server"></asp:TextBox> </td> <td style="width:10%;"> &nbsp; </td> </tr> </table>

</asp:TableCell> <asp:TableCell> <asp:Button ID="btnUpdate" runat="server" Text="Add" OnClick="btnUpdate_Click" /> </asp:TableCell> </asp:TableRow>

</asp:Table>

</div>

</div> <asp:ObjectDataSource ID="DSSubjectName" runat="server" DeleteMethod="DeleteData" InsertMethod="InsertData" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="SubjectsBLL" UpdateMethod="UpdateData"> <DeleteParameters> <asp:Parameter Name="subjectid" Type="Decimal" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="subjectname" Type="String" /> <asp:Parameter Name="classid" Type="Decimal" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="subjectid" Type="Decimal" /> <asp:Parameter Name="subjectname" Type="String" /> <asp:Parameter Name="classid" Type="Decimal" /> </UpdateParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="DSClassRec" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetClassSectAdd" TypeName="ClassRecBLL"></asp:ObjectDataSource> <asp:ObjectDataSource ID="DSGridAll" runat="server" DeleteMethod="DeleteData" InsertMethod="InsertData" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataEx" TypeName="SubjectsBLL" UpdateMethod="UpdateData">

<DeleteParameters> <asp:Parameter Name="subjectid" Type="Decimal" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="subjectname" Type="String" /> <asp:Parameter Name="classid" Type="Decimal" /> <asp:Parameter Name="teacherid" Type="Decimal" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="subjectid" Type="Decimal" /> <asp:Parameter Name="subjectname" Type="String" /> <asp:Parameter Name="classid" Type="Decimal" /> <asp:Parameter Name="teacherid" Type="Decimal" /> </UpdateParameters> </asp:ObjectDataSource> <asp:SqlDataSource ID="DSTeachers" runat="server" ConnectionString="<%$ ConnectionStrings:springdaleConnectionString2 %>" SelectCommand="SELECT [TeacherID], [TeacherName] FROM [TeacherDummy]"></asp:SqlDataSource> <asp:SqlDataSource ID="DSGridView2" runat="server" ConnectionString="<%$ ConnectionStrings:springdaleConnectionString2 %>" SelectCommand="SELECT SubjectRec.SubjectID, SubjectRec.SubjectName, ClassRec.ClassName, ClassRec.ClassSection, SubjectRec.NumPeriodsPerWeek,TeacherDummy.TeacherName FROM SubjectRec INNER JOIN TeacherDummy ON SubjectRec.TeacherID = TeacherDummy.TeacherID INNER JOIN ClassRec ON SubjectRec.ClassID = ClassRec.ClassID"></asp:SqlDataSource> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="btnUpdate" /> </Triggers> </asp:UpdatePanel> <asp:UpdatePanel ID="Update2" runat="server"> <ContentTemplate>

<div style="clear:both;">&nbsp;</div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;">&nbsp;</div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;">

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="DSGridView2" ondatabound="GridView1_DataBound" RowStyle-BorderStyle="None" GridLines="None" BorderStyle="None" style="border-bottom-style:none; border-top-style:none; border-left-style:none; border-right-style:none; width:100%;" AllowPaging="True" > <Columns> <asp:BoundField DataField="SubjectID" HeaderText="SubjectID" SortExpression="SubjectID" /> <asp:BoundField DataField="SubjectName" HeaderText="SubjectName" SortExpression="SubjectName" /> <asp:BoundField DataField="ClassName" HeaderText="ClassName" SortExpression="ClassName" /> <asp:BoundField DataField="ClassSection" HeaderText="ClassSection" SortExpression="ClassSection" /> <asp:BoundField DataField="NumPeriodsPerWeek" HeaderText="NumPeriodsPerWeek" SortExpression="NumPeriodsPerWeek" /> <asp:BoundField DataField="TeacherName" HeaderText="TeacherName" SortExpression="TeacherName" /> <asp:TemplateField> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="http://learnasp.in/css/remove.png" RowIndex='<%# Container.DisplayIndex %>' OnClick="ImageButton1_Click"/>

</ItemTemplate> </asp:TemplateField> </Columns> <RowStyle BorderStyle="None" /> </asp:GridView> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="Update2" > <ProgressTemplate> <asp:Image ID="Image1" runat="server" ImageUrl="http://learnasp.in/css/ajaxloader.gif" /> </ProgressTemplate> </asp:UpdateProgress> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Admin\SubjectManager.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Admin_SubjectManager : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); if (Page.IsPostBack) { GridView1.DataBind(); } else { GridView1.DataBind(); } } protected void btnUpdate_Click(object sender, EventArgs e) { SubjectsBLL obj = new SubjectsBLL(); if (string.IsNullOrEmpty(txtSubName.Text)) return;

// convert to char array of the string char[] letters = txtSubName.Text.ToCharArray(); // upper case the first char letters[0] = char.ToUpper(letters[0]); // return the array made of the new char array txtSubName.Text= new string(letters); if (txtNumPeriods.Text =="") txtNumPeriods.Text = "1"; if(obj.IsRecordExist(txtSubName.Text,decimal.Parse(cmbClasses.SelectedValue))) obj.UpdateData(txtSubName.Text, decimal.Parse(cmbClasses.SelectedValue), decimal.Parse(cmbTeacher.SelectedValue), decimal.Parse(txtNumPeriods.Text)); else obj.InsertData(txtSubName.Text, decimal.Parse(cmbClasses.SelectedValue),decimal.Parse(cmbTeacher.SelectedValue),decim al.Parse(txtNumPeriods.Text)); GridView1.DataBind(); } protected void cmbSubName_SelChanged(object sender, EventArgs e) { txtSubName.Text = cmbSubName.SelectedItem.Text; } protected void GridView1_DataBound(object sender, EventArgs e) { GridView1.UseAccessibleHeader = true; GridView1.HeaderRow.TableSection = TableRowSection.TableHeader; GridView1.BorderStyle = BorderStyle.None; GridView1.BorderWidth = new Unit(0.0); } protected void cmbSubName_TextChanged(object sender, EventArgs e) { txtSubName.Text = cmbSubName.SelectedItem.Text; } protected void ImageButton1_Click(object sender, EventArgs e)

{ ImageButton bt = (ImageButton)sender; SubjectsBLL obj = new SubjectsBLL(); int rowIndex = Convert.ToInt32(bt.Attributes["RowIndex"]); string subjectname = GridView1.Rows[rowIndex].Cells[1].Text; string classname = GridView1.Rows[rowIndex].Cells[2].Text; string classection = GridView1.Rows[rowIndex].Cells[3].Text; decimal classid = 0; ClassRecBLL class_obj = new ClassRecBLL(); classid=(decimal)class_obj.GetClassID(classname,classection); class_obj.Dispose(); obj.DeleteData(subjectname, classid); GridView1.DataBind(); } }

K:\SpringDale\Admin\TimeTableCreator.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="TimeTableCreator.aspx.cs" Inherits="Admin_TimeTableCreator" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <style type="text/css"> table { border:0 none; } .subjects { float:left; width:80px; font-size:smaller;

} .draggable { width: 100px; height: 80px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; } .droppable { width: 100px; height: 80px; padding: 0.5em; float: left; margin: 10px; } .ui-state-highlightme { background-color:White; border-color:Orange; width:100px;

height:80px; } </style> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; var color = ''; var current_div; function addload() {

$("#opener").button(); $("#opener").click(function () { return false; }); $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); }); TimeTableManager.GetClassListBox(GotClassListBox); }

function GotClassListBox(result) { $('#classbox').html(result); } function startBuild() { var selected = $("#allclasses option:selected");

var output = ""; if (selected.val() != 0) { output = selected.val(); TimeTableManager.GetAllSubjects(output, GotAllSubjects); TimeTableManager.GetTimeTableGrid(output, GotTheGrid); } } function GotAllSubjects(result) { $('#subjectlist').html(result); } function GotTheGrid(result) { $('#TimeTableGrid').html(result); $('#subjectlist > div').each(function () { $(this).draggable({ revert: "invalid", appendTo: "body", helper: "clone", create: function (event, ui) { var x = $(this).css('backgroundColor'); hexc(x); }, start: function (event, ui) { var x = $(this).css('backgroundColor'); hexc(x); current_div = $(this); } }); }); $('div#TimeTableGrid td').each(function () { $(this).droppable({ activeClass: "ui-state-hover", hoverClass: "ui-state-active",

drop: function (event, ui) { $(this).addClass("ui-state-highlightme") $(this).html(ui.draggable.text()); $(this).css('backgroundColor', color); current_div.hide(); } }); }); } function hexc(colorval) { var parts = colorval.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); delete (parts[0]); for (var i = 1; i <= 3; ++i) { parts[i] = parseInt(parts[i]).toString(16); if (parts[i].length == 1) parts[i] = '0' + parts[i]; } color = '#' + parts.join(''); } function saveTimeTable() { var classid ; var selected = $("#allclasses option:selected"); if (selected.val() != 0) { classid = selected.val(); } var i = 0;

var j = 0; var arr = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; $('div#TimeTableGrid tr').each(function () { i++; $(this).find('td').each(function () { j++; if (j > 1) { var txt = $(this).text(); if (txt != "" && txt.length > 5) { var arr_txt = txt.split("/"); //alert("Day is " + arr[i - 1] + " PeriodNum is " + (j - 1).toString() + " Subject id is " + arr_txt[0] + " Teacher Id is " + arr_txt[2]); TimeTableManager.insertInTimeTable(classid, arr[i - 1], j - 1, arr_txt[0], arr_txt[2], function (result) { if (result == false) { Notifier.error("Unable To Update", "Something has gone wrong"); } }); } } }); j = 0; }); }

</script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services>

<asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/TimeTableManager.asmx" /> <asp:ServiceReference Path="http://learnasp.in/GetTeachers.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3> </div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> </p>

<div style="margin-top:8px; text-align:center;" id="fixed-div"><button id="opener">Search .......</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <div style="margin:auto 0;padding:0;width:100%;"> <table width="100%" border="0"> <tr> <td style="width:10%;"><b>Choose Class</b></td> <td style="width:15%;" id="classbox"></td> <td style="width:20%;" > <input id="btnGetData" type="button" value="StartBuild" onclick="startBuild();" /> </td> <td style="width:15%;"> <input id="btnSave" type="button" value="Save Time Table" onclick="saveTimeTable();" /> </td> </tr> </table> <table width="100%" border="0"> <tr> <td id="subjectlist"> </td> </tr> </table> <div id='TimeTableGrid'> </div> </div> </div> </div> </ContentTemplate> </asp:UpdatePanel>

</asp:Content>

K:\SpringDale\Admin\TimeTableCreator.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Admin_TimeTableCreator : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); } }

K:\SpringDale\Admin\TimeTableMaster.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="TimeTableMaster.aspx.cs" Inherits="Admin_TimeTableMaster" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; function addload() {

$("#opener").button();

$("#opener").click(function () { return false; }); $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" });

$("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); });

</script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> <asp:ServiceReference Path="http://learnasp.in/GetTeachers.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3> </div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> </p>

<option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px; text-align:center;" id="fixed-div"><button id="opener">Search .......</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <div style="margin:auto 0;padding:0;width:100%;"> <table border="0" width="50%"> <thead> <tr> <td> <b>Choose Your Class For Fixing Time Table Metrics </b> </td> </tr> </thead> <tbody> <tr> <td> <asp:ListBox ID="lstClasses" runat="server" DataSourceID="ObjectDataSource1" Width="100%" DataTextField="Class" DataValueField="ClassID" SelectionMode="Multiple"></asp:ListBox> </td> </tr> </tbody> </table> </div>

<table border="0" width="100%"> <thead> <tr> <th>Day Name</th> <th>Number Of Periods</th> <th></th> </tr> </thead> <tbody> <tr> <td>Monday</td> <td> <asp:TextBox ID="txtMonday" runat="server"></asp:TextBox><asp:RequiredFieldValidator ControlToValidate="txtMonday" ID="RequiredFieldValidator1" runat="server" ErrorMessage="Cannot Be Blank" Display="None"></asp:RequiredFieldValidator> <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="RequiredFieldValidator1"> </asp:ValidatorCalloutExtender> </td> <td></td> </tr> <tr> <td>Tuesday</td> <td> <asp:TextBox ID="txtTuesday" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="txtTuesday" ID="RequiredFieldValidator2" runat="server" ErrorMessage="Cannot Be Blank" Display="None"></asp:RequiredFieldValidator>

<asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server" TargetControlID="RequiredFieldValidator2"> </asp:ValidatorCalloutExtender> </td> <td></td> </tr> <tr> <td>Wednesday</td> <td> <asp:TextBox ID="txtWednesday" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="txtWednesday" ID="RequiredFieldValidator3" runat="server" ErrorMessage="Cannot Be Blank" Display="None"></asp:RequiredFieldValidator> <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender5" runat="server" TargetControlID="RequiredFieldValidator3"> </asp:ValidatorCalloutExtender> <a </td> <td></td> </tr> <tr> <td>Thursday</td> <td> <asp:TextBox ID="txtThursday" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="txtThursday" ID="RequiredFieldValidator4" runat="server" ErrorMessage="Cannot Be Blank" Display="None"></asp:RequiredFieldValidator> <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender7" runat="server" TargetControlID="RequiredFieldValidator4"> </asp:ValidatorCalloutExtender>

</td> <td></td> </tr> <tr> <td>Friday</td> <td> <asp:TextBox ID="txtFriday" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="txtFriday" ID="RequiredFieldValidator5" runat="server" ErrorMessage="Cannot Be Blank" Display="None"></asp:RequiredFieldValidator> <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender9" runat="server" TargetControlID="RequiredFieldValidator5"> </asp:ValidatorCalloutExtender> </td> <td></td> </tr> <tr> <td>Saturday</td> <td> <asp:TextBox ID="txtSaturday" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ControlToValidate="txtSaturday" ID="RequiredFieldValidator6" runat="server" ErrorMessage="Cannot Be Blank" Display="None"></asp:RequiredFieldValidator > <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender11" runat="server" TargetControlID="RequiredFieldValidator6"> </asp:ValidatorCalloutExtender> </td> <td> <asp:Button ID="btnUpdate" runat="server" Text="Update...." CssClass="uibutton-text-icon ui-button ui-widget

ui-state-default ui-corner-all ui-button-text-only" onclick="btnUpdate_Click" /> </td> </tr> </tbody> </table> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" > <ProgressTemplate> <asp:Image ID="Image1" runat="server" ImageUrl="http://learnasp.in/css/ajaxloader.gif" /> </ProgressTemplate> </asp:UpdateProgress> </div> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetClassSectAdd" TypeName="ClassRecBLL"></asp:ObjectDataSource> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Admin\TimeTableMaster.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Admin_TimeTableMaster : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); } protected void btnUpdate_Click(object sender, EventArgs e) {

TimeTableMasterBLL obj = new TimeTableMasterBLL(); for (int i = lstClasses.Items.Count - 1; i >= 0; i--) { if (lstClasses.Items[i].Selected == true) { //txtMonday.Text+= " , " + lstClasses.Items[i].Value; if (obj.RecordExists(decimal.Parse(lstClasses.Items[i].Value), "Monday"))

obj.UpdateData(decimal.Parse(lstClasses.Items[i].Value), "Monday", int.Parse(txtMonday.Text)); else obj.InsertData(decimal.Parse(lstClasses.Items[i].Value), "Monday", int.Parse(txtMonday.Text)); if (!obj.RecordExists(decimal.Parse(lstClasses.Items[i].Value), "Tuesday")) obj.InsertData(decimal.Parse(lstClasses.Items[i].Value), "Tuesday", int.Parse(txtTuesday.Text)); else obj.UpdateData(decimal.Parse(lstClasses.Items[i].Value), "Tuesday", int.Parse(txtTuesday.Text)); if (!obj.RecordExists(decimal.Parse(lstClasses.Items[i].Value), "Wednesday")) obj.InsertData(decimal.Parse(lstClasses.Items[i].Value), "Wednesday", int.Parse(txtWednesday.Text)); else obj.UpdateData(decimal.Parse(lstClasses.Items[i].Value), "Wednesday", int.Parse(txtWednesday.Text)); if (!obj.RecordExists(decimal.Parse(lstClasses.Items[i].Value), "Thursday")) obj.InsertData(decimal.Parse(lstClasses.Items[i].Value), "Thursday", int.Parse(txtThursday.Text)); else obj.UpdateData(decimal.Parse(lstClasses.Items[i].Value), "Thursday", int.Parse(txtThursday.Text)); if (!obj.RecordExists(decimal.Parse(lstClasses.Items[i].Value), "Friday")) obj.InsertData(decimal.Parse(lstClasses.Items[i].Value), "Friday", int.Parse(txtFriday.Text)); else obj.UpdateData(decimal.Parse(lstClasses.Items[i].Value), "Friday", int.Parse(txtFriday.Text)); if (!obj.RecordExists(decimal.Parse(lstClasses.Items[i].Value), "Saturday")) obj.InsertData(decimal.Parse(lstClasses.Items[i].Value), "Saturday", int.Parse(txtSaturday.Text)); else obj.UpdateData(decimal.Parse(lstClasses.Items[i].Value), "Saturday", int.Parse(txtSaturday.Text));

} } } }

K:\SpringDale\Admin\web.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <authorization> <allow roles="Administrators"/> <deny roles="Teachers" /> <deny users="*"/> </authorization> </system.web> </configuration>

K:\SpringDale\App_Code\AttendanceCtrl.cs
using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Data; using System.Web; /// <summary> ///This class handles the complex relationship between ///student attendance and class ///use this to show and update data for attendance table /// </summary> /// [System.ComponentModel.DataObject] public class AttendanceControler:IDisposable { private SqlConnection con; private SqlDataAdapter da; private DataTable dt=null; public AttendanceControler(int ClassID) { string connString = System.Configuration.ConfigurationManager.ConnectionStrings["springdaleConnectionStrin g1"].ConnectionString; con = new SqlConnection(connString.ToString() ); try { con.Open();

string commtxt = "Select AttendanceRec.*,(Select FirstName from StudentRec where AttendanceRec.EnrollNo=StudentRec.EnrollNo) as FirstName,"; commtxt+=" (Select LastName from StudentRec where AttendanceRec.EnrollNo=StudentRec.EnrollNo) as LastName from AttendanceRec "; commtxt += "where AttendanceRec.EnrollNo in (Select EnrollNo from StudentRec where ClassID=" + ClassID.ToString() +")"; da = new SqlDataAdapter(commtxt, con); dt = new DataTable("ComplexAttendance"); da.Fill(dt); } catch (Exception ex) { throw ex; } }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public DataTable GetData() { return dt; } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); }

protected virtual void Dispose(bool disposing) { if (disposing) { dt.Dispose(); da.Dispose(); con.Dispose(); } else { } } ~AttendanceControler() { Dispose(false); } }

K:\SpringDale\App_Code\GetAttendanceTable.cs
using System; using System.Collections.Generic; using System.Web; using System.IO; using System.Text; using System.Xml; using System.Web.Services;

/// <summary> /// Summary description for GetAttendanceTable /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class GetAttendanceTable : System.Web.Services.WebService { public GetAttendanceTable () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string GetClassListBox() { string answer = "<select id='lstClass' style='width:50%'>"; ClassRecBLL obj = new ClassRecBLL();

ClassRec.ClassRecDataTable dt = obj.GetUniqueName(); ; foreach(ClassRec.ClassRecRow row1 in dt.Rows) { answer += "<option value='" + row1.ClassName + "'>" + row1.ClassName + "</option>"; } answer+="</option>"; return answer;

} [WebMethod] public string GetSectionListBox() { string answer = "<select id='lstSection' style='width:50%'>"; ClassRecBLL obj = new ClassRecBLL(); ClassRec.ClassRecDataTable dt = obj.GetUniqueSection() ; foreach (ClassRec.ClassRecRow row1 in dt.Rows) { answer += "<option value='" + row1.ClassSection + "'>" + row1.ClassSection + "</option>"; } answer += "</option>"; return answer;

[WebMethod] public string GetDataTable(string ClassName,string ClassSection) { //<input id="Radio1" type="radio" /> ClassRecBLL obj = new ClassRecBLL();

int classid = (int)obj.GetClassID(ClassName, ClassSection); string answer = "<Table id='mainAttendance'><thead><tr class='trHead'><th class='thEnroll'>EnrollNo</th>"; answer+="<th class='thEnroll'>RollNo</th><th class='thFirst'>First Name</th><th class='thLast'>Last Name</th>"; answer += "<th class='thRadio'><a href='#' class='headLink' onclick='chooseAll(1);'>Present</a></th><th class='thRadio'>"; answer+="<a href='#' class='headLink' onclick='chooseAll(2);'>Absent</a></th>"; answer += "<th class='thRadio'><a href='#' class='headLink' onclick='chooseAll(3);'>"; answer+="Leave</a></th><th class='thRadio'><a href='#' class='headLink' onclick='chooseAll(4);'>Unknown</a></th></tr></thead><tbody>"; obj.Dispose();

StudentRecBLL obj1 = new StudentRecBLL(); StudentRecord.StudentRecDataTable dt = obj1.GetDataByClassID(classid); int icounter=1; string strclass=""; foreach (StudentRecord.StudentRecRow row1 in dt.Rows) { if (icounter % 2 == 0) strclass = "trEven"; else strclass = "trOdd"; answer += "<tr class='" + strclass + "'><td class='EnrollNo'>" + row1.EnrollNo.ToString() + "</td>";

answer+="<td class='tdRollNo'>" + row1.RollNo.ToString() + "</td>"; answer+="<td class='tdFirstName'>" + row1.FirstName + "</td>"; answer += "<td class='tdFirstName'>" + row1.LastName + "</td>"; answer += "<td class='tdRadio'><input type='radio' " + "Name='Att" + icounter.ToString() + "' value='P' />" + "</td>"; answer += "<td class='tdRadio'><input type='radio' " + "Name='Att" + icounter.ToString() + "' value='A' />" + "</td>"; answer += "<td class='tdRadio'><input type='radio' " + "Name='Att" + icounter.ToString() + "' value='L'/>" + "</td>"; answer += "<td class='tdRadio'><input type='radio' " + "Name='Att" + icounter.ToString() + "' value='U'/>" + "</td>"; icounter+=1; answer+="</tr>";

} answer += "</tbody></table>"; obj1.Dispose(); return answer; } [WebMethod] public string GetNewDataTable(string ClassName,string ClassSection,DateTime AttDate) { DateTime validDate = DateTime.Now; try { System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; validDate = Convert.ToDateTime(AttDate.ToShortDateString(), dateInfo); } catch (Exception ex) {

return ex.Message + " " + AttDate.ToShortDateString(); } ClassRecBLL obj = new ClassRecBLL(); string style1 = " background: #ffcccc;font-weight:bolder;"; int classid = (int)obj.GetClassID(ClassName, ClassSection); string answer = "<Table id='mainAttendance'><thead><tr class='trHead'><th class='thEnroll'>EnrollNo</th>"; answer += "<th class='thEnroll'>RollNo</th><th class='thFirst'>First Name</th><th class='thLast'>Last Name</th>"; answer += "<th class='thRadio'><a href='javascript:void(0);' class='headLink' onclick='chooseAll(1);'>Present</a></th><th class='thRadio'>"; answer += "<a href='javascript:void(0);' class='headLink' onclick='chooseAll(2);'>Absent</a></th>"; answer += "<th class='thRadio'><a href='javascript:void(0);' class='headLink' onclick='chooseAll(3);'>"; answer += "Leave</a></th><th class='thRadio'><a href='javascript:void(0);' class='headLink' onclick='chooseAll(4);'>"; answer+="Unknown</a></th><th>%</th><th>Stat</th></tr></thead><tbody>"; obj.Dispose();

StudentRecBLL obj1 = new StudentRecBLL(); StudentRecord.StudentRecDataTable dt = obj1.GetDataByClassID(classid); AttendanceRecBLL att_rec = new AttendanceRecBLL(); int icounter = 1; string strclass = ""; foreach (StudentRecord.StudentRecRow row1 in dt.Rows) {

AttendanceRec.AttendanceRecDataTable att_dt = att_rec.GetRecordByDateEnroll(row1.EnrollNo, validDate); string chk1, chk2, chk3, chk4; chk1 = ""; chk2 = ""; chk3 = ""; chk4 = ""; if (att_dt.Rows.Count > 0) { if (att_dt.Rows[0]["AttendanceType"].ToString() == "P") { chk1 = "checked"; chk2 = ""; chk3 = ""; chk4 = ""; } else if (att_dt.Rows[0]["AttendanceType"].ToString() == "A") { chk1 = ""; chk2 = "checked"; chk3 = ""; chk4 = ""; } else if (att_dt.Rows[0]["AttendanceType"].ToString() == "L") { chk1 = ""; chk2 = ""; chk3 = "checked"; chk4 = "";

} else if (att_dt.Rows[0]["AttendanceType"].ToString() == "U") { chk1 = ""; chk2 = ""; chk3 = ""; chk4 = "checked"; } } if (icounter % 2 == 0) strclass = "trEven"; else strclass = "trOdd"; decimal? enroll = row1.EnrollNo; //This has to be changed because percentage is shown according to the given date not the current date this to me is a bit of an error float percentage = att_rec.PercentageAttendance(enroll.Value, AttDate, "P"); //att_rec.PercentageAttendance((decimal)9, AttDate, "P"); //float percentage = 0.0f; if(percentage<50) answer += "<tr style='" + style1 + "'><td class='EnrollNo'>" + row1.EnrollNo.ToString() + "</td>"; else answer += "<tr class='" + strclass + "'><td class='EnrollNo'>" + row1.EnrollNo.ToString() + "</td>"; answer += "<td class='tdRollNo'>" + row1.RollNo.ToString() + "</td>"; answer += "<td class='tdFirstName'>" + row1.FirstName + "</td>"; answer += "<td class='tdFirstName'>" + row1.LastName + "</td>"; answer += "<td class='tdRadio'><input type='radio' " + "Name='Att" + icounter.ToString() + "' " + chk1 + " value='P' />" + "</td>";

answer += "<td class='tdRadio'><input type='radio' " + "Name='Att" + icounter.ToString() + "' " + chk2 + " value='A' />" + "</td>"; answer += "<td class='tdRadio'><input type='radio' " + "Name='Att" + icounter.ToString() + "' " + chk3 + " value='L'/>" + "</td>"; answer += "<td class='tdRadio'><input type='radio' " + "Name='Att" + icounter.ToString() + "' " + chk4 + " value='U'/>" + "</td>"; answer += "<td>" + percentage.ToString() + "</td>"; answer += "<td><a href='javascript:void(0)' onclick='showChart(" + row1.EnrollNo.ToString() + ");'><img style='border:0;' src='http://learnasp.in/css/chart_bar.png' alt='X'/></a></td>"; icounter += 1; answer += "</tr>";

} answer += "</tbody></table>"; obj1.Dispose(); return answer; //return AttDate.ToString(); } [WebMethod] public string GetDataTableForSearch(int ctrlNum, string searchStr) { //<input id="Radio1" type="radio" /> StudentRecBLL obj = null; ClassRecBLL obj1 = null; StudentRecord.StudentRecDataTable dt = null; if (ctrlNum==1) { obj = new StudentRecBLL(); obj1 = new ClassRecBLL();

dt = obj.GetDataByEnrollNoEx(int.Parse(searchStr));

} else if (ctrlNum == 2) { obj = new StudentRecBLL(); obj1 = new ClassRecBLL(); dt = obj.GetDataByRollNo(int.Parse(searchStr)); } else if (ctrlNum==3) { obj = new StudentRecBLL(); obj1 = new ClassRecBLL(); searchStr +="%"; dt = obj.GetDataByFirstName(searchStr); } else if (ctrlNum==4) { obj = new StudentRecBLL(); obj1 = new ClassRecBLL(); string[] temp = searchStr.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries); if (temp.Length >= 2) { int classid = (int)obj1.GetClassID(temp[0], temp[1]); dt = obj.GetDataByClassID(classid); } }

string answer = "<Table id='studentData'><thead><tr class='trHead'>"; answer += "<th class='thEnroll'> EnrollNo </th>"; answer += "<th class='thEnroll'> RollNo</th>"; answer += "<th class='thEnroll'>First Name </th>"; answer += "<th class='thEnroll'>Last Name</th>"; answer += "<th class='thEnroll'>Class</th>"; answer += "<th class='thEnroll'>Section</th>"; answer += "</thead><tbody>";

int icounter = 1; string strclass = ""; foreach (StudentRecord.StudentRecRow row1 in dt.Rows) { if (icounter % 2 == 0) strclass = "trEven"; else strclass = "trOdd"; answer += "<tr class='" + strclass + "'><td class='EnrollNo'><a href='#' style='textdecoration:none;' onclick='openAttendanceRecord(" + row1.EnrollNo.ToString() + ");'>"; answer+=row1.EnrollNo.ToString() + "</a></td>"; answer += "<td class='tdRollNo'>" + row1.RollNo.ToString() + "</td>"; answer += "<td class='tdFirstName'>" + row1.FirstName + "</td>"; answer += "<td class='tdFirstName'>" + row1.LastName + "</td>"; answer += "<td class='tdFirstName'>" + row1.ClassName + "</td>"; answer += "<td class='tdFirstName'>" + row1.ClassSection + "</td>"; icounter += 1; answer += "</tr>";

} answer += "</tbody></table>"; obj1.Dispose(); return answer; }

[WebMethod] public System.Data.DataTable GetDefaultingStudent(string ClassName, string ClassSection, float cutoffpercent) { AttendanceRecBLL obj = new AttendanceRecBLL(); return obj.DefaultingStudents(ClassName, ClassSection, cutoffpercent); } [WebMethod] public string GetMonthlyAttendance(decimal Enroll, DateTime AttDate,string AttType ) { AttendanceRecBLL obj = new AttendanceRecBLL(); Decimal? enrollno = Enroll; return obj.PercentageMonthly(enrollno.Value, AttDate, AttType); } [WebMethod] public string GetMonthlyAttendanceAll(decimal Enroll, DateTime AttDate) { AttendanceRecBLL obj = new AttendanceRecBLL(); Decimal? enrollno = Enroll; return obj.PercentageAttAllMonthly(enrollno.Value, AttDate);

} [WebMethod] public string UpdateAttendance(string xmlstr,DateTime AttDate) { String msg = ""; string enrollno = "", atttype = ""; AttendanceRecBLL obj = new AttendanceRecBLL(); XmlReader reader = XmlReader.Create(new StringReader(xmlstr)); try { reader.ReadStartElement(); int i = 0; bool enroll = true; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: if (reader.Name == "EnrollNo") { //reader.Read(); enroll = true; i++; } else if (reader.Name == "AttType") { //reader.Read(); //atttype = reader.Value; //msg += " AttType " + atttype ;

enroll = false; i++; } break; case XmlNodeType.Text: if (enroll!= true) { atttype = reader.Value; i++; } else { enrollno = reader.Value; i++; } break; } if (i == 4) { if (obj.IsRecordExist(decimal.Parse(enrollno), AttDate)) { // msg = "Data Already Exists "; if (obj.UpdateAttendance(decimal.Parse(enrollno), AttDate, atttype) == false) { msg = "Data Already Exists Unable to update"; //throw new Exception("Something went wrong while Updating record"); } else { msg = "Data Updated " + AttDate.ToShortDateString(); }

} else { //msg = "No records found."; if (obj.AddAttendance(int.Parse(enrollno), AttDate, atttype) == false) throw new Exception("Something went wrong while Inserting record"); else msg = "Data Added " + AttDate.ToShortDateString(); } i = 0; }

} } catch (Exception ex) { msg = "Problem : " + ex.Message + " enroll " + enrollno + " type " + atttype + " date " + AttDate.ToShortDateString(); } return msg; } }

K:\SpringDale\App_Code\GetTeachers.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Data.SqlClient; using System.Data; using System.Configuration; /// <summary> /// Summary description for GetTeachers /// </summary> [WebService(Namespace = "http://learnasp.in/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class GetTeachers : System.Web.Services.WebService { public GetTeachers () { //Uncomment the following line if using designed components //InitializeComponent(); } /// <summary> /// At present this method connects with the dummy /// teachers table, in future this will connect with the /// actual teachers table /// </summary> /// <returns></returns>

[WebMethod] public string GetTeachersList() { String answer=""; SqlConnection con; SqlDataAdapter da; System.Data.DataTable dt; string connString = ConfigurationManager.ConnectionStrings["springdaleConnectionString2"].ConnectionString; con = new SqlConnection(connString.ToString()); try { con.Open(); string commtxt = "Select TeacherID,TeacherName from TeacherDummy"; da = new SqlDataAdapter(commtxt, con); dt = new System.Data.DataTable("TeacherDummy"); da.Fill(dt); answer = "<ul>"; foreach (DataRow dr in dt.Rows) { answer += "<li>" + dr[1].ToString() + "</li>"; } answer += "</ul>"; dt.Dispose(); da.Dispose(); con.Close(); con.Dispose(); } catch (Exception ex) { throw ex; } return answer;

} }

K:\SpringDale\App_Code\HolidayList.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.IO; using System.Text; using System.Data; using System.Data.SqlClient; using System.Web.Services; using System.Runtime.Serialization.Json; using System.Web.Script.Serialization; using System.Configuration; using HolidayListTableAdapters; /// <summary> /// Manages the HolidayList Table and returns/updates all the data /// </summary> [WebService(Namespace = "http://learnasp.in/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.Web.Script.Services.ScriptService] public class HolidayListSvc : System.Web.Services.WebService { public HolidayListSvc () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod]

public bool InsertHoliday(int dt_dd,int dt_mm,int dt_yyyy,string dt_desc) { HolidayListXTableAdapter _adapter = new HolidayListXTableAdapter(); decimal? val= _adapter.MaxSno(); if (val.HasValue) { if (val > 0) { val = val + 1; } else { val = 1; } } else { val = 1; } int res=_adapter.InsertQuery((decimal)val,(decimal)dt_dd, (decimal)dt_mm, (decimal)dt_yyyy, dt_desc); return (res == 1); } [WebMethod] public bool DeleteHoliday(int dt_dd, int dt_mm, int dt_yyyy) { HolidayListXTableAdapter _adapter = new HolidayListXTableAdapter(); int res = _adapter.DeleteDateQuery((decimal)dt_dd, (decimal)dt_mm, (decimal)dt_yyyy); return (res == 1); }

[WebMethod] public bool DeleteAllHolidays() { HolidayListXTableAdapter _adapter = new HolidayListXTableAdapter(); int res = _adapter.DeleteAllQuery(); return (res > 0); } [WebMethod] public bool DeleteMonthHolidays(int dt_mm) { HolidayListXTableAdapter _adapter = new HolidayListXTableAdapter(); int res = _adapter.DeleteMonthQuery((decimal)dt_mm); return (res > 0); } [WebMethod] public bool DeleteSnoHolidays(int Sno) { HolidayListXTableAdapter _adapter = new HolidayListXTableAdapter(); int res = _adapter.DeleteOnSno((decimal)Sno); return (res > 0); } [WebMethod] public string GetAllHolidays(){ HolidayListXTableAdapter _adapter = new HolidayListXTableAdapter();

System.Data.DataTable dt = _adapter.GetData(); var results = new List<object>(); foreach (DataRow row in dt.Rows) { var item = new Dictionary<string, string>(); foreach (DataColumn column in dt.Columns) { item.Add(column.ColumnName, row[column].ToString()); } results.Add(item); }

//return results; string jsonstring = new JavaScriptSerializer().Serialize(results); return jsonstring; } [WebMethod] public HolidayList.HolidayListXDataTable GetAllHolidaysEx() { HolidayListXTableAdapter _adapter = new HolidayListXTableAdapter(); return _adapter.GetData(); } }

K:\SpringDale\App_Code\LibraryManagement.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.IO; using System.Text; using System.Data; using System.Data.SqlClient; using System.Web.Services; using System.Runtime.Serialization.Json; using System.Web.Script.Serialization; using System.Configuration;

/// <summary> /// Summary description for LibraryManagement /// </summary> [WebService(Namespace = "http://learnasp.in/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class LibraryManagement : System.Web.Services.WebService { public LibraryManagement () { //Uncomment the following line if using designed components //InitializeComponent(); }

[WebMethod] public string getDataByAuthor(string authname) { BooksBLL obj = new BooksBLL(); System.Data.DataTable dt = obj.GetDataByAuthor(authname); var results = new List<object>(); foreach (DataRow row in dt.Rows) { var item = new Dictionary<string, string>(); foreach (DataColumn column in dt.Columns) { item.Add(column.ColumnName, row[column].ToString()); } results.Add(item); }

//return results; string jsonstring = new JavaScriptSerializer().Serialize(results); return jsonstring; } [WebMethod] public string getDataByTitle(string title) { BooksBLL obj = new BooksBLL(); System.Data.DataTable dt = obj.GetDataByTitle(title);

var results = new List<object>(); foreach (DataRow row in dt.Rows) { var item = new Dictionary<string, string>(); foreach (DataColumn column in dt.Columns) { item.Add(column.ColumnName, row[column].ToString()); } results.Add(item); }

string jsonstring = new JavaScriptSerializer().Serialize(results); return jsonstring; } [WebMethod] public string getDataBySubject(string subject) { BooksBLL obj = new BooksBLL(); System.Data.DataTable dt = obj.GetDataBySubject(subject); var results = new List<object>(); foreach (DataRow row in dt.Rows) { var item = new Dictionary<string, string>(); foreach (DataColumn column in dt.Columns) { item.Add(column.ColumnName, row[column].ToString()); }

results.Add(item); }

string jsonstring = new JavaScriptSerializer().Serialize(results); return jsonstring; } [WebMethod] public string getDataByPublisher(string subject) { BooksBLL obj = new BooksBLL(); System.Data.DataTable dt = obj.GetDataBySubject(subject); var results = new List<object>(); foreach (DataRow row in dt.Rows) { var item = new Dictionary<string, string>(); foreach (DataColumn column in dt.Columns) { item.Add(column.ColumnName, row[column].ToString()); } results.Add(item); }

string jsonstring = new JavaScriptSerializer().Serialize(results); return jsonstring; }

[WebMethod] public string getDataByISBN(decimal isbn) { BooksBLL obj = new BooksBLL(); System.Data.DataTable dt = obj.GetDataByISBN(isbn); var results = new List<object>(); foreach (DataRow row in dt.Rows) { var item = new Dictionary<string, string>(); foreach (DataColumn column in dt.Columns) { item.Add(column.ColumnName, row[column].ToString()); } results.Add(item); }

string jsonstring = new JavaScriptSerializer().Serialize(results); return jsonstring; } [WebMethod] public string getDataByBookNo(int bookno) { BooksBLL obj = new BooksBLL(); System.Data.DataTable dt = obj.GetDataByBookNo(bookno);

var results = new List<object>(); foreach (DataRow row in dt.Rows) { var item = new Dictionary<string, string>(); foreach (DataColumn column in dt.Columns) { item.Add(column.ColumnName, row[column].ToString()); } results.Add(item); }

string jsonstring = new JavaScriptSerializer().Serialize(results); return jsonstring; }

[WebMethod] public bool checkAccNo(decimal accno) { bool answer = false; LibMemberBLL obj = new LibMemberBLL(); if(obj.GetDataByAccNo(accno)>0 && obj.GetDataByBooksLeft(accno)>0) answer = true;

return answer; }

[WebMethod] public bool issueBook(decimal accno, decimal bookno, string issuedate, string returndate) { bool ans = false; decimal fine = 0; IssuesReturnsBll obj = new IssuesReturnsBll(); System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; DateTime validissueDate = Convert.ToDateTime(issuedate, dateInfo); DateTime validreturnDate = Convert.ToDateTime(returndate, dateInfo); //ans=obj.Adapter.IssueQuery(,bookno, accno, validissueDate, validreturnDate, fine); //DateTime validreturnDate = new DateTime(); //validreturnDate.ToShortDateString(); SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["springdaleC onnectionString1"].ConnectionString); con.Open(); string commtext = "Select * from Members where AccNo=" + accno.ToString(); SqlDataAdapter da = new SqlDataAdapter(commtext, con); System.Data.DataTable dt = new System.Data.DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { int i = int.Parse(dt.Rows[0]["BooksLeft"].ToString()); if (i > 0) { decimal? maxid = obj.Adapter.GetMaxTransactID(); if (maxid == null) maxid = 0;

else { maxid += 1; } IssuesReturnsBll obj_temp = new IssuesReturnsBll(); ans=obj_temp.IssueBook(bookno,accno,validissueDate,validreturnDate,0); string comtxt = "Update Members set BooksLeft=" + (i - 1).ToString() + " where AccNo=" + accno.ToString(); SqlCommand comm = new SqlCommand(comtxt, con); comm.ExecuteNonQuery(); comm.Dispose(); ans = true; } } con.Close(); con.Dispose(); ////@TransactID, @BookNo, @AccNo, @IssueDate, @DueDate, @Fine) //ans=obj.IssueBook(bookno, accno, validissueDate, validreturnDate, fine); return ans; } [WebMethod] public bool ReturnBook(decimal transactid,decimal accno,decimal bookno,string returndate) { IssuesReturnsBll obj_temp = new IssuesReturnsBll(); IssueReturn.IssuesReturnsDataTable dt = obj_temp.GetDataByTransactionID(transactid); System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; DateTime validdate = Convert.ToDateTime(returndate, dateInfo);

DateTime validissuedate = Convert.ToDateTime(dt[0]["IssueDate"].ToString(), dateInfo); DateTime validduedate = Convert.ToDateTime(dt[0]["DueDate"].ToString(), dateInfo); LibMemberBLL libobj = new LibMemberBLL(); bool answer = false; if (obj_temp.ReturnQuery(validissuedate, validduedate, validdate, accno, bookno)) { } int booksleft=(int)libobj.GetDataByBooksLeft(accno); booksleft+=1; answer = libobj.UpdateBooksLeft(accno, booksleft); //answer = obj_temp.ReturnQuery(validissuedate, validduedate, validdate, accno, bookno); return answer; //return validduedate.ToString(); }

[WebMethod] public string getDataForMember(decimal accno) { IssuesReturnsBll objbll = new IssuesReturnsBll(); DataTable dt = objbll.GetDataForMember(accno); string answer = ""; if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { for (int i = 0; i < dt.Columns.Count; i++) { if (dr[i].ToString() != "")

answer += dr[i].ToString() + "="; } answer = answer.Substring(0, answer.Length - 1); answer += "^"; } answer = answer.Substring(0, answer.Length - 1); } else answer = ""; return answer; } }

K:\SpringDale\App_Code\ManageUsersRoles.cs
using System; using System.Collections.Generic; using System.Collections; using System.Web.Security; using System.Web; using System.Web.Services; using ManageUsersTableAdapters; using System.Text.RegularExpressions; using Microsoft.VisualBasic; /// <summary> /// Summary description for ManageUsersRoles /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class ManageUsersRoles : System.Web.Services.WebService { public ManageUsersRoles () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod()] public bool DeleteUser(string username) { return Membership.DeleteUser(username, true); }

[WebMethod()] public string[] GetAllUsers() { MembershipUserCollection objarr= Membership.GetAllUsers(); string[] arr=new string[objarr.Count -1]; int i = 0; foreach (MembershipUser us1 in objarr) { arr[i++] = us1.UserName.ToString(); } return arr;

} [WebMethod()] public string[] GetAllUsersEx(string username) { //Regex regex = new Regex(username + "*");

MembershipUserCollection objarr = Membership.GetAllUsers(); ArrayList arrlst = new ArrayList(); //string[] arr = new string[objarr.Count - 1]; ManageUsersTableAdapters.tableUsersTableAdapter obj = new ManageUsersTableAdapters.tableUsersTableAdapter(); username += "%"; ManageUsers.tableUsersDataTable dt = obj.GetDataByUserName(username); int j=0; foreach (ManageUsers.tableUsersRow tr in dt.Rows) { arrlst.Add(tr.UserName);

j++; } string[] arr = new string[j]; arrlst.CopyTo(arr); obj.Dispose(); return arr; }

[WebMethod()] public string CreateNewUser(string username, string password, string email) { string answer = "User Creation Successfull"; MembershipCreateStatus status; try { MembershipUser user1 = Membership.CreateUser(username, password, email, "fgf", "fggf", true,out status); if (user1 == null) { answer = status.ToString(); } else { user1.IsApproved = true; } } catch(Exception ex) { answer = "Something Went Wrong " +ex.Message ; } return answer;

} /// <summary> /// Overloaded method which creates a new user with email and security question /// </summary> /// <param name="username">users login name</param> /// <param name="password">users login password</param> /// <param name="email">email to be used for retreiving password etc</param> /// <param name="securityQ">the question user must reply before password retrieval is allowed</param> /// <param name="securityanswer">the answer to the user given question</param> /// <returns>message to indicate success or failure</returns> [WebMethod()] public string CreateNewUser(string username, string password, string email,string securityQ,string securityanswer) { string answer = "User Creation Successfull"; MembershipCreateStatus status; try { MembershipUser user1 = Membership.CreateUser(username, password, email, securityQ,securityanswer, true, out status); if (user1 == null) { answer = status.ToString(); } else { user1.IsApproved = true; } }

catch (Exception ex) { answer = "Something Went Wrong " + ex.Message; } return answer; }

[WebMethod()] public string[] GetAllRoles() { return Roles.GetAllRoles(); } [WebMethod()] public string[] GetUserRoles(string username) { return Roles.GetRolesForUser(username); } [WebMethod()] public string GetUserRolesTable(string username) { int i, j; string strclass=""; string answer = "<Table id='mainUsersRoles'><thead><tr class='trHead'><th class='thEnroll'>Del</th><th class='thEnroll'>UserName</th>"; string[] roles1 = GetAllRoles(); for (i = 0; i < roles1.Length; i++) { answer += "<th class='thRadio'><a href='#' class='headLink' onclick='chooseAll(" + i.ToString() + ");'>" + roles1[i] + "</a></th>";

} answer += "</tr></thead><tbody>"; string[] users=GetAllUsersEx(username); for (i = 0; i < users.Length; i++) { if ((i+1) % 2 == 0) strclass = "trEven"; else strclass = "trOdd"; answer += "<tr class='" + strclass + "'><td class='tdAText' align='center'><a href='#' Name='Del"; answer += users[i] + "' onclick='delUser(\"" + users[i] + "\");'><img border='0' alt='Del' src='http://learnasp.in/css/remove.png' /></a></td>"; answer += "<td class='EnrollNo'>" + users[i] + "</td>"; //<input id="Checkbox1" type="checkbox" /> for (j = 0; j < roles1.Length; j++) { answer += "<td class='tdRadio' align='center'><input type='checkbox' onclick='updateUser(this);'" + "Name='" + users[i] + "' value='" + roles1[j] + "'"; if(Roles.IsUserInRole(users[i],roles1[j])) answer += "checked='yes'/>" + "</td>"; else answer += "/>" + "</td>";

} answer += "</tr>";

} answer += "</tbody></table>"; return answer; } [WebMethod()] public bool putUserInRole(string username, string rolename) { bool answer = false; if (Roles.IsUserInRole(username, rolename) == false) { Roles.AddUserToRole(username, rolename); answer = true; } return answer; } [WebMethod()] public bool removeUserFromRole(string username, string rolename) { bool answer = false; if (Roles.IsUserInRole(username, rolename) == true) { Roles.RemoveUserFromRole(username, rolename); answer = true; } return answer; } [WebMethod()] public bool addRole(string rolename) {

bool answer = false; if (Roles.RoleExists(rolename) == false) { Roles.CreateRole(rolename); answer = true; } return answer; } [WebMethod()] public bool removeRole(string rolename) { bool answer = false; if (Roles.RoleExists(rolename) ) { Roles.DeleteRole(rolename); answer = true; } return answer; } }

K:\SpringDale\App_Code\MarksWeb.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Text.RegularExpressions; /// <summary> /// Summary description for MarksWeb /// </summary> [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.Web.Script.Services.ScriptService] public class MarksWeb : System.Web.Services.WebService { public MarksWeb () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string getClasses(string userid) { // ; var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(userid);

var alpha = match.Groups["Alpha"].Value; var teacherid = match.Groups["Numeric"].Value; string ans = ""; string constr = ConfigurationManager.ConnectionStrings["springdaleConnectionString2"].ToString(); SqlConnection con = new SqlConnection(constr); con.Open(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter("SELECT ClassRec.ClassName + '-' + ClassRec.ClassSection AS ClassName, SubjectRec.SubjectID," + " SubjectRec.SubjectName, SubjectRec.TeacherID, ClassRec.ClassID FROM " + "SubjectRec INNER JOIN ClassRec ON SubjectRec.ClassID = ClassRec.ClassID " + "WHERE (SubjectRec.TeacherID =" + teacherid.ToString() + ")",con); da.Fill(dt); ans = "<select id='cmbclasses' onchange='classes_change();'>"; foreach (DataRow dr in dt.Rows) { ans += "<option value='" + dr["ClassID"] + "'>" + dr["ClassName"] + "</option>"; } ans += "</select>"; return ans; } [WebMethod] public string getSubjects(string userid,decimal classid) { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(userid); var alpha = match.Groups["Alpha"].Value; var teacherid = match.Groups["Numeric"].Value; string ans = ""; string constr = ConfigurationManager.ConnectionStrings["springdaleConnectionString2"].ToString(); SqlConnection con = new SqlConnection(constr);

con.Open(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter("SELECT SubjectName, SubjectID, ClassID, TeacherID FROM" + " SubjectRec WHERE (ClassID = " + classid.ToString() + ") AND (TeacherID = " +teacherid.ToString() + ")", con); da.Fill(dt); ans = "<select id='cmbSubjects'>"; foreach (DataRow dr in dt.Rows) { ans += "<option value='" + dr["SubjectID"] + "'>" + dr["SubjectName"] + "</option>"; } ans += "</select>"; return ans; } [WebMethod] public string getTerms(string classname) { // ; string ans = ""; string constr = ConfigurationManager.ConnectionStrings["springdaleConnectionString2"].ToString(); SqlConnection con = new SqlConnection(constr); con.Open(); DataTable dt = new DataTable(); string[] classarr=classname.Split('-'); SqlDataAdapter da = new SqlDataAdapter("SELECT TermID, TermName, MaxMarks, PassMarks, Weightage, " + "Classes FROM ExamSetting WHERE (Classes = '" + classarr[0] + "')", con); da.Fill(dt); ans = "<select id='cmbTerms' >"; foreach (DataRow dr in dt.Rows) {

ans += "<option value='" + dr["TermID"] + "'>" + dr["TermName"] + "</option>"; } ans += "</select>"; return ans; } [WebMethod] public string getMarksTable(string subject, decimal termid, decimal classid) { string ans = ""; StudentRecBLL obj = new StudentRecBLL(); StudentRecord.StudentRecDataTable dt = obj.GetDataByClassID((int)classid);

int i = 1; ans = "<table id='mainmarkstable'><thead><th>EnrollNo</th><th>Name</th><th>Marks</th></thead><t body>"; foreach (DataRow dr in dt.Rows) { ans+="<tr><td id='enroll" + i.ToString() + "'>" + dr["EnrollNo"].ToString() + "</td>"; ans+= "<td>" + dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + "</td>"; ans += "<td>" + "<input id='txt" + i.ToString() + "' type='text' />" + "</td></tr>"; i = i + 1; } ans += "</tbody></table>"; return ans; } [WebMethod] public string updateMarks(decimal enroll,decimal marks,decimal termid,string classes,decimal subjectid)

{ string ans="false"; MarksBLL obj = new MarksBLL(); string[] classarr = classes.Split('-'); decimal marksid = getMaxMarksID(); int j=(obj.InsertData(marksid,enroll, marks, termid, classarr[0],subjectid)); if (j > 0) ans = "true"; return ans; } [WebMethod] public decimal getMaxMarksID() { MarksBLL obj=new MarksBLL(); return obj.GetMaxID(); } }

K:\SpringDale\App_Code\TimeTableManager.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Data; using System.Data.SqlClient; /// <summary> /// Summary description for TimeTableManager /// </summary> [WebService(Namespace = "http://learnasp.in/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] public class TimeTableManager : System.Web.Services.WebService { public TimeTableManager () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string GetClassListBox() { string answer="<select id='allclasses'>"; ClassRecBLL class_obj = new ClassRecBLL(); DataTable dt = class_obj.GetClassSectAdd(); foreach (DataRow dr in dt.Rows)

{ answer += "<option value='" + dr["ClassID"].ToString() + "'>" + dr["Class"].ToString() + "</option>"; } answer += "</select>"; return answer; } [WebMethod] public string GetAllSubjects(decimal classid) { string answer = ""; string[] colors = { "#f5565d", "#5674f5", "#f071cb", "#f1eb4d", "#73eb6a", "#6aebe9", "#ecae42","#da7148", "#5242ec", "#42ec9e", "#d68f42"}; SubjectsBLL sub_obj = new SubjectsBLL(); SubjectRec.SubjectRecDataTable dt = sub_obj.GetData(classid); int i = 0; foreach (DataRow dr in dt.Rows) {

string subname=dr["SubjectName"].ToString(); subname=subname.Replace(" ",""); if (i >= colors.Length) i = 0; for (int j = 0; j < int.Parse(dr["NumPeriodsPerWeek"].ToString()); j++) { answer += "<div class='subjects draggable' id='" + subname + "' style='backgroundcolor:" + colors[i] + ";'>" + dr["SubjectID"].ToString() + "/" + dr["SubjectName"].ToString() + "/" + dr["TeacherID"].ToString() + "/[";

answer += (j+1).ToString() + "]</div>"; } i++; } return answer; } [WebMethod] public string GetTimeTableGrid(decimal classid) { TimeTableMasterBLL tt_obj = new TimeTableMasterBLL(); TimeTableRealBLL ttr_obj = new TimeTableRealBLL(); string answer = ""; string[] days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; string[] colors = { "#f5565d", "#5674f5", "#f071cb", "#f1eb4d", "#73eb6a", "#6aebe9", "#ecae42","#da7148", "#5242ec", "#42ec9e", "#d68f42"}; answer = "<table width='100%' border='1' id='mytimetable'><tbody>"; var m = 0; for (int j = 0; j < days.Length - 1; j++) { TimeTableMaster.TimeTableMasterDataTable dt = tt_obj.GetData(classid, days[j]); if (dt.Rows.Count > 0) { answer += "<tr style='border:1px solid;'><td style='width:100px;height:85px;'><b>" + dt[0]["DayName"].ToString() + "</b></td>"; for (int i = 1; i <= int.Parse(dt[0]["NumPeriods"].ToString()); i++) { TimeTableReal.TimeTableDataTable dt_real = ttr_obj.getData(classid, days[j],i); if (dt_real.Rows.Count > 0) {

SubjectsBLL sub_obj = new SubjectsBLL(); SubjectRec.SubjectRecDataTable dt_sub = sub_obj.GetDataBySubjectID((decimal)dt_real[0]["SubjectID"]); if (dt_sub.Rows.Count > 0) { answer += "<td style='width:100px;height:85px;background-color:" + colors[int.Parse(dt_real[0]["SubjectID"].ToString())-1] + ";'>" + dt_real[0]["SubjectID"] + "/" + dt_sub[0]["SubjectName"] + "/" + dt_real[0]["TeacherID"] + "</td>"; } else { answer += "<td style='width:100px;height:85px;background-color:" + colors[int.Parse(dt_real[0]["SubjectID"].ToString())-1] + ";'>" + dt_real[0]["SubjectID"] + "/UNKNOWN" + "/" + dt_real[0]["TeacherID"] + "</td>"; } } else { answer += "<td>&nbsp;</td>"; } ttr_obj.deleteQuery(classid, days[j], i); } answer += "</tr>"; m = int.Parse(dt[0]["NumPeriods"].ToString()); } else { answer += "<tr style='border:1px solid;'><td style='width:100px;height:85px;'><b>" + days[j] + "</b></td>"; for (int i = 1; i <= m; i++)

{ TimeTableReal.TimeTableDataTable dt_real2 = ttr_obj.getData(classid, days[j], i); if (dt_real2.Rows.Count > 0) { SubjectsBLL sub_obj2 = new SubjectsBLL(); SubjectRec.SubjectRecDataTable dt_sub2 = sub_obj2.GetDataBySubjectID((decimal)dt_real2[0]["SubjectID"]); if (dt_sub2.Rows.Count > 0) { answer += "<td style='width:100px;height:85px;;background-color:" + colors[int.Parse(dt_real2[0]["SubjectID"].ToString()) - 1] +";'>" + dt_real2[0]["SubjectID"] + "/" + dt_sub2[0]["SubjectName"] + "/" + dt_real2[0]["TeacherID"] + "</td>"; } else { answer += "<td style='width:100px;height:85px;background-color:" + colors[int.Parse(dt_real2[0]["SubjectID"].ToString()) - 1] +";'>" + dt_real2[0]["SubjectID"] + "/UNKNOWN" + "/" + dt_real2[0]["TeacherID"] + "</td>"; } } else { answer += "<td style='width:100px;height:85px;'>&nbsp;</td>"; } ttr_obj.deleteQuery(classid, days[j], i); } answer += "</tr>"; } dt.Dispose();

} answer+="</tbody></table>"; return answer; } [WebMethod] public bool insertInTimeTable(decimal ClassID, string DayName, int PeriodNum, decimal SubjectID, decimal TeacherID) { TimeTableRealBLL tt_obj = new TimeTableRealBLL(); return (tt_obj.insertQuery(ClassID, DayName, PeriodNum, SubjectID, TeacherID) > 0); }

K:\SpringDale\App_Code\BLL\AttendanceRecBLL.cs
using System; using System.Data.SqlClient; using System.Collections.Generic; using System.Xml; using System.Xml.Serialization; using System.Web; using System.Data; using AttendanceRecTableAdapters; /// <summary> /// Summary description for AttendanceRecBLL /// </summary> /// [System.ComponentModel.DataObject] public class AttendanceRecBLL:IDisposable { private AttendanceRecTableAdapter _attendanceAdapter = null; public AttendanceRecBLL() { // // TODO: Add constructor logic here // _attendanceAdapter = new AttendanceRecTableAdapter(); }

public AttendanceRecTableAdapter Adapter { get

{ if (_attendanceAdapter == null) _attendanceAdapter = new AttendanceRecTableAdapter (); return _attendanceAdapter; } }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public AttendanceRec.AttendanceRecDataTable GetData() { return _attendanceAdapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, false)] public bool AddAttendance(int EnrollNo,DateTime AttDate,string AttType) { int ans = 0; decimal? sno = null; ; decimal? enroll = null; DateTime validDate = DateTime.Now; try { System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; validDate = Convert.ToDateTime(AttDate, dateInfo);

} catch (Exception ex) { throw new Exception("GetDataByDateEnroll in IsRecordExist has thrown an exception : " + ex.Message); } try { sno = _attendanceAdapter.GetMaxSNo() + 1; if (sno == null) sno = 1; enroll = EnrollNo; //ans = _attendanceAdapter.InsertQuery((decimal)sno.Value , (decimal)enroll.Value , AttDate.ToShortDateString(), AttType); ans = _attendanceAdapter.InsertQuery((decimal)sno.Value, (decimal)enroll.Value, validDate.ToShortDateString(), AttType); } catch (Exception ex) { throw new Exception("BLL sno="+sno.Value+" enrol " + enroll.Value + " " + ex.Message); } return (ans == 1); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Update, false)] public bool UpdateAttendance(decimal? EnrollNo, DateTime AttDate,string AttType) { int ans = 0; DateTime validDate=DateTime.Now;

try { System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; validDate= Convert.ToDateTime(AttDate, dateInfo); } catch (Exception ex) { throw new Exception("GetDataByDateEnroll in IsRecordExist has thrown an exception : " + ex.Message); } try { ans=_attendanceAdapter.UpdateQuery(AttType, EnrollNo, validDate.ToShortDateString()); } catch (Exception ex) { throw new Exception("UpdateAttendance has thrown an exception : " + ex.Message); } return (ans > 0); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public bool IsRecordExist(decimal? EnrollNo, DateTime AttDate) { bool ans=false; AttendanceRec.AttendanceRecDataTable dt=null; try

{ System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; DateTime validDate = Convert.ToDateTime(AttDate, dateInfo); dt = _attendanceAdapter.GetDataByDateEnroll(validDate.ToShortDateString(), EnrollNo); if (dt.Rows.Count > 0) ans = true; } catch (Exception ex) { throw new Exception("GetDataByDateEnroll in IsRecordExist has thrown an exception : " + ex.Message); } return ans; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public AttendanceRec.AttendanceRecDataTable GetRecordByDateEnroll(decimal? EnrollNo, DateTime AttDate) { AttendanceRec.AttendanceRecDataTable dt = null; try {

System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "dd/MM/yyyy"; DateTime validDate = Convert.ToDateTime(AttDate, dateInfo); dt = _attendanceAdapter.GetDataByDateEnroll(validDate.ToShortDateString(), EnrollNo);

} catch (Exception ex) { throw new Exception("GetRecordByDateEnroll has thrown an exception : " + ex.Message); } return dt; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public float PercentageAttendance(decimal? EnrollNo, DateTime AttDate, string AttType) { System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; DateTime validDate = Convert.ToDateTime(AttDate, dateInfo); int present=(int)_attendanceAdapter.AttTypeTotal(EnrollNo.Value, "P",validDate.ToShortDateString()); int absent = (int)_attendanceAdapter.AttTypeTotal(EnrollNo.Value, "A", validDate.ToShortDateString()); int leave = (int)_attendanceAdapter.AttTypeTotal(EnrollNo.Value, "L", validDate.ToShortDateString());

int unknown = (int)_attendanceAdapter.AttTypeTotal(EnrollNo.Value, "U", validDate.ToShortDateString()); float total = (present + absent + unknown); float percentage = 0.0f; if (AttType == "P") percentage = (present / total) * 100; if (AttType == "A") percentage = (absent / total) * 100; if (AttType == "L") percentage = (leave / total) * 100; if (AttType == "U") percentage = (unknown / total) * 100; return (float) Math.Round(percentage,2); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public string PercentageMonthly(decimal? EnrollNo, DateTime AttDate, string AttType) { System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; DateTime validDate = Convert.ToDateTime(AttDate, dateInfo); int finalm = validDate.Month; int i; int present, absent, leave, unknown; float total; float percentage; DateTime dt1 = new DateTime(validDate.Year, 1, 1);

string arr = "";// finalm.ToString() + "," + validDate.ToShortDateString() + ":" + EnrollNo.Value.ToString() + "," + AttDate.ToShortDateString() + ":"; string constr = System.Configuration.ConfigurationManager.ConnectionStrings["springdaleConnectionStrin g1"].ConnectionString; string comtext=""; //@EnrollNo) AND (AttendanceType = @AttType) AND (MONTH(AttendanceDate) = @Month) AND (YEAR(AttendanceDate) = @Year)"; SqlConnection con = new SqlConnection(constr); try { con.Open(); } catch (Exception ex) { } int mnth = 1; for (i = 0; i < finalm*2; i=i+2) { SqlCommand com = new SqlCommand(); comtext = "SELECT COUNT(*) AS Expr1 FROM AttendanceRec WHERE (EnrollNo = " + EnrollNo.Value.ToString(); comtext += ") AND (AttendanceType = 'P') AND (MONTH(AttendanceDate) = " + (mnth).ToString(); comtext += ") AND (YEAR(AttendanceDate) = " + validDate.Year + ")"; com.CommandText = comtext; com.Connection = con; present = (int)com.ExecuteScalar();

comtext = "SELECT COUNT(*) AS Expr1 FROM AttendanceRec WHERE (EnrollNo = " + EnrollNo.Value.ToString(); comtext += ") AND (AttendanceType = 'A') AND (MONTH(AttendanceDate) = " + (mnth).ToString(); comtext += ") AND (YEAR(AttendanceDate) = " + validDate.Year + ")"; com.CommandText = comtext;

com.Connection = con; absent = (int)com.ExecuteScalar();

comtext = "SELECT COUNT(*) AS Expr1 FROM AttendanceRec WHERE (EnrollNo = " + EnrollNo.Value.ToString(); comtext += ") AND (AttendanceType = 'L') AND (MONTH(AttendanceDate) = " + (mnth).ToString(); comtext += ") AND (YEAR(AttendanceDate) = " + validDate.Year + ")"; com.CommandText = comtext; com.Connection = con; leave = (int)com.ExecuteScalar(); comtext = "SELECT COUNT(*) AS Expr1 FROM AttendanceRec WHERE (EnrollNo = " + EnrollNo.Value.ToString(); comtext += ") AND (AttendanceType = 'U') AND (MONTH(AttendanceDate) = " + (mnth).ToString(); comtext += ") AND (YEAR(AttendanceDate) = " + validDate.Year + ")"; com.CommandText = comtext; com.Connection = con; unknown = (int)com.ExecuteScalar(); //(int)_attendanceAdapter.AttCountMonthly(9, "P", (decimal)i + 1, (decimal)validDate.Year); /*int absent = (int)_attendanceAdapter.AttCountMonthly(9, "A", 1, 2012); int leave = (int)_attendanceAdapter.AttCountMonthly(EnrollNo.Value, "L", i, validDate.Year); int unknown = (int)_attendanceAdapter.AttCountMonthly(EnrollNo.Value, "U", i, validDate.Year);*/ total = (present + absent + unknown); percentage = 0.0f; if (AttType == "P") { if (present > 0) percentage = (present / total) * 100;

else percentage = 0; } if (AttType == "A") percentage = (absent / total) * 100; if (AttType == "L") percentage = (leave / total) * 100; if (AttType == "U") percentage = (unknown / total) * 100; if (percentage == float.PositiveInfinity || percentage== float.NegativeInfinity || percentage == float.NaN) percentage = 0.0f; arr += dt1.ToString("MMM"); dt1=dt1.AddMonths(1); arr += "," + percentage.ToString() + ":"; com.Dispose(); mnth += 1; } arr = arr.Substring(0, arr.Length - 1); con.Dispose(); return arr; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Update, false)] public string PercentageAttAllMonthly(decimal? EnrollNo, DateTime AttDate) { System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "MM/dd/yyyy"; DateTime validDate = Convert.ToDateTime(AttDate, dateInfo); int finalm = validDate.Month;

int i; int present, absent, leave, unknown; float total; float percentageP,percentageA,percentageL,percentageU; DateTime dt1 = new DateTime(validDate.Year, 1, 1); string arr = "";// finalm.ToString() + "," + validDate.ToShortDateString() + ":" + EnrollNo.Value.ToString() + "," + AttDate.ToShortDateString() + ":"; string constr = System.Configuration.ConfigurationManager.ConnectionStrings["springdaleConnectionStrin g1"].ConnectionString; string comtext = ""; //@EnrollNo) AND (AttendanceType = @AttType) AND (MONTH(AttendanceDate) = @Month) AND (YEAR(AttendanceDate) = @Year)"; SqlConnection con = new SqlConnection(constr); try { con.Open(); } catch (Exception ex) { } int mnth = 1; for (i = 0; i < finalm * 2; i = i + 2) { SqlCommand com = new SqlCommand(); comtext = "SELECT COUNT(*) AS Expr1 FROM AttendanceRec WHERE (EnrollNo = " + EnrollNo.Value.ToString(); comtext += ") AND (AttendanceType = 'P') AND (MONTH(AttendanceDate) = " + (mnth).ToString(); comtext += ") AND (YEAR(AttendanceDate) = " + validDate.Year + ")"; com.CommandText = comtext; com.Connection = con; present = (int)com.ExecuteScalar();

comtext = "SELECT COUNT(*) AS Expr1 FROM AttendanceRec WHERE (EnrollNo = " + EnrollNo.Value.ToString(); comtext += ") AND (AttendanceType = 'A') AND (MONTH(AttendanceDate) = " + (mnth).ToString(); comtext += ") AND (YEAR(AttendanceDate) = " + validDate.Year + ")"; com.CommandText = comtext; com.Connection = con; absent = (int)com.ExecuteScalar();

comtext = "SELECT COUNT(*) AS Expr1 FROM AttendanceRec WHERE (EnrollNo = " + EnrollNo.Value.ToString(); comtext += ") AND (AttendanceType = 'L') AND (MONTH(AttendanceDate) = " + (mnth).ToString(); comtext += ") AND (YEAR(AttendanceDate) = " + validDate.Year + ")"; com.CommandText = comtext; com.Connection = con; leave = (int)com.ExecuteScalar(); comtext = "SELECT COUNT(*) AS Expr1 FROM AttendanceRec WHERE (EnrollNo = " + EnrollNo.Value.ToString(); comtext += ") AND (AttendanceType = 'U') AND (MONTH(AttendanceDate) = " + (mnth).ToString(); comtext += ") AND (YEAR(AttendanceDate) = " + validDate.Year + ")"; com.CommandText = comtext; com.Connection = con; unknown = (int)com.ExecuteScalar(); //(int)_attendanceAdapter.AttCountMonthly(9, "P", (decimal)i + 1, (decimal)validDate.Year); /*int absent = (int)_attendanceAdapter.AttCountMonthly(9, "A", 1, 2012); int leave = (int)_attendanceAdapter.AttCountMonthly(EnrollNo.Value, "L", i, validDate.Year);

int unknown = (int)_attendanceAdapter.AttCountMonthly(EnrollNo.Value, "U", i, validDate.Year);*/ total = (present + absent + unknown); percentageP = 0.0f;

if (present > 0) percentageP = (present / total) * 100; else percentageP = 0; if (absent > 0) percentageA = (absent / total) * 100; else percentageA = 0; if (leave > 0) percentageL = (leave / total) * 100; else percentageL = 0; if (unknown > 0) percentageU = (unknown / total) * 100; else percentageU = 0; arr += dt1.ToString("MMM"); dt1 = dt1.AddMonths(1); arr += "," + percentageP.ToString() + "," + percentageA.ToString() + "," + percentageL.ToString() + "," +percentageU.ToString() + ":"; com.Dispose(); mnth += 1; } arr = arr.Substring(0, arr.Length - 1); con.Dispose(); return arr;

} public DataTable DefaultingStudents(string ClassName, string ClassSection, float percentagelimit) { String answer="Hello"; ClassRecBLL crb = new ClassRecBLL(); int classid = (int)crb.GetClassID(ClassName, ClassSection); string constr = System.Configuration.ConfigurationManager.ConnectionStrings["springdaleConnectionStrin g1"].ConnectionString; crb.Dispose(); SqlConnection con = new SqlConnection(constr); con.Open(); SqlDataAdapter da = new SqlDataAdapter("Select * from StudentRec where ClassID=" + classid.ToString(), con); System.Data.DataTable dt = new System.Data.DataTable(); da.Fill(dt); DataTable newdt = new DataTable("mytable"); DateTime tdate = DateTime.Now; newdt.Columns.Add(new DataColumn("EnrollNo",Type.GetType("System.Decimal"))); newdt.Columns.Add(new DataColumn("FirstName", Type.GetType("System.String"))); newdt.Columns.Add(new DataColumn("LastName", Type.GetType("System.String"))); newdt.Columns.Add(new DataColumn("FathersName", Type.GetType("System.String"))); newdt.Columns.Add(new DataColumn("Attendance", Type.GetType("System.Decimal"))); newdt.Columns.Add(new DataColumn("Email", Type.GetType("System.String"))); int j = 0; foreach (DataRow dr in dt.Rows) { string result = PercentageAttAllMonthly((decimal)dr["EnrollNo"], tdate);

string[] first = result.Split(':'); float sum = 0; int i; for (i = 0; i < first.Length; i++) { string[] second = first[i].Split(','); float perP = float.Parse(second[1]); sum += perP; } sum=sum/i; if (sum < percentagelimit) { //this wil be replaced by Dataset method once the table structure is finalized SqlDataAdapter da2 = new SqlDataAdapter("Select * from StudentPersonal where EnrollNo=" + dr["EnrollNo"].ToString(), con); DataTable dt2 = new DataTable(); da2.Fill(dt2); DataRow newdr = newdt.NewRow(); newdr["EnrollNo"] = dr["EnrollNo"]; newdr["FirstName"] = dr["FirstName"]; newdr["LastName"] = dr["LastName"]; newdr["FathersName"] = dt2.Rows[0]["FathersName"]; newdr["Email"] = dt2.Rows[0]["FathersEmail"]; newdr["Attendance"] = sum; j = j + 1; newdt.Rows.Add(newdr); newdt.AcceptChanges(); dt2.Dispose(); da2.Dispose(); } }

return newdt; } [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public DataTable GetMonthlyAttendance(decimal enrollno) { DataTable dt; dt=new DataTable("myattendance"); dt.Columns.Add(new DataColumn("Month", Type.GetType("System.String"))); dt.Columns.Add(new DataColumn("Present", Type.GetType("System.Decimal"))); dt.Columns.Add(new DataColumn("Absent", Type.GetType("System.Decimal"))); dt.Columns.Add(new DataColumn("Leave", Type.GetType("System.Decimal"))); dt.AcceptChanges(); string[] mnths = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; DateTime dttime=DateTime.Now; for (int i = 0; i < 12; i++) { DataRow dr = dt.NewRow(); dr[0] = mnths[i]; dr[1] = _attendanceAdapter.AttCountMonthly(enrollno, "P", (i + 1), (decimal)dttime.Year); dr[2] = _attendanceAdapter.AttCountMonthly(enrollno, "A", (i + 1), (decimal)dttime.Year); dr[3] = _attendanceAdapter.AttCountMonthly(enrollno, "L", (i + 1), (decimal)dttime.Year); dt.Rows.Add(dr); dt.AcceptChanges(); }

return dt; } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { _attendanceAdapter.Dispose(); } else { } } ~AttendanceRecBLL() { Dispose(false); }

K:\SpringDale\App_Code\BLL\BooksBLL.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data; using System.Data.SqlClient; using BooksRecTableAdapters;

using System.Configuration; using AuthorsRecTableAdapters; using IssueReturnTableAdapters; /// <summary> /// Summary description for BooksBLL /// </summary> /// [System.ComponentModel.DataObject] public class BooksBLL { private BooksTableAdapter _adapter = new BooksTableAdapter(); public BooksTableAdapter Adapter { get { if (_adapter == null) _adapter = new BooksTableAdapter(); return _adapter; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public System.Data.DataTable GetData() { BooksRec.BooksDataTable bt = Adapter.GetData(); DataTable dt = new DataTable(); dt = bt.Clone(); dt.Columns.Add(new DataColumn("Authors", Type.GetType("System.String"))); AuthorsRecTableAdapters.AuthorsTableAdapter authors = new AuthorsTableAdapter(); AuthorsRecTableAdapters.BookAuthorTableAdapter bookrel = new BookAuthorTableAdapter(); foreach(BooksRec.BooksRow r1 in dt.Rows) { string authorname=""; DataTable relationdt = bookrel.GetDataByBookID(r1.BookNo); foreach (DataRow dr in relationdt.Rows) { DataTable authdt = authors.GetDataByAuthorID((decimal)dr["AuthorID"]); foreach (DataRow dr2 in authdt.Rows) { authorname += dr2["AuthorName"] + ","; } } if (authorname.Length > 1) { r1["Authors"] = authorname.Substring(0, authorname.Length - 1); } dt.AcceptChanges(); } return dt;

} [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert , false)] public bool insertNewBook(decimal ISBN,string subject,string BookName, string PublisherName,decimal copies,decimal cost,decimal edition,string authors,byte[] image) { bool ans = false; decimal bno = (decimal)_adapter.MaxBookNo(); bno+=1; if (Adapter.InsertQuery(bno, ISBN, subject.ToUpper(), BookName.ToUpper(), PublisherName.ToUpper(), copies, cost, edition) >= 1) { string constring = ConfigurationManager.ConnectionStrings["springdaleConnectionString1"].ConnectionString; SqlConnection con = new SqlConnection(constring); con.Open(); string commtext = "Update Books Set Image= @Image where BookNo=" + bno.ToString(); SqlCommand com = new SqlCommand(commtext, con); com.Parameters.Add(new SqlParameter("@Image", SqlDbType.Image, image.Length)).Value = image; com.ExecuteNonQuery(); con.Close(); con.Dispose(); AuthorsTableAdapter auth = new AuthorsRecTableAdapters.AuthorsTableAdapter(); BookAuthorTableAdapter bookauth = new AuthorsRecTableAdapters.BookAuthorTableAdapter(); string[] arr = authors.Split(','); for (int i = 0; i < arr.Length; i++) { decimal auid = 0; AuthorsRec.AuthorsDataTable dt = auth.GetDataByAuthorName(arr[i].ToUpper());

if (dt.Rows.Count < 1) { auid = (decimal)auth.MaxAuthID(); auid += 1; auth.InsertQuery(auid, arr[i].ToUpper()); } else { auid = decimal.Parse(dt.Rows[0]["AuthorID"].ToString());

} if (bookauth.GetDataByBookID(bno).Rows.Count > 0 && bookauth.GetDataByAuthorID(auid).Rows.Count > 0) {} else { bookauth.InsertQuery(bookauth.GetMaxSNo() + 1, bno,auid); } } ans = true; }

return ans; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)]

public BooksRec.BooksExtraTableDataTable GetDataByAuthor(string authorname) { AuthorsRec.BookAuthRelDataTable dt = new AuthorsRec.BookAuthRelDataTable(); BookAuthRelTableAdapter _temp=new BookAuthRelTableAdapter(); BooksRec.BooksExtraTableDataTable newdt = new BooksRec.BooksExtraTableDataTable(); IssuesReturnsBll issret = new IssuesReturnsBll(); newdt.Columns.Add(new DataColumn("Available",System.Type.GetType("System.Int32"))); newdt.AcceptChanges(); try { authorname = "%" + authorname + "%"; dt = _temp.GetDataByAuthorName(authorname); foreach (AuthorsRec.BookAuthRelRow rw in dt.Rows) { BooksRec.BooksDataTable bookdt = new BooksRec.BooksDataTable(); bookdt = _adapter.GetDataByBookNo(rw.BookID); foreach (BooksRec.BooksRow rw2 in bookdt.Rows) { int? bookavail = issret.GetDataByBookavailable(rw2.BookNo).Rows.Count; BooksRec.BooksExtraTableRow newr = (BooksRec.BooksExtraTableRow)newdt.NewRow(); newr.BookNo = rw2.BookNo; newr.ISBN = rw2.ISBN; newr.BookName = rw2.BookName; newr.AuthorName = getAllAuthors(rw2.BookNo); if(rw2.IsEditionNull()==false ) newr.Edition = rw2.Edition; else newr.Edition = 1;// rw2.Edition; if(rw2.IsSubjectNull()==false)

newr.Subject = rw2.Subject; else newr.Subject = "UNKNOWN";// rw2.Subject; if(rw2.IsPublisherNameNull()==false) newr.PublisherName = rw2.PublisherName; else newr.PublisherName = "UNKNOWN";// rw2.PublisherName; if (rw2.IsCopiesNull() == false) newr.Copies = rw2.Copies; else newr.Copies = 0; if (bookavail.HasValue && rw2.IsCopiesNull() == false) { if (bookavail == 0) { newr["Available"] = 1; } else { newr["Available"] = 0; } } else newr["Available"] = 0; newdt.Rows.Add(newr); } newdt.AcceptChanges(); } } catch (Exception ex) {} return newdt;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public BooksRec.BooksExtraTableDataTable GetDataByTitle(string booktitle) {

BooksRec.BooksExtraTableDataTable newdt = new BooksRec.BooksExtraTableDataTable(); try { booktitle = "%" + booktitle + "%"; BooksRec.BooksDataTable bookdt=Adapter.GetDataByBookName(booktitle); IssuesReturnsBll issret = new IssuesReturnsBll(); newdt.Columns.Add(new DataColumn("Available", System.Type.GetType("System.Int32"))); newdt.AcceptChanges(); foreach (BooksRec.BooksRow rw2 in bookdt.Rows) { BooksRec.BooksExtraTableRow newr = (BooksRec.BooksExtraTableRow)newdt.NewRow(); int? bookavail = issret.GetDataByBookavailable(rw2.BookNo).Rows.Count; newr.BookNo = rw2.BookNo; newr.ISBN = rw2.ISBN; newr.BookName = rw2.BookName; newr.AuthorName = getAllAuthors(rw2.BookNo); if (rw2.IsEditionNull() == false) newr.Edition = rw2.Edition; else

newr.Edition = 1;// rw2.Edition; if (rw2.IsSubjectNull() == false) newr.Subject = rw2.Subject; else newr.Subject = "UNKNOWN";// rw2.Subject; if (rw2.IsPublisherNameNull() == false) newr.PublisherName = rw2.PublisherName; else newr.PublisherName = "UNKNOWN";// rw2.PublisherName; if (rw2.IsCopiesNull() == false) newr.Copies = rw2.Copies; else newr.Copies = 0; if (bookavail.HasValue && rw2.IsCopiesNull() == false) newr["Available"] = (int)bookavail; else newr["Available"] = 0; newdt.Rows.Add(newr); newdt.AcceptChanges(); } } catch (Exception ex) {} return newdt;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public BooksRec.BooksExtraTableDataTable GetDataBySubject(string booksubject)

BooksRec.BooksExtraTableDataTable newdt = new BooksRec.BooksExtraTableDataTable(); try { booksubject = "%" + booksubject + "%"; BooksRec.BooksDataTable bookdt = Adapter.GetDataBySubjectName(booksubject); IssuesReturnsBll issret = new IssuesReturnsBll(); newdt.Columns.Add(new DataColumn("Available", System.Type.GetType("System.Int32"))); newdt.AcceptChanges(); foreach (BooksRec.BooksRow rw2 in bookdt.Rows) { BooksRec.BooksExtraTableRow newr = (BooksRec.BooksExtraTableRow)newdt.NewRow(); int? bookavail = issret.GetDataByBookavailable(rw2.BookNo).Rows.Count; newr.BookNo = rw2.BookNo; newr.ISBN = rw2.ISBN; newr.BookName = rw2.BookName; newr.AuthorName = getAllAuthors(rw2.BookNo); if (rw2.IsEditionNull() == false) newr.Edition = rw2.Edition; else newr.Edition = 1;// rw2.Edition; if (rw2.IsSubjectNull() == false) newr.Subject = rw2.Subject; else newr.Subject = "UNKNOWN";// rw2.Subject; if (rw2.IsPublisherNameNull() == false) newr.PublisherName = rw2.PublisherName; else newr.PublisherName = "UNKNOWN";// rw2.PublisherName;

if (rw2.IsCopiesNull() == false) newr.Copies = rw2.Copies; else newr.Copies = 0; if (bookavail.HasValue && rw2.IsCopiesNull() == false) newr["Available"] = (int)bookavail; else newr["Available"] = 0; newdt.Rows.Add(newr); newdt.AcceptChanges(); } } catch (Exception ex) {} return newdt;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public BooksRec.BooksExtraTableDataTable GetDataByBookNo(decimal bookno) {

BooksRec.BooksExtraTableDataTable newdt = new BooksRec.BooksExtraTableDataTable(); try { BooksRec.BooksDataTable bookdt = Adapter.GetDataByBookNo(bookno);

IssuesReturnsBll issret = new IssuesReturnsBll(); newdt.Columns.Add(new DataColumn("Available", System.Type.GetType("System.Int32"))); newdt.AcceptChanges(); foreach (BooksRec.BooksRow rw2 in bookdt.Rows) { BooksRec.BooksExtraTableRow newr = (BooksRec.BooksExtraTableRow)newdt.NewRow(); int? bookavail = issret.GetDataByBookavailable(rw2.BookNo).Rows.Count; newr.BookNo = rw2.BookNo; newr.ISBN = rw2.ISBN; newr.BookName = rw2.BookName; newr.AuthorName = getAllAuthors(rw2.BookNo); if (rw2.IsEditionNull() == false) newr.Edition = rw2.Edition; else newr.Edition = 1;// rw2.Edition; if (rw2.IsSubjectNull() == false) newr.Subject = rw2.Subject; else newr.Subject = "UNKNOWN";// rw2.Subject; if (rw2.IsPublisherNameNull() == false) newr.PublisherName = rw2.PublisherName; else newr.PublisherName = "UNKNOWN";// rw2.PublisherName; if (rw2.IsCopiesNull() == false) newr.Copies = rw2.Copies; else newr.Copies = 0; if (bookavail.HasValue && rw2.IsCopiesNull() == false) newr["Available"] = (int)bookavail; else newr["Available"] = 0;

newdt.Rows.Add(newr); newdt.AcceptChanges(); } } catch (Exception ex) {} return newdt;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public BooksRec.BooksExtraTableDataTable GetDataByISBN(decimal isbn) {

BooksRec.BooksExtraTableDataTable newdt = new BooksRec.BooksExtraTableDataTable(); try { BooksRec.BooksDataTable bookdt = Adapter.GetDataByISBN(isbn); IssuesReturnsBll issret = new IssuesReturnsBll(); newdt.Columns.Add(new DataColumn("Available", System.Type.GetType("System.Int32"))); newdt.AcceptChanges(); foreach (BooksRec.BooksRow rw2 in bookdt.Rows) { BooksRec.BooksExtraTableRow newr = (BooksRec.BooksExtraTableRow)newdt.NewRow(); int? bookavail = issret.GetDataByBookavailable(rw2.BookNo).Rows.Count;

newr.BookNo = rw2.BookNo; newr.ISBN = rw2.ISBN; newr.BookName = rw2.BookName; newr.AuthorName = getAllAuthors(rw2.BookNo); if (rw2.IsEditionNull() == false) newr.Edition = rw2.Edition; else newr.Edition = 1;// rw2.Edition; if (rw2.IsSubjectNull() == false) newr.Subject = rw2.Subject; else newr.Subject = "UNKNOWN";// rw2.Subject; if (rw2.IsPublisherNameNull() == false) newr.PublisherName = rw2.PublisherName; else newr.PublisherName = "UNKNOWN";// rw2.PublisherName; if (rw2.IsCopiesNull() == false) newr.Copies = rw2.Copies; else newr.Copies = 0; if (bookavail.HasValue && rw2.IsCopiesNull() == false) newr["Available"] = (int)bookavail; else newr["Available"] = 0; newdt.Rows.Add(newr); newdt.AcceptChanges(); } } catch (Exception ex) {} return newdt;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public BooksRec.BooksExtraTableDataTable GetDataByPublisher(string publisher) {

BooksRec.BooksExtraTableDataTable newdt = new BooksRec.BooksExtraTableDataTable(); try { publisher = "%" + publisher + "%"; BooksRec.BooksDataTable bookdt = Adapter.GetDataByPublisher(publisher); IssuesReturnsBll issret = new IssuesReturnsBll(); newdt.Columns.Add(new DataColumn("Available", System.Type.GetType("System.Int32"))); newdt.AcceptChanges(); foreach (BooksRec.BooksRow rw2 in bookdt.Rows) { BooksRec.BooksExtraTableRow newr = (BooksRec.BooksExtraTableRow)newdt.NewRow(); int? bookavail = issret.GetDataByBookavailable(rw2.BookNo).Rows.Count; newr.BookNo = rw2.BookNo; newr.ISBN = rw2.ISBN; newr.BookName = rw2.BookName; newr.AuthorName = getAllAuthors(rw2.BookNo); if (rw2.IsEditionNull() == false) newr.Edition = rw2.Edition; else newr.Edition = 1;// rw2.Edition;

if (rw2.IsSubjectNull() == false) newr.Subject = rw2.Subject; else newr.Subject = "UNKNOWN";// rw2.Subject; if (rw2.IsPublisherNameNull() == false) newr.PublisherName = rw2.PublisherName; else newr.PublisherName = "UNKNOWN";// rw2.PublisherName; if (rw2.IsCopiesNull() == false) newr.Copies = rw2.Copies; else newr.Copies = 0; if (bookavail.HasValue && rw2.IsCopiesNull() == false) newr["Available"] = (int)bookavail; else newr["Available"] = 0; newdt.Rows.Add(newr); newdt.AcceptChanges(); } } catch (Exception ex) {} return newdt;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public BooksRec.BooksDataTable GetDataByBookID(decimal bookid) {

BooksRec.BooksDataTable dt = new BooksRec.BooksDataTable(); dt = _adapter.GetDataByBookNo(bookid); return dt; } private string getAllAuthors(decimal bookid) { string ans = ""; AuthorsRec.BookAuthRelDataTable dt = new AuthorsRec.BookAuthRelDataTable(); BookAuthRelTableAdapter _temp = new BookAuthRelTableAdapter(); dt = _temp.GetDataByBookID(bookid); foreach (AuthorsRec.BookAuthRelRow rw in dt.Rows) { ans += rw.AuthorName + ","; } ans = ans.Substring(0, ans.Length - 1); return ans; } public BooksBLL() { _adapter = new BooksTableAdapter(); } }

K:\SpringDale\App_Code\BLL\ClassAttendanceReport.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using StudentRecordTableAdapters; using ClassRecTableAdapters; using AttendanceRecTableAdapters; using System.Data.SqlClient; using System.Data; /// <summary> /// This will be used to show report for a particular class. /// It will have functions for a single month /// for a range of months /// for a whole year /// for few days /// for a single day /// </summary> /// [System.ComponentModel.DataObject] public class ClassAttendanceReport {

public ClassAttendanceReport() { // // TODO: Add constructor logic here // }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public DataTable GetDataForASingleDay(DateTime dateValue,string className,string classSection) { ClassRecBLL classes = new ClassRecBLL(); decimal classid= (decimal)classes.GetClassID(className, classSection); SqlConnection con = new SqlConnection("Data Source=69.16.252.20;Initial Catalog=springdale;Persist Security Info=True;User ID=dbadmin;Password=sudeep"); SqlDataAdapter da = null; DataSet ds = new DataSet(); //try //{ string strText = "SELECT StudentRec.EnrollNo, StudentRec.FirstName + ' ' + StudentRec.LastName AS Name,"; strText += " AttendanceRec.AttendanceType FROM AttendanceRec INNER JOIN"; strText += " StudentRec ON AttendanceRec.EnrollNo = StudentRec.EnrollNo"; strText += " WHERE ( StudentRec.ClassID = " + classid.ToString() + " and AttendanceRec.AttendanceDate=@Param1)"; con.Open();

da = new SqlDataAdapter(strText, con); SqlParameter myParam = new SqlParameter(); myParam.ParameterName = "@Param1"; myParam.SqlDbType = SqlDbType.DateTime; myParam.Value = dateValue; da.SelectCommand.Parameters.Add(myParam);

da.Fill(ds);

//} //catch (Exception ex) //{ // return null; //} //finally //{ // //da.Dispose(); //con.Close(); //} return ds.Tables[0]; //return _studentAdapter.GetData(); } [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public DataTable GetDataForASingleDayEx(DateTime dateValue, string className, string classSection) { ClassRecBLL classes = new ClassRecBLL(); decimal classid = (decimal)classes.GetClassID(className, classSection); SqlConnection con = new SqlConnection("Data Source=69.16.252.20;Initial Catalog=springdale;Persist Security Info=True;User ID=dbadmin;Password=sudeep"); SqlDataAdapter da = null; DataSet ds = new DataSet(); //try //{ string strText = "SELECT StudentRec.EnrollNo, StudentRec.FirstName , StudentRec.LastName,"; strText += " AttendanceRec.AttendanceType FROM AttendanceRec INNER JOIN";

strText += " StudentRec ON AttendanceRec.EnrollNo = StudentRec.EnrollNo"; strText += " WHERE ( StudentRec.ClassID = " + classid.ToString() + " and AttendanceRec.AttendanceDate=@Param1)"; con.Open();

da = new SqlDataAdapter(strText, con); SqlParameter myParam = new SqlParameter(); myParam.ParameterName = "@Param1"; myParam.SqlDbType = SqlDbType.DateTime; myParam.Value = dateValue; da.SelectCommand.Parameters.Add(myParam);

da.Fill(ds);

//} //catch (Exception ex) //{ // return null; //} //finally //{ // //da.Dispose(); //con.Close(); //} return ds.Tables[0]; //return _studentAdapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public DataTable GetDataForAMonth(int month,int year,string className,string classSection) {

SqlConnection con = new SqlConnection("Data Source=69.16.252.20;Initial Catalog=springdale;Persist Security Info=True;User ID=dbadmin;Password=sudeep"); SqlDataAdapter da = null; DataSet ds = new DataSet(); DataTable newDT = new DataTable("repMonthly"); //try //{ string strText ="SELECT sr.EnrollNo, sr.FirstName, sr.LastName, ar.Total, cr.ClassName, cr.ClassSection"; strText+=" FROM (SELECT EnrollNo, COUNT(AttendanceType) AS Total FROM AttendanceRec"; strText+=" WHERE (AttendanceType = 'P') AND (MONTH(AttendanceDate) = @month) AND (YEAR(AttendanceDate) = @year)"; strText+=" GROUP BY EnrollNo) AS ar INNER JOIN StudentRec AS sr ON sr.EnrollNo = ar.EnrollNo INNER JOIN"; strText += " ClassRec AS cr ON sr.ClassID = cr.ClassID "; con.Open();

da = new SqlDataAdapter(strText, con); SqlParameter mymonth = new SqlParameter(); mymonth.ParameterName = "@month"; SqlParameter myyear = new SqlParameter(); myyear.ParameterName = "@year"; mymonth.SqlDbType = SqlDbType.Int;

myyear.SqlDbType = SqlDbType.Int; mymonth.Value = month; myyear.Value = year; da.SelectCommand.Parameters.Add(mymonth); da.SelectCommand.Parameters.Add(myyear); da.Fill(ds);

newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[0].ColumnName,ds.Tables[0].Columns[0].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[1].ColumnName, ds.Tables[0].Columns[1].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[2].ColumnName, ds.Tables[0].Columns[2].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[3].ColumnName, ds.Tables[0].Columns[3].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[4].ColumnName, ds.Tables[0].Columns[4].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[5].ColumnName, ds.Tables[0].Columns[5].DataType)); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["ClassName"].ToString() == className && dr["ClassSection"].ToString()==classSection) { DataRow dr1 = newDT.NewRow(); dr1[0]=dr[0]; dr1[1]=dr[1]; dr1[2]=dr[2]; dr1[3]=dr[3]; dr1[4]=dr[4]; dr1[5]=dr[5];

newDT.Rows.Add(dr1); } } newDT.AcceptChanges(); //} //catch (Exception ex) //{ //return null; // }

return newDT;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public DataTable GetDataForARange(string startDate, string endDate, string className, string classSection) { SqlConnection con = new SqlConnection("Data Source=69.16.252.20;Initial Catalog=springdale;Persist Security Info=True;User ID=dbadmin;Password=sudeep"); SqlDataAdapter da = null; DataSet ds = new DataSet(); DataTable newDT = new DataTable("repMonthly"); //try //{ string strText = "SELECT sr.EnrollNo, sr.FirstName, sr.LastName, ar.Total, cr.ClassName, cr.ClassSection";

strText += " FROM (SELECT EnrollNo, COUNT(AttendanceType) AS Total FROM AttendanceRec"; strText += " WHERE (AttendanceType = 'P') AND (AttendanceDate >= @startdate) AND (AttendanceDate <= @enddate)"; strText += " GROUP BY EnrollNo) AS ar INNER JOIN StudentRec AS sr ON sr.EnrollNo = ar.EnrollNo INNER JOIN"; strText += " ClassRec AS cr ON sr.ClassID = cr.ClassID "; con.Open();

da = new SqlDataAdapter(strText, con); SqlParameter dtStart = new SqlParameter(); dtStart.ParameterName = "@startdate"; SqlParameter dtEnd = new SqlParameter(); dtEnd.ParameterName = "@enddate"; dtStart.SqlDbType = SqlDbType.DateTime; dtEnd.SqlDbType = SqlDbType.DateTime; //CultureInfo culture = new CultureInfo("en-US"); DateTime d1 = DateTime.Parse(startDate);//, "mm/dd/yyyy", null); dtStart.Value = d1; DateTime d2 = DateTime.Parse(endDate);//, "mm/dd/yyyy", null); dtEnd.Value = d2;// Convert.ToDateTime(endDate); //dtStart.Value = "01/01/2012"; //dtEnd.Value = "01/30/2012"; da.SelectCommand.Parameters.Add(dtStart); da.SelectCommand.Parameters.Add(dtEnd); da.Fill(ds);

newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[0].ColumnName, ds.Tables[0].Columns[0].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[1].ColumnName, ds.Tables[0].Columns[1].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[2].ColumnName, ds.Tables[0].Columns[2].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[3].ColumnName, ds.Tables[0].Columns[3].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[4].ColumnName, ds.Tables[0].Columns[4].DataType)); newDT.Columns.Add(new DataColumn(ds.Tables[0].Columns[5].ColumnName, ds.Tables[0].Columns[5].DataType)); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["ClassName"].ToString() == className && dr["ClassSection"].ToString() == classSection) { DataRow dr1 = newDT.NewRow(); dr1[0] = dr[0]; dr1[1] = dr[1]; dr1[2] = dr[2]; dr1[3] = dr[3]; dr1[4] = dr[4]; dr1[5] = dr[5]; newDT.Rows.Add(dr1); } } newDT.AcceptChanges(); //} //catch (Exception ex) //{ //return null;

// }

return newDT; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public DataTable GetDataForStudentForAYear(int EnrollNo, int searchYear,string className, string classSection) { SqlConnection con = new SqlConnection("Data Source=69.16.252.20;Initial Catalog=springdale;Persist Security Info=True;User ID=dbadmin;Password=sudeep"); SqlDataAdapter da = null; DataSet ds = new DataSet(); DataTable newDT = new DataTable("repStudentYearWise"); int i=0; //try //{ con.Open(); string strText = "SELECT Count(AttendanceType) AS Attendance from AttendanceRec where AttendanceType='P' and EnrollNo=@enrollno and (MONTH(AttendanceDate)=@month) and (YEAR(AttendanceDate)=@year)"; newDT.Columns.Add(new DataColumn("Month", System.Type.GetType("System.String") )); newDT.Columns.Add(new DataColumn("Attendance", System.Type.GetType("System.Int32"))); DataRow dr,dr1=null ; DataTable olddt = new DataTable();

SqlCommand com = null; string[] months = { "Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" }; for (i = 0; i < 12; i++) { strText = "SELECT Count(*) AS Attendance from AttendanceRec where AttendanceType='P' and EnrollNo="; strText += EnrollNo.ToString() + " and MONTH(AttendanceDate)=" + (i + 1).ToString() + " and YEAR(AttendanceDate)=" + searchYear.ToString(); com = new SqlCommand(strText, con); dr1 = newDT.NewRow(); dr1[0] = months[i]; dr1[1] = com.ExecuteScalar(); newDT.Rows.Add(dr1); newDT.AcceptChanges(); }

//} //catch (Exception ex) //{ //return null; // }

return newDT; }

K:\SpringDale\App_Code\BLL\ClassRecBLL.cs
using System; using System.Collections.Generic; using System.Web; using ClassRecTableAdapters; /// <summary> /// Summary description for ClassRecBLL /// </summary> /// [System.ComponentModel.DataObject] public class ClassRecBLL:IDisposable { public ClassRecBLL() { // // TODO: Add constructor logic here // } private ClassRecTableAdapter _classrecadapter = new ClassRecTableAdapter(); public ClassRecTableAdapter Adapter { get { if (_classrecadapter == null) _classrecadapter = new ClassRecTableAdapter(); return _classrecadapter; } }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public ClassRec.ClassRecDataTable GetData() { return _classrecadapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public System.Data.DataTable GetClassSectAdd() { return _classrecadapter.GetDataByClassSectAdd(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public decimal? GetClassID(string classname,string classsection) { System.Data.DataTable dt =_classrecadapter.GetClassID(classname, classsection); decimal? ans = null; if (dt.Rows.Count > 0) { System.Data.DataRow r1 = dt.Rows[0]; ans=(decimal)r1["ClassID"]; } return ans;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public decimal? GetMaxClassID() { return _classrecadapter.GetMaxClassID();

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public ClassRec.ClassRecDataTable GetUniqueName() { return _classrecadapter.GetUniqueName();

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public ClassRec.ClassRecDataTable GetUniqueSection() { return _classrecadapter.GetUniqueSection();

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)]

public bool AddNewClass(string ClassName,string SectionName,decimal ClassID) { return (_classrecadapter.InsertQuery(ClassID, ClassName, SectionName) == 1);

} public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { _classrecadapter.Dispose(); } else { } } ~ClassRecBLL() { Dispose(false); } }

K:\SpringDale\App_Code\BLL\ExamSettingBLL.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using ExamSettingRecTableAdapters; /// <summary> /// Summary description for ExamSettingBLL /// </summary> /// [System.ComponentModel.DataObject] public class ExamSettingBLL:IDisposable { // static const Object obj = new Object(); ExamSettingTableAdapter _adapter; public ExamSettingBLL() { _adapter = new ExamSettingTableAdapter(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public ExamSettingRec.ExamSettingDataTable GetData() { return _adapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public ExamSettingRec.ExamSettingDataTable GetData(decimal TermID) { return _adapter.GetDataByTermID(TermID); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public ExamSettingRec.ExamSettingDataTable GetData(decimal TermID,string classes) { return _adapter.GetDataByTermClass(TermID, classes); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, true)] public int InsertData(string TermName,decimal maxmarks,decimal pass,decimal weightage,string classes) { //lock(obj){ decimal? termid=_adapter.MaxTermID(); if(termid.HasValue==false) termid=0; else termid=termid+1; return _adapter.Insert((decimal)termid, TermName, maxmarks, pass, weightage, classes);

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Update, true)] public int UpdateData(decimal TermID,string TermName, decimal maxmarks, decimal pass, decimal weightage, string classes) { return _adapter.UpdateQuery(TermName, maxmarks, pass, weightage, classes, (decimal)TermID); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Delete, true)] public int RemoveData(decimal TermID) { return _adapter.DeleteQuery((decimal)TermID); } public decimal ClassExists(string classname) { decimal ans = -1; ExamSettingRec.ExamSettingDataTable dt = _adapter.GetDataByClassName(classname); if (dt.Rows.Count > 0) ans = (decimal)dt.Rows[0][0]; return ans; } public void Dispose()

{ Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { _adapter.Dispose(); } else { } } ~ExamSettingBLL() { Dispose(false); } }

K:\SpringDale\App_Code\BLL\IssuesReturnsBll.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using IssueReturnTableAdapters; using System.Configuration; using System.Data.SqlClient; using LibMemberTableAdapters; /// <summary> /// Summary description for IssuesReturnsBll /// </summary> /// [System.ComponentModel.DataObject] public class IssuesReturnsBll { private IssueReturnTableAdapters.IssuesReturnsTableAdapter _adapter; public IssuesReturnsBll() { _adapter = new IssuesReturnsTableAdapter(); } public IssuesReturnsTableAdapter Adapter { get { if(_adapter==null) _adapter = new IssuesReturnsTableAdapter(); return _adapter; } }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public IssueReturn.IssuesReturnsDataTable GetData() { return Adapter.GetData(); }

public int NumCopiesIssued(decimal bookno) { return (int)Adapter.NumIssued((decimal)bookno);

} /// <summary> /// This function is causing serious problems due to some error called invalid cast /// Thus I am moving the logic to the web service will bring it back later /// </summary> /// <param name="bookno"></param> /// <param name="accno"></param> /// <param name="issudate"></param> /// <param name="duedate"></param> /// <param name="fine"></param> /// <returns></returns> [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, true)] public bool IssueBook(decimal bookno,decimal accno,DateTime issudate,DateTime duedate,decimal fine) {

bool ans = false; string constring = ConfigurationManager.ConnectionStrings["springdaleConnectionString2"].ConnectionString; SqlConnection con = new SqlConnection(constring); con.Open(); string commtext = "Select * from Members where AccNo=" + accno.ToString(); SqlDataAdapter da = new SqlDataAdapter(commtext, con); System.Data.DataTable dt = new System.Data.DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { int i=int.Parse(dt.Rows[0]["BooksLeft"].ToString()); if (i > 0) { decimal? maxid=Adapter.GetMaxTransactID(); if(maxid==null) maxid=0; else { maxid+=1; } Adapter.IssueQuery((decimal)maxid,(decimal?)bookno, (decimal?)accno, issudate.ToString(), duedate.ToString(), (decimal)0); commtext = "Update Members set BooksLeft=" + (i - 1).ToString() + " where AccNo=" + accno.ToString(); SqlCommand comm = new SqlCommand(commtext, con); comm.ExecuteNonQuery(); comm.Dispose(); ans = true; } else ans = false; }

con.Close(); con.Dispose(); return ans;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Update, true)] public bool ReturnQuery(DateTime issuedate, DateTime duedate,DateTime returndate,decimal accno,decimal bookno) { float fine = CalcFine(duedate, returndate); return (Adapter.ReturnQuery(returndate.ToString(), (decimal)fine, bookno, accno, issuedate.ToString())>0); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public IssueReturn.IssuesReturnsDataTable GetDataByTransactionID(decimal transactid) { return Adapter.GetDataByTransactionID(transactid); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public IssueReturn.IssuesReturnsDataTable GetDataByBookavailable(decimal bookno) {

return Adapter.GetDataByBookAvailable(bookno); } public float CalcFine( DateTime duedate,DateTime returndate) { float ans = 0; TimeSpan ts = returndate - duedate; int num=ts.Days; ans = (float)num * 1.5f; if (ans <= 0) ans = 0; return ans; } public decimal getMaxTranID() { return (decimal)Adapter.GetMaxTransactID(); } public System.Data.DataTable GetDataForMember(decimal AccNo) { System.Data.DataTable dt = Adapter.GetDataByMember(AccNo); return dt; }

K:\SpringDale\App_Code\BLL\LibMemberBLL.cs
using System; using System.Collections.Generic; using System.Linq; using System.Data.SqlClient; using System.Web; using System.Configuration; using LibMemberTableAdapters; /// <summary> /// Summary description for LibMemberBLL /// </summary> /// [System.ComponentModel.DataObject] public class LibMemberBLL { private LibMemberTableAdapters.MembersTableAdapter _adapter; public LibMemberBLL() { _adapter = new MembersTableAdapter(); } public MembersTableAdapter Adapter { get { if (_adapter == null) _adapter = new MembersTableAdapter(); return _adapter; } }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public LibMember.MembersDataTable GetData() { return _adapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public int GetDataByAccNo(decimal accno) { int answer = (int)_adapter.FillByAccNo(accno); return answer; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public int GetDataByBooksLeft(decimal accno) { int answer = 0; LibMember.MembersDataTable dt= _adapter.GetDataByBooksLeft(accno); if (dt != null && dt.Rows.Count > 0) { if (dt[0].IsBooksLeftNull()) answer = 0; else answer = (int)dt[0].BooksLeft; } return answer;

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert , true)] public bool InsertData(decimal enrollno,decimal booklimit,decimal status,byte[] img) { decimal accno = 0; if (_adapter.GetMaxAccNo() == null || _adapter.GetMaxAccNo() == 0) accno = 0; else accno=(decimal)_adapter.GetMaxAccNo(); accno += 1; if (_adapter.InsertQuery((decimal)accno, enrollno, booklimit, booklimit, status) >= 1) {

string constring = ConfigurationManager.ConnectionStrings["springdaleConnectionString1"].ConnectionString; SqlConnection con = new SqlConnection(constring); con.Open(); string commtext = "Update Members Set MemberImage= @Image where AccNo=" + accno.ToString(); SqlCommand com = new SqlCommand(commtext, con); com.Parameters.Add(new SqlParameter("@Image", System.Data.SqlDbType.Image, img.Length)).Value = img; com.ExecuteNonQuery(); con.Close(); con.Dispose(); } else return false;

return true;

//return _usersAdapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Update, false)] public bool UpdateLimit(decimal accno, decimal booklimit) { return(_adapter.UpdateTotalLimit(booklimit, accno)>0); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Update, false)] public bool UpdateBooksLeft(decimal accno, decimal booksleft) { return (_adapter.UpdateBooksLeft(booksleft, accno) > 0); }

K:\SpringDale\App_Code\BLL\ManageUsersBLL.cs
using System; using System.Collections.Generic; using System.Web.Security; using System.Web; using ManageUsersTableAdapters; /// <summary> /// Summary description for ManageUsersBLL /// </summary> /// [System.ComponentModel.DataObject] public class ManageUsersBLL:IDisposable { private ManageUsersTableAdapters.tableUsersTableAdapter _usersAdapter=null ; public ManageUsersBLL() { _usersAdapter = new tableUsersTableAdapter(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public ManageUsers.tableUsersDataTable GetData() { return _usersAdapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public ManageUsers.tableUsersDataTable GetDataByUserName(string username)

{ return _usersAdapter.GetDataByUserName(username); } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { _usersAdapter.Dispose(); } else { } } ~ManageUsersBLL(){ Dispose(false); } }

K:\SpringDale\App_Code\BLL\MarksBLL.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using MarksDLLTableAdapters; /// <summary> /// Summary description for MarksBLL /// </summary> /// [System.ComponentModel.DataObject] public class MarksBLL:IDisposable { MarksDLLTableAdapters.MarksRecTableAdapter _adapter; public MarksBLL() { _adapter = new MarksRecTableAdapter(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public MarksDLL.MarksRecDataTable GetData() { return _adapter.GetData(); } [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)]

public MarksDLL.MarksRecDataTable GetData(decimal EnrollNo,decimal TermID) { return _adapter.GetDataByEnrollTerm(EnrollNo,TermID); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, true)] public int InsertData(decimal enroll,decimal marks,decimal termid,string classes,decimal SubjectID) { decimal? marksid = _adapter.MaxMarksID(); if (marksid.HasValue == false) marksid = 0; else marksid = marksid + 1; ExamSettingBLL obj2 = new ExamSettingBLL(); ExamSettingRec.ExamSettingDataTable dt= obj2.GetData(termid,classes); decimal weight = ((decimal.Parse(dt[0]["Weightage"].ToString()) /100) * marks); return _adapter.Insert((decimal)marksid, (decimal)enroll, (decimal)termid, (decimal)marks, (decimal)weight,(decimal)SubjectID);

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, true)] public int InsertData(decimal MarksID,decimal enroll, decimal marks, decimal termid, string classes,decimal SubjectID) { decimal? marksid = _adapter.MaxMarksID(); if (marksid.HasValue == false)

marksid = 0; else marksid = marksid + 1; ExamSettingBLL obj2 = new ExamSettingBLL(); ExamSettingRec.ExamSettingDataTable dt = obj2.GetData(termid, classes); decimal weight = ((decimal.Parse(dt[0]["Weightage"].ToString()) / 100)*marks); return _adapter.Insert((decimal)MarksID, (decimal)enroll, (decimal)termid, (decimal)marks, (decimal)weight,(decimal)SubjectID);

} public decimal GetMaxID() { decimal? marksid = _adapter.MaxMarksID(); if (marksid.HasValue == false) marksid = 0; else marksid = marksid + 1; return (decimal)marksid; }

/*[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataO bjectMethodType.Update, true)] public int UpdateData(decimal TermID, string TermName, decimal maxmarks, decimal pass, decimal weightage, string classes) { return _adapter.UpdateQuery(TermName, maxmarks, pass, weightage, classes, (decimal)TermID); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Delete, true)] public int RemoveData(decimal TermID) { return _adapter.DeleteQuery((decimal)TermID); } public decimal ClassExists(string classname) { decimal ans = -1; ExamSettingRec.ExamSettingDataTable dt = _adapter.GetDataByClassName(classname); if (dt.Rows.Count > 0) ans = (decimal)dt.Rows[0][0]; return ans; }*/

public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { _adapter.Dispose(); }

else { } } ~MarksBLL() { Dispose(false); } }

K:\SpringDale\App_Code\BLL\StudentRecBLL.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using StudentRecordTableAdapters; using ClassRecTableAdapters; /// <summary> /// Summary description for StudentRecBLL /// </summary> [System.ComponentModel.DataObject] public class StudentRecBLL:IDisposable { private StudentRecAdapter _studentAdapter=null; public StudentRecAdapter Adapter { get { if(_studentAdapter==null) _studentAdapter= new StudentRecAdapter(); return _studentAdapter; } } [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select,true )] public StudentRecord.StudentRecDataTable GetData() { return _studentAdapter.GetData();

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public StudentRecord.StudentRecDataTable GetDataByEnrollNo(int EnrollNo) { return _studentAdapter.GetDataByEnrollNo(EnrollNo); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public StudentRecord.StudentRecDataTable GetLatestStudent() { return _studentAdapter.GetDataByEnrollNo((decimal)_studentAdapter.GetMaxEnrollNo()); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public StudentRecord.StudentRecDataTable GetDataByRollNo(int RollNo) { return _studentAdapter.GetDataByRollNo(RollNo); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public StudentRecord.StudentRecDataTable GetDataByFirstName(string FirstName) {

return _studentAdapter.GetDataByFirstName(FirstName); } [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public StudentRecord.StudentRecDataTable GetDataByClassID(int ClassID) { return _studentAdapter.GetDataByClassID(ClassID); } /// <summary> /// This function brings the data from ClassRec table and StudentRec table /// which matches the enrollno /// </summary> /// <param name="EnrollNo">an integer value for searching record</param> /// <returns></returns> [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public StudentRecord.StudentRecDataTable GetDataByEnrollNoEx(int EnrollNo) { return _studentAdapter.GetDataByEnrollNoEx(EnrollNo); } /// <summary> /// This function creates the EnrollmentNo and RollNo based on the next available number. You dont have to /// give any input. /// </summary> /// <param name="FirstName"></param> /// <param name="LastName"></param> /// <returns>true for success and false for failure</returns>

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, false)] public bool AddStudent( string FirstName, string LastName, string ClassName,string ClassSection,string Email) { StudentRecord.StudentRecDataTable _studentTable = new StudentRecord.StudentRecDataTable(); StudentRecord.StudentRecRow newrow = _studentTable.NewStudentRecRow(); decimal? ans=1; decimal? _enroll = _studentAdapter.GetMaxEnrollNo(); if (_enroll == null) { newrow.EnrollNo = 1; _enroll = 1; } else { newrow.EnrollNo = _enroll.Value + 1; _enroll += 1; } decimal? _roll = _studentAdapter.GetMaxRollNo(); if (_roll == null) { newrow.RollNo = 1; _roll = 1; } else { newrow.RollNo = _roll.Value + 1; _roll += 1; } if (FirstName == null)

newrow.SetFirstNameNull(); else newrow.FirstName = FirstName ; if (LastName == null) newrow.SetLastNameNull(); else newrow.LastName = LastName ; /*if (ClassID == null) newrow.SetClassIDNull(); else newrow.ClassID = ClassID.Value;*/ if (ClassName != null && ClassSection != null) { ClassRecBLL obj = new ClassRecBLL(); ans= obj.GetClassID(ClassName, ClassSection); if (ans == null) { ans = obj.GetMaxClassID() + 1; obj.AddNewClass(ClassName, ClassSection, (decimal)ans); } newrow.ClassID = ans.Value;

} int rowsaffected = _studentAdapter.InsertQuery((decimal)_enroll, _roll, LastName, (decimal)ans, FirstName); bool answer=false; if (rowsaffected == 1) { ManageUsersRoles mem1 = new ManageUsersRoles();

mem1.CreateNewUser(FirstName+ _enroll.ToString(), "1234567", Email); mem1.putUserInRole(FirstName + _enroll.ToString(), "Students"); LibMemberBLL obj2 = new LibMemberBLL(); int val = 0; //System.IO.Stream inputStream = imgUpload.PostedFile.InputStream; //int imageLength = imgUpload.PostedFile.ContentLength; //imageBinary = new byte[imageLength]; //int inputRead = inputStream.Read(imageBinary, 0, imageLength); //imageData = imageBinary; //imgSave.Enabled = true; answer=obj2.InsertData(decimal.Parse(_enroll.ToString()), 2, 1, null); } //_studentTable.AddStudentRecRow(newrow); //int rowsaffected = _studentAdapter.Update(_studentTable); return answer; //rowsaffected == 1; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, false)] public bool AddStudent(string FirstName, string LastName, string ClassName, string ClassSection, string Email,string FathersName, string MothersName,string Address,string City,string State,string HomePhone,string CompanyName,string CompanyAddress, string CompanyPhone,string Designation,string LastCollege,decimal LastResult,Byte[] img) {

StudentRecord.StudentRecDataTable _studentTable = new StudentRecord.StudentRecDataTable(); StudentRecord.StudentRecRow newrow = _studentTable.NewStudentRecRow(); decimal? ans = 1; decimal? _enroll = _studentAdapter.GetMaxEnrollNo(); if (_enroll == null) { newrow.EnrollNo = 1; _enroll = 1; } else { newrow.EnrollNo = _enroll.Value + 1; _enroll += 1; } decimal? _roll = _studentAdapter.GetMaxRollNo(); if (_roll == null) { newrow.RollNo = 1; _roll = 1; } else { newrow.RollNo = _roll.Value + 1; _roll += 1; } if (FirstName == null) newrow.SetFirstNameNull(); else newrow.FirstName = FirstName; if (LastName == null) newrow.SetLastNameNull();

else newrow.LastName = LastName; /*if (ClassID == null) newrow.SetClassIDNull(); else newrow.ClassID = ClassID.Value;*/ if (ClassName != null && ClassSection != null) { ClassRecBLL obj = new ClassRecBLL(); ans = obj.GetClassID(ClassName, ClassSection); if (ans == null) { ans = obj.GetMaxClassID() + 1; obj.AddNewClass(ClassName, ClassSection, (decimal)ans); } newrow.ClassID = ans.Value;

} int rowsaffected = _studentAdapter.InsertQueryEx((decimal)_enroll, (decimal)_roll, FirstName, LastName, (decimal)ans, FathersName, MothersName, Address , City, State, HomePhone, CompanyName, CompanyAddress, CompanyPhone, Designation, LastCollege, (decimal)LastResult, img); bool answer = false; if (rowsaffected == 1) { ManageUsersRoles mem1 = new ManageUsersRoles(); mem1.CreateNewUser(FirstName + _enroll.ToString(), "1234567", Email); mem1.putUserInRole(FirstName + _enroll.ToString(), "Students"); LibMemberBLL obj2 = new LibMemberBLL(); int val = 0;

//System.IO.Stream inputStream = imgUpload.PostedFile.InputStream; //int imageLength = imgUpload.PostedFile.ContentLength; //imageBinary = new byte[imageLength]; //int inputRead = inputStream.Read(imageBinary, 0, imageLength); //imageData = imageBinary; //imgSave.Enabled = true; answer = obj2.InsertData(decimal.Parse(_enroll.ToString()), 2, 1, img); } //_studentTable.AddStudentRecRow(newrow); //int rowsaffected = _studentAdapter.Update(_studentTable); return answer; //rowsaffected == 1; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, false)] public bool UpdateStudent(int? EnrollNo,int? RollNo,string FirstName, string LastName, int? ClassID) { StudentRecord.StudentRecDataTable _studentTable = _studentAdapter.GetDataByEnrollNo(EnrollNo.Value); StudentRecord.StudentRecRow newrow; if (_studentTable.Count < 1) { return false; } else {

newrow = _studentTable[0]; }

if (EnrollNo != null) newrow.EnrollNo = EnrollNo.Value; else return false; if (RollNo != null) newrow.EnrollNo = RollNo.Value; else newrow.SetRollNoNull(); if (FirstName == null) newrow.SetFirstNameNull(); else newrow.FirstName = FirstName; if (LastName == null) newrow.SetLastNameNull(); else newrow.LastName = LastName; if (ClassID == null) newrow.SetClassIDNull(); else newrow.ClassID = ClassID.Value;

int rowsaffected = _studentAdapter.Update(newrow ); return rowsaffected == 1; } /// <summary> /// Overloaded Update function which searches the ClassID for you by using the ClassRecBLL /// </summary> /// <param name="EnrollNo"></param> /// <param name="RollNo"></param> /// <param name="FirstName"></param> /// <param name="LastName"></param> /// <param name="ClassName"></param> /// <param name="ClassSection"></param> /// <returns>true for success and false for failure</returns> [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, false)] public bool UpdateStudent(int? EnrollNo, int? RollNo, string FirstName, string LastName, string ClassName,string ClassSection) { StudentRecord.StudentRecDataTable _studentTable = _studentAdapter.GetDataByEnrollNo(EnrollNo.Value); StudentRecord.StudentRecRow newrow; if (_studentTable.Count < 1) { return false; } else { newrow = _studentTable[0]; }

if (EnrollNo != null) newrow.EnrollNo = EnrollNo.Value; else return false; if (RollNo != null) newrow.EnrollNo = RollNo.Value; else newrow.SetRollNoNull(); if (FirstName == null) newrow.SetFirstNameNull(); else newrow.FirstName = FirstName; if (LastName == null) newrow.SetLastNameNull(); else newrow.LastName = LastName; ClassRecBLL obj1 = new ClassRecBLL(); decimal? ClassID=obj1.GetClassID(ClassName, ClassSection); if (ClassID == null) newrow.SetClassIDNull(); else newrow.ClassID = ClassID.Value; obj1.Dispose();

int rowsaffected = _studentAdapter.Update(newrow);

return rowsaffected == 1; } public StudentRecBLL() { // // TODO: Add constructor logic here // _studentAdapter = new StudentRecAdapter(); } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (disposing) { _studentAdapter.Dispose(); } else { } } ~StudentRecBLL() { Dispose(false); }

K:\SpringDale\App_Code\BLL\SubjectsBLL.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using SubjectRecTableAdapters; using System.Data; using System.Data.SqlClient; /// <summary> /// Summary description for SubjectsBLL /// </summary> /// [System.ComponentModel.DataObject] public class SubjectsBLL { private SubjectRecTableAdapter _adapter; public SubjectsBLL() { // // TODO: Add constructor logic here // _adapter = new SubjectRecTableAdapter(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public SubjectRec.SubjectRecDataTable GetData() {

return _adapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public DataTable GetDataEx() { SubjectRec.SubjectRecDataTable sdt=_adapter.GetData(); DataTable newdt=new DataTable(); DataTable dt; SqlConnection con; SqlDataAdapter da; string connString = System.Configuration.ConfigurationManager.ConnectionStrings["springdaleConnectionStrin g2"].ConnectionString; newdt.Columns.Add(new DataColumn(sdt.Columns[0].ColumnName, Type.GetType("System.Decimal"))); newdt.Columns.Add(new DataColumn(sdt.Columns[1].ColumnName, Type.GetType("System.String"))); newdt.Columns.Add(new DataColumn(sdt.Columns[2].ColumnName, Type.GetType("System.Decimal"))); newdt.Columns.Add(new DataColumn(sdt.Columns[3].ColumnName, Type.GetType("System.Decimal"))); newdt.Columns.Add(new DataColumn("TeacherName",Type.GetType("System.String"))); newdt.AcceptChanges(); con = new SqlConnection(connString.ToString()); // try //{ con.Open(); string commtxt = "Select TeacherID,TeacherName from TeacherDummy"; foreach (DataRow dr in sdt.Rows)

{ string comtxt2= commtxt +" where TeacherID =" + dr["TeacherID"].ToString(); da = new SqlDataAdapter(comtxt2, con); dt = new System.Data.DataTable("TeacherDummy2"); da.Fill(dt); DataRow drnew=newdt.NewRow(); drnew[0]=dr[0]; drnew[1]=dr[1]; drnew[2]=dr[2]; drnew[3] = dr[3]; drnew[4]=dt.Rows[0][1]; newdt.Rows.Add(drnew); newdt.AcceptChanges(); dt.Dispose(); da.Dispose();

} con.Close(); con.Dispose(); //} //catch (Exception ex) //{ // throw ex; //} return newdt; }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)]

public SubjectRec.SubjectRecDataTable GetData(decimal classid) { return _adapter.GetDataByClassID(classid); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public SubjectRec.SubjectRecDataTable GetData(string subjectname) { return _adapter.GetDataBySubjectName(subjectname); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public SubjectRec.SubjectRecDataTable GetDataBySubjectID(decimal subjectid) { return _adapter.GetDataBySubjectID(subjectid); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert,true)] public int InsertData(string subjectname,decimal classid,decimal teacherid,decimal numperiods) { decimal? subid = _adapter.GetMaxSubjectID(); if (subid.HasValue) {

subid += 1; } else subid = 1; return _adapter.InsertQuery(subid.Value, subjectname, classid, teacherid, numperiods); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Update, true)] public int UpdateData(string subjectname, decimal classid, decimal teacherid, decimal numperiods) { decimal subjectid = 0; SubjectRec.SubjectRecDataTable dt = _adapter.GetDataBySubjectName(subjectname); if (dt.Rows.Count > 0) subjectid = (decimal)dt.Rows[0]["SubjectID"]; return _adapter.UpdateQuery(subjectname, classid, teacherid, numperiods,subjectid); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Delete, true)] public int DeleteData(string subjectname,decimal classid) { decimal subjectid = 0; SubjectRec.SubjectRecDataTable dt = _adapter.GetDataByClassAndSubject(subjectname, classid); if (dt.Rows.Count > 0) subjectid = (decimal)dt.Rows[0]["SubjectID"];

return _adapter.DeleteQuery(subjectid); } public bool IsRecordExist(string subject, decimal classid) { return(_adapter.GetDataByClassAndSubject(subject,classid).Rows.Count>0); } }

K:\SpringDale\App_Code\BLL\TimeTableMasterBLL.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using TimeTableMasterTableAdapters; /// <summary> /// Summary description for TimeTableMasterBLL /// </summary> /// [System.ComponentModel.DataObject] public class TimeTableMasterBLL { private TimeTableMasterTableAdapter _adapter; public TimeTableMasterBLL() { _adapter = new TimeTableMasterTableAdapter(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public TimeTableMaster.TimeTableMasterDataTable GetData() { return _adapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)]

public TimeTableMaster.TimeTableMasterDataTable GetData(decimal classid,string dayname) { return _adapter.GetDataByDayAndClass(dayname, classid); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public TimeTableMaster.TimeTableMasterDataTable GetDataByClassID(decimal classid) { return _adapter.GetDataByClassID(classid); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, true)] public int InsertData(decimal classid,string dayname,int numperiods ) { return _adapter.InsertQuery(classid, dayname, numperiods); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Update, true)] public int UpdateData(decimal classid, string dayname, int numperiods) { return _adapter.UpdateQuery(numperiods, classid, dayname); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Delete, true)] public int DeleteData(decimal classid, string dayname, int numperiods) {

return _adapter.DeleteQuery(classid, dayname); } public bool RecordExists(decimal classid, string dayname) { bool answer = false; answer = (_adapter.GetDataByDayAndClass(dayname, classid).Rows.Count > 0); return answer; } }

K:\SpringDale\App_Code\BLL\TimeTableRealBLL.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using TimeTableRealTableAdapters; /// <summary> /// Summary description for TimeTableRealBLL /// </summary> /// [System.ComponentModel.DataObject] public class TimeTableRealBLL { private TimeTableRealTableAdapters.TimeTableTableAdapter _adapter; public TimeTableRealBLL() { // // TODO: Add constructor logic here // _adapter = new TimeTableTableAdapter(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, true)] public TimeTableReal.TimeTableDataTable getData() { return _adapter.GetData(); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public TimeTableReal.TimeTableDataTable getData(decimal classid,string dayname) { return _adapter.GetDataByClassIDDay(classid, dayname); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Select, false)] public TimeTableReal.TimeTableDataTable getData(decimal classid, string dayname,int periodnum) { return _adapter.GetDataByPeriodNum(classid, dayname,(decimal)periodnum); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Insert, true)] public int insertQuery(decimal ClassID, string DayName, int PeriodNum, decimal SubjectID, decimal TeacherID) { return _adapter.InsertQuery(ClassID, DayName, PeriodNum, SubjectID, TeacherID); }

[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObj ectMethodType.Delete, true)] public int deleteQuery(decimal ClassID, string DayName, int PeriodNum) { return _adapter.DeleteQuery(ClassID, DayName, PeriodNum);

} }

K:\SpringDale\ChartReports\RoughPage2.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="RoughPage2.aspx.cs" Inherits="RoughPage2" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <style type="text/css"> table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption { text-align: center; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left; height:30px;

} thead th, tfoot th { padding:5px; } table a { color: #333333; text-decoration:none; } table a:hover { text-decoration:underline; } tr.odd { background: #f1f1f1; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none; } .callout { padding: 5px; border: 1px solid #7992B0;

background-color: #8AA9B7; border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); } </style> <script type="text/javascript"> var myObject = null; $(document).ready(function () { $("#IssueBook").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 800, height: 450 }); $("#dateissuepicker").datepicker({ dateFormat: 'dd-mm-yy', onSelect: function (dateText, inst) { var cooldate = dateText.split('-'); var now = new Date(); var msg = ""; if (cooldate[0] != now.getDate()) msg+="Incorrect Date "; if (cooldate[1] != (now.getMonth() + 1)) msg+=" Incorrect Month Value"; if (cooldate[2] != (now.getYear() + 1900)) msg += " Incorrect Year"; if(msg!="")

Notifier.error(msg, 'Issue Date May be Incorrect'); } });

$("#datereturnpicker").datepicker({ dateFormat: 'dd-mm-yy', onSelect: function (dateText, inst) { var cooldate = dateText.split('-'); var now = new Date(); var msg = ""; if (cooldate[2] != (now.getYear() + 1900)) msg += " Are you sure about this date.Specially the year"; if (msg != "") Notifier.error(msg, 'Issue Date May be Incorrect'); } }); $('#txtBookSearchString').focus();

}); function parseJsonString() { $.fx.speeds._default = 1000; $("#ajaxloader").show(); $("#showjson").hide(); var radiogrp = document.getElementsByName('searchChoice'); var txtsearch = document.getElementById('txtBookSearchString'); var i=0; for (i = 0; i < radiogrp.length; i++) {

if (radiogrp[i].value == 1 && radiogrp[i].checked) { LibraryManagement.getDataByAuthor(txtsearch.value,jsonFeedRecieved); } else if (radiogrp[i].value == 2 && radiogrp[i].checked) { LibraryManagement.getDataByTitle(txtsearch.value, jsonFeedRecieved); } else if (radiogrp[i].value == 3 && radiogrp[i].checked) { LibraryManagement.getDataBySubject(txtsearch.value, jsonFeedRecieved); } else if (radiogrp[i].value == 4 && radiogrp[i].checked) { LibraryManagement.getDataByPublisher(txtsearch.value, jsonFeedRecieved); } else if (radiogrp[i].value == 5 && radiogrp[i].checked) { LibraryManagement.getDataByISBN( parseInt(txtsearch.value), jsonFeedRecieved); } else if (radiogrp[i].value == 6 && radiogrp[i].checked) { LibraryManagement.getDataByBookNo(parseInt(txtsearch.value), jsonFeedRecieved); } }

} function jsonFeedRecieved(result) { var i=0; myObject = JSON.parse(result); var txt = "<table style='margin:0 auto;width:100%;border:none;'>"; txt += "<thead><tr><th>BookNo</th><th>Title</th><th>Authors</th><th>Edition</th><th>Subjec t</th><th>Publisher</th><th>Avail</th></tr></thead><tbody>"; for (i = 0; i < myObject.length; i++) {

txt += "<tr onclick='openIssue("+ i.toString() +");' class='hovereffect'><td>" + myObject[i].BookNo + "</td>"; txt += "<td>" + myObject[i].BookName + "</td>"; txt += "<td>" + myObject[i].AuthorName + "</td>"; txt += "<td>" + myObject[i].Edition + "</td>"; txt += "<td>" + myObject[i].Subject + "</td>"; txt += "<td>" + myObject[i].PublisherName + "</td>"; if (myObject[i].Available > 0) txt += "<td>" + "<a href='#' ><img alt='Yes' src='http://learnasp.in/css/tick_02.png'/></a>" + "</td></tr>"; else txt += "<td>" + "<img alt='No' src='http://learnasp.in/css/remove.png'/>" + "</td></tr>"; } txt += "</tbody></table>"; $("#ajaxloader").hide(); $("#showjson").show("fast"); $("#showjson").html(txt);

//divid.innerHTML = txt; } function openIssue(i) { $("#bookname").html(myObject[i].BookName); $("#IssueBook").dialog("open"); $("#IssueBook").dialog("option", "height", 450); $("#IssueBook").dialog("option", "width", 800); } function validateAccNo() {

var valtxt = document.getElementById("txtAccno").value; if (valtxt == undefined || valtxt == '') { Notifier.warning('Oooops Acc No Not Given!', 'Alert!Alert!Alert'); } else { LibraryManagement.checkAccNo(parseInt(valtxt), function (result) { if (result == false) { Notifier.error('Please check the account no.Or the book limit', 'Acc No Not Found Or Book Limit Exceded'); } }); }

} </script> <style type="text/css"> #Text1 { width: 293px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/LibraryManagement.asmx" /> </Services> </asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div id="IssueBook" title="Book Issue Dialog" > <table style="width: 100%;"> <tr> <td> Book Name : </td> <td> <div id="bookname"></div> </td> <td></td> </tr> <tr> <td>Acc No</td> <td> <input type="text" id="txtAccno" onblur="validateAccNo();" ></td> <td><div id="accNoCallOut"></div></td> </tr> <tr> <td> Date Of Issue : </td> <td> <input type="text" id="dateissuepicker"> </td> <td></td> </tr> <tr> <td> Date Of Return

</td> <td> <input type="text" id="datereturnpicker"> </td> <td> &nbsp; </td> </tr> </table> </div> <div style="width:90%;"> <table style="margin:0 auto"> <tr> <td><b style="font-family: Arial, Helvetica, sans-serif; font-size: medium; fontweight: bold">Enter Text</b></td> <td><b><input id="txtBookSearchString" onkeyup="parseJsonString();" type="text" style="font-family: Arial, Helvetica, sans-serif; font-size: medium" /></b></td> <td> <input name="searchChoice" id="Radio1" type="radio" value="1" checked="checked" />Author <input name="searchChoice" id="Radio2" type="radio" value="2" />Title <input name="searchChoice" id="Radio3" type="radio" value="3" />Subject <input name="searchChoice" id="Radio4" type="radio" value="4" />Publisher <input name="searchChoice" id="Radio5" type="radio" value="5" />ISBN <input name="searchChoice" id="Radio6" type="radio" value="6" />BookNo </td> <td><input id="Button1" type="button" value="Search.." onclick="parseJsonString();" /></td> <td> <div style="float:left; display:none;" id="ajaxloader">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> </tr>

</table> <div id="showjson" style="width:800px;margin:0 auto;"> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\ChartReports\RoughPage2.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class RoughPage2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

K:\SpringDale\ChartReports\web.config
<?xml version="1.0"?> <!-For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <appSettings> <add key="ChartImageHandler" value="storage=memory;timeout=20;" /> </appSettings> <connectionStrings> <add name="springdaleConnectionString1" connectionString="Data Source=69.16.252.20;Initial Catalog=springdale;Persist Security Info=True;User ID=dbadmin;Password=sudeep" providerName="System.Data.SqlClient"/> </connectionStrings> <location path="UnauthorizedAccess.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="Login.aspx"> <system.web> <authorization> <allow users="*"/> </authorization> </system.web> </location> <location path="Default.aspx"> <system.web>

<authorization> <deny users="?"/> <allow users="*"/> </authorization> </system.web> </location> <system.web> <authorization> <deny users="?" /> <allow roles="Administrators" /> </authorization> <authentication mode="Forms"> <forms loginUrl="login.aspx" cookieless="AutoDetect" defaultUrl="Default.aspx"> </forms> </authentication> <customErrors mode="Off"/> <httpHandlers> <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" /> <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" /> </httpHandlers> <pages enableViewStateMac="false" enableEventValidation="false" clientIDMode="AutoID" controlRenderingCompatibilityVersion="4.0" validateRequest="false" viewStateEncryptionMode="Never">

<controls> <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </controls> </pages> <compilation debug="false" targetFramework="4.0"> <assemblies> <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> </assemblies> <buildProviders> <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </buildProviders> </compilation> <membership defaultProvider="SecurityTutorialsSqlMembershipProvider"> <providers> <!--Add a customized SqlMembershipProvider --> <add name="SecurityTutorialsSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider"

connectionStringName="springdaleConnectionString1" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="SpringDale" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/> </providers> </membership> <roleManager enabled="true" defaultProvider="SecurityTutorialsSqlRoleProvider" cacheRolesInCookie="true" createPersistentCookie="false" cookieProtection="All"> <providers> <add name="SecurityTutorialsSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" applicationName="SecurityTutorials" connectionStringName="springdaleConnectionString1"/> </providers> </roleManager> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <handlers> <remove name="ChartImageHandler" /> <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </handlers> </system.webServer> </configuration>

K:\SpringDale\css\GreyTableStyle.css
table, .table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption, .caption { text-align: left; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot, .theader { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left; height:30px; } thead th, tfoot th, .theader th { padding:5px; text-align:left } table a { color: #333333; text-decoration:none; }

table a:hover { } tr.odd, .odd { background: #f1f1f1; text-align:left; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none; } .callout { padding: 5px; border: 1px solid #7992B0; background-color: #8AA9B7; border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6);

-moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); }

K:\SpringDale\css\MyMenu.css
body { font: normal .8em/1.5em Arial, Helvetica, sans-serif; background: #ebebeb; width: 100%; color: #666; } #mainContent { width:87%; margin:0 auto; } a{ color: #333; } #nav { margin: 0 auto; padding: 7px 6px 03px 3px; background: #7d7d7d url(http://learnasp.in/css/gradient.png) repeat-x 0 -110px; line-height: 100%; border-radius: 2em; -webkit-border-radius: 2em; -moz-border-radius: 2em; -webkit-box-shadow: 0 1px 3px rgba(0,0,0, .4); -moz-box-shadow: 0 1px 3px rgba(0,0,0, .4); }

#nav li { margin: 0 5px; padding: 0 0 8px; float: left; position: relative; list-style: none; }

/* main level link */ #nav a { font-weight: bold; color:#ffffff; /*#e7e5e5;*/ text-decoration: none; display: block; padding: 8px 20px; margin: 0; vertical-align:middle; font-size:medium; -webkit-border-radius: 1.6em; -moz-border-radius: 1.6em; text-shadow: 0 1px 1px rgba(0,0,0, .3); } #nav a:hover { background: #000; color: #fff; } /* main level link hover */

#nav .current a, #nav li:hover > a { background: #666 url(http://learnasp.in/css/gradient.png) repeat-x 0 -40px; color: #444; border-top: solid 1px #f8f8f8; -webkit-box-shadow: 0 1px 1px rgba(0,0,0, .2); -moz-box-shadow: 0 1px 1px rgba(0,0,0, .2); box-shadow: 0 1px 1px rgba(0,0,0, .2); text-shadow: 0 1px 0 rgba(255,255,255, 1); } /* sub levels link hover */ #nav ul li:hover a, #nav li:hover li a { background: none; border: none; color: #666; -webkit-box-shadow: none; -moz-box-shadow: none; } #nav ul a:hover { background: #0078ff url(http://learnasp.in/css/gradient.png) repeat-x 0 -100px !important; color: #fff !important; -webkit-border-radius: 0; -moz-border-radius: 0; text-shadow: 0 1px 1px rgba(0,0,0, .1); } /* dropdown */

#nav li:hover > ul { display: block; } /* level 2 list */ #nav ul { display: none; margin: 0; padding: 0; width: 185px; position: absolute; top: 35px; left: 0; background: #ddd url(http://learnasp.in/css/gradient.png) repeat-x 0 0; border: solid 1px #b4b4b4; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; -webkit-box-shadow: 0 1px 3px rgba(0,0,0, .3); -moz-box-shadow: 0 1px 3px rgba(0,0,0, .3); box-shadow: 0 1px 3px rgba(0,0,0, .3); } #nav ul li { float: none; margin: 0; padding: 0; } #nav ul a {

font-weight: normal; text-shadow: 0 1px 0 #fff; } /* level 3+ list */ #nav ul ul { left: 181px; top: -3px; } /* rounded corners of first and last link */ #nav ul li:first-child > a { -webkit-border-top-left-radius: 9px; -moz-border-radius-topleft: 9px; -webkit-border-top-right-radius: 9px; -moz-border-radius-topright: 9px; } #nav ul li:last-child > a { -webkit-border-bottom-left-radius: 9px; -moz-border-radius-bottomleft: 9px; -webkit-border-bottom-right-radius: 9px; -moz-border-radius-bottomright: 9px; } /* clearfix */ #nav:after { content: "."; display: block; clear: both; visibility: hidden;

line-height: 0; height: 0; } #nav { display: inline-block; } html[xmlns] #nav { display: block; height: 38px; } * html #nav { height: 1%; }

K:\SpringDale\css\MyTableStyle.css
body { } #AttendanceGrid { border:1px solid grey; margin-top:10px; margin-bottom:10px; } #mainAttendance { width:100%; } #mainUsersRoles { width:100%; }

.defaultPageHeader { font-family:Arial;font-size:x-large; font-weight:bold; text-decoration:underline; color:#6B696B; } .defaultText { font-family:Times New Roman ;

font-size:x-large; font-style:italic oblique; line-height:40px; } .rowWithBorder { border-color:#6B696B; border-width:thin; border-style:outset; border-collapse:collapse; } .shadedHeader { background-color:#6B696B; width:100%; text-align:center; color:White; font-family:Arial; font-size:medium; font-weight:bold; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; border: 1px solid; } #headerRow { font-family: Arial, Helvetica, sans-serif; font-size: xx-large; font-style: normal;

line-height: 25px; font-weight: bolder; font-variant: normal; color: #FFF; text-decoration: underline; background-color: #6B696B; vertical-align: middle; word-spacing: normal; text-align: center; display: block; border: thin solid #333; } .label { font-family: Arial, Helvetica, sans-serif; font-size: medium; font-style: normal; font-weight: bold; color: #353133; letter-spacing: normal; width: 45%; } .textbox1 { font-family: Arial, Helvetica, sans-serif; font-size: medium; width: 50%; }

K:\SpringDale\css\niftyCorners.css
/*Nifty Corners Cube CSS by Alessandro Fulciniti The following classes are added dinamically by javascript, and their use should be avoided in the markup */ b.niftycorners,b.niftyfill{display:block} b.niftycorners *{display:block;height: 1px;line-height:1px;font-size: 1px; overflow:hidden;border-style:solid;border-width: 0 1px} /*normal*/ b.r1{margin: 0 3px;border-width: 0 2px} b.r2{margin: 0 2px} b.r3{margin: 0 1px} b.r4{height: 2px} b.rb1{margin: 0 8px;border-width:0 2px} b.rb2{margin: 0 6px;border-width:0 2px} b.rb3{margin: 0 5px} b.rb4{margin: 0 4px} b.rb5{margin: 0 3px} b.rb6{margin: 0 2px} b.rb7{margin: 0 1px;height:2px} b.rb8{margin: 0;height:2px} b.rs1{margin: 0 1px} /*transparent inside*/ b.t1{border-width: 0 5px} b.t2{border-width: 0 3px} b.t3{border-width: 0 2px} b.t4{height: 2px} b.tb1{border-width: 0 10px} b.tb2{border-width: 0 8px} b.tb3{border-width: 0 6px} b.tb4{border-width: 0 5px}

b.tb5{border-width: 0 4px} b.tb6{border-width: 0 3px} b.tb7{border-width: 0 2px;height:2px} b.tb8{border-width: 0 1px;height:2px} b.ts1{border-width: 0 2px}

K:\SpringDale\css\NiftyLayout.css
html,body{margin:0;padding:0} body{font: 85%/1.3 Verdana,Arial,sans-serif; text-align: center;background: #757D88;padding-bottom:20px} p{margin-top:0} h1,h2,h3{font: normal normal 200% "Trebuchet MS",Arial,sans-serif} h2{font-size:160%} h3{font-size:120%} div#header{width:100%;overflow:hidden;background: #595D66} div#header h1,div#menu{width:770px;margin:0 auto;text-align:left} div#header h1{padding: 30px 0 10px;color: #FFF} ul#nav,ul#nav li{list-style-type:none;margin:0;padding:0} ul#nav{float:right;font-size: 80%} ul#nav li{float:left;margin-left: 3px;text-align: center} ul#nav a{float:left;width: 95px;padding: 5px 0;background: #369A3D;textdecoration:none;color: #FFC} ul#nav a:hover{background: #CDFFA1;color: #006A35} ul#nav li.activelink a,ul#nav li.activelink a:hover{background: #FFF;color: #003} div#container{width:770px;margin:0 auto 10px;padding:20px 0 10px;textalign:left;background:#FFF} div#content{float:left;display:inline;width:560px;margin:0 0 10px 10px} ul#intro,ul#intro li{list-style-type:none;margin:0;padding:0} ul#intro{width:100%;overflow:hidden;margin-bottom:20px} ul#intro li{float:left;width:180px;margin-right:10px;padding: 10px 0} li#mission{background: #E65714} li#services{background: #42B4AC} ul#intro li#more{margin-right:0;background: #7D63A9}

ul#intro p,ul#intro h3{margin:0;padding: 0 10px} ul#intro h3{text-transform:uppercase;padding-bottom:3px;color: #FFF} div#content h2{margin: 10px 0;color: #007BC4} div.date{float:left;width: 4em;padding: 5px 0;background: #F1DDC4;color:#B0001E; text-align:center;margin: 0 4px 4px 0;font-size: 80%;line-height:0.9} div.date span{display:block;font-size: 150%;font-weight:bold} div.comments div{background: #EEE;margin-bottom:10px} div.comments p{padding: 10px;margin:0} div.comments div.odd{background:#DAE6FE} div#side{float:right;display:inline;width: 180px;background:#F3CF00; margin:0 10px 10px 0} div#side p{margin:5px 0 10px;padding: 0 10px} div#side div{margin: 0 0 10px;padding: 10px 0} div#footer{clear:both;width:750px;margin:0 10px 0;padding: 10px 0; background: #586695;color: #FFF;text-align:center} div#footer p{margin:0}

K:\SpringDale\Library\AddBooks.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AddBooks.aspx.cs" Inherits="Library_AddBooks" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <style type="text/css"> table { border:0 none; } .LabelTD { background-color:#7d7d7d; font-family:Arial ; font-size:medium; font-weight:bold; color:White; } .DataTD { font-family:Times New Roman; font-size:medium; }

.member_header { background:#7d7d7d;width:80%; color:White; font-size:large; font-family:Arial; fontweight:bold; text-align:center; margin:0 auto; } .asp_table { margin:0 auto; } </style> <script type="text/javascript"> function myPageLoad() { // findRoles(); //$("#rptTabs").tabs(); $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#chartDiv").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400,

height: 300 }); $("#opener").button(); $("#opener").click(SearchClicked); return false; } function SearchClicked() { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result);

}, function () { $("#dialog").html("Unable To Retrieve Data...!"); }) }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; } function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false; }

</script> <script runat="server">

protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e) { ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message; } </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server" OnAsyncPostBackError="ScriptManager1_AsyncPostBackError"> <Services> <asp:ServiceReference Path="http://localhost:85/SpringDale/GetAttendanceTable.asmx" /> </Services> </asp:ScriptManager> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Detailed Student Information" style="width:200px;height:300px;"> <p>This will show the record for the student you have selected</p>

</div> <div style="width:100%;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:12px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:12px; text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> <div style="margin-top:12px; text-align:center;" id="chart-div"> </div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <asp:Panel runat="server" CssClass="member_header" ID="Panel1"> New Books </asp:Panel> <asp:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="Panel1" Corners="All" Radius="9"> </asp:RoundedCornersExtender> <asp:Table ID="Table1" runat="server" Width="75%" CssClass="asp_table"> <asp:TableRow CssClass="OddRow">

<asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label1" runat="server" Text="ISBN"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD"> <asp:TextBox ID="txtISBN" runat="server" CssClass="DataTD"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="EvenRow"> <asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label2" runat="server" Text="BookName"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD"> <asp:TextBox ID="txtBookName" runat="server" Width="100%" CssClass="DataTD"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="OddRow"> <asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label3" runat="server" Text="PublisherName"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD"> <asp:TextBox ID="txtPublisherName" runat="server" CssClass="DataTD"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="EvenRow"> <asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label4" runat="server" Text="Authors"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD"> <asp:TextBox ID="txtAuthors" runat="server" Width="90%" CssClass="DataTD"></asp:TextBox>

</asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="OddRow"> <asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label5" runat="server" Text="Edition"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD"> <asp:TextBox ID="txtEdition" runat="server" CssClass="DataTD"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="EvenRow"> <asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label6" runat="server" Text="Subject"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD"> <asp:TextBox ID="txtSubject" runat="server" Width="100%" CssClass="DataTD"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="OddRow"> <asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label7" runat="server" Text="Copies"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD"> <asp:TextBox ID="txtCopies" runat="server" CssClass="DataTD"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="EvenRow"> <asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label8" runat="server" Text="Cost"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD">

<asp:TextBox ID="txtCost" runat="server" CssClass="DataTD"></asp:TextBox> </asp:TableCell> </asp:TableRow> <asp:TableRow CssClass="OddRow"> <asp:TableCell CssClass="LabelTD"> <asp:Label ID="Label10" runat="server" Text="Image"></asp:Label> </asp:TableCell> <asp:TableCell CssClass="DataTD"> <asp:FileUpload ID="imgUpload" runat="server" Width="90%" CssClass="DataTD" /> </asp:TableCell> </asp:TableRow> </asp:Table> <table width="35%" class="asp_table"> <tr> <td></td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td> <asp:ImageButton ID="btnAddNewImg" runat="server" ImageUrl="~/css/list_add.png" onclick="ImageButton1_Click" /> </td>

<td><asp:ImageButton ID="btnSave" runat="server" ImageUrl="~/css/list_save.png" onclick="btnSave_Click1" /></td> <td> &nbsp; </td> <td> <img src="../css/ajax-loadersmall.gif" width="32" height="32" runat="server" alt="Please Wait..." visible="false" id="small_ajax" /> </td> </tr> </table> </div> </div> </asp:Content>

K:\SpringDale\Library\AddBooks.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Configuration; using System.Data.SqlClient; using AuthorsRecTableAdapters; using BooksRecTableAdapters;

public partial class Library_AddBooks : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(myPageLoad);", true); if (!IsPostBack) { } }

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)

{ txtAuthors.Text = ""; txtBookName.Text = ""; txtCopies.Text = ""; txtCost.Text = ""; txtEdition.Text = ""; txtISBN.Text = ""; txtPublisherName.Text = ""; txtSubject.Text = ""; } protected void btnSave_Click1(object sender, ImageClickEventArgs e) { BooksBLL obj = new BooksBLL(); small_ajax.Visible = true; System.IO.Stream inputStream = imgUpload.PostedFile.InputStream; int imageLength = imgUpload.PostedFile.ContentLength; byte[] imageBinary = new byte[imageLength]; int inputRead = inputStream.Read(imageBinary, 0, imageLength); byte[] imageData = imageBinary; int i; for(i=1;i<=int.Parse(txtCopies.Text);i++) obj.insertNewBook(decimal.Parse(txtISBN.Text), txtSubject.Text, txtBookName.Text, txtPublisherName.Text, decimal.Parse(txtCopies.Text), decimal.Parse(txtCost.Text), decimal.Parse(txtEdition.Text), txtAuthors.Text, imageData); small_ajax.Visible = false; txtAuthors.Text = ""; txtBookName.Text = ""; txtCopies.Text = ""; txtCost.Text = ""; txtEdition.Text = ""; txtISBN.Text = ""; txtPublisherName.Text = ""; txtSubject.Text = "";

} }

K:\SpringDale\Library\AddMember.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AddMember.aspx.cs" Inherits="Library_AddMember" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <style type="text/css"> .LabelTD { background-color:#7d7d7d; font-family:Arial ; font-size:medium; font-weight:bold; color:White; } .DataTD { font-family:Times New Roman; font-size:medium; } .member_header { background:#7d7d7d;width:30%; color:White; font-size:large; font-family:Arial; fontweight:bold; text-align:center; margin:0 auto;

} </style> <script type="text/javascript"> function myPageLoad() { // findRoles(); //$("#rptTabs").tabs(); $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#chartDiv").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#opener").button(); $("#opener").click(SearchClicked); return false; }

function SearchClicked() { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result);

}, function () { $("#dialog").html("Unable To Retrieve Data...!"); }) }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; } function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false; }

</script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>

<div style="width:100%"> <asp:Panel runat="server" CssClass="member_header" ID="Panel1"> New Member </asp:Panel> <asp:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="Panel1" Radius="9" Corners="All"> </asp:RoundedCornersExtender> <table width="30%" style="margin:0 auto"> <tr> <td class="LabelTD"> EnrollNo </td> <td class="DataTD"> <asp:TextBox ID="txtEnroll" runat="server"></asp:TextBox> </td> </tr> <tr> <td class="LabelTD"> Total Limit </td> <td class="DataTD"> <asp:TextBox ID="txtLimit" runat="server"></asp:TextBox> </td> </tr> <tr> <td class="LabelTD"> Status </td> <td class="DataTD"> <asp:RadioButton GroupName="Status" ID="RadioButton1" runat="server" Text="Inactive" /> <asp:RadioButton GroupName="Status" ID="RadioButton2" Text ="Active" runat="server" /> </td>

</tr> <tr> <td class="LabelTD"> Member Pic </td> <td class="DataTD"> <asp:FileUpload ID="imgUpload" runat="server" /> </td> </tr> <tr> <td >&nbsp; </td> <td class="DataTD"> </td> </tr> </table> <table style="width:6%; margin:0 auto"> <tr> <td> &nbsp; </td> <td> <asp:ImageButton ID="imgAddnew" runat="server" ImageUrl="~/css/list_add.png" onclick="imgAddnew_Click" /> </td> <td> &nbsp; </td> <td> <asp:ImageButton ID="imgSave" runat="server" ImageUrl="~/css/list_save.png" onclick="imgSave_Click" />

</td> </tr> </table> <br /> <br /> <asp:Label ID="Label1" runat="server" Text=" "></asp:Label> </div> </asp:Content>

K:\SpringDale\Library\AddMember.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Library_AddMember : System.Web.UI.Page { byte[] imageBinary; byte[] imageData; protected void Page_Load(object sender, EventArgs e) { } protected void imgSave_Click(object sender, ImageClickEventArgs e) { LibMemberBLL obj = new LibMemberBLL(); int val = 0; if (RadioButton1.Checked) val = 1; System.IO.Stream inputStream = imgUpload.PostedFile.InputStream; int imageLength = imgUpload.PostedFile.ContentLength; imageBinary = new byte[imageLength]; int inputRead = inputStream.Read(imageBinary, 0, imageLength); imageData = imageBinary; imgSave.Enabled = true; if (obj.InsertData(decimal.Parse(txtEnroll.Text), decimal.Parse(txtLimit.Text), val, imageData))

Label1.Text = "Data Inserted Successfully"; }

protected void imgAddnew_Click(object sender, ImageClickEventArgs e) { txtLimit.Text = ""; txtEnroll.Text = ""; Label1.Text = "Enter Data...."; } }

K:\SpringDale\Library\BookReturn.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="BookReturn.aspx.cs" Inherits="Library_BookReturn" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <style type="text/css"> table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption { text-align: center; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left; height:30px;

} thead th, tfoot th { padding:5px; } table a { color: #333333; text-decoration:none; } table a:hover { text-decoration:underline; } tr.odd { background: #f1f1f1; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none; } .callout { padding: 5px; border: 1px solid #7992B0;

background-color: #8AA9B7; border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); } </style> <script type="text/javascript"> var myObject = null; $(document).ready(function () { $('#issueButton').button(); $("#ReturnBook").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 800, height: 450 }); $('#txtAccNo').focus();

}); function GetMemberData() { $.fx.speeds._default = 1000; $("#ajaxloader").show(); $("#showjson").hide(); var txtAccNo = document.getElementById('txtAccNo');

var i = 0; LibraryManagement.getDataForMember(txtAccNo.value, jsonFeedRecieved); } function jsonFeedRecieved(result) { var i = 0; var j = 0; if (result == "") { Notifier.info('No Pending Returns', 'No Data Found For The User'); $("#ajaxloader").hide(); return false; } var temp = result.toString(); var upper = temp.split("^"); var txt = "<table style='margin:0 auto;width:100%;border:none;'>"; txt += "<thead><tr><th>TranID</th><th>BookNo</th><th>AccNo</th><th>Title</th><th>IssueDat e</th><th>DueDate</th><th>Fine</th><th>Return</th></tr></thead><tbody>"; for (i = 0; i < upper.length; i++) { var upper2 = upper[i].split("="); txt+="<tr class='hovereffect'>"; //for (j = 0; j < upper2.length; j++) { // alert(upper2[j].toString() + "," + j.toString()); var today = new Date(); var duedate=new Date(upper2[3].toString()); var fine = 0.0; if (today < duedate) { var today_mill = today.getTime(); var due_mill = duedate.getTime();

var oneday = 1000 * 60 * 60 * 24; val = ((today_mill - due_mill) / oneday) * 1.50; fine = Math.floor(val); } txt += "<td>" + upper2[5].toString() + "</td>"; txt += "<td>" + upper2[0].toString() + "</td>"; txt += "<td>" + upper2[1].toString() + "</td>"; txt += "<td>" + upper2[6].toString() + "</td>"; txt += "<td>" + upper2[2].toString() + "</td>"; txt += "<td>" + upper2[3].toString() + "</td>"; if (parseFloat(upper2[4].toString()) > 0) txt += "<td>" + val.toString() + "</td>"; else txt += "<td>" + upper2[4].toString() + "</td>"; txt += "<td><a href='javascript:void(0);' onclick='returnBook(" + upper2[5].toString() + "," + upper2[1].toString() + "," + upper2[0].toString() + ");'><img src='http://learnasp.in/css/edit_undo.png' alt='X'/></a>" + "</td>";

txt += "</tr>"; }

txt += "</tbody></table>"; $("#ajaxloader").hide(); $("#showjson").show("fast"); $("#showjson").html(txt);

//divid.innerHTML = txt; } function returnBook(tranid, accno, bookno) { returndate = new Date(); var ret_date = (returndate.getMonth() + 1) + "/" + returndate.getDate() + "/" + returndate.getFullYear(); LibraryManagement.ReturnBook(tranid, accno, bookno, ret_date, returncomplete); } function returncomplete(result) { $("#ajaxloader").hide(); if(result==true) Notifier.info('Book Return Successfull', 'Book Returned Successfully'); else Notifier.error('This is embarassing. The Book could not be returned','Book Return Crashed'); //alert(result); }

</script> <style type="text/css"> #Text1 { width: 293px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server">

<Services> <asp:ServiceReference Path="http://learnasp.in/LibraryManagement.asmx" /> </Services> </asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate><!-<div id="ReturnBook" title="Book Return Dialog" > <table style="width: 100%;"> <tr> <td> Book Name : </td> <td> <div id="bookname"></div> </td> <td>&nbsp;<input id="jsonindex" type="hidden" /></td> </tr> <tr> <td>Acc No</td> <td> <input type="text" id="txtAccno" onblur="validateAccNo();" ></td> <td> <div style="float:left; display:none;" id="ajaxLoader2">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> </tr> <tr> <td> Date Of Issue : </td>

<td> <input type="text" id="dateissuepicker"> </td> <td></td> </tr> <tr> <td> Date Of Return </td> <td> <input type="text" id="datereturnpicker"> </td> <td> &nbsp; </td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> <td> <input id="issueButton" type="button" value="Issue" onclick="issueBook();" style="display:none;" /> </td> </tr> </table> </div>--> <div style="width:90%;"> <table style="margin:0 auto"> <tr> <td><b style="font-family: Arial, Helvetica, sans-serif; font-size: medium; fontweight: bold">Enter AccNo</b></td>

<td><b><input id="txtAccNo" onkeyup="GetMemberData();" type="text" style="font-family: Arial, Helvetica, sans-serif; font-size: medium" /></b></td> <td> &nbsp; </td> <td><input id="Button1" type="button" value="Search.." onclick="parseJsonString();" /></td> <td> <div style="float:left; display:none;" id="ajaxloader">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> </tr> </table> <div id="showjson" style="width:800px;margin:0 auto;"> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Library\BookReturn.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Library_BookReturn : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

K:\SpringDale\Library\FindBooks.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="FindBooks.aspx.cs" Inherits="Library_FindBooks" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <style type="text/css"> .ajx_cmb_box { vertical-align:top; } .ajax__combobox_itemlist { margin: 0px; padding: 0px; cursor: default; list-style-type: none; text-align: right; border: solid 1px ButtonShadow; background-color: Window; font-size: xx-large; font-family: Verdana; width: 100%; /*color:Red;*/ } .ajax__combobox_itemlist li { white-space: nowrap; padding: 0 3px 0 2px;

color:Blue; } #cmbBookOpts { width: 126px; } .LabelTD { background-color:#7d7d7d; font-family:Arial ; font-size:medium; font-weight:bold; color:White; } .DataTD { font-family:Times New Roman; font-size:medium; } .member_header { background:#7d7d7d;width:60%; color:White; font-size:large; font-family:Arial; fontweight:bold; text-align:center; margin:0 auto; } table { border:0 none; } </style> </asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <table width="30%" style="margin:0 auto;"> <tr style="vertical-align:top"> <td> <select runat="server" id="cmbBookOpts" style="font-family: Arial; font-size: medium; font-weight: normal" > <option value="0">Book Title</option> <option value="1">Author</option> <option value="2">Subject</option> <option value="3">BookNo</option> <option value="4">ISBN</option> </select>

</td> <td> <asp:TextBox ID="txtBookSearch" runat="server" Font-Names="Arial" Font-Size="Medium"></asp:TextBox> </td> <td> <asp:Button ID="btnSearchBooks" runat="server" Text="Search" onclick="Button1_Click" Font-Names="Arial" Font-Size="Medium" /> </td> </tr>

</table> <asp:Panel ID="Panel1" runat="server" CssClass="member_header"> Books Detail </asp:Panel> <asp:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="Panel1" Radius="9" Corners="All"> </asp:RoundedCornersExtender> <table style="margin:0 auto;width:60%"> <tr> <td> <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="100%" AllowPaging="True" AutoGenerateRows="False" BackColor="White" BorderColor="#EBEBEB" BorderStyle="None" CellPadding="3" DataKeyNames="BookNo" Font-Names="Arial" Font-Size="Medium" GridLines="None" onitemcreated="DetailsView1_ItemCreated"> <AlternatingRowStyle BackColor="#DCDCDC" Font-Names="Arial" Font-Size="Medium" /> <EditRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> <EmptyDataRowStyle BackColor="#EBEBEB" /> <FieldHeaderStyle Font-Bold="True" Font-Names="Arial" FontSize="Medium" Width="100px" /> <Fields> <asp:BoundField DataField="BookNo" HeaderText="BookNo" ReadOnly="True" SortExpression="BookNo" /> <asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" /> <asp:BoundField DataField="BookName" HeaderText="BookName" SortExpression="BookName" /> <asp:BoundField DataField="Edition" HeaderText="Edition"

SortExpression="Edition" /> <asp:BoundField DataField="Subject" HeaderText="Subject" SortExpression="Subject" /> <asp:BoundField DataField="Copies" HeaderText="Copies" SortExpression="Copies" /> <asp:BoundField DataField="PublisherName" HeaderText="PublisherName" SortExpression="PublisherName" /> <asp:BoundField DataField="AuthorName" HeaderText="AuthorName" SortExpression="AuthorName" /> </Fields> <FooterStyle BackColor="#CCCCCC" ForeColor="Black" /> <PagerStyle BackColor="#999999" Font-Names="Times New Roman" Font-Size="Small" ForeColor="Black" HorizontalAlign="Center" /> <RowStyle BackColor="#EEEEEE" Font-Names="Arial" Font-Size="Medium" ForeColor="Black" /> </asp:DetailsView> </td> <td> </td> </tr> </table> <asp:ObjectDataSource ID="objAuthor" runat="server" OldValuesParameterFormatString="original_{0}" onselecting="objAuthor_Selecting" SelectMethod="GetDataByAuthor" TypeName="BooksBLL"> <SelectParameters> <asp:Parameter Name="authorname" Type="String" /> </SelectParameters>

</asp:ObjectDataSource> <asp:ObjectDataSource ID="objBookTitle" runat="server" OldValuesParameterFormatString="original_{0}" onselecting="objBookTitle_Selecting" SelectMethod="GetDataByTitle" TypeName="BooksBLL"> <SelectParameters> <asp:Parameter Name="booktitle" Type="String" /> </SelectParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="objBookSubject" runat="server" OldValuesParameterFormatString="original_{0}" onselecting="objBookSubject_Selecting" SelectMethod="GetDataBySubject" TypeName="BooksBLL"> <SelectParameters> <asp:Parameter Name="booksubject" Type="String" /> </SelectParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="objBookNo" runat="server" OldValuesParameterFormatString="original_{0}" onselecting="objBookNo_Selecting" SelectMethod="GetDataByBookNo" TypeName="BooksBLL"> <SelectParameters> <asp:Parameter Name="bookno" Type="Decimal" /> </SelectParameters> </asp:ObjectDataSource> <asp:ObjectDataSource ID="objBookISBN" runat="server" OldValuesParameterFormatString="original_{0}" onselecting="objBookISBN_Selecting" SelectMethod="GetDataByISBN" TypeName="BooksBLL"> <SelectParameters> <asp:Parameter Name="isbn" Type="Decimal" /> </SelectParameters> </asp:ObjectDataSource>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server" > <ProgressTemplate> <asp:Image ID="Image1" runat="server" Width="150px" Height="150px" ImageUrl="http://learnasp.in/css/BigLoader.gif" /> </ProgressTemplate> </asp:UpdateProgress> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Library\FindBooks.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BooksRecTableAdapters; using AuthorsRecTableAdapters; public partial class Library_FindBooks : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

} protected void ComboBox1_SelectedIndexChanged(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { try {

if (int.Parse(cmbBookOpts.Items[cmbBookOpts.SelectedIndex].Value) == 0) { DetailsView1.DataSourceID = "objBookTitle";

DetailsView1.AllowPaging = true; DetailsView1.DataBind(); } else if (int.Parse(cmbBookOpts.Items[cmbBookOpts.SelectedIndex].Value) == 1) { //GridView1.DataSource = obj.GetDataByAuthor(txtBookSearch.Text.ToUpper()); DetailsView1.DataSourceID = "objAuthor"; DetailsView1.AllowPaging = true; DetailsView1.DataBind();

} else if (int.Parse(cmbBookOpts.Items[cmbBookOpts.SelectedIndex].Value) == 2) { DetailsView1.DataSourceID = "objBookSubject"; DetailsView1.AllowPaging = true; DetailsView1.DataBind(); } else if (int.Parse(cmbBookOpts.Items[cmbBookOpts.SelectedIndex].Value) == 3) { DetailsView1.DataSourceID = "objBookNo"; DetailsView1.AllowPaging = true;

DetailsView1.DataBind(); } else if (int.Parse(cmbBookOpts.Items[cmbBookOpts.SelectedIndex].Value) == 4) { DetailsView1.DataSourceID = "objBookISBN"; DetailsView1.AllowPaging = true; DetailsView1.DataBind(); } } catch (Exception ex) { } //GridView1.DataBind(); }

protected void objBookTitle_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["booktitle"] = txtBookSearch.Text; } protected void objBookSubject_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["booksubject"] = txtBookSearch.Text; } protected void objBookISBN_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["isbn"] = txtBookSearch.Text; }

protected void objBookNo_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["bookno"] = txtBookSearch.Text; } protected void objAuthor_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { e.InputParameters["authorname"] = txtBookSearch.Text; } protected void DetailsView1_ItemCreated(object sender, EventArgs e) { DataKey dk = DetailsView1.DataKey; //Label1.Text = dk.Value.ToString(); } }

K:\SpringDale\Library\RoughPage2.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="RoughPage2.aspx.cs" Inherits="RoughPage2" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <style type="text/css"> table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption { text-align: center; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left; height:30px;

} thead th, tfoot th { padding:5px; } table a { color: #333333; text-decoration:none; } table a:hover { text-decoration:underline; } tr.odd { background: #f1f1f1; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none; } .callout { padding: 5px; border: 1px solid #7992B0;

background-color: #8AA9B7; border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); } </style> <script type="text/javascript"> var myObject = null; $(document).ready(function () { $('#issueButton').button(); $("#IssueBook").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 800, height: 450 }); $("#dateissuepicker").datepicker({ dateFormat: 'mm/dd/yy', onSelect: function (dateText, inst) { /*var cooldate = dateText.split('/'); var now = new Date(); var msg = ""; if (cooldate[0] != now.getDate()) msg += "Incorrect Date "; if (cooldate[1] != (now.getMonth() + 1)) msg += " Incorrect Month Value"; if (cooldate[2] != (now.getYear() + 1900)) msg += " Incorrect Year"; if (msg != "")

Notifier.error(msg, 'Issue Date May be Incorrect');*/ } });

$("#datereturnpicker").datepicker({ dateFormat: 'mm/dd/yy', onSelect: function (dateText, inst) { var cooldate = dateText.split('/'); var now = new Date(); var msg = ""; if (cooldate[2] != (now.getYear() + 1900)) msg += " Are you sure about this date.Specially the year"; if (msg != "") Notifier.error(msg, 'Issue Date May be Incorrect'); } }); $('#txtBookSearchString').focus();

}); function parseJsonString() { $.fx.speeds._default = 1000; $("#ajaxloader").show(); $("#showjson").hide(); var radiogrp = document.getElementsByName('searchChoice'); var txtsearch = document.getElementById('txtBookSearchString'); var i=0; for (i = 0; i < radiogrp.length; i++) {

if (radiogrp[i].value == 1 && radiogrp[i].checked) { LibraryManagement.getDataByAuthor(txtsearch.value,jsonFeedRecieved); } else if (radiogrp[i].value == 2 && radiogrp[i].checked) { LibraryManagement.getDataByTitle(txtsearch.value, jsonFeedRecieved); } else if (radiogrp[i].value == 3 && radiogrp[i].checked) { LibraryManagement.getDataBySubject(txtsearch.value, jsonFeedRecieved); } else if (radiogrp[i].value == 4 && radiogrp[i].checked) { LibraryManagement.getDataByPublisher(txtsearch.value, jsonFeedRecieved); } else if (radiogrp[i].value == 5 && radiogrp[i].checked) { LibraryManagement.getDataByISBN( parseInt(txtsearch.value), jsonFeedRecieved); } else if (radiogrp[i].value == 6 && radiogrp[i].checked) { LibraryManagement.getDataByBookNo(parseInt(txtsearch.value), jsonFeedRecieved); } }

} function jsonFeedRecieved(result) { var i=0; myObject = jQuery.parseJSON(result); var txt = "<table style='margin:0 auto;width:100%;border:none;'>"; txt += "<thead><tr><th>BookNo</th><th>Title</th><th>Authors</th><th>Edition</th><th>Subjec t</th><th>Publisher</th><th>Avail</th></tr></thead><tbody>"; for (i = 0; i < myObject.length; i++) {

txt += "<tr onclick='openIssue(" + i.toString() + ");' class='hovereffect'><td>" + myObject[i].BookNo + "</td>"; txt += "<td>" + myObject[i].BookName + "</td>"; txt += "<td>" + myObject[i].AuthorName + "</td>"; txt += "<td>" + myObject[i].Edition + "</td>"; txt += "<td>" + myObject[i].Subject + "</td>"; txt += "<td>" + myObject[i].PublisherName + "</td>"; if (myObject[i].Available > 0) { txt += "<td>" + "<a href='#' ><img alt='Yes' src='http://learnasp.in/css/tick_02.png'/></a>" + "</td></tr>"; } else { txt += "<td>" + "<img alt='No' src='http://learnasp.in/css/remove.png'/>" + "</td></tr>"; } } txt += "</tbody></table>"; $("#ajaxloader").hide(); $("#showjson").show("fast"); $("#showjson").html(txt);

//divid.innerHTML = txt; } function openIssue(i) { $('#issueButton').hide(); $('#jsonindex').val(i);

$("#bookname").html(myObject[i].BookName); $("#IssueBook").dialog("open"); $("#IssueBook").dialog("option", "height", 450); $("#IssueBook").dialog("option", "width", 800); } function validateAccNo() { $('#ajaxLoader2').show(); var valtxt = document.getElementById("txtAccno").value; if (valtxt == undefined || valtxt == '') { Notifier.warning('Oooops Acc No Not Given!', 'Alert!Alert!Alert'); } else { LibraryManagement.checkAccNo(parseInt(valtxt), function (result) { $('#ajaxLoader2').hide(); if (result == false) { Notifier.error('Please check the account no.Or the book limit', 'Acc No Not Found Or Book Limit Exceeded'); } else { $('#issueButton').show(); } }); }

} function issueBook() { var ind,accno;

ind=$('#jsonindex').val(); accno = $('#txtAccno').val(); var issdate = $('#dateissuepicker').val().toString(); var retdate = $('#datereturnpicker').val().toString(); var issuedate = new Date(issdate); var returndate = new Date(retdate); issdate = (issuedate.getMonth() + 1) + "/" + issuedate.getDate() + "/" + issuedate.getFullYear(); retdate = (returndate.getMonth() + 1) + "/" + returndate.getDate() + "/" + returndate.getFullYear(); //alert(issuedate); LibraryManagement.issueBook(accno, myObject[ind].BookNo, issdate,retdate, function (result) { if (result == true) { Notifier.info('Book Issued Successfully', 'Book Issue Success'); } else { Notifier.error('Sorry This Transaction Failed', 'Book Issue Problem'); } }); } </script> <style type="text/css"> #Text1 { width: 293px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/LibraryManagement.asmx" /> </Services> </asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div id="IssueBook" title="Book Issue Dialog" > <table style="width: 100%;"> <tr> <td> Book Name : </td> <td> <div id="bookname"></div> </td> <td>&nbsp;<input id="jsonindex" type="hidden" /></td> </tr> <tr> <td>Acc No</td> <td> <input type="text" id="txtAccno" onblur="validateAccNo();" ></td> <td> <div style="float:left; display:none;" id="ajaxLoader2">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> </tr> <tr> <td> Date Of Issue :

</td> <td> <input type="text" id="dateissuepicker"> </td> <td></td> </tr> <tr> <td> Date Of Return </td> <td> <input type="text" id="datereturnpicker"> </td> <td> &nbsp; </td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> <td> <input id="issueButton" type="button" value="Issue" onclick="issueBook();" style="display:none;" /> </td> </tr> </table> </div> <div style="width:90%;"> <table style="margin:0 auto"> <tr> <td><b style="font-family: Arial, Helvetica, sans-serif; font-size: medium; fontweight: bold">Enter Text</b></td>

<td><b><input id="txtBookSearchString" onkeyup="parseJsonString();" type="text" style="font-family: Arial, Helvetica, sans-serif; font-size: medium" /></b></td> <td> <input name="searchChoice" id="Radio1" type="radio" value="1" checked="checked" />Author <input name="searchChoice" id="Radio2" type="radio" value="2" />Title <input name="searchChoice" id="Radio3" type="radio" value="3" />Subject <input name="searchChoice" id="Radio4" type="radio" value="4" />Publisher <input name="searchChoice" id="Radio5" type="radio" value="5" />ISBN <input name="searchChoice" id="Radio6" type="radio" value="6" />BookNo </td> <td><input id="Button1" type="button" value="Search.." onclick="parseJsonString();" /></td> <td> <div style="float:left; display:none;" id="ajaxloader">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> </tr> </table> <div id="showjson" style="width:800px;margin:0 auto;"> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Library\RoughPage2.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class RoughPage2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button2_Click(object sender, EventArgs e) { bool ans = false; decimal fine = 0,bookno=6,accno=1; IssuesReturnsBll obj = new IssuesReturnsBll(); string issuedate="01/04/2012"; string returndate = "08/04/2012"; DateTime issuedt = DateTime.Parse(issuedate);//, System.Globalization.CultureInfo.CreateSpecificCulture("en-UK").DateTimeFormat); DateTime returndt = DateTime.Parse(returndate);//, System.Globalization.CultureInfo.CreateSpecificCulture("en-UK").DateTimeFormat); System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "dd/MM/yyyy"; DateTime validissueDate = Convert.ToDateTime(issuedt, dateInfo); DateTime validreturnDate = Convert.ToDateTime(returndt, dateInfo); //ans = obj.IssueBook(bookno, accno, validissueDate, validreturnDate, fine);

} }

K:\SpringDale\Student\StudentProfile.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="StudentProfile.aspx.cs" Inherits="Student_StudentProfile" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <link type="text/css" href="http://learnasp.in/css/MyTableStyle.css" /> <link type="text/css" href="http://learnasp.in/css/GreyTableStyle.css" /> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <style type="text/css"> .HeaderCSS { background-image:url('http://learnasp.in/css/bg1.png'); background-repeat:repeat; font-family:Times New Roman; font-weight:bold; font-size:large; cursor:pointer; height:1.4em; padding:5px; border:1 solid grey; } .ContentCss { border:0 none; }

.mGrid { width: 100%; background-color: #fff; margin: 5px 0 10px 0; border: solid 1px #525252; border-collapse:collapse; } .mGrid td { padding: 2px; border: solid 1px #c1c1c1; color: #717171; } .mGrid th { padding: 4px 2px; color: #fff; background: #424242 url("http://learnasp.in/css/grd_head.png") repeat-x top; border-left: solid 1px #525252; font-size: 0.9em; } .mGrid .alt { background: #fcfcfc url("http://learnasp.in/css/grd_alt.png") repeat-x top; } .mGrid .pgr { background: #424242 url("http://learnasp.in/css/grd_pgr.png") repeat-x top; } .mGrid .pgr table { margin: 5px 0; } .mGrid .pgr td { border-width: 0; padding: 0 6px; border-left: solid 1px #666; font-weight: bold; color: #fff; line-height: 12px; } .mGrid .pgr a { color: #666; text-decoration: none; } .mGrid .pgr a:hover { color: #000; text-decoration: none; }

</style> <script type="text/javascript"> function myPageLoad() { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" });

$("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#opener").button(); $("#opener").click(SearchClicked);

//$("#btnAddRole").button();

return false; } function SearchClicked() { $("#lstSearchItem option:selected").each(function () { $("#dialog").html();

GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result);

}, function () { $("#dialog").html("Unable To Retrieve Data...!"); }) }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; } function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false; }

</script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>

<asp:Accordion ID="studentMain" runat="server" HeaderCssClass="HeaderCSS" Width="98%" FadeTransitions="true" TransitionDuration="250" FramesPerSecond="40" RequireOpenedPane="false" SuppressHeaderPostbacks="true"> <Panes> <asp:AccordionPane ID="PersonalPane" runat="server" ContentCssClass="ContentCss"> <Header> Personal Information </Header> <Content> <table id="studentInfo" width="100%" border="0"> <tbody> <tr> <td> <div style="float:left; width:150px;height:150px;"> <asp:Image ID="Image1" runat="server" Width="100px" Height="100px" /> </div> <div> <asp:DetailsView GridLines="None" BorderStyle="None" ID="studentDetails" runat="server" Height="50px" Width="600px" RowStyle-VerticalAlign="Middle" RowStyle-Width="100%" RowStyle-BorderStyle="None" Font-Size="Medium" HeaderStyleBackColor="#3366CC" FieldHeaderStyle-BackColor="#CCCCCC" FieldHeaderStyleWidth="400px"> </asp:DetailsView> </div> </td>

<td> </td> <td></td> </tr> </tbody> </table> </Content> </asp:AccordionPane> <asp:AccordionPane ID="AttendancePanel" runat="server"> <Header> Your Attendance </Header> <Content> <asp:GridView ID="attendanceGrid" runat="server" Width="100%" GridLines="None" AllowPaging="false" CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" > </asp:GridView> </Content> </asp:AccordionPane> </Panes> </asp:Accordion> <asp:ObjectDataSource ID="studentAttendance" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetMonthlyAttendance" TypeName="AttendanceRecBLL"> <SelectParameters> <asp:Parameter Name="enrollno" Type="Decimal" /> </SelectParameters> </asp:ObjectDataSource> <asp:SqlDataSource ID="SqlDataSource1" runat="server"

ConnectionString="<%$ ConnectionStrings:springdaleConnectionString2 %>" SelectCommand="SELECT (SELECT FROM WHERE (SELECT FROM ClassRec (ClassID = StudentRec.ClassID)) AS ClassName, ClassSection ClassRec AS ClassRec_1 EnrollNo, RollNo, FirstName, LastName, ClassID, ClassName

WHERE (ClassID = StudentRec.ClassID)) AS ClassSection, FathersName, MothersName, Address, City, State, HomePhone, CompanyName, CompanyAddress, CompanyPhone, Designation, LastCollege, LastResult, StudentImage FROM StudentRec where EnrollNo=@enroll"> <SelectParameters> <asp:Parameter Name="enroll" /> </SelectParameters> </asp:SqlDataSource> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Student\StudentProfile.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text.RegularExpressions; public partial class Student_StudentProfile : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(myPageLoad);", true); if (!IsPostBack) { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value; Parameter enroll = SqlDataSource1.SelectParameters[0]; SqlDataSource1.SelectParameters.Remove(enroll); SqlDataSource1.SelectParameters.Add("enroll", num); Image1.ImageUrl = "http://learnasp.in/ShowImage.ashx?enroll=" + num.ToString(); SqlDataSource1.DataBind(); studentDetails.DataSource = SqlDataSource1; studentDetails.DataBind(); Parameter enroll2 = studentAttendance.SelectParameters[0];

studentAttendance.SelectParameters.Remove(enroll2); studentAttendance.SelectParameters.Add("enrollno", num); //studentAttendance.DataBind(); attendanceGrid.DataSource = studentAttendance; attendanceGrid.DataBind(); //Response.Write(num); } } }

K:\SpringDale\Student\Web.config
<?xml version="1.0"?> <configuration> <system.web> <authorization> <allow roles="Administrators"/> <allow roles="Teachers" /> <allow roles="Students" /> <deny users="*"/> </authorization> </system.web> </configuration>

K:\SpringDale\Reports\ShowReports.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ShowReports.aspx.cs" Inherits="Reports_ShowReports" %> <%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %> <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <style type="text/css"> .fancy .ajax__tab_header { font-size:13px; font-weight:bold; color:white; font-family:sans-serif; background-color:#7D7D7D; } .handlerresize { color:Blue; }

table { border:0 none;} </style> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript"> function myPageLoad() { // findRoles(); //$("#rptTabs").tabs(); $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#chartDiv").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#opener").button();

$("#opener").click(SearchClicked); /*to keep the selected tab index*/

//var currTab = $("#<%= fldHidden.ClientID %>").val(); //$("#rptTabs").tabs({ selected: currTab }); //var indexToSelect = parseInt($('#fldHidden').val()); //$('#rptTabs').tabs('select', indexToSelect);

return false; } function SearchClicked() { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result);

}, function () { $("#dialog").html("Unable To Retrieve Data...!"); }) }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false;

} function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false; }

</script> <script runat="server"> protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e) { ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message; } </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server" OnAsyncPostBackError="ScriptManager1_AsyncPostBackError" ScriptMode="Release"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate>

<div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Detailed Student Information" style="width:200px;height:300px;"> <p>This will show the record for the student you have selected</p> </div> <div id="chartDiv" title="Chart Info" style="width:500px;height:500px;"> <rsweb:ReportViewer ID="rptChartViewer" runat="server" Width="100%"> </rsweb:ReportViewer> </div> <div style="width:100%;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:12px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:12px; text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> <div style="margin-top:12px; text-align:center;" id="chart-div"> </div>

<asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" runat="server" > <ProgressTemplate> <asp:Image ID="Image1" runat="server" Width="150px" Height="150px" ImageUrl="http://learnasp.in/css/BigLoader.gif" /> </ProgressTemplate> </asp:UpdateProgress> </div> <div style="float:left;width:4%; padding-left:20px;"><asp:HiddenField ID="fldHidden" runat="server" ClientIDMode="Static" />&nbsp; <asp:ObjectDataSource ID="ClassDS" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetUniqueName" TypeName="ClassRecBLL"></asp:ObjectDataSource> <asp:ObjectDataSource ID="SectionDS" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetUniqueSection" TypeName="ClassRecBLL"></asp:ObjectDataSource> </div> <div id="masterCtrl" style="height:600px;float:left;width:74%; margin-top:5px;"> <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2" OnActiveTabChanged="onActiveTabChanged" Width="100%" Font-Size="Medium" Height="1600px" > <asp:TabPanel ID="TabPanel1" runat="server" HeaderText="DayReport">

<ContentTemplate> <div id="divrptDay">

<p>

<table style="width:100%">

<tr style="font-size:medium; font-weight:bold;">

<td>Class : <asp:DropDownList ID="lstClass" runat="server" DataSourceID="ClassDS" DataTextField="ClassName" DataValueField="ClassName"></asp:DropDownList></td><td>Section : <asp:DropDownList ID="lstSection" runat="server" DataSourceID="SectionDS" DataTextField="ClassSection" DataValueField="ClassSection"></asp:DropDownList> </td> <td>Date : <asp:TextBox ID="txtDate" runat="server"></asp:TextBox> <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDate" Format="dd-MM-yyyy" ></asp:CalendarExtender> </td> <td>

<asp:Button ID="Button1" runat="server" Text="Show Report" class="ui-button-text-icon ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="Button1_Click" />

</td>

</tr>

</table>

</p>

<p>

<rsweb:ReportViewer ID="rptDay" runat="server" Width="100%" Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" WaitMessageFontSize="14pt" Visible="False">

</rsweb:ReportViewer></p></div> </ContentTemplate> </asp:TabPanel> <asp:TabPanel ID="TabPanel2" runat="server" HeaderText="Class Monthly">

<ContentTemplate> <div id="rptMonth">

<p>

<table style="width:100%"> <tr style="font-size:medium; font-weight:bold;">

<td>

Class : <asp:DropDownList ID="lstClass2" runat="server" DataSourceID="ClassDS" DataTextField="ClassName" DataValueField="ClassName">

</asp:DropDownList>

</td>

<td>

Section : <asp:DropDownList ID="lstSection2" runat="server" DataSourceID="SectionDS" DataTextField="ClassSection" DataValueField="ClassSection">

</asp:DropDownList>

</td>

<td>

Month : <asp:DropDownList ID="lstMonth" runat="server">

<asp:ListItem Value="1">January</asp:ListItem>

<asp:ListItem Value="2">February</asp:ListItem>

<asp:ListItem Value="3">March</asp:ListItem>

<asp:ListItem Value="4">April</asp:ListItem>

<asp:ListItem Value="5">May</asp:ListItem>

<asp:ListItem Value="6">June</asp:ListItem>

<asp:ListItem Value="7">July</asp:ListItem>

<asp:ListItem Value="8">August</asp:ListItem>

<asp:ListItem Value="9">September</asp:ListItem>

<asp:ListItem Value="10">October</asp:ListItem>

<asp:ListItem Value="11">November</asp:ListItem>

<asp:ListItem Value="12">December</asp:ListItem>

</asp:DropDownList>

</td>

<td>

Year : <asp:DropDownList ID="lstYear" runat="server">

</asp:DropDownList>

</td>

<td>

<asp:Button ID="btnMonthly" runat="server" class="ui-buttontext-icon ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" OnClick="btnMonthly_Click" Text="Show Report" />

</td>

</table> <rsweb:ReportViewer ID="rptMonthly" runat="server" Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" WaitMessageFontSize="14pt" Width="100%" Visible="False"></rsweb:ReportViewer> </div> </ContentTemplate> </asp:TabPanel> <asp:TabPanel ID="TabPanel3" runat="server" HeaderText="Date Range">

<ContentTemplate>

<div id="Div1"><p>

<table style="width:100%">

<tr style="font-size:medium; font-weight:bold;">

<td>Class : <asp:DropDownList ID="lstClass3" runat="server" DataSourceID="ClassDS" DataTextField="ClassName" DataValueField="ClassName"></asp:DropDownList>

</td>

<td>Section : <asp:DropDownList ID="lstSection3" runat="server" DataSourceID="SectionDS" DataTextField="ClassSection" DataValueField="ClassSection"></asp:DropDownList>

</td>

<td>Start Date : <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>

<asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtStartDate" Format="dd-MM-yyyy" Enabled="True" onprerender="CalendarExtender2_PreRender" ></asp:CalendarExtender>

</td>

<td>End Date : <asp:TextBox ID="txtEndDate" runat="server"></asp:TextBox>

<asp:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtEndDate" Format="dd-MM-yyyy" Enabled="True" ></asp:CalendarExtender>

</td>

<td>

<asp:Button ID="btnRange" runat="server" Text="Show Report" OnClick="btnRange_Click" class="ui-button-text-icon ui-button ui-widget ui-state-default uicorner-all ui-button-text-only" />

</td>

</tr>

</table>

<rsweb:ReportViewer ID="rptDateRange" runat="server" Width="100%" Font-Names="Verdana" Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" WaitMessageFontSize="14pt" Visible="False"></rsweb:ReportViewer>

</div>

</ContentTemplate>

</asp:TabPanel> <asp:TabPanel ID="TabPanel4" runat="server" HeaderText="Yearly">

<ContentTemplate>

<div id="Div2"><p>

<table style="width:100%">

<tr style="font-size:medium; font-weight:bold;">

<td>Class : <asp:DropDownList ID="lstClass4" runat="server" DataSourceID="ClassDS" DataTextField="ClassName" DataValueField="ClassName">

</asp:DropDownList>

</td>

<td>Section : <asp:DropDownList ID="lstSection4" runat="server" DataSourceID="SectionDS" DataTextField="ClassSection" DataValueField="ClassSection">

</asp:DropDownList>

</td>

<td>Year :

<asp:DropDownList ID="lstYear2" runat="server">

</asp:DropDownList>

</td>

<td >

Enrollment : <asp:TextBox ID="txtEnrollRpt" runat="server"></asp:TextBox>

</td>

<td>

<asp:Button ID="btnYearly" runat="server" Text="Show Report" OnClick="btnYearly_Click" class="ui-button-text-icon ui-button ui-widget ui-state-default uicorner-all ui-button-text-only" />

</td>

<td>

<asp:Button ID="btnChart" runat="server" Text="Show Chart" OnClick="btnChart_Click" class="ui-button-text-icon ui-button ui-widget ui-state-default uicorner-all ui-button-text-only" />

</td>

</tr>

</table> <rsweb:ReportViewer ID="rptChildReport" runat="server" Width="100%" Height="600px">

</rsweb:ReportViewer> </div> </ContentTemplate> </asp:TabPanel> </asp:TabContainer> </div> <div style="clear:both;"></div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Reports\ShowReports.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Text; public partial class Reports_ShowReports : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //if(!ClientScript.IsStartupScriptRegistered("initpage")) ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(myPageLoad);", true); if (!IsPostBack) { lstYear.Items.Clear(); int i; for (i = 1990; i <= 2090; i++) { lstYear.Items.Add(new ListItem(i.ToString(), i.ToString())); lstYear2.Items.Add(new ListItem(i.ToString(), i.ToString())); } } else {

} } protected void Button1_Click(object sender, EventArgs e) { System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "dd/MM/yyyy"; DateTime validDate = Convert.ToDateTime(txtDate.Text, dateInfo);

ClassAttendanceReport obj = new ClassAttendanceReport(); DataTable dt = obj.GetDataForASingleDayEx(validDate, lstClass.Text, lstSection.Text ); rptDay.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; rptDay.LocalReport.ReportPath = "Reports\\AttendanceForADay.rdlc"; if (dt == null) throw new Exception("data table is null"); rptDay.LocalReport.DataSources.Clear();

Microsoft.Reporting.WebForms.ReportDataSource ds = new Microsoft.Reporting.WebForms.ReportDataSource("RptForADay", (System.Data.DataTable)dt); rptDay.LocalReport.DataSources.Add(ds); rptDay.LocalReport.Refresh(); rptDay.Visible = true; } protected void btnMonthly_Click(object sender, EventArgs e) {

ClassAttendanceReport obj = new ClassAttendanceReport(); int month = int.Parse(lstMonth.SelectedValue); int year = int.Parse(lstYear.SelectedValue); DataTable dt = obj.GetDataForAMonth(month, year, lstClass2.Text, lstSection2.Text); rptMonthly.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; rptMonthly.LocalReport.ReportPath = "Reports\\ClassMonthly.rdlc"; if (dt == null) throw new Exception("dt is null"); rptMonthly.LocalReport.DataSources.Clear(); Microsoft.Reporting.WebForms.ReportDataSource ds = new Microsoft.Reporting.WebForms.ReportDataSource("rptMonthly", (System.Data.DataTable)dt); rptMonthly.LocalReport.DataSources.Add(ds); rptMonthly.LocalReport.Refresh(); rptMonthly.Visible = true;

} protected void btnRange_Click(object sender, EventArgs e) {

System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "dd/MM/yyyy"; DateTime validEndDate = Convert.ToDateTime(txtEndDate.Text, dateInfo); dateInfo = new System.Globalization.DateTimeFormatInfo(); dateInfo.ShortDatePattern = "dd/MM/yyyy"; DateTime validStartDate = Convert.ToDateTime(txtStartDate.Text, dateInfo);

ClassAttendanceReport obj = new ClassAttendanceReport(); DataTable dt = obj.GetDataForARange(validStartDate.ToString(), validEndDate.ToString(), lstClass3.Text, lstSection3.Text); //DataTable dt = obj.GetDataForARange(stdate.ToString(), endate.ToString(), lstClass3.Text, lstSection3.Text); if (dt == null) throw new Exception("dt is null"); rptDateRange.LocalReport.DataSources.Clear(); rptDateRange.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ; rptDateRange.LocalReport.ReportPath = "Reports\\DateRange.rdlc"; Microsoft.Reporting.WebForms.ReportDataSource ds = new Microsoft.Reporting.WebForms.ReportDataSource("rptDateRange", (System.Data.DataTable)dt); rptDateRange.LocalReport.DataSources.Add(ds); rptDateRange.LocalReport.Refresh(); rptDateRange.Visible = true;

} protected void btnYearly_Click(object sender, EventArgs e) { ClassAttendanceReport obj = new ClassAttendanceReport(); int searchyear = int.Parse(lstYear2.SelectedValue); DataTable dt = obj.GetDataForStudentForAYear(int.Parse(txtEnrollRpt.Text), searchyear, lstClass4.Text, lstSection4.Text);

rptChildReport.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; rptChildReport.LocalReport.ReportPath = "Reports\\ChildYearly.rdlc"; if (dt == null) throw new Exception("dt is null"); rptChildReport.LocalReport.DataSources.Clear(); Microsoft.Reporting.WebForms.ReportDataSource ds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", (System.Data.DataTable)dt); rptChildReport.LocalReport.DataSources.Add(ds); rptChildReport.LocalReport.Refresh(); rptChildReport.Visible = true;

} protected void btnChart_Click(object sender, EventArgs e) { ClassAttendanceReport obj = new ClassAttendanceReport(); int searchyear = int.Parse(lstYear2.SelectedValue); DataTable dt = obj.GetDataForStudentForAYear(int.Parse(txtEnrollRpt.Text),searchyear, lstClass4.Text, lstSection4.Text); rptChildReport.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; rptChildReport.LocalReport.ReportPath = "ChartReports\\YearlyChart.rdlc"; if (dt == null) throw new Exception("dt is null");

rptChildReport.LocalReport.DataSources.Clear(); Microsoft.Reporting.WebForms.ReportDataSource ds = new Microsoft.Reporting.WebForms.ReportDataSource("yearlyAttChartDS", (System.Data.DataTable)dt); rptChildReport.LocalReport.DataSources.Add(ds); rptChildReport.LocalReport.Refresh(); rptChildReport.Visible = true; }

protected void onActiveTabChanged(object sender, EventArgs e) { fldHidden.Value = TabContainer1.ActiveTabIndex.ToString(); } protected void CalendarExtender2_PreRender(object sender, EventArgs e) { } }

K:\SpringDale\Teacher\AddMarks.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AddMarks.aspx.cs" Inherits="Teacher_AddMarks" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http/learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http/learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; function addload() {

$("#opener").button();

$("#opener").click(function () { return false; }); $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false,

show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); });

</script>

<style type="text/css"> .sendback { z-index:-9999; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> <asp:ServiceReference Path="http://learnasp.in/GetTeachers.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3>

</p> </div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div>

<div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px; text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Teacher\AddMarks.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Teacher_AddMarks : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); if (!IsPostBack) { //Response.Write(Page.User.Identity.Name); } } }

K:\SpringDale\Teacher\AttendanceCtrl.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AttendanceCtrl.aspx.cs" Inherits="Teacher_AttendanceCtrl" EnableSessionState="True" %> <%@ MasterType VirtualPath="~/MasterPage.master"%> <%@ Register src="../UserControls/AttendanceTable.ascx" tagname="AttendanceTable" tagprefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; // Load the Visualization API and the piechart package. google.load('visualization', '1.0', { 'packages': ['corechart'] }); // Set a callback to run when the Google Visualization API is loaded. //google.setOnLoadCallback(drawChart); function showChart(enrollno) { currentenroll = enrollno; $("#ShowChart").dialog("open"); setTimeout("drawChart();", 2000);

// Callback that creates and populates a data table, // instantiates the pie chart, passes in the data and // draws it. function drawChart() { GetAttendanceTable.GetMonthlyAttendanceAll(currentenroll, currentdate, function (result) { var data = new google.visualization.DataTable(); data.addColumn('string', 'Month'); data.addColumn('number', 'Present'); data.addColumn('number', 'Absent'); data.addColumn('number', 'Leave'); data.addColumn('number', 'Unknown'); var arr = result.split(":"); data.addRows(arr.length); for (i = 0; i < arr.length; i++) { var innerdata = arr[i].split(","); data.setCell(i, 0, innerdata[0]); data.setCell(i, 1, parseFloat(innerdata[1])); data.setCell(i, 2, parseFloat(innerdata[2])); data.setCell(i, 3, parseFloat(innerdata[3])); data.setCell(i, 4, parseFloat(innerdata[4])); }

// Set chart options var options = { 'title': 'Monthly Attendance Of Student' }; // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));

chart.draw(data, options); }); // Create the data table. return false; }

function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false; } function jsonFeedRecieved(result) { var i = 0; //myObject = JSON.parse(result); myObject = jQuery.parseJSON(result); $("#datepicker").datepicker({ beforeShowDay: setHoliDays, onSelect: function (dateText, inst) { currentdate = dateText; } });

function addload(){ GetAttendanceTable.GetClassListBox(function (result) { $("#tdClassName").html("<b>Class Name </b> " + result.toString()); }, function (result) { $("#tdClassName").html(result.toString()); }); GetAttendanceTable.GetSectionListBox(function (result) { $("#tdSectionName").html("<b>Section </b> " + result.toString()); }, function (result) { $("#tdSectionName").html(result.toString()); }); HolidayListSvc.GetAllHolidays(jsonFeedRecieved);

$("#gridviewmain").hide(); $("#opener").button(); //$("#btnLoadAttendance").button(); $("#btnLoadAttendance").click(OnLoadAttendanceClick);

//$("#btnUpdateAttendance").button(); $("#btnUpdateAttendance").click(updateButtonClick); //$("#btnUpdateAttendanceTop").button(); $("#btnUpdateAttendanceTop").click(updateButtonClick);

$("#opener").click(function () { return false; });

} function setHoliDays(date) { for (i = 0; i < myObject.length; i++) { if (date.getFullYear() == myObject[i].dt_yyyy && date.getMonth() == myObject[i].dt_mm-1 && date.getDate() == myObject[i].dt_dd) { return [false, 'holiday', myObject[i].dt_desc]; } } return [true, '']; } function updateButtonClick() { var icounter = 0; var strxml="<?xml version='1.0'?><Items>" $('#mainAttendance tr').each(function () { if (icounter > 0) { var enrollno = this.cells[0].innerHTML; if (enrollno == null) alert("no data found"); strxml += "<Item><EnrollNo>" + enrollno + "</EnrollNo>"; var sel = 'input[name=Att' + icounter.toString() + ']:checked'; var atttype = $(sel).val(); strxml += "<AttType>" + atttype + "</AttType></Item>";

} icounter++;

}); if (currentdate == undefined) currentdate = Date(); strxml += "</Items>"; //GetAttendanceTable.UpdateAttendance(strxml, attdate.toString()); GetAttendanceTable.UpdateAttendance(strxml, currentdate, function (result) { Notifier.info(result, 'User Action Result'); ; return false; }, function (result) { Notifier.error(result.get_message(), 'Error'); return false; }); return false; }

function popupCalendar() { var dateField = document.getElementById('dateField'); // toggle the div if (dateField.style.display == 'none') dateField.style.display = 'block'; else dateField.style.display = 'none'; }

function OnLoadAttendanceClick() { //var txtName = $get("name"); $('#ajaxLoader2').show(); var txtName = $("#lstClass option:selected"); var txtSection = $("#lstSection option:selected"); //var attdate = document.getElementById('datepicker'); if($('#datepicker').val()=="") $('#datepicker').val(currentdate); if (currentdate == undefined || currentdate == null) { currentdate = Date().toString(); $('#datepicker').val(currentdate); }

GetAttendanceTable.GetNewDataTable(txtName.val(), txtSection.val(), currentdate, GotTable, DidNotGetTable); return false; } function GotTable(result) { $("#AttendanceGrid").html(result.toString()); $('#ajaxLoader2').hide(); return false; } function DidNotGetTable(result) { Notifier.error(result.get_message(), 'Unable To Retrieve Table'); return false; }

function chooseAll(colno) { var icounter = 0; $('#mainAttendance tr').each(function () { if(icounter>0) { $radios = $('input:radio[name=Att' + icounter.toString() + ']'); if (colno == 1) $radios.filter('[value=P]').attr('checked', true); else if (colno == 2) $radios.filter('[value=A]').attr('checked', true); else if (colno == 3) $radios.filter('[value=L]').attr('checked', true); else if (colno == 4) $radios.filter('[value=U]').attr('checked', true);

} icounter++;

}); return false; } function toggleGrid() { $('#gridviewmain').toggle(); return false;

// increase the default animation speed to exaggerate the effect $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#ShowChart").dialog({ autoOpen: false, show: "blind", hide: "explode", width:700, height:500 }); $("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html();

GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); });

</script> <style type="text/css"> .holiday a.ui-state-default { background: green !important; } .holiday a.ui-state-hover { background: red !important; } .ui-datepicker-week-end .ui-datepicker-unselectable .ui-state-disabled { opacity:1.0; background-color:Red;

color:White; } table, .table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption, .caption { text-align: left; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot, .theader { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left; height:30px; } thead th, tfoot th, .theader th { padding:5px; text-align:left } table a { color: #333333; text-decoration:none; } table a:hover {

} tr.odd, .odd { background: #f1f1f1; text-align:left; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none; } .callout { padding: 5px; border: 1px solid #7992B0; background-color: #8AA9B7; border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6);

-webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); } .griddiv { height:300px;

} .gridhead { height:30px; background-color:Red; } .gridmain { height:70%; background-color:Green; } .style2 { width: 50px; } .style7 { width: 20%; } .style8 { width: 7%;

} .style9 { width: 16%; } #fixed-div { position:relative; top: 1em; left:1em; margin-top:20px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3> <p> </p> <p>

</p> </p> </div> <div id="ShowChart" style="width:700px;height:650px;" title="Student Attendance Chart"> <div id="chart_div" style="z-index:99999;width:100%; height:500px;" ></div> </div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <div style="width:100%; margin:0 auto; "> <table style="width:100%;"> <tr>

<td style="width:68%;"> <table style="width:100%"> <tr> <td id="tdClassName" style="width:30%;"> </td> <td id="tdSectionName" style="width:30%;"> </td> <td style="width:30%;"> <p>Date: <input type="text" id="datepicker"></p> </td> <td style="width:5%;"> <button id="btnLoadAttendance" value="Load Attendance" style="margin-left: 6px">Load Attendance</button> </td> <td style="width:5%;"> <button id="btnUpdateAttendanceTop" value="Update Attendance" style="margin-left: 6px" >Update Attendance</button> </td> <td style="width:0%;"> </td> </tr> </table> </td> </tr> <tr>

<td> <div id='AttendanceGrid'></div> </td> </tr> <tr> <td> <table> <tr> <td> <button id="btnUpdateAttendance" value="Update Attendance" style="margin-left: 26px" >Update Attendance</button> </td> <td> <asp:Button ID="btnReset" runat="server" Text="Reset Attendance" style="margin-left: 26px; display:none;" /> </td> <td> <div style="float:left; display:none;" id="ajaxLoader2">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> </tr> </table>

</td>

</tr>

</table> </div> </div> </div> </ContentTemplate> </asp:UpdatePanel> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> </asp:Content>

K:\SpringDale\Teacher\AttendanceCtrl.aspx.cs
using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Xml; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using AttendanceRecTableAdapters; public partial class Teacher_AttendanceCtrl : System.Web.UI.Page { protected void Page_Init(object sender, EventArgs e) { // Wire up the event (MoodChanged) to the event handler (MoodChangedFromMasterPage) //Master.B += new CommandEventHandler(MoodChangedFromMasterPage); //Master.BrowseData += new CommandEventHandler(Master_BrowseData); } protected void Page_Load(object sender, EventArgs e) {

ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); if (Page.IsPostBack) { } else

{ } }

private void Master_BrowseData(object sender, CommandEventArgs e) { }

K:\SpringDale\Teacher\AttendanceEmailMaster.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AttendanceEmailMaster.aspx.cs" Inherits="Admin_AttendanceEmailMaster" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode", postion:"left" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () {

$("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); $("#dialog").dialog("option", "position", "left"); return false; }); });

function addload() {

$("#gridviewmain").hide(); $("#opener").button();

$("#opener").click(function () { return false; });

} </script> <style> table, .table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption, .caption { text-align: left; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot, .theader { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left; height:30px; } thead th, tfoot th, .theader th { padding:5px; text-align:left }

table a { color: #333333; text-decoration:none; } table a:hover { } tr.odd, .odd { background: #f1f1f1; text-align:left; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none; } .callout { padding: 5px; border: 1px solid #7992B0; background-color: #8AA9B7;

border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> </Services> </asp:ScriptManager> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <h3>This will show the cumulative of the student</h3> </div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option>

<option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px;text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <div> <asp:Label ID="Label1" runat="server" Font-Bold="True" FontSize="Medium"></asp:Label></div> <div style="width:100%; margin:0 auto; "> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Table runat="server" Width="100%"> <asp:TableRow> <asp:TableCell Width="20%"> <b>Class:</b> <asp:DropDownList ID="lstClass" runat="server" DataSourceID="ObjectDataSource1" DataTextField="ClassName" DataValueField="ClassName"> </asp:DropDownList> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetUniqueName" TypeName="ClassRecBLL"></asp:ObjectDataSource> </asp:TableCell>

<asp:TableCell Width="20%"> <b> Section:</b> <asp:DropDownList ID="lstSection" runat="server" DataSourceID="ObjectDataSource2" DataTextField="ClassSection" DataValueField="ClassSection"> </asp:DropDownList> <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetUniqueSection" TypeName="ClassRecBLL"></asp:ObjectDataSource> </asp:TableCell> <asp:TableCell Width="30%"> <b>Cutoff% : </b> <asp:TextBox ID="txtPercent" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell Width="15%"> <asp:Button ID="btnLoadStudent" runat="server" Text="Load Defaulting Students" CssClass="ui-button ui-widget ui-state-default ui-corner-all uibutton-text-only" onclick="btnLoadStudent_Click"/> </asp:TableCell> <asp:TableCell Width="15%"> <asp:Button ID="btnSendMail" runat="server" Text="Send Mail" onclick="Sendmail_Click" CssClass="ui-button ui-widget ui-state-default ui-corner-all uibutton-text-only" /> </asp:TableCell> </asp:TableRow>

</asp:Table> <asp:Table runat="server" Width="100%"> <asp:TableRow> <asp:TableCell> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" > <ProgressTemplate> <asp:Image ID="Image1" runat="server" ImageUrl="http://learnasp.in/css/ajax-loader.gif" /> </ProgressTemplate> </asp:UpdateProgress> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell Width="100%" BorderStyle="None"> <asp:GridView ID="studentGrid" runat="server" Width="100%" BorderStyle="None" OnDataBound="studentGrid_DataBound" DataKeyNames="EnrollNo" GridLines="None"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="StudentSelector" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </asp:TableCell> </asp:TableRow> </asp:Table> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="btnSendMail" />

</Triggers> </asp:UpdatePanel> </div> </div> </div> </asp:Content>

K:\SpringDale\Teacher\AttendanceEmailMaster.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Net.Mail; public partial class Admin_AttendanceEmailMaster : System.Web.UI.Page { DataTable students; protected void Page_Load(object sender, EventArgs e) { //if (ClientScript.IsStartupScriptRegistered("initpage")==false ) //{ ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); //} } protected void btnLoadStudent_Click(object sender, EventArgs e) { GetAttendanceTable ga = new GetAttendanceTable(); students = ga.GetDefaultingStudent(lstClass.Text, lstSection.Text, float.Parse(txtPercent.Text)); studentGrid.DataSource = students; studentGrid.DataBind();

} protected void studentGrid_DataBound(Object sender, EventArgs e) {

studentGrid.UseAccessibleHeader = true; studentGrid.HeaderRow.TableSection = TableRowSection.TableHeader; studentGrid.BorderStyle = BorderStyle.None; } protected void Sendmail_Click(Object sender, EventArgs e) { // Iterate through the Products.Rows property foreach (GridViewRow row in studentGrid.Rows) { // Access the CheckBox CheckBox cb = (CheckBox)row.FindControl("StudentSelector"); if (cb != null && cb.Checked) {

int enrollno = Convert.ToInt32(studentGrid.DataKeys[row.RowIndex].Value); sendMail(enrollno); } } Label1.Text = "Messages Sent...!"; } protected bool sendMail(int enrollno) {

bool answer = false; GetAttendanceTable ga = new GetAttendanceTable(); students = ga.GetDefaultingStudent(lstClass.Text, lstSection.Text, float.Parse(txtPercent.Text)); foreach (DataRow dr in students.Rows) { if (int.Parse(dr["EnrollNo"].ToString()) == enrollno) { MailMessage mail=new MailMessage(); //mail.To.Add("Email ID where you wanna send copy of email") mail.To.Add(dr["Email"].ToString()); mail.From = new MailAddress("[email protected]"); mail.Subject = "Low Attendance Of Your Ward"; GetAttendanceTable gt = new GetAttendanceTable(); string webdata = gt.GetMonthlyAttendanceAll((decimal)enrollno, DateTime.Now); string[] step1=webdata.Split(':'); string sx = ""; string sy1,sy2,sy3,sy4; sy1= ""; sy2 = ""; sy3 = ""; sy4 = ""; for (int i = 0; i < step1.Length; i++) { string[] step2 = step1[i].Split(','); sx += step2[0] + "%7c"; sy1 += step2[1] + "%2c"; sy2 += step2[2] + "%2c"; sy3 += step2[3] + "%2c"; sy4+=step2[4] + "%2c"; } sx = sx.Substring(0, sx.Length - 3);

sy1 = sy1.Substring(0, sy1.Length - 3); sy2 = sy1.Substring(0, sy1.Length - 3); sy3 = sy1.Substring(0, sy1.Length - 3); sy4 = sy1.Substring(0, sy1.Length - 3); string body = "Dear Sir,<br/> This is to inform you that your ward <b><u>" + dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + "</u></b>, has been missing his classes regularly. <br/>His current attendance percentage is " + dr["Attendance"].ToString() + ". Please be kind enough to come to the school and meet either the Principal or the class teacher immediately.<br/>For your " + "information please view the attached graphical representation of the mentioned data.<br/>" + "yours sincerely <br/> Web Admin<br/>" + DateTime.Now.ToString() + "<br/><img src='" + "https://chart.googleapis.com/chart?chs=500x500&amp;chds=a&amp;cht=bvs&amp;chd=t: " + sy1 + "&amp;chl=" + sx + "&amp;chxt=x%2cy&amp;chbh=r%2c0.5%2c1.5'/>"; //"%7c" + sy2 + "%7c" + sy3 + "%7c" +sy4 + mail.Body = body; mail.IsBodyHtml = true;

SmtpClient smtp=new SmtpClient(); smtp.UseDefaultCredentials = false; //smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "sudeep0104"); smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "sudeep0104"); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Host = "smtp.gmail.com"; // 'Or Your SMTP Server Address //smtp.Host = "learnasp.in"; smtp.Port = 587;

smtp.EnableSsl = true; smtp.Send(mail); answer = true; return answer; } } return answer; } }

K:\SpringDale\Teacher\BrowseAttendance.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="BrowseAttendance.aspx.cs" Inherits="Teacher_BrowseAttendance" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript"> function addload(){ GetAttendanceTable.GetClassListBox(function (result) { $("#tdClassName").html("<b>Class Name </b> " + result.toString()); }, function (result) { $("#tdClassName").html(result.toString()); }); GetAttendanceTable.GetSectionListBox(function (result) { $("#tdSectionName").html("<b>Section </b> " + result.toString()); }, function (result) { $("#tdSectionName").html(result.toString()); }); $("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' }); $("#gridviewmain").hide();

} </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </asp:Content>

K:\SpringDale\Teacher\BrowseAttendance.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Teacher_BrowseAttendance : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

K:\SpringDale\Teacher\EnterMarks.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="EnterMarks.aspx.cs" Inherits="Teacher_EnterMarks" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; var termid = 0; var classname = ""; var subjectid = 0; function addload() { var id = '<%=Page.User.Identity.Name %>'; MarksWeb.getClasses(id,gotclasses); $("#opener").button(); // $("#btnLoadAttendance").button(); $("#opener").click(function () { return false; }); $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({

autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false;

}); });

} function gotclasses(result) { $('#divclasses').show(); $('#divclasseslabel').show(); $('#divclasses').html(result); } function classes_change() { var dropdown = document.getElementById("cmbclasses"); var index = dropdown.selectedIndex; var ddVal = dropdown.options[index].value; var ddText = dropdown.options[index].text; var id = '<%=Page.User.Identity.Name %>'; //alert(ddVal + "," + id); MarksWeb.getSubjects(id, ddVal, gotSubjects); MarksWeb.getTerms(ddText, gotTerms); return false;

} function gotSubjects(result) { $('#divsubjects').show(); $('#divsubjectslabel').show(); $('#divsubjects').html(result);

$('#divterms').show(); $('#divtermslabel').show(); $('#btnUpdate').show(); $('#btnNext').show();

} function gotTerms(result) { $('#divterms').show(); $('#divtermslabel').show(); $('#divterms').html(result); } function next_click() { $('#showajax').show(); var dropdown = document.getElementById("cmbclasses"); var index = dropdown.selectedIndex; var classid = dropdown.options[index].value; classname= dropdown.options[index].text; var dropdown2 = document.getElementById("cmbSubjects"); var index2 = dropdown2.selectedIndex; var subjectname = dropdown2.options[index2].text; subjectid = dropdown2.options[index2].value; var dropdown3 = document.getElementById("cmbTerms"); var index3 = dropdown3.selectedIndex;

termid = dropdown3.options[index3].value; MarksWeb.getMarksTable(subjectname, termid, classid, gotMarksTable); } function gotMarksTable(result) { $('#showajax').hide(); $('#divmarks').html(result); } function update_click() { i = 0; $('#showajax').show(); $('#mainmarkstable tr').each(function () { $this = $(this); if (i > 0) { var enroll = $this.find('#enroll' + i.toString()); var enrollno; if (enroll != null) { enrollno = enroll.text(); } var obj = $this.find('#txt' + i.toString()); var marks; if (obj != null) { marks = obj.val(); MarksWeb.updateMarks(enrollno, marks, termid, classname, subjectid,marksUpdated); } } i = i + 1; });

} function marksUpdated(result) { $('#showajax').hide(); if(result=="true") Notifier.info('Marks Update Success','Success'); else Notifier.error('oooops! Something has gone wrong','Error'); } </script> <style type="text/css"> .sendbehind { z-index:-99999; } .mypanel { padding-top:10px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/MarksWeb.asmx" /> <asp:ServiceReference Path="http://learnasp.in/GetTeachers.asmx" /> </Services> </asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3>

<p> </p>

<p> </p>

</p> </div> <div style="width:98%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option>

<option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px; text-align:center;" id="fixed-div"><button id="opener">Search .......</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:78%;"> <div style="margin:0 auto;width:70%;"> <div style="padding-left:10px; padding-right:10px; padding-top:10px; paddingbottom:12px;"> <div id='divclasseslabel' style="float:left;padding:5px;display:none; verticalalign:middle"><b>Choose Class :</b></div> <div id="divclasses" style="float:left;vertical-align:middle;display:none;"></div> <div id='divsubjectslabel' style="float:left;padding:5px;display:none; verticalalign:middle;"><b>Choose Subject :</b></div> <div id="divsubjects" style="float:left;vertical-align:middle;display:none;"></div> &nbsp; <div id='divtermslabel' style="float:left;padding:5px;display:none; verticalalign:middle;"><b>Choose Term : </b></div> <div id="divterms" style="float:left; vertical-align:middle;display:none;"></div> <div id="showajax" style="float:left; vertical-align:middle;display:none;"> <img alt="" src="http://learnasp.in/css/ajax-loadersmall.gif" /></div> &nbsp; <input id="btnNext" type="button" value="Next >>" onclick="next_click();" style="display:none;" />

<input id="btnUpdate" type="button" value="Update" onclick="update_click();" style="display:none;"/> <div style="clear:both;"> &nbsp;</div> <div id="divmarks" style="width:70%; margin:0 auto;"></div> </div> </div> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Teacher\EnterMarks.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Text.RegularExpressions; using System.Web.UI.WebControls; using System.Data; public partial class Teacher_EnterMarks : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); if (!IsPostBack) { try { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value;

} catch (Exception ex) { }

} protected void cmbClasses_SelectedIndexChanged2(object sender, EventArgs e) {

var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value;

} protected void cmbSubjects_SelectedIndexChanged(object sender, EventArgs e) { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value;

} }

K:\SpringDale\Teacher\Web.config
<?xml version="1.0"?> <configuration> <system.web> <authorization> <allow roles="Administrators"/> <allow roles="Teachers" /> <deny roles="Students"/> <deny users="*"/> </authorization> </system.web> </configuration>

K:\SpringDale\Teacher\AddMarks.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AddMarks.aspx.cs" Inherits="Teacher_AddMarks" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http/learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http/learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; function addload() {

$("#opener").button();

$("#opener").click(function () { return false; }); $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false,

show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); });

</script>

<style type="text/css"> .sendback { z-index:-9999; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> <asp:ServiceReference Path="http://learnasp.in/GetTeachers.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3>

</p> </div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div>

<div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px; text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Teacher\AddMarks.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Teacher_AddMarks : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); if (!IsPostBack) { //Response.Write(Page.User.Identity.Name); } } }

K:\SpringDale\Teacher\AttendanceCtrl.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AttendanceCtrl.aspx.cs" Inherits="Teacher_AttendanceCtrl" EnableSessionState="True" %> <%@ MasterType VirtualPath="~/MasterPage.master"%> <%@ Register src="../UserControls/AttendanceTable.ascx" tagname="AttendanceTable" tagprefix="uc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; // Load the Visualization API and the piechart package. google.load('visualization', '1.0', { 'packages': ['corechart'] }); // Set a callback to run when the Google Visualization API is loaded. //google.setOnLoadCallback(drawChart); function showChart(enrollno) { currentenroll = enrollno; $("#ShowChart").dialog("open"); setTimeout("drawChart();", 2000);

// Callback that creates and populates a data table, // instantiates the pie chart, passes in the data and // draws it. function drawChart() { GetAttendanceTable.GetMonthlyAttendanceAll(currentenroll, currentdate, function (result) { var data = new google.visualization.DataTable(); data.addColumn('string', 'Month'); data.addColumn('number', 'Present'); data.addColumn('number', 'Absent'); data.addColumn('number', 'Leave'); data.addColumn('number', 'Unknown'); var arr = result.split(":"); data.addRows(arr.length); for (i = 0; i < arr.length; i++) { var innerdata = arr[i].split(","); data.setCell(i, 0, innerdata[0]); data.setCell(i, 1, parseFloat(innerdata[1])); data.setCell(i, 2, parseFloat(innerdata[2])); data.setCell(i, 3, parseFloat(innerdata[3])); data.setCell(i, 4, parseFloat(innerdata[4])); }

// Set chart options var options = { 'title': 'Monthly Attendance Of Student' }; // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));

chart.draw(data, options); }); // Create the data table. return false; }

function openAttendanceRecord(par) { $("#StudentAttRec").dialog("open"); return false; } function jsonFeedRecieved(result) { var i = 0; //myObject = JSON.parse(result); myObject = jQuery.parseJSON(result); $("#datepicker").datepicker({ beforeShowDay: setHoliDays, onSelect: function (dateText, inst) { currentdate = dateText; } });

function addload(){ GetAttendanceTable.GetClassListBox(function (result) { $("#tdClassName").html("<b>Class Name </b> " + result.toString()); }, function (result) { $("#tdClassName").html(result.toString()); }); GetAttendanceTable.GetSectionListBox(function (result) { $("#tdSectionName").html("<b>Section </b> " + result.toString()); }, function (result) { $("#tdSectionName").html(result.toString()); }); HolidayListSvc.GetAllHolidays(jsonFeedRecieved);

$("#gridviewmain").hide(); $("#opener").button(); //$("#btnLoadAttendance").button(); $("#btnLoadAttendance").click(OnLoadAttendanceClick);

//$("#btnUpdateAttendance").button(); $("#btnUpdateAttendance").click(updateButtonClick); //$("#btnUpdateAttendanceTop").button(); $("#btnUpdateAttendanceTop").click(updateButtonClick);

$("#opener").click(function () { return false; });

} function setHoliDays(date) { for (i = 0; i < myObject.length; i++) { if (date.getFullYear() == myObject[i].dt_yyyy && date.getMonth() == myObject[i].dt_mm-1 && date.getDate() == myObject[i].dt_dd) { return [false, 'holiday', myObject[i].dt_desc]; } } return [true, '']; } function updateButtonClick() { var icounter = 0; var strxml="<?xml version='1.0'?><Items>" $('#mainAttendance tr').each(function () { if (icounter > 0) { var enrollno = this.cells[0].innerHTML; if (enrollno == null) alert("no data found"); strxml += "<Item><EnrollNo>" + enrollno + "</EnrollNo>"; var sel = 'input[name=Att' + icounter.toString() + ']:checked'; var atttype = $(sel).val(); strxml += "<AttType>" + atttype + "</AttType></Item>";

} icounter++;

}); if (currentdate == undefined) currentdate = Date(); strxml += "</Items>"; //GetAttendanceTable.UpdateAttendance(strxml, attdate.toString()); GetAttendanceTable.UpdateAttendance(strxml, currentdate, function (result) { Notifier.info(result, 'User Action Result'); ; return false; }, function (result) { Notifier.error(result.get_message(), 'Error'); return false; }); return false; }

function popupCalendar() { var dateField = document.getElementById('dateField'); // toggle the div if (dateField.style.display == 'none') dateField.style.display = 'block'; else dateField.style.display = 'none'; }

function OnLoadAttendanceClick() { //var txtName = $get("name"); $('#ajaxLoader2').show(); var txtName = $("#lstClass option:selected"); var txtSection = $("#lstSection option:selected"); //var attdate = document.getElementById('datepicker'); if($('#datepicker').val()=="") $('#datepicker').val(currentdate); if (currentdate == undefined || currentdate == null) { currentdate = Date().toString(); $('#datepicker').val(currentdate); }

GetAttendanceTable.GetNewDataTable(txtName.val(), txtSection.val(), currentdate, GotTable, DidNotGetTable); return false; } function GotTable(result) { $("#AttendanceGrid").html(result.toString()); $('#ajaxLoader2').hide(); return false; } function DidNotGetTable(result) { Notifier.error(result.get_message(), 'Unable To Retrieve Table'); return false; }

function chooseAll(colno) { var icounter = 0; $('#mainAttendance tr').each(function () { if(icounter>0) { $radios = $('input:radio[name=Att' + icounter.toString() + ']'); if (colno == 1) $radios.filter('[value=P]').attr('checked', true); else if (colno == 2) $radios.filter('[value=A]').attr('checked', true); else if (colno == 3) $radios.filter('[value=L]').attr('checked', true); else if (colno == 4) $radios.filter('[value=U]').attr('checked', true);

} icounter++;

}); return false; } function toggleGrid() { $('#gridviewmain').toggle(); return false;

// increase the default animation speed to exaggerate the effect $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 }); $("#ShowChart").dialog({ autoOpen: false, show: "blind", hide: "explode", width:700, height:500 }); $("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html();

GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false; }); });

</script> <style type="text/css"> .holiday a.ui-state-default { background: green !important; } .holiday a.ui-state-hover { background: red !important; } .ui-datepicker-week-end .ui-datepicker-unselectable .ui-state-disabled { opacity:1.0; background-color:Red;

color:White; } table, .table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption, .caption { text-align: left; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot, .theader { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left; height:30px; } thead th, tfoot th, .theader th { padding:5px; text-align:left } table a { color: #333333; text-decoration:none; } table a:hover {

} tr.odd, .odd { background: #f1f1f1; text-align:left; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none; } .callout { padding: 5px; border: 1px solid #7992B0; background-color: #8AA9B7; border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6);

-webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); } .griddiv { height:300px;

} .gridhead { height:30px; background-color:Red; } .gridmain { height:70%; background-color:Green; } .style2 { width: 50px; } .style7 { width: 20%; } .style8 { width: 7%;

} .style9 { width: 16%; } #fixed-div { position:relative; top: 1em; left:1em; margin-top:20px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> </Services> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3> <p> </p> <p>

</p> </p> </div> <div id="ShowChart" style="width:700px;height:650px;" title="Student Attendance Chart"> <div id="chart_div" style="z-index:99999;width:100%; height:500px;" ></div> </div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <div style="width:100%; margin:0 auto; "> <table style="width:100%;"> <tr>

<td style="width:68%;"> <table style="width:100%"> <tr> <td id="tdClassName" style="width:30%;"> </td> <td id="tdSectionName" style="width:30%;"> </td> <td style="width:30%;"> <p>Date: <input type="text" id="datepicker"></p> </td> <td style="width:5%;"> <button id="btnLoadAttendance" value="Load Attendance" style="margin-left: 6px">Load Attendance</button> </td> <td style="width:5%;"> <button id="btnUpdateAttendanceTop" value="Update Attendance" style="margin-left: 6px" >Update Attendance</button> </td> <td style="width:0%;"> </td> </tr> </table> </td> </tr> <tr>

<td> <div id='AttendanceGrid'></div> </td> </tr> <tr> <td> <table> <tr> <td> <button id="btnUpdateAttendance" value="Update Attendance" style="margin-left: 26px" >Update Attendance</button> </td> <td> <asp:Button ID="btnReset" runat="server" Text="Reset Attendance" style="margin-left: 26px; display:none;" /> </td> <td> <div style="float:left; display:none;" id="ajaxLoader2">&nbsp; <img src="http://learnasp.in/css/ajax-loadersmall.gif" alt="Loading..."/> </div> </td> </tr> </table>

</td>

</tr>

</table> </div> </div> </div> </ContentTemplate> </asp:UpdatePanel> <asp:Label ID="Label1" runat="server" Text=""></asp:Label> </asp:Content>

K:\SpringDale\Teacher\AttendanceCtrl.aspx.cs
using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Xml; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using AttendanceRecTableAdapters; public partial class Teacher_AttendanceCtrl : System.Web.UI.Page { protected void Page_Init(object sender, EventArgs e) { // Wire up the event (MoodChanged) to the event handler (MoodChangedFromMasterPage) //Master.B += new CommandEventHandler(MoodChangedFromMasterPage); //Master.BrowseData += new CommandEventHandler(Master_BrowseData); } protected void Page_Load(object sender, EventArgs e) {

ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); if (Page.IsPostBack) { } else

{ } }

private void Master_BrowseData(object sender, CommandEventArgs e) { }

K:\SpringDale\Teacher\AttendanceEmailMaster.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AttendanceEmailMaster.aspx.cs" Inherits="Admin_AttendanceEmailMaster" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({ autoOpen: false, show: "blind", hide: "explode", postion:"left" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () {

$("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); $("#dialog").dialog("option", "position", "left"); return false; }); });

function addload() {

$("#gridviewmain").hide(); $("#opener").button();

$("#opener").click(function () { return false; });

} </script> <style> table, .table { border-collapse: collapse; border: 1px solid #666666; font: normal 11px verdana, arial, helvetica, sans-serif; color: #363636; background: #f6f6f6; text-align:left; } caption, .caption { text-align: left; font: bold 16px arial, helvetica, sans-serif; background: transparent; padding:6px 4px 8px 0px; color: #CC00FF; text-transform: uppercase; } thead, tfoot, .theader { background:url(http://learnasp.in/css/bg1.png) repeat-x; text-align:left; height:30px; } thead th, tfoot th, .theader th { padding:5px; text-align:left }

table a { color: #333333; text-decoration:none; } table a:hover { } tr.odd, .odd { background: #f1f1f1; text-align:left; } tbody th, tbody td { padding:5px; } tr:hover.hovereffect { background-color:#C0C0C0; font-weight:bold; cursor:pointer; cursor:hand; } td img { border-style:none; } .callout { padding: 5px; border: 1px solid #7992B0; background-color: #8AA9B7;

border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); -webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.6); } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/HolidayList.asmx" /> </Services> </asp:ScriptManager> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <h3>This will show the cumulative of the student</h3> </div> <div style="width:100%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option> <option value="3">First Name</option>

<option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px;text-align:center;" id="fixed-div"><button id="opener">Search...</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:74%;"> <div> <asp:Label ID="Label1" runat="server" Font-Bold="True" FontSize="Medium"></asp:Label></div> <div style="width:100%; margin:0 auto; "> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Table runat="server" Width="100%"> <asp:TableRow> <asp:TableCell Width="20%"> <b>Class:</b> <asp:DropDownList ID="lstClass" runat="server" DataSourceID="ObjectDataSource1" DataTextField="ClassName" DataValueField="ClassName"> </asp:DropDownList> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetUniqueName" TypeName="ClassRecBLL"></asp:ObjectDataSource> </asp:TableCell>

<asp:TableCell Width="20%"> <b> Section:</b> <asp:DropDownList ID="lstSection" runat="server" DataSourceID="ObjectDataSource2" DataTextField="ClassSection" DataValueField="ClassSection"> </asp:DropDownList> <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetUniqueSection" TypeName="ClassRecBLL"></asp:ObjectDataSource> </asp:TableCell> <asp:TableCell Width="30%"> <b>Cutoff% : </b> <asp:TextBox ID="txtPercent" runat="server"></asp:TextBox> </asp:TableCell> <asp:TableCell Width="15%"> <asp:Button ID="btnLoadStudent" runat="server" Text="Load Defaulting Students" CssClass="ui-button ui-widget ui-state-default ui-corner-all uibutton-text-only" onclick="btnLoadStudent_Click"/> </asp:TableCell> <asp:TableCell Width="15%"> <asp:Button ID="btnSendMail" runat="server" Text="Send Mail" onclick="Sendmail_Click" CssClass="ui-button ui-widget ui-state-default ui-corner-all uibutton-text-only" /> </asp:TableCell> </asp:TableRow>

</asp:Table> <asp:Table runat="server" Width="100%"> <asp:TableRow> <asp:TableCell> <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" > <ProgressTemplate> <asp:Image ID="Image1" runat="server" ImageUrl="http://learnasp.in/css/ajax-loader.gif" /> </ProgressTemplate> </asp:UpdateProgress> </asp:TableCell> </asp:TableRow> <asp:TableRow> <asp:TableCell Width="100%" BorderStyle="None"> <asp:GridView ID="studentGrid" runat="server" Width="100%" BorderStyle="None" OnDataBound="studentGrid_DataBound" DataKeyNames="EnrollNo" GridLines="None"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="StudentSelector" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </asp:TableCell> </asp:TableRow> </asp:Table> </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="btnSendMail" />

</Triggers> </asp:UpdatePanel> </div> </div> </div> </asp:Content>

K:\SpringDale\Teacher\AttendanceEmailMaster.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Net.Mail; public partial class Admin_AttendanceEmailMaster : System.Web.UI.Page { DataTable students; protected void Page_Load(object sender, EventArgs e) { //if (ClientScript.IsStartupScriptRegistered("initpage")==false ) //{ ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); //} } protected void btnLoadStudent_Click(object sender, EventArgs e) { GetAttendanceTable ga = new GetAttendanceTable(); students = ga.GetDefaultingStudent(lstClass.Text, lstSection.Text, float.Parse(txtPercent.Text)); studentGrid.DataSource = students; studentGrid.DataBind();

} protected void studentGrid_DataBound(Object sender, EventArgs e) {

studentGrid.UseAccessibleHeader = true; studentGrid.HeaderRow.TableSection = TableRowSection.TableHeader; studentGrid.BorderStyle = BorderStyle.None; } protected void Sendmail_Click(Object sender, EventArgs e) { // Iterate through the Products.Rows property foreach (GridViewRow row in studentGrid.Rows) { // Access the CheckBox CheckBox cb = (CheckBox)row.FindControl("StudentSelector"); if (cb != null && cb.Checked) {

int enrollno = Convert.ToInt32(studentGrid.DataKeys[row.RowIndex].Value); sendMail(enrollno); } } Label1.Text = "Messages Sent...!"; } protected bool sendMail(int enrollno) {

bool answer = false; GetAttendanceTable ga = new GetAttendanceTable(); students = ga.GetDefaultingStudent(lstClass.Text, lstSection.Text, float.Parse(txtPercent.Text)); foreach (DataRow dr in students.Rows) { if (int.Parse(dr["EnrollNo"].ToString()) == enrollno) { MailMessage mail=new MailMessage(); //mail.To.Add("Email ID where you wanna send copy of email") mail.To.Add(dr["Email"].ToString()); mail.From = new MailAddress("[email protected]"); mail.Subject = "Low Attendance Of Your Ward"; GetAttendanceTable gt = new GetAttendanceTable(); string webdata = gt.GetMonthlyAttendanceAll((decimal)enrollno, DateTime.Now); string[] step1=webdata.Split(':'); string sx = ""; string sy1,sy2,sy3,sy4; sy1= ""; sy2 = ""; sy3 = ""; sy4 = ""; for (int i = 0; i < step1.Length; i++) { string[] step2 = step1[i].Split(','); sx += step2[0] + "%7c"; sy1 += step2[1] + "%2c"; sy2 += step2[2] + "%2c"; sy3 += step2[3] + "%2c"; sy4+=step2[4] + "%2c"; } sx = sx.Substring(0, sx.Length - 3);

sy1 = sy1.Substring(0, sy1.Length - 3); sy2 = sy1.Substring(0, sy1.Length - 3); sy3 = sy1.Substring(0, sy1.Length - 3); sy4 = sy1.Substring(0, sy1.Length - 3); string body = "Dear Sir,<br/> This is to inform you that your ward <b><u>" + dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + "</u></b>, has been missing his classes regularly. <br/>His current attendance percentage is " + dr["Attendance"].ToString() + ". Please be kind enough to come to the school and meet either the Principal or the class teacher immediately.<br/>For your " + "information please view the attached graphical representation of the mentioned data.<br/>" + "yours sincerely <br/> Web Admin<br/>" + DateTime.Now.ToString() + "<br/><img src='" + "https://chart.googleapis.com/chart?chs=500x500&amp;chds=a&amp;cht=bvs&amp;chd=t: " + sy1 + "&amp;chl=" + sx + "&amp;chxt=x%2cy&amp;chbh=r%2c0.5%2c1.5'/>"; //"%7c" + sy2 + "%7c" + sy3 + "%7c" +sy4 + mail.Body = body; mail.IsBodyHtml = true;

SmtpClient smtp=new SmtpClient(); smtp.UseDefaultCredentials = false; //smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "sudeep0104"); smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "sudeep0104"); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Host = "smtp.gmail.com"; // 'Or Your SMTP Server Address //smtp.Host = "learnasp.in"; smtp.Port = 587;

smtp.EnableSsl = true; smtp.Send(mail); answer = true; return answer; } } return answer; } }

K:\SpringDale\Teacher\BrowseAttendance.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="BrowseAttendance.aspx.cs" Inherits="Teacher_BrowseAttendance" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="../js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script> <script type="text/javascript"> function addload(){ GetAttendanceTable.GetClassListBox(function (result) { $("#tdClassName").html("<b>Class Name </b> " + result.toString()); }, function (result) { $("#tdClassName").html(result.toString()); }); GetAttendanceTable.GetSectionListBox(function (result) { $("#tdSectionName").html("<b>Section </b> " + result.toString()); }, function (result) { $("#tdSectionName").html(result.toString()); }); $("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' }); $("#gridviewmain").hide();

} </script> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </asp:Content>

K:\SpringDale\Teacher\BrowseAttendance.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Teacher_BrowseAttendance : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } }

K:\SpringDale\Teacher\EnterMarks.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="EnterMarks.aspx.cs" Inherits="Teacher_EnterMarks" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <script type="text/javascript" src="http://learnasp.in/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/jquery-ui1.8.18.custom.min.js"></script> <script type="text/javascript" src="http://learnasp.in/js/notifier.js"></script> <script type="text/javascript"> var myObject; var currentdate = new Date(); var currentenroll = 0; var termid = 0; var classname = ""; var subjectid = 0; function addload() { var id = '<%=Page.User.Identity.Name %>'; MarksWeb.getClasses(id,gotclasses); $("#opener").button(); // $("#btnLoadAttendance").button(); $("#opener").click(function () { return false; }); $.fx.speeds._default = 1000; $(function () { $("#dialog").dialog({

autoOpen: false, show: "blind", hide: "explode" }); $("#StudentAttRec").dialog({ autoOpen: false, show: "blind", hide: "explode", width: 400, height: 300 });

$("#opener").click(function () { $("#lstSearchItem option:selected").each(function () { $("#dialog").html(); GetAttendanceTable.GetDataTableForSearch($(this).val(), $("#txtSearchString").val(), function (result) { $("#dialog").html(result); }, function () { $("#dialog").html("Unable To Retrieve Data...!"); }); }); $("#dialog").dialog("open"); $("#dialog").dialog("option", "height", 250); $("#dialog").dialog("option", "width", 430); return false;

}); });

} function gotclasses(result) { $('#divclasses').show(); $('#divclasseslabel').show(); $('#divclasses').html(result); } function classes_change() { var dropdown = document.getElementById("cmbclasses"); var index = dropdown.selectedIndex; var ddVal = dropdown.options[index].value; var ddText = dropdown.options[index].text; var id = '<%=Page.User.Identity.Name %>'; //alert(ddVal + "," + id); MarksWeb.getSubjects(id, ddVal, gotSubjects); MarksWeb.getTerms(ddText, gotTerms); return false;

} function gotSubjects(result) { $('#divsubjects').show(); $('#divsubjectslabel').show(); $('#divsubjects').html(result);

$('#divterms').show(); $('#divtermslabel').show(); $('#btnUpdate').show(); $('#btnNext').show();

} function gotTerms(result) { $('#divterms').show(); $('#divtermslabel').show(); $('#divterms').html(result); } function next_click() { $('#showajax').show(); var dropdown = document.getElementById("cmbclasses"); var index = dropdown.selectedIndex; var classid = dropdown.options[index].value; classname= dropdown.options[index].text; var dropdown2 = document.getElementById("cmbSubjects"); var index2 = dropdown2.selectedIndex; var subjectname = dropdown2.options[index2].text; subjectid = dropdown2.options[index2].value; var dropdown3 = document.getElementById("cmbTerms"); var index3 = dropdown3.selectedIndex;

termid = dropdown3.options[index3].value; MarksWeb.getMarksTable(subjectname, termid, classid, gotMarksTable); } function gotMarksTable(result) { $('#showajax').hide(); $('#divmarks').html(result); } function update_click() { i = 0; $('#showajax').show(); $('#mainmarkstable tr').each(function () { $this = $(this); if (i > 0) { var enroll = $this.find('#enroll' + i.toString()); var enrollno; if (enroll != null) { enrollno = enroll.text(); } var obj = $this.find('#txt' + i.toString()); var marks; if (obj != null) { marks = obj.val(); MarksWeb.updateMarks(enrollno, marks, termid, classname, subjectid,marksUpdated); } } i = i + 1; });

} function marksUpdated(result) { $('#showajax').hide(); if(result=="true") Notifier.info('Marks Update Success','Success'); else Notifier.error('oooops! Something has gone wrong','Error'); } </script> <style type="text/css"> .sendbehind { z-index:-99999; } .mypanel { padding-top:10px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="http://learnasp.in/GetAttendanceTable.asmx" /> <asp:ServiceReference Path="http://learnasp.in/MarksWeb.asmx" /> <asp:ServiceReference Path="http://learnasp.in/GetTeachers.asmx" /> </Services> </asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ViewStateMode="Enabled"> <ContentTemplate> <div id="dialog" title="Student Information" style="width:400px;height:300px;"> </div> <div id="StudentAttRec" title="Student Attendance Information" style="width:200px;height:300px;"> <p><h3>This will show the cumulative of the student</h3>

<p> </p>

<p> </p>

</p> </div> <div style="width:98%; margin-left:10px;"> <div style="float:left;width:10%;"> <div class="shadedHeader" style="margin-top:10px;"> Search Student</div> <div style="margin-top:8px; text-align:center"> <select id="lstSearchItem"> <option value="1">Enrollment No</option> <option value="2">Roll No</option>

<option value="3">First Name</option> <option value="4">Class-Section</option> <option value="5">Class</option> </select> </div> <div style="margin-top:8px; text-align:center;"> <input type="text" id="txtSearchString" size="20px" /> </div> <div style="margin-top:8px; text-align:center;" id="fixed-div"><button id="opener">Search .......</button></div> </div> <div style="float:left;width:4%; padding-left:20px;">&nbsp;</div> <div style="float:left;width:78%;"> <div style="margin:0 auto;width:70%;"> <div style="padding-left:10px; padding-right:10px; padding-top:10px; paddingbottom:12px;"> <div id='divclasseslabel' style="float:left;padding:5px;display:none; verticalalign:middle"><b>Choose Class :</b></div> <div id="divclasses" style="float:left;vertical-align:middle;display:none;"></div> <div id='divsubjectslabel' style="float:left;padding:5px;display:none; verticalalign:middle;"><b>Choose Subject :</b></div> <div id="divsubjects" style="float:left;vertical-align:middle;display:none;"></div> &nbsp; <div id='divtermslabel' style="float:left;padding:5px;display:none; verticalalign:middle;"><b>Choose Term : </b></div> <div id="divterms" style="float:left; vertical-align:middle;display:none;"></div> <div id="showajax" style="float:left; vertical-align:middle;display:none;"> <img alt="" src="http://learnasp.in/css/ajax-loadersmall.gif" /></div> &nbsp; <input id="btnNext" type="button" value="Next >>" onclick="next_click();" style="display:none;" />

<input id="btnUpdate" type="button" value="Update" onclick="update_click();" style="display:none;"/> <div style="clear:both;"> &nbsp;</div> <div id="divmarks" style="width:70%; margin:0 auto;"></div> </div> </div> </div> </div> </ContentTemplate> </asp:UpdatePanel> </asp:Content>

K:\SpringDale\Teacher\EnterMarks.aspx.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Text.RegularExpressions; using System.Web.UI.WebControls; using System.Data; public partial class Teacher_EnterMarks : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "initpage", "Sys.Application.add_load(addload);", true); if (!IsPostBack) { try { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value;

} catch (Exception ex) { }

} protected void cmbClasses_SelectedIndexChanged2(object sender, EventArgs e) {

var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value;

} protected void cmbSubjects_SelectedIndexChanged(object sender, EventArgs e) { var numAlpha = new Regex("(?<Alpha>[a-zA-Z]*)(?<Numeric>[0-9]*)"); var match = numAlpha.Match(Page.User.Identity.Name); var alpha = match.Groups["Alpha"].Value; var num = match.Groups["Numeric"].Value;

} }

K:\SpringDale\Teacher\Web.config
<?xml version="1.0"?> <configuration> <system.web> <authorization> <allow roles="Administrators"/> <allow roles="Teachers" /> <deny roles="Students"/> <deny users="*"/> </authorization> </system.web> </configuration>

You might also like