<pre lang="C#">using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Script.Serialization; using System.Collections.Specialized; namespace XeroConsultingWebApp { /// <summary> /// Summary description for JQGridHandler /// </summary> public class JQGridHandler : IHttpHandler { public void ProcessRequest(HttpContext context) { int userID = 0; //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); System.Collections.Specialized.NameValueCollection forms = context.Request.Form; string strOperation = forms.Get("oper"); RsHunterDBEntities ctx = new RsHunterDBEntities(); var userCollection = ctx.Users.Where(x => x.UserID == userID).ToList(); string strResponse = String.Empty; if (strOperation == null) { //oper = null which means its first load. var jsonSerializer = new JavaScriptSerializer(); context.Response.Write(jsonSerializer.Serialize(userCollection.AsQueryable<User>().ToList<User>())); } else if(strOperation == "del") { using (var ctx2 = new RsHunterDBEntities()) { var query = ctx.Users.Where(x => x.UserID == userID).First(); ctx.Users.Remove(query); ctx.SaveChanges(); } strResponse = "User Record Successfully Removed"; context.Response.Write(strResponse); } else { string strOut = String.Empty; context.Response.Write(strOut); } } public bool IsReusable { get { return false; } } public void AddEdit(NameValueCollection forms, RsHunterDBEntities myContext, out string strResponse, int userID) { string strOperation = forms.Get("oper"); string strUserId = string.Empty; if (strOperation == "add") { strUserId = forms.Get("UserID").ToString(); } else if(strOperation == "edit") { var result = myContext.Users.AsQueryable<User>().Select(x => x.UserID).Max(); strUserId = result.ToString(); } string strFirstName = forms.Get("FirstName"); string strLastName = forms.Get("LastName"); string strIsActive = forms.Get("IsActive").ToString(); string strDepartment = forms.Get("Department"); string strEmail = forms.Get("Email"); string strIsSuperAdmin = forms.Get("IsSuperAdmin").ToString(); string strJobRole = forms.Get("JobRole"); string strUsername = forms.Get("Username"); var queryUser = myContext.Users.Where(x => x.UserID == userID).First(); queryUser.UserID = Convert.ToInt32(strUserId); queryUser.FirstName = strFirstName; queryUser.LastName = strLastName; queryUser.IsActive = Convert.ToBoolean(strIsActive); queryUser.Department = strDepartment; queryUser.Email = strEmail; queryUser.IsSuperAdmin = Convert.ToBoolean(strIsSuperAdmin); queryUser.JobRole = strJobRole; queryUser.UserName = strUsername; myContext.Users.Add(queryUser); strResponse = "Record Successfully Updated"; } } }</pre> ====================================================================================== <pre lang="HTML"><%@ Master Language="C#" AutoEventWireup="true" CodeBehind="AlternateMaster.master.cs" Inherits="XeroConsultingWebApp.AlternateMaster" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <link rel="stylesheet" type="text/css" href="Content/bootstrap.min.css" /> <!--<link rel="stylesheet" type="text/css" href="Content/bootstrap.css" />--> <link rel="stylesheet" type="text/css" href="Content/default.css" /> <link rel="stylesheet" href="Content/font-awesome/css/font-awesome.min.css"/> <link rel="stylesheet" href="Content/accordion-menu.css" /> <script src="JQGridReq/jquery-1.9.0.min.js" type="text/javascript"></script> <link href="JQGridReq/jquery-ui-1.9.2.custom.css" rel="stylesheet" type="text/css" /> <script src="JQGridReq/jquery.jqGrid.js" type="text/javascript"></script> <link href="JQGridReq/ui.jqgrid.css" rel="stylesheet" type="text/css" /> <script src="JQGridReq/grid.locale-en.js" type="text/javascript"></script> <script type="text/javascript" src="/scripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="/Scripts/accordion-menu.js"></script> <script type="text/javascript" src="Scripts/checkAll.js"></script> <%--<link rel="stylesheet" type="text/css" href="Content/ui.jqgrid.css" />--%> </head> <body> <form runat="server"> <div id="header"> <div id="logo"><a href="Default.aspx"><img runat="server" src="images/logo.jpg" /></a></div> <div id="topnav"> <asp:Panel ID="Panel1" runat="server"> <asp:LoginView ID="LoginView1" runat="server"> <AnonymousTemplate> <asp:Panel ID="CtrlAnonymousPanel" runat="server"> <ul class="nav navbar-nav navbar-right"> <li><a runat="server" href="~/Account/Register.aspx">Register</a></li> <li><a runat="server" href="~/Account/Login.aspx">Log in</a></li> <li><a runat="server" href="~/Account/ForgotPassword.aspx">Forgot Password</a></li> </ul> </asp:Panel> </AnonymousTemplate> <LoggedInTemplate> <asp:Panel ID="CtrlLoggedInPanel" runat="server"> <ul class="nav navbar-nav navbar-right"> <li><a runat="server" href="~/Account/Manage" title="Manage your account">Hello, <%: Context.User.Identity.Name %> !</a></li> <li> <asp:LoginStatus runat="server" LogoutAction="Redirect" LogoutText="Log off" LogoutPageUrl="~/" OnLoggingOut="Unnamed_LoggingOut" /> </li> </ul> </asp:Panel> </LoggedInTemplate></asp:LoginView> </asp:Panel> </div> </div> <div id="banner"><img runat="server" src="images/banner.jpg" /> </div> <asp:ContentPlaceHolder ID="AlternateMasterContent" runat="server"> </asp:ContentPlaceHolder> <div class="clearfix"></div> <div id="container"> <div class="row"> <div class="col-md-4"> <i class="fa fa-user fa-4x" ></i> <h3>Competency Framework</h3> <p> ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model. A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access. </p> <div id="btn"> <a class="btn btn-primary btn-large" href="#">Read More</a> </div> </div> <div class="col-md-4"> <i class="fa fa-windows fa-4x" ></i> <h3>Competency Catalog</h3> <p> ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model. A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access. </p> <div id="btn1"> <a class="btn btn-primary btn-large" href="#">Read More</a> </div> </div> <div class="col-md-4"> <i class="fa fa-arrow-circle-o-down fa-4x" ></i> <h3>Competency Assessment</h3> <p> ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model. A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access. </p> <div id="btn2"> <a class="btn btn-primary btn-large" href="#">Read More</a> </div> </div> </div> </div> <div id="footer"> <p id="datePicker">&copy; <%: DateTime.Now.Year %> - Xero Consulting</p> </div> </form> </body> </html></pre>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)