protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } var cUser = Utils.User; BestCenters bcenters = new BestCenters(); bcenters.LoadRows(); string CenterId = HttpContext.Current.Session["UserCenter"].ToString(); ltrCenters.Text = string.Join("", bcenters.TableRows.Rows.Select( x => (cUser.BestUser.IsAllowedCenter(x.Fields["CenterId"].fieldValue) ? "<option value=\"" + HttpUtility.HtmlEncode(x.Fields["CenterId"].fieldValue) + "\" " + (x.Fields["CenterId"].fieldValue.Equals(CenterId) ? "selected" :"") + " >" + HttpUtility.HtmlEncode(x.Fields["CenterId"].fieldValue) + "</option>" : "") ).ToArray()); if (IsPostBack) { string centerid = Request.Form["centerid"]; if (! string.IsNullOrEmpty(centerid)) { HttpContext.Current.Session["UserCenter"] = centerid; UserPrefs up = new UserPrefs(Utils.User.UserName); up.SetPreference("LastCenter", centerid); Response.Redirect("Dashboard.aspx"); } } }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.StudentMenu("studentinfo"); string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); string submitMode = Request["submitMode"]; if (IsPostBack) { if (!string.IsNullOrEmpty(submitMode)) { if (submitMode.Equals("add")) { if (!Utils.User.UserRoleByName("Student - Information").allowAdd) { Response.Write("You do not have rights to add."); return; } } if (submitMode.Equals("edit")) { if (!Utils.User.UserRoleByName("Student - Information").allowEdit) { Response.Write("You do not have rights to edit."); return; } } } } BestCenters bcs = new BestCenters(); bcs.LoadRows(); StringBuilder sbc = new StringBuilder(); sbc.Append("<option value=\"\"></option>"); for (int rnum = 0; rnum < bcs.TableRows.Count; rnum++) { string cid = bcs.TableRows[rnum].Fields["CenterId"].fieldValue; if (cid.Equals(Utils.User.CenterId)) { this.CenterId.Items.Add(cid); } //sbc.Append("<option value=\"" + HttpUtility.HtmlEncode(cid) + "\">" + HttpUtility.HtmlEncode(cid) + "</option>"); } //this.ltrCenters.Text = sbc.ToString(); this.ltrState.Text = Utils.StateOptions(); StringBuilder jsbp = new StringBuilder(); jsbp.Append("jsProg=["); StringBuilder sbp = new StringBuilder(); sbp.Append("<option value=\"\"></option>"); BestPrograms bps = new BestPrograms(); bps.LoadRows(); ListItem ltItem = new ListItem("", ""); this.proposedProg.Items.Add(ltItem); for (int rnum = 0; rnum < bps.TableRows.Count; rnum++) { string optext = bps.TableRows[rnum].Fields["programName"].fieldValue + ":" + bps.TableRows[rnum].Fields["programType"].fieldValue + ": Per " + bps.TableRows[rnum].Fields["amountType"].fieldValue; string optval = bps.TableRows[rnum].Fields["guidfield"].fieldValue; sbp.Append("<option value=\"" + HttpUtility.HtmlEncode(optval) + "\">" + HttpUtility.HtmlEncode(optext) + "</option>"); jsbp.Append("{\"guid\":\"" + optval + "\",\"amount\":\"" + bps.TableRows[rnum].Fields["amount"].fieldValue + "\",\"amountType\":\"" + bps.TableRows[rnum].Fields["amountType"].fieldValue + "\"}"); if (rnum < bps.TableRows.Count - 1) jsbp.Append(","); ltItem = new ListItem(optext, optval); this.proposedProg.Items.Add(ltItem); } jsbp.Append("]"); this.ltrprog1.Text = sbp.ToString(); this.ltrRelation.Text = Utils.RelationshipOptions(); if (!string.IsNullOrEmpty(submitMode) && submitMode.Equals("add") && !IsPostBack) { /* Get New Next Student ID */ BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = "Best_GetNextStudentId"; this.CenterId.SelectedIndex = 0; OleDbParameter p1 = new OleDbParameter("@xcenterid", OleDbType.VarChar, 10); p1.Value = this.CenterId.Items[0].Value; myCmd.Parameters.Add(p1); myCmd.CommandType = System.Data.CommandType.StoredProcedure; OleDbDataReader read = myCmd.ExecuteReader(); if (read.Read()) { string studentid = read.GetValue(0).ToString(); this.StudentId.Value = studentid; } } string studentguid = Request.QueryString["studentguid"]; Guid studentGuid = Guid.NewGuid(); if (!string.IsNullOrEmpty(studentguid)) { studentGuid = new Guid(studentguid); } StringBuilder jstdProg = new StringBuilder(); StringBuilder jstdPick = new StringBuilder(); StringBuilder jstdGPA = new StringBuilder(); jstdProg.AppendLine(""); jstdProg.Append("studentProg = ["); jstdPick.AppendLine(""); jstdPick.Append("pickupInfo = ["); string jsSelState = ""; jstdGPA.AppendLine(""); jstdGPA.Append("studentGPA = ["); if (submitMode.Equals("edit")) { /* Load Student Master */ try { List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = studentguid; bparams.Add(guid); bstdMast.LoadRows("guidfield=?", bparams); bstdPic.LoadRows("studentguid=?", bparams); bstdPay.LoadRows("studentguid=?", bparams); bstdRef.LoadRows("studentguid=?", bparams); bstdProg.LoadRows("studentguid=?", bparams); bstdPickup.LoadRows("studentguid=?", bparams); bstdGPA.LoadRows("studentguid=?", bparams); jsSelState = bstdMast.state; } catch (Exception ex) { Response.Write("Error:" + HttpUtility.HtmlEncode(ex.Message)); return; } if (!IsPostBack) { LoadForm(studentguid); } } if (IsPostBack) { doSave(studentGuid); } jstdProg.AppendLine(getStudentProgJS()); jstdPick.AppendLine(getStudentPickupJS()); jstdGPA.AppendLine(getStudentGPAJS()); jstdProg.Append("]"); jstdPick.Append("]"); jstdGPA.Append("]"); StringBuilder jsDateEvents = new StringBuilder(); jsDateEvents.AppendLine(""); jsDateEvents.AppendLine("$(document).ready(function(){"); jsDateEvents.AppendLine("$('#" + this.cellPhone.ClientID + ",#" + this.homePhone.ClientID + ",#" + this.workPhone.ClientID + ",#contact0').mask('(999) 999-9999')"); jsDateEvents.AppendLine("$('#" + this.joinDate.ClientID + ",#" + this.birthDate.ClientID + "').mask('99/99/9999');"); jsDateEvents.AppendLine("$('#" + this.joinDate.ClientID + ",#" + this.birthDate.ClientID + "').datepicker({ showOn: 'button', buttonImage: 'images/date.png', buttonImageOnly: true, changeYear: true, changeMonth: true });"); if (!string.IsNullOrEmpty(jsSelState)) { jsDateEvents.AppendLine("$('#selState').val('" + jsSelState + "');"); } jsDateEvents.AppendLine("$('#+" + this.firstName.ClientID + "').focus();"); jsDateEvents.AppendLine("});"); jsDateEvents.AppendLine("parentNameId = '" + this.parentName.ClientID + "';"); jsDateEvents.AppendLine("payeenameId = '" + this.paymentname1.ClientID + "';"); this.ltrProgScript.Text = "<script type=\"text/javascript\">" + jsbp.ToString() + jstdProg.ToString() + jstdPick.ToString() + jstdGPA.ToString() + jsDateEvents.ToString() + "</script>"; if (submitMode.Equals("edit")) { this.ltrPhoto.Text = "<a href=\"UploadPhoto.aspx?sid=" + HttpUtility.UrlEncode(this.StudentId.Value) + "&cid=" + HttpUtility.UrlEncode(this.CenterId.Value) + "\" target=\"_blank\">Choose Photo</a>"; } this.photoDisplay.Text = "<img id=\"empPhoto\" alt=\"Employee Photo\" src=\"getPhoto.aspx?sid=" + Server.UrlEncode(this.StudentId.Value) + "&cid=" + Server.UrlEncode(this.CenterId.Value) + "\" />"; }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.TutorMenu("tutorinfo"); string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); if (!Utils.User.UserRoleByName("Tutor - Information").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } this.ltrStateOpts.Text = Utils.StateOptions(); BestCenters bcs = new BestCenters(); bcs.LoadRows(); for (int rnum = 0; rnum < bcs.TableRows.Count; rnum++) { string cid = bcs.TableRows[rnum].Fields["CenterId"].fieldValue; if (cid.Equals(Utils.User.CenterId)) { this.CenterId.Items.Add(cid); } } string saveClicked = Request.Form["SaveClicked"] ?? ""; if (IsPostBack && saveClicked.Equals("1")) { BestTutors bs = new BestTutors(); string isnew = Request.Form["isnew"]; bool cansave = true; if (string.IsNullOrEmpty(isnew)) { List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = Request.Form["guidfield"]; bparams.Add(guid); if (!string.IsNullOrEmpty(guid.fieldValue)) { bs.LoadRows("guidfield=?", bparams); } else { string delguid = Request.Form["deleteguid"]; if (!string.IsNullOrEmpty(delguid)) { bparams[0].fieldValue = delguid; bs.LoadRows("guidfield=?", bparams); bs.CurrentRow.IsDelete = true; bs.CurrentRow.Save(); } cansave = false; } } if (cansave) { bs.TutorId = Request.Form["g_TutorId"]; bs.firstName = Request.Form["g_firstName"]; bs.lastName = Request.Form["g_lastName"]; bs.CenterId = this.CenterId.Value; if (string.IsNullOrEmpty(bs.TutorId)) { ltrValidateMsg.Text = Utils.WarningMessage("Tutor Id is Required."); cansave = false; } if (string.IsNullOrEmpty(bs.firstName) && string.IsNullOrEmpty(bs.lastName)) { ltrValidateMsg.Text = Utils.WarningMessage("First Name or Last Name is required"); cansave = false; } if (cansave) { bs.middleName = Request.Form["g_middleName"]; bs.address1 = Request.Form["g_address1"]; bs.address2 = Request.Form["g_address2"]; bs.city = Request.Form["g_city"]; bs.state = Request.Form["g_state"]; bs.zip = Request.Form["g_zip"]; bs.cellPhone = Request.Form["g_cellPhone"]; bs.workPhone = Request.Form["g_workPhone"]; bs.homePhone = Request.Form["g_homePhone"]; bs.emailId = Request.Form["g_emailId"]; bs.gender = Request.Form["g_gender"]; bs.School = Request.Form["g_school"]; bs.yearGraduated = Request.Form["g_yearGraduated"]; bs.GPA = Request.Form["g_GPA"]; bs.Major = Request.Form["g_Major"]; bs.Expertise = Request.Form["g_Expertise"]; bs.learningStyle = Request.Form["g_learningStyle"]; bs.Matchup = Request.Form["g_Matchup"]; bs.gradeLevels = Request.Form["g_gradeLevels"]; bs.otherSkill = Request.Form["g_otherSkill"]; bs.programStyle = Request.Form["g_programStyle"]; string salary = Request.Form["g_salary"]; string perhour = Request.Form["g_perhour"]; if (!string.IsNullOrEmpty(salary)) { bs.Salary = Convert.ToDecimal(salary); } if (!string.IsNullOrEmpty(perhour)) { bs.PerHour = Convert.ToDecimal(perhour); } if (!string.IsNullOrEmpty(Request.Form["g_joinDate"])) { bs.joinDate = Convert.ToDateTime(Request.Form["g_joinDate"]); } if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = "Best_GetNextTutorId"; OleDbParameter p1 = new OleDbParameter("@makehigherthan", OleDbType.VarChar, 10); p1.Value = "T0"; myCmd.Parameters.Add(p1); myCmd.CommandType = System.Data.CommandType.StoredProcedure; OleDbDataReader read = myCmd.ExecuteReader(); string tutorid = ""; if (read.Read()) { tutorid = read.GetValue(0).ToString(); } ltrLoadScript.Text = "<script type=\"text/javascript\">\n newtutorid='" + tutorid + "'\n</script>\n"; BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Tutuor Information"; bsGrid.GridTable = new BestTutors(); bsGrid.securityPage = "Tutor - Information"; ltrGrid.Text = bsGrid.ToHTML(); }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.StudentMenu("studentinfo"); if (!Utils.User.UserRoleByName("Student - Information").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); BestCenters bcs = new BestCenters(); bcs.LoadRows(); StringBuilder sbc = new StringBuilder(); sbc.Append("<option value=\"\"></option>"); for (int rnum = 0; rnum < bcs.TableRows.Count; rnum++) { string cid = bcs.TableRows[rnum].Fields["CenterId"].fieldValue; sbc.Append("<option value=\"" + HttpUtility.HtmlEncode(cid) + "\">" + HttpUtility.HtmlEncode(cid) + "</option>"); } this.ltrCenters.Text = sbc.ToString(); StringBuilder jsbp = new StringBuilder(); jsbp.Append("jsProg=["); StringBuilder sbp = new StringBuilder(); sbp.Append("<option value=\"\"></option>"); BestPrograms bps = new BestPrograms(); bps.LoadRows(); for (int rnum = 0; rnum < bps.TableRows.Count; rnum++) { string optext = bps.TableRows[rnum].Fields["programName"].fieldValue + ":" + bps.TableRows[rnum].Fields["programType"].fieldValue + ": Per " + bps.TableRows[rnum].Fields["amountType"].fieldValue; string optval = bps.TableRows[rnum].Fields["guidfield"].fieldValue; sbp.Append("<option value=\"" + HttpUtility.HtmlEncode(optval) + "\">" + HttpUtility.HtmlEncode(optext) + "</option>"); jsbp.Append("{\"guid\":\"" + optval + "\",\"amount\":\"" + bps.TableRows[rnum].Fields["amount"].fieldValue + "\",\"amountType\":\"" + bps.TableRows[rnum].Fields["amountType"].fieldValue + "\"}"); if (rnum < bps.TableRows.Count - 1) jsbp.Append(","); } jsbp.Append("]"); this.ltrProgScript.Text = "<script type=\"text/javascript\">" + jsbp.ToString() + "</script>"; this.ltrPrograms.Text = sbp.ToString(); this.ltrStateOpts.Text = Utils.StateOptions(); if (IsPostBack) { BestStudents bs = new BestStudents(); string isnew = Request.Form["isnew"]; bool cansave = true; if (string.IsNullOrEmpty(isnew)) { List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = Request.Form["guidfield"]; bparams.Add(guid); if (!string.IsNullOrEmpty(guid.fieldValue)) { bs.LoadRows("guidfield=?", bparams); } else { string delguid = Request.Form["deleteguid"]; if (!string.IsNullOrEmpty(delguid)) { bparams[0].fieldValue = delguid; bs.LoadRows("guidfield=?", bparams); bs.CurrentRow.IsDelete = true; bs.CurrentRow.Save(); } cansave = false; } } if (cansave) { bs.StudentId = Request.Form["g_StudentId"]; bs.CenterId = Request.Form["g_CenterId"]; bs.firstName = Request.Form["g_firstName"]; bs.lastName = Request.Form["g_lastName"]; if (string.IsNullOrEmpty(bs.StudentId)) { ltrValidateMsg.Text = Utils.WarningMessage("Student Id is Required."); cansave = false; } if (string.IsNullOrEmpty(bs.CenterId)) { ltrValidateMsg.Text = Utils.WarningMessage("Center Id is Required."); cansave = false; } if (string.IsNullOrEmpty(bs.firstName) && string.IsNullOrEmpty(bs.lastName)) { ltrValidateMsg.Text = Utils.WarningMessage("First Name or Last Name is required"); cansave = false; } if (cansave) { bs.middleName = Request.Form["g_middleName"]; bs.parentName = Request.Form["g_parentName"]; if(!string.IsNullOrEmpty(Request.Form["g_programGuid"])) bs.programGuid = new Guid(Request.Form["g_programGuid"]); bs.address1 = Request.Form["g_address1"]; bs.address2 = Request.Form["g_address2"]; bs.city = Request.Form["g_city"]; bs.state = Request.Form["g_state"]; bs.zip = Request.Form["g_zip"]; bs.cellPhone = Request.Form["g_cellPhone"]; bs.workPhone = Request.Form["g_workPhone"]; bs.homePhone = Request.Form["g_homePhone"]; bs.emailId = Request.Form["g_emailId"]; bs.gender = Request.Form["g_gender"]; bs.Hours = Request.Form["g_Hours"]; bs.hourType = Request.Form["g_hourType"]; bs.amountType = Request.Form["g_amountType"]; bs.Amount = Request.Form["g_Amount"]; string joinDate = Request.Form["g_joinDate"]; if (!string.IsNullOrEmpty(joinDate)) { bs.joinDate = Convert.ToDateTime(joinDate); } string birthDate = Request.Form["g_birthDate"]; if (!string.IsNullOrEmpty(birthDate)) { bs.joinDate = Convert.ToDateTime(birthDate); } if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Students Information"; bsGrid.GridTable = new BestStudents(); bsGrid.securityPage = "Student - Information"; ltrGrid.Text = bsGrid.ToHTML(); }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.SetupSubMenu("centers"); if (!Utils.User.UserRoleByName("Setup - Center Information").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; this.ltrMScript.Text = Utils.MenuSelectScript(ms); ltrState.Text = Utils.StateOptions(); string saveClicked = Request.Form["SaveClicked"] ?? ""; if (IsPostBack && saveClicked.Equals("1")) { BestCenters bs = new BestCenters(); string isnew = Request.Form["isnew"]; bool cansave = true; if (string.IsNullOrEmpty(isnew)) { List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = Request.Form["guidfield"]; bparams.Add(guid); if (!string.IsNullOrEmpty(guid.fieldValue)) { bs.LoadRows("guidfield=?", bparams); } else { string delguid = Request.Form["deleteguid"]; if (!string.IsNullOrEmpty(delguid)) { bparams[0].fieldValue = delguid; bs.LoadRows("guidfield=?", bparams); bs.CurrentRow.IsDelete = true; bs.CurrentRow.Save(); } cansave = false; } } if (cansave) { if (!string.IsNullOrEmpty(isnew)) { bs.CenterId = Request.Form["g_CenterId"]; } if (string.IsNullOrEmpty(bs.CenterId)) { ltrValidateMsg.Text = Utils.WarningMessage("Center Id is Required."); cansave = false; } if (cansave) { bs.address1 = Request.Form["g_address1"]; bs.address2 = Request.Form["g_address2"]; bs.city = Request.Form["g_city"]; bs.contactEMail = Request.Form["g_contactEMail"]; bs.contactName = Request.Form["g_contactName"]; bs.contactPhone = Request.Form["g_contactPhone"]; bs.state = Request.Form["g_state"]; bs.zip = Request.Form["g_zip"]; if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Center Information"; bsGrid.securityPage = "Setup - Center Information"; bsGrid.GridTable = new BestCenters(); ltrGrid.Text = bsGrid.ToHTML(); }