protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] != null) { var cUser = Utils.User.BestUser; if (cUser != null) { var sessguid = HttpContext.Current.Session["SessionGuid"]; if (sessguid != null) { BestField sguid = new BestField() { fieldName = "sessionguid", fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, fieldSize = 40 }; sguid.fieldValue = sessguid.ToString(); BestLogins bslog = new BestLogins(); List<BestField> bparam = new List<BestField>(); bparam.Add(sguid); bslog.LoadRows("sessionguid=?", bparam); if (bslog.TableRows.Count > 0) { bslog.logoutdate = DateTime.Now; bslog.CurrentRow.Save(); } } } } Session.Contents.Abandon(); }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.TutorMenu("tutorpersonal"); if (!Utils.User.UserRoleByName("Tutor - Personal").allowView) { ltrPersonalData.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; this.ltrMScript.Text = Utils.MenuSelectScript(ms); string tutorguid = Utils.User.BestUser.tutorGuid.ToString(); BestField fld = new BestField() { fieldName = "guidfield", paramOledbType = System.Data.OleDb.OleDbType.Guid, fieldType = "System.Guid", fieldSize = 40 }; fld.fieldValue = tutorguid; List<BestField> bparam = new List<BestField>(); bparam.Add(fld); btu.LoadRows("guidfield=?", bparam); setdata(); }
public BestStudentNotes() { this.TableName = "BestStudentNotes"; this.SecurityPage = "Student - Notes"; TableFields.Add(new BestField() { fieldName = "guidfield", fieldHeader = "guid", displayField = false, fieldSize = 40, IsRequired = true, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid }); TableFields.Add(new BestField() { fieldName = "lastChange", fieldHeader = "Last Change", displayField = false, fieldSize = 20, IsRequired = true, fieldType = "System.DateTime", paramOledbType = System.Data.OleDb.OleDbType.DBTimeStamp }); TableFields.Add(new BestField() { fieldName = "lastChangeUser", fieldHeader = "Last Change User", displayField = false, fieldSize = 128, IsRequired = true, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar }); TableFields.Add(new BestField() { fieldName = "studentGuid", fieldHeader = "Student Name", displayField = true, fieldSize = 40, IsRequired = false, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayFormatFunc = new Func<BestRow,object>( (obj) => { BestRow bstd = (BestRow)obj; List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "studentGuid", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = bstd.Fields["studentGuid"].fieldValue; bparams.Add(guid); BestStudents bpstd = new BestStudents(); bpstd.LoadRows("guidfield=?", bparams); return bpstd.firstName + " " + bpstd.lastName; })}); TableFields.Add(new BestField() { fieldName = "noteDate", fieldHeader = "Note Date", displayField = true, fieldSize = 20, IsRequired = true, fieldType = "System.DateTime", paramOledbType = System.Data.OleDb.OleDbType.DBDate }); TableFields.Add(new BestField() { fieldName = "notes", fieldHeader = "Notes", displayField = true, fieldSize = 9000, IsRequired = true, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar}); TableFields.Add(new BestField() { fieldName = "CenterId", displayField = true, fieldHeader = "Center Id", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 50 }); TableFields.Add(new BestField() { fieldName = "StudentId", displayField = true, fieldHeader = "Student Id", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 50 }); }
private void Reload() { BestField bfld = new BestField() { fieldName = "username", fieldSize = 128, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar }; bfld.fieldValue = _username; List<BestField> bparam = new List<BestField>(); bparam.Add(bfld); userPrefs.LoadRows("username=?", bparam, "name"); }
public PaymentDetails() { this.TableName = "BestPaymentDetails"; this.SecurityPage = "Payment - Details"; TableFields.Add(new BestField() { fieldName = "paymentTypeGuid", fieldHeader = "Program Type", displayField = true, fieldSize = 128, IsRequired = true, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayFormatFunc = new Func<BestRow, object>((obj) => { BestRow pd = (BestRow)obj; List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "paymentTypeGuid", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = pd.Fields["paymentTypeGuid"].fieldValue; bparams.Add(guid); PaymentTypes bptype = new PaymentTypes(); bptype.LoadRows("guidfield=?", bparams); return bptype.paymentType; }) }); TableFields.Add(new BestField() { fieldName = "studentGuid", fieldHeader = "Student", displayField = true, fieldSize = 128, IsRequired = true, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayFormatFunc = new Func<BestRow,object>((obj)=> { BestRow pd = (BestRow)obj; List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "studentGuid", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = pd.Fields["studentGuid"].fieldValue; bparams.Add(guid); BestStudents bpstd = new BestStudents(); bpstd.LoadRows("guidfield=?", bparams); return bpstd.firstName + " " + bpstd.lastName; }) }); TableFields.Add(new BestField() { fieldName = "amount", fieldHeader = "Amount", displayField = true, fieldSize = 18, IsRequired = false, fieldType = "System.Decimal", paramOledbType = System.Data.OleDb.OleDbType.Decimal }); TableFields.Add(new BestField() { fieldName = "paymentDate", fieldHeader = "Payment Date", displayField = true, fieldSize = 10, IsRequired = false, fieldType = "System.DateTime", paramOledbType = System.Data.OleDb.OleDbType.DBTimeStamp, displayFormatFunc = new Func<BestRow,object>((obj)=> { BestRow br = (BestRow) obj; DateTime dt = Convert.ToDateTime(br.Fields["paymentDate"].fieldValue); return dt.ToString("MM/dd/yyyy"); }) }); TableFields.Add(new BestField() { fieldName = "guidfield", fieldHeader = "guid", displayField = false, fieldSize = 40, IsRequired = false, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid }); TableFields.Add(new BestField() { fieldName = "lastChange", fieldHeader = "Last Change", displayField = false, fieldSize = 20, IsRequired = false, fieldType = "System.DateTime", paramOledbType = System.Data.OleDb.OleDbType.DBTimeStamp }); TableFields.Add(new BestField() { fieldName = "lastChangeUser", fieldHeader = "Last Change User", displayField = false, fieldSize = 128, IsRequired = false, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar }); TableFields.Add(new BestField() { fieldName = "hours", fieldHeader = "Hours", displayField = true, fieldSize = 18, IsRequired = false, fieldType = "System.Decimal", paramOledbType = System.Data.OleDb.OleDbType.Decimal, Precision = 18, scale = 2 }); TableFields.Add(new BestField() { fieldName = "CenterId", displayField = true, fieldHeader = "Center Id", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 50 }); }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } string exportguid = Request.Form["exportguid"]; if (string.IsNullOrEmpty(exportguid)) { exportguid = Request.QueryString["exportguid"]; } if (!string.IsNullOrEmpty(exportguid)) { List<BestField> bparam = new List<BestField>(); BestField fld = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid }; fld.fieldValue = exportguid; bparam.Add(fld); BestExports bexp = new BestExports(); bexp.LoadRows("guidfield=?", bparam); BestExportFields bexpFields = new BestExportFields(); bexpFields.LoadRows("exportguid=?", bparam, "ordinal"); string selfields = string.Join(",", bexpFields.TableRows.Rows.Select(x => x.Fields["fieldname"].fieldValue).ToArray()); selfields = ReplaceT1(selfields); string headers = "\"" + string.Join("\",\"",bexpFields.TableRows.Rows.Select(x=>x.Fields["displayname"].fieldValue).ToArray()) + "\"\n"; string filedata = getExportData(bexp.exportType, selfields); byte[] bytedata = strToByteArray(filedata); MemoryStream ms = new MemoryStream(); byte[] bytes = strToByteArray(headers); ms.Write(bytes, 0, bytes.Length); ms.Write(bytedata, 0, bytedata.Length); string dest = bexp.exportType + DateTime.Today.ToString("MMddyyyy") + ".csv"; Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/csv"; Response.AddHeader("Content-Disposition", "attachment; filename=" + dest); Response.OutputStream.Write(ms.ToArray(), 0, ms.ToArray().Length); Response.Flush(); Response.Close(); ms.Close(); } }
public BestStudentPicture() { this.TableName = "BestStudentPicture"; this.SecurityPage = "Student - Information"; TableFields.Add(new BestField() { fieldName = "guidfield", displayField = false, fieldHeader = "Guid", fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, fieldSize = 40 }); TableFields.Add(new BestField() { fieldName = "lastChange", displayField = false, fieldHeader = "Last Change", fieldType = "System.DateTime", paramOledbType = System.Data.OleDb.OleDbType.DBTime, fieldSize = 20 }); TableFields.Add(new BestField() { fieldName = "lastChangeUser", displayField = false, fieldHeader = "Last Change User", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 128 }); TableFields.Add(new BestField() { fieldName = "CenterId", displayField = true, fieldHeader = "Center Id", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 50 }); TableFields.Add(new BestField() { fieldName = "StudentId", displayField = true, fieldHeader = "Student Id", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 50 }); TableFields.Add(new BestField() { fieldName = "studentGuid", fieldHeader = "Student Name", displayField = true, fieldSize = 128, IsRequired = true, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayFormatFunc = new Func<BestRow, object>((obj) => { BestRow pd = (BestRow)obj; List<BestField> bparams = new List<BestField>(); BestField guid = new BestField() { fieldName = "studentGuid", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; guid.fieldValue = pd.Fields["studentGuid"].fieldValue; bparams.Add(guid); BestStudents bpstd = new BestStudents(); bpstd.LoadRows("guidfield=?", bparams); return bpstd.firstName + " " + bpstd.lastName; }) }); TableFields.Add(new BestField() { fieldName = "picture", displayField = false, fieldHeader = "Photo", fieldType = "System.byte[]", paramOledbType = System.Data.OleDb.OleDbType.LongVarBinary, fieldSize = -1 }); TableFields.Add(new BestField() { fieldName = "photoSize", displayField = false, fieldHeader = "Photo Size", fieldType = "System.Decimal", paramOledbType = System.Data.OleDb.OleDbType.Decimal, fieldSize = 18 }); TableFields.Add(new BestField() { fieldName = "photoName", displayField = true, fieldHeader = "Photo Name", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 200 }); //hobbies,personality,goals,learningstyle,tutorpreference, TableFields.Add(new BestField() { fieldName = "hobbies", displayField = false, fieldHeader = "Hobbies", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 500 }); TableFields.Add(new BestField() { fieldName = "personality", displayField = false, fieldHeader = "Personality", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 500 }); TableFields.Add(new BestField() { fieldName = "goals", displayField = false, fieldHeader = "Goals", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 500 }); TableFields.Add(new BestField() { fieldName = "learningstyle", displayField = false, fieldHeader = "Learning Style", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 500 }); TableFields.Add(new BestField() { fieldName = "tutorpreference", displayField = false, fieldHeader = "Tutor Preference", fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 50 }); }
public void SetPreference(string name, string value) { BestUserPrefs upf = new BestUserPrefs(); BestField bfld = new BestField() { fieldName = "username", fieldSize = 128, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar }; bfld.fieldValue = _username; BestField bfld1 = new BestField() { fieldName = "Name", fieldSize = 50, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar }; bfld1.fieldValue = name; List<BestField> bparam = new List<BestField>(); bparam.Add(bfld); bparam.Add(bfld1); upf.LoadRows("username=? and name=?", bparam); upf.UserName = _username; upf.Name = name; upf.Value = value; upf.CurrentRow.Save(); Reload(); }
private void SaveGPA(Guid studentGuid) { string assessmentData = Request.Form["assessmentData"]; if (!string.IsNullOrEmpty(assessmentData)) { string[] aryGPA = assessmentData.Split('\n'); for (int i = 0; i < aryGPA.Length; i++) { string[] aryFields = aryGPA[i].Split('\t'); if (aryFields[0].Length > 16) { /* Edit or Delete */ BestStudentGPA bstudGPA = new BestStudentGPA(); 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 = aryFields[0]; bparams.Add(guid); if (!string.IsNullOrEmpty(guid.fieldValue)) { bstudGPA.LoadRows("guidfield=?", bparams); } if (!string.IsNullOrEmpty(aryFields[1])) bstudGPA.assessmentDate = Convert.ToDateTime(aryFields[1]); bstudGPA.assessmentGPA = aryFields[2]; bstudGPA.assessmentLevel = aryFields[3]; bstudGPA.CurrentRow.IsDelete = aryFields[4].Equals("true\r"); bstudGPA.CurrentRow.Save(); } else if (aryFields[0].Length != 0) { /* Add */ BestStudentGPA bstudGPA = new BestStudentGPA(); bstudGPA.studentGuid = studentGuid; if(!string.IsNullOrEmpty( aryFields[1])) bstudGPA.assessmentDate = Convert.ToDateTime(aryFields[1]); bstudGPA.assessmentGPA = aryFields[2]; bstudGPA.assessmentLevel = aryFields[3]; bstudGPA.StudentId = this.StudentId.Value; bstudGPA.CenterId = this.CenterId.Value; bstudGPA.CurrentRow.Save(); } } } }
private void SendEMails() { /* Send EMails */ string strRows = Request.Form["rowcount"]; int rowCount; int.TryParse(strRows, out rowCount); List<BestField> bparams = new List<BestField>(); string paramQs = ""; for (int i = 0; i < rowCount; i++) { string chkStr = Request.Form["chk_" + i.ToString()]??""; if (chkStr.Equals("on")) { BestField bsf = new BestField() { fieldName = "guidfield", paramOledbType = System.Data.OleDb.OleDbType.Guid, fieldType = "System.Guid" }; bsf.fieldValue = Request.Form["guid" + i.ToString()]; bparams.Add(bsf); paramQs += "?,"; } } paramQs = (paramQs.Length > 0) ? paramQs.Substring(0, paramQs.Length - 1) : ""; string selWho = Request.Form["selWho"]; if (bparams.Count > 0) { Dictionary<string, BMails> nvc = new Dictionary<string, BMails>(); string emailBody = getEMailBody(); if (selWho.Equals("Student")) { BestStudents bs = new BestStudents(); bs.LoadRows("guidfield in (" + paramQs + ")", bparams); for (int i = 0; i < bs.TableRows.Count; i++) { bs.currentRowId = i; BMails bm = new BMails(); bm.emailbody = ReplaceParams(bs, emailBody); bm.emailToName = bs.firstName + " " + bs.lastName; nvc.Add(bs.emailId, bm); } } else if (selWho.Equals("Tutor")) { BestTutors bt = new BestTutors(); bt.LoadRows("guidfield in (" + paramQs + ")", bparams); for (int i = 0; i < bt.TableRows.Count; i++) { bt.currentRowId = i; BMails bm = new BMails(); bm.emailbody = ReplaceParams(bt, emailBody); bm.emailToName = bt.firstName + " " + bt.lastName; nvc.Add(bt.emailId, bm); } } string emailSubject = Request.Form["emailSubject"] ?? ""; string message = "Send EMail To:\n"; foreach (string key in nvc.Keys) { BMails bm = (BMails)nvc[key]; if (Utils.User.emailUtil.Send(key, emailSubject, bm.emailbody, bm.emailToName)) { message += key + " " + bm.emailToName + "\n"; } } ltrValidateMsg.Text = Utils.InfoMessage(message); } }
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.UtilityMenu("exportexcel"); string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); if (!Utils.User.UserRoleByName("Export To Excel").allowView) { ltrValidateMsg.Text = "You do not have rights to view."; return; } if (IsPostBack) { BestExports bs = new BestExports(); string isnew = Request.Form["isnew"]; bool cansave = true; Guid exportGuid = Guid.NewGuid(); 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 (Utils.IsGuid(guid.fieldValue)) { exportGuid = new Guid(guid.fieldValue); } 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; } } else { bs.guidfield = exportGuid; } if (cansave) { if (!string.IsNullOrEmpty(isnew)) { bs.exportName = Request.Form["g_exportName"]; } if (string.IsNullOrEmpty(bs.exportName)) { ltrValidateMsg.Text = Utils.WarningMessage("Export Name is Required."); cansave = false; } if (cansave) { bs.exportType = Request.Form["g_exportType"]; bs.exportTitle = Request.Form["g_exportTitle"]; if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } else { /* Insert or Update Export Fields */ string FieldData = Request.Form["hidExportData"] ?? ""; if (!string.IsNullOrEmpty(FieldData)) { string[] lines = FieldData.Split('\n'); int i = 0; foreach (string line in lines) { if (!string.IsNullOrEmpty(line)) { string[] fields = line.Replace("\r","").Split('\t'); //0.guidfield 1.exportguid 2.fieldname 3.displayname 4.isnew 5.isdeleted if (fields[4].Equals("1")) { if (fields[5].Equals("0") && (!string.IsNullOrEmpty(fields[2]))) { /* Add New */ BestExportFields bexpfld = new BestExportFields(); bexpfld.exportguid = exportGuid; bexpfld.fieldName = fields[2]; bexpfld.displayName = fields[3]; int idx; int.TryParse(fields[6], out idx); bexpfld.Ordinal = idx; if (!bexpfld.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } else { /* Update */ List<BestField> bparam = new List<BestField>(); BestField fguid = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = System.Data.OleDb.OleDbType.Guid, displayField = false }; fguid.fieldValue = fields[0]; bparam.Add(fguid); BestExportFields bsFields = new BestExportFields(); bsFields.LoadRows("guidfield=?", bparam); bsFields.fieldName = fields[2]; bsFields.displayName = fields[3]; int idx; int.TryParse(fields[6], out idx); bsFields.Ordinal = idx; bsFields.CurrentRow.IsDelete = fields[5].Equals("1"); if (!bsFields.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } } } } } if ((Request.Form["SaveAndExport"] ?? "").Equals("1")) { ltrExportScript.Text = @"<script type=""text/javascript"">$(document).ready(function(){ $('#addiframe').html('<iframe src = ""DownloadExport.aspx?exportguid=" + exportGuid + @""" /></iframe>'); });</script>"; } } ltrPageScript.Text = "<script type=\"text/javascript\">" + ExportFieldJS() +"\n" + ExportMastTableJs() + "</script>"; BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Export Information"; bsGrid.securityPage = "Export To Excel"; bsGrid.GridTable = new BestExports(); bsGrid.extraRowHTML = "<a href=\"DownloadExport.aspx?exportguid=[paramGuid]\" ><img src=\"images\\xls.gif\" alt=\"runexport\" /></a>"; 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("studentreports"); if (!Utils.User.UserRoleByName("Student - Reports").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); StringBuilder rowshtml = new StringBuilder(); string fromdate = Request.Form["fromdate"]; if (string.IsNullOrEmpty(fromdate)) fromdate = DateTime.Today.ToString("MM/dd/yyyy"); string todate = Request.Form["todate"]; if (string.IsNullOrEmpty(todate)) todate = DateTime.Today.AddMonths(1).AddDays(-1).ToString("MM/dd/yyyy"); string summaryby = Request.Form["summaryby"]; if (string.IsNullOrEmpty(summaryby)) summaryby = ""; bool chkStudentName = (Request.Form["chkStudentName"] ?? "").Equals("on"); bool chkParentName = (Request.Form["chkParentName"] ?? "").Equals("on"); bool chkAddress = (Request.Form["chkAddress"]??"").Equals("on"); bool chkTutorName = (Request.Form["chkTutorName"]??"").Equals("on"); bool chkTotalHours = (Request.Form["chkTotalHours"]??"").Equals("on"); bool chkTotalAmountPaid = (Request.Form["chkTotalAmountPaid"]??"").Equals("on"); bool chkTotalAmountCharged = (Request.Form["chkTotalAmountCharged"]??"").Equals("on"); bool chkAmountDue = (Request.Form["chkAmountDue"]??"").Equals("on"); bool chkPayDate = (Request.Form["chkPayDate"]??"").Equals("on"); bool chkProgramDesc = (Request.Form["chkProgramDesc"]??"").Equals("on"); bool chkNotes = (Request.Form["chkNotes"] ?? "").Equals("on"); if (!IsPostBack) { chkStudentName = true; chkTotalHours = true; chkTotalAmountPaid = true; chkTotalAmountCharged = true; chkAmountDue = true; chkPayDate = true; } if (IsPostBack) { bool canReport = true; if (!string.IsNullOrEmpty(fromdate)) { try { DateTime fromdt = Convert.ToDateTime(fromdate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("From Date is Required."); canReport = false; } if (!string.IsNullOrEmpty(todate)) { try { DateTime todt = Convert.ToDateTime(todate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("To Date is Required."); canReport = false; } if (canReport) { BestField bffromdate = new BestField() { fieldName = "fromdate", fieldSize = 40, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false }; bffromdate.fieldValue = fromdate.Substring(6, 4) + fromdate.Substring(0, 2) + fromdate.Substring(3, 2); BestField bftodate = new BestField() { fieldName = "todate", fieldSize = 40, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false }; bftodate.fieldValue = todate.Substring(6, 4) + todate.Substring(0, 2) + todate.Substring(3, 2); BestField GuidField = new BestField() { fieldName = "guidfield", fieldSize = 40, fieldType = "System.Guid", paramOledbType = OleDbType.Guid, displayField = false }; string StudentGuid = Request.Form["StudentGuid"] ?? ""; GuidField.fieldValue = StudentGuid; string tsql = "select schdate, studentid, BestStudents.firstName + ' ' + BestStudents.lastName as StudentName, BestStudents.ParentName, BestStudents.address1 + ' ' + BestStudents.address2 as address, BestStudents.city + ' ' + BestStudents.state + ' ' + BestStudents.zip as csz, BestStudents.homephone as homephone, BestStudents.workphone as workphone, BestStudents.emailid, case when trantype='Scheduled' then isnull(vbest.amount,0) else 0 end as tobecharged, case when trantype!='Scheduled' then vbest.amount else 0 end as paid, vbest.hours, case trantype when 'Scheduled' then case vbest.attendance when 0 then 'Charged' when 1 then 'Informed' when 2 then 'No Charge' end else 'Payment' end transType, bprog.programName + ':' + bprog.programType programName, BestTutors.firstName + ' ' + BestTutors.lastName as TutorName, vbest.note from VBestSchedulesAndPayments vbest inner join BestStudents on beststudents.guidfield = vbest.studentguid left join BestPrograms bprog on bprog.guidfield = vbest.programguid left join BestTutors on BestTutors.guidfield = vbest.tutGuid where schdate >= ? and schdate <= ? and BestStudents.CenterId=? " ; if (!string.IsNullOrEmpty(StudentGuid)) { tsql = tsql + " and BestStudents.guidfield=? "; } tsql += " order by StudentName, schDate"; BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = tsql; myCmd.Parameters.Add(bffromdate.Param); myCmd.Parameters.Add(bftodate.Param); myCmd.Parameters.Add(Utils.User.CenterIdField.Param); if (!string.IsNullOrEmpty(StudentGuid)) { myCmd.Parameters.Add(GuidField.Param); } OleDbDataReader tblReader = myCmd.ExecuteReader(); double total = 0; double chargedTotal = 0; double totalHours = 0; int colSpan = 0; rowshtml.Append("<br /><div id=\"studentReport\"><table class=\"tblreports\" cellspacing=\"0\" cellpadding=\"0\">"); rowshtml.Append("<thead><tr><td colspan=\"9\" style=\"font-weight:bold;font-size:12px;\">" + Utils.User.CenterId + " Students Report</td></thead>"); rowshtml.Append("<tr>"); if (chkPayDate) { rowshtml.Append("<th>Date</th>"); colSpan++; } rowshtml.Append("<th>Student Id</th>"); colSpan++; if (chkStudentName) { rowshtml.Append("<th>Student Name</th>"); colSpan++; } if (chkParentName) { rowshtml.Append("<th>Parent Name</th>"); colSpan++; } if (chkAddress) { rowshtml.Append("<th>Contact Info</th>"); rowshtml.Append("<th>Home Phone</th>"); rowshtml.Append("<th>Work Phone</th>"); rowshtml.Append("<th>E-Mail Id</th>"); colSpan += 4; } if (chkProgramDesc) { rowshtml.Append("<th>Program Name</th>"); colSpan++; } if (chkTutorName) { rowshtml.Append("<th>Tutor Name</th>"); colSpan++; } if (chkNotes) { rowshtml.Append("<th>Notes</th>"); colSpan++; } rowshtml.Append("<th>Trans Type</th>"); colSpan++; rowshtml.Append("<th>Charged Amount</th>"); rowshtml.Append("<th>Amount Paid</th>"); rowshtml.Append("<th>Hours</th>"); rowshtml.Append("<th>Balance</th>"); rowshtml.Append("</tr>"); string studentid = ""; int Cnt = 0; string studName = ""; double grandTotal = 0; while (tblReader.Read()) { string stuid = tblReader[1].ToString(); if (!studentid.Equals(stuid) && (Cnt > 0)) { /* Totals for the Student */ rowshtml.Append("<tr><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"" + colSpan.ToString() + "\">" + studName + " Total </td>"); if (chkTotalAmountCharged) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + chargedTotal.ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkTotalAmountPaid) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + total.ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkTotalHours) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + totalHours.ToString("0") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkAmountDue) { rowshtml.Append("<td class=\"ra\" style=\"white-space:nowrap;background-color:#fff;padding-right:3px;\">" + (total - chargedTotal).ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } rowshtml.Append("</tr>"); chargedTotal = 0; total = 0; totalHours = 0; } studentid = stuid; Cnt++; string paydate = tblReader[0].ToString(); paydate = paydate.Substring(4, 2) + "/" + paydate.Substring(6, 2) + "/" + paydate.Substring(0, 4); studName = tblReader[2].ToString(); string parentName = tblReader[3].ToString(); string address = tblReader[4].ToString() + " " + tblReader[5].ToString(); string homephone = tblReader[6].ToString(); string workphone = tblReader[7].ToString(); string emailid = tblReader[8].ToString(); string tranType = tblReader[12].ToString(); Double chargedAmt = 0; Double.TryParse(tblReader[9].ToString(), out chargedAmt); if (tranType.Equals("Informed")) { chargedAmt = 0; } Double payAmt = 0; Double.TryParse(tblReader[10].ToString(), out payAmt); Double hours = 0; Double.TryParse(tblReader[11].ToString(), out hours); totalHours += hours; string progName = tblReader[13].ToString(); string tutorName = tblReader[14].ToString(); string notes = tblReader[15].ToString(); total += payAmt; chargedTotal += chargedAmt; grandTotal += chargedAmt; string strPayAmt = (payAmt > 0) ? payAmt.ToString("$0.00") : " "; string strChargedAmt = (chargedAmt > 0) ? chargedAmt.ToString("$0.00") : " "; rowshtml.Append("<tr>"); if (chkPayDate) { rowshtml.Append("<td>" + paydate + "</td>"); } rowshtml.Append("<td>" + HttpUtility.HtmlEncode(stuid) + "</td>"); if (chkStudentName) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(studName) + "</td>"); } if (chkParentName) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(parentName) + "</td>"); } if (chkAddress) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(address) + "</td>"); rowshtml.Append("<td>" + HttpUtility.HtmlEncode(homephone) + "</td>"); rowshtml.Append("<td>" + HttpUtility.HtmlEncode(workphone) + "</td>"); rowshtml.Append("<td>" + HttpUtility.HtmlEncode(emailid) + "</td>"); } if (chkProgramDesc) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(progName) + "</td>"); } if (chkTutorName) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(tutorName) + "</td>"); } if (chkNotes) { rowshtml.Append("<td>" + HttpUtility.HtmlEncode(notes) + "</td>"); } rowshtml.Append("<td>" + HttpUtility.HtmlEncode(tranType) + "</td>"); rowshtml.Append("<td class=\"ra\" style=\"padding-right:3px;\">" + strChargedAmt + "</td>"); rowshtml.Append("<td class=\"ra\" style=\"padding-right:3px;\">" + strPayAmt + "</td>"); rowshtml.Append("<td class=\"ra\">" + HttpUtility.HtmlEncode(hours.ToString("0")) + "</td></tr>"); } rowshtml.Append("<tr><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"" + colSpan.ToString() + "\">" + studName + " Total </td>"); if (chkTotalAmountCharged) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + chargedTotal.ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkTotalAmountPaid) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + total.ToString("$0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkTotalHours) { rowshtml.Append("<td class=\"ra\" style=\"background-color:#fff;padding-right:3px;\">" + totalHours.ToString("0") + "</td>"); } else { rowshtml.Append("<td> </td>"); } if (chkAmountDue) { rowshtml.Append("<td class=\"ra\" style=\"white-space:nowrap;background-color:#fff;padding-right:3px;\">" + (total - chargedTotal).ToString("0.00") + "</td>"); } else { rowshtml.Append("<td> </td>"); } rowshtml.Append("</tr>"); rowshtml.Append("<tr><td style=\"font-weight:bold;\">Grand Total</td><td>" + Server.HtmlEncode(fromdate + " to " + todate) + "</td><td colspan=\"3\" style=\"text-align:right;font-weight:bold;\">" + grandTotal.ToString("$0.00") + "</td></tr>"); rowshtml.Append("</table></div><br />"); rowshtml.Append("<div><input type=\"button\" value=\"Print\" onclick=\"PrintTable('studentReport');\" /></div>"); } } StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"centered\">"); sb.Append("<table class=\"bestgrid\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">"); sb.Append("<tr><td style=\"text-align:center;\" colspan=\"4\">Student Reports</td></tr>"); sb.Append("<tr><td>From Date <input type=\"text\" id=\"fromdate\" name=\"fromdate\" size=\"9\" maxlength=\"10\" value=\"" + Server.HtmlEncode(fromdate) + "\" /></td><td>To Date <input type=\"text\" id=\"todate\" name=\"todate\" size=\"9\" maxlength=\"10\" value=\"" + Server.HtmlEncode(todate) + "\" /></td>"); sb.Append("<td>Summary By <select id=\"summaryby\" name=\"summaryby\"><option value=\"\"></option>"); sb.Append("<option value=\"paydate\" " + (summaryby.Equals("paydate") ? " selected " : "") + ">Payment Date</option>"); sb.Append("<option value=\"payweek\" " + (summaryby.Equals("payweek") ? " selected " : "") + ">Week</option>"); sb.Append("<option value=\"paymonth\" " + (summaryby.Equals("paymonth") ? " selected " : "") + ">Month</option>"); sb.Append("<option value=\"payyear\" " + (summaryby.Equals("payyear") ? " selected " : "") + ">Year</option>"); sb.Append("</select></td></tr>"); sb.Append("<tr><td><input type=\"checkbox\" id=\"chkStudentName\" name=\"chkStudentName\" " + (chkStudentName ? "checked=\"checked\"" : "") + " /><label for=\"chkStudentName\">Student Name</lable></td><td><input type=\"checkbox\" id=\"chkParentName\" name=\"chkParentName\" " + (chkParentName ? "checked=\"checked\"" : "") + " /><label for=\"chkParentName\">Parent Name</label></td><td><input type=\"checkbox\" id=\"chkAddress\" name=\"chkAddress\" " + (chkAddress ? "checked=\"checked\"" : "") + " /><label for=\"chkAddress\">Contact Info</label></td></tr>"); sb.Append("<tr><td><input type=\"checkbox\" name=\"chkTutorName\" id=\"chkTutorName\" " + (chkTutorName ? "checked=\"checked\"" : "") + " /><label for=\"chkTutorName\">Tutor name</label></td><td><input type=\"checkbox\" id=\"chkTotalHours\" name=\"chkTotalHours\" " + (chkTotalHours ? "checked=\"checked\"" : "") + " /><lable for=\"chkTotalHours\">Total Hours</label></td><td><input type=\"checkbox\" id=\"chkTotalAmountPaid\" name=\"chkTotalAmountPaid\" " + (chkTotalAmountPaid ? "checked=\"checked\"" : "") + " /><label for=\"chkTotalAmountPaid\">Total Amount Paid</lable></td></tr>"); sb.Append("<tr><td><input type=\"checkbox\" id=\"chkTotalAmountCharged\" name=\"chkTotalAmountCharged\" " + (chkTotalAmountCharged ? "checked=\"checked\"" : "") + " /><label for=\"chkTotalAmountCharged\">Total Amount Charged</label></td><td><input type=\"checkbox\" id=\"chkAmountDue\" name=\"chkAmountDue\" " + (chkAmountDue ? "checked=\"checked\"" : "") + " /><label for=\"chkAmountDue\">Amount Due</label></td><td><input type=\"checkbox\" id=\"chkPayDate\" name=\"chkPayDate\" " + (chkPayDate ? "checked=\"checked\"" : "") + " /><label for=\"chkPayDate\">Payment Date</label></td></tr>"); sb.Append("<tr><td><input type=\"checkbox\" id=\"chkProgramDesc\" name=\"chkProgramDesc\" " + (chkProgramDesc ? "checked=\"checked\"" : "") + " /><label for=\"chkProgramDesc\">Program Description</label></td><td><input type=\"checkbox\" id=\"chkNotes\" name=\"chkNotes\" " + (chkNotes ? "checked=\"checked\"" : "") + " /><label for=\"chkNotes\">Additional notes</label></td>"); sb.Append("<td>Student <select id=\"StudentGuid\" name=\"StudentGuid\">" + StudentOptions() + "</select></td></tr>"); sb.Append("<tr><td colspan=\"3\" style=\"text-align:center;\" ><input type=\"button\" value=\"Submit\" onclick=\"submit();\" /></td></tr>"); sb.Append("</table>"); ltrGrid.Text = sb.ToString() + rowshtml.ToString() + "</div>"; }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.PaymentMenu("paymentdetails"); if (!Utils.User.UserRoleByName("Payment - Details").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); string saveClicked = Request.Form["SaveClicked"] ?? ""; if (IsPostBack && saveClicked.Equals("1")) { PaymentDetails bs = new PaymentDetails(); 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) { string stdguid = Request.Form["g_studentGuid"]; string payguid = Request.Form["g_paymentTypeGuid"]; string amt = Request.Form["g_amount"]; string paydate = Request.Form["g_paymentDate"]; string hours = Request.Form["g_hours"]; if (string.IsNullOrEmpty(payguid)) { ltrValidateMsg.Text = Utils.WarningMessage("Payment Type is Required."); cansave = false; } if (string.IsNullOrEmpty(stdguid)) { ltrValidateMsg.Text = Utils.WarningMessage("Student is Required."); cansave = false; } if (string.IsNullOrEmpty(paydate)) { ltrValidateMsg.Text = Utils.WarningMessage("Payment Date is Required."); cansave = false; } if (cansave) { bs.studentGuid = new Guid(stdguid); bs.paymentTypeGuid = new Guid(payguid); bs.amount = amt; Decimal dhours; Decimal.TryParse(hours, out dhours); bs.hours = dhours; bs.paymentDate = Convert.ToDateTime(paydate); bs.CenterId = Utils.User.CenterId; if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } PaymentTypes bpayTypes = new PaymentTypes(); bpayTypes.LoadRows(); StringBuilder sbc = new StringBuilder(); sbc.Append("<option value=\"\"></option>"); for (int rnum = 0; rnum < bpayTypes.TableRows.Count; rnum++) { string paytype = bpayTypes.TableRows[rnum].Fields["paymentType"].fieldValue; string guid = bpayTypes.TableRows[rnum].Fields["guidfield"].fieldValue; sbc.Append("<option value=\"" + HttpUtility.HtmlEncode(guid) + "\">" + HttpUtility.HtmlEncode(paytype) + "</option>"); } ltrPayTypes.Text = sbc.ToString(); /* Auto Student */ string autoSample = "{value:\"[paramValue]\", label:[paramLabel]}"; StringBuilder sb = new StringBuilder(); sb.AppendLine("autoStudents = ["); BestStudents bstd = new BestStudents(); bstd.LoadRows("CenterId=?", Utils.User.CIdParam); for (int s = 0; s < bstd.TableRows.Count; s++) { string result = autoSample; result = result.Replace("[paramValue]", bstd.TableRows[s].Fields["guidfield"].fieldValue); result = result.Replace("[paramLabel]", Utils.EnquoteJS((bstd.TableRows[s].Fields["firstName"].fieldValue ?? "") + " " + (bstd.TableRows[s].Fields["lastName"].fieldValue ?? ""))); sb.Append(result); if (s < bstd.TableRows.Count - 1) sb.AppendLine(","); } sb.AppendLine("];"); ltrScript.Text = @"<script type=""text/javascript""> $(document).ready(function(){ " + sb.ToString() + @" $('#studentTag1').autocomplete( { source:autoStudents, delay: 0, select : function( event, ui){ $('#studentGuid').val( ui.item.value ); $( this ).val( ui.item.label ); return false; } } ); }); </script>"; BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Payment Details"; bsGrid.GridTable = new PaymentDetails(); bsGrid.securityPage = "Payment - Details"; 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.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("studentdocument"); if (!Utils.User.UserRoleByName("Student - Documents").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; this.ltrMScript.Text = Utils.MenuSelectScript(ms); string saveClicked = Request.Form["SaveClicked"] ?? ""; if (IsPostBack && saveClicked.Equals("1")) { BestDocuments bs = new BestDocuments(); 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)) { string guid = Request.Form["g_studentGuid"]; if (string.IsNullOrEmpty(guid)) { ltrValidateMsg.Text = Utils.WarningMessage("Student Name is Required."); cansave = false; } bs.studentGuid = new Guid(guid); } if (cansave) { bool showToStudent = (Request.Form["g_showToStudent"] ?? "").ToLower().Equals("true"); bs.showToStudent = showToStudent; string docdate = Request.Form["g_documentDate"]; if (!string.IsNullOrEmpty(docdate)) { bs.documentDate = Convert.ToDateTime(docdate); } bs.documentTitle = Request.Form["g_documentTitle"]; string expdate = Request.Form["g_documentExpiry"]; if (!string.IsNullOrEmpty(expdate)) { bs.documentExpiry = Convert.ToDateTime(expdate); } bs.CenterId = Utils.User.CenterId; BestStudents bestStd = new BestStudents(); bestStd.LoadRows("guidfield=?", "studentguid", bs.studentGuid, ""); bs.StudentId = bestStd.StudentId; if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } /* Auto Student */ string autoSample = "{value:\"[paramValue]\", label:[paramLabel]}"; StringBuilder sb = new StringBuilder(); sb.AppendLine("autoStudents = ["); BestStudents bstd = new BestStudents(); bstd.LoadRows("CenterId=?", Utils.User.CIdParam); for (int s = 0; s < bstd.TableRows.Count; s++) { string result = autoSample; result = result.Replace("[paramValue]", bstd.TableRows[s].Fields["guidfield"].fieldValue); result = result.Replace("[paramLabel]", Utils.EnquoteJS((bstd.TableRows[s].Fields["firstName"].fieldValue ?? "") + " " + (bstd.TableRows[s].Fields["lastName"].fieldValue ?? ""))); sb.Append(result); if (s < bstd.TableRows.Count - 1) sb.AppendLine(","); } sb.AppendLine("];"); ltrScript.Text = @"<script type=""text/javascript""> $(document).ready(function(){ " + sb.ToString() + @" $('#studentTag1').autocomplete( { source:autoStudents, delay: 0, select : function( event, ui){ $('#studentGuid').val( ui.item.value ); $( this ).val( ui.item.label ); return false; } } ); }); </script>"; BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Student Documents"; bsGrid.securityPage = "Student - Documents"; bsGrid.GridTable = new BestDocuments(); bsGrid.extraRowHTML = "<span><a href=\"javascript:void(0);\" onclick=\"showUploadDocument('[paramCID]','[paramSID]','[paramGuid]', [paramRowNum]);\" title=\"Upload Document\" ><img src=\"images\\folder_page.png\" alt=\"upload\" /></a></span><span><a href=\"javascript:void(0);\" onclick=\"DownloadDocument('[paramGuid]','[paramCID]','[paramSID]');\" title=\"Download Document\"><img src=\"images\\page_white_put.png\" alt=\"upload\" /></a></span>"; bsGrid.whereClause = ""; ltrGrid.Text = bsGrid.ToHTML(); }
private string EMailTargetHTML(string studTutor, string filter, string filterval) { StringBuilder result = new StringBuilder(); result.Append("<table id=\"available\" class=\"bestgrid\" cellspacing=\"0\" cellpadding=\"0\" style=\"width:80%;\"><tr><th><input type=\"checkbox\" id=\"checkAll\" onclick=\"ToggleCheck();\" /></th><th>Id</th><th>First Name</th><th>Last Name</th><th>EMail Address</th></tr>"); int rowcount = 0; if (studTutor.Equals("Student")) { BestStudents bs = new BestStudents(); if (!string.IsNullOrEmpty(filter) && !string.IsNullOrEmpty(filterval)) { BestField bfld = new BestField() { fieldName = "filterparam", paramOledbType = System.Data.OleDb.OleDbType.VarChar, fieldSize = 50, fieldType = "System.String" }; bfld.fieldValue = filterval; List<BestField> bparam = new List<BestField>(); bparam.Add(bfld); bparam.Add(Utils.User.CenterIdField); if (filter.Equals("School")) { bs.LoadRows("school = ? and CenterId=?", bparam,"firstname,lastname"); } else if (filter.Equals("Grade")) { bs.LoadRows("grade = ? and CenterId=?", bparam, "firstname,lastname"); } } else { bs.LoadRows("CenterId=?",Utils.User.CIdParam,"firstname, lastname"); } rowcount = bs.TableRows.Count; for (int row = 0; row < bs.TableRows.Count; row++) { bs.currentRowId = row; string trclass = (row % 2 == 0) ? "" : " class=\"gridodd\" "; result.Append("<tr" + trclass + ">"); if (!string.IsNullOrEmpty(bs.emailId)) { result.Append("<td><input type=\"checkbox\" id=\"chk_" + row.ToString() + "\" name=\"chk_" + row.ToString() + "\" /><input type=\"hidden\" id=\"guid" + row.ToString() + "\" name=\"guid" + row.ToString() + "\" value=\"" + HttpUtility.HtmlEncode(bs.guidfield.ToString()) + "\" /></td>"); } else { result.Append("<td> </td>"); } result.Append("<td>" + HttpUtility.HtmlEncode(bs.StudentId) + "</td><td>" + HttpUtility.HtmlEncode(bs.firstName) + "</td><td>" + HttpUtility.HtmlEncode(bs.lastName) + "</td><td>" + HttpUtility.HtmlEncode(bs.emailId) + "</td></tr>"); } } else if (studTutor.Equals("Tutor")) { BestTutors bt = new BestTutors(); bt.LoadRows("CenterId=?", Utils.User.CIdParam, "firstname,lastname"); rowcount = bt.TableRows.Count; for (int row = 0; row < bt.TableRows.Count; row++) { bt.currentRowId = row; string trclass = (row % 2 == 0) ? "" : " class=\"gridodd\" "; result.Append("<tr" + trclass + ">"); if (!string.IsNullOrEmpty(bt.emailId)) { result.Append("<td><input type=\"checkbox\" id=\"chk_" + row.ToString() + "\" name=\"chk_" + row.ToString() + "\" /><input type=\"hidden\" id=\"guid" + row.ToString() + "\" name=\"guid" + row.ToString() + "\" value=\"" + HttpUtility.HtmlEncode(bt.guidfield.ToString()) + "\" /></td>"); } else { result.Append("<td> </td>"); } result.Append("<td>" + HttpUtility.HtmlEncode(bt.TutorId) + "</td><td>" + HttpUtility.HtmlEncode(bt.firstName) + "</td><td>" + HttpUtility.HtmlEncode(bt.lastName) + "</td><td>" + HttpUtility.HtmlEncode(bt.emailId) + "</td></tr>"); } } result.Append("<input type=\"hidden\" id=\"rowcount\" name=\"rowcount\" value=\"" + rowcount.ToString() + "\" />"); result.Append("</table>"); return result.ToString(); }
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(); }
public BestField this[string name] { get { BestField fld = new BestField(); foreach (BestField field in _fields) { if (field.fieldName.Equals(name, StringComparison.InvariantCultureIgnoreCase)) { fld = field; break; } } return fld; } }
public void LoadRows(string whereclause, string param1, Guid value1, string orderby) { BestField bfld = new BestField() { fieldName = param1, fieldType ="System.Guid", paramOledbType = OleDbType.Guid, fieldSize = 50 }; bfld.fieldValue = value1.ToString(); List<BestField> bparam = new List<BestField>(); bparam.Add(bfld); this.LoadRows(whereclause, bparam, orderby); }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } string tutGuid = Request.Form["tutGuid"]; string stuGuid1 = Request.Form["stuGuid1"]; string stuGuid2 = Request.Form["stuGuid2"]; string stuGuid3 = Request.Form["stuGuid3"]; string stuGuid4 = Request.Form["stuGuid4"]; string stuGuid5 = Request.Form["stuGuid5"]; string schGuid = Request.Form["schGuid"]; string schDate = Request.Form["schDate"]; string schFrom = Request.Form["schFrom"]; string schTo = Request.Form["schTo"]; string isdelete = Request.Form["isDel"]; string attend1 = Request.Form["attend0"]; string attend2 = Request.Form["attend1"]; string attend3 = Request.Form["attend2"]; string attend4 = Request.Form["attend3"]; string attend5 = Request.Form["attend4"]; string note1 = Request.Form["note0"]; string note2 = Request.Form["note1"]; string note3 = Request.Form["note2"]; string note4 = Request.Form["note3"]; string note5 = Request.Form["note4"]; string progGuid1 = Request.Form["progGuid1"]; string progGuid2 = Request.Form["progGuid2"]; string progGuid3 = Request.Form["progGuid3"]; string progGuid4 = Request.Form["progGuid4"]; string progGuid5 = Request.Form["progGuid5"]; string tutorattend = Request.Form["tutorattend"]; BestSchedules bsch = new BestSchedules(); if (Utils.IsGuid(schGuid)) { /* Update */ if (!(Utils.User.UserRoleByName("5.Schedules").allowEdit)) { Response.Write("{result:false,Message:'You do not have rights to edit.'}"); return; } 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 = schGuid; bparams.Add(guid); bsch.LoadRows("guidfield = ?", bparams); if (bsch.TableRows.Count > 0) { bsch.schDate = schDate; bsch.schFrom = schFrom; bsch.schTo = schTo; if(! string.IsNullOrEmpty(isdelete)) bsch.isDeleted = isdelete; } } else { /* Add New */ if (!(Utils.User.UserRoleByName("5.Schedules").allowAdd)) { Response.Write("{result:false,Message:'You do not have rights to add.'}"); return; } bsch.guidfield = Guid.NewGuid(); bsch.schDate = schDate; bsch.schFrom = schFrom; bsch.schTo = schTo; } if (Utils.IsGuid(tutGuid)) bsch.tutGuid = new Guid(tutGuid); bsch.stuGuid1 = new Guid(stuGuid1); if (Utils.IsGuid(stuGuid2)) bsch.stuGuid2 = new Guid(stuGuid2); else bsch.stuGuid2 = null; if (Utils.IsGuid(stuGuid3)) bsch.stuGuid3 = new Guid(stuGuid3); else bsch.stuGuid3 = null; if (Utils.IsGuid(stuGuid4)) bsch.stuGuid4 = new Guid(stuGuid4); else bsch.stuGuid4 = null; if (Utils.IsGuid(stuGuid5)) bsch.stuGuid5 = new Guid(stuGuid5); else bsch.stuGuid5 = null; bsch.isDeleted = isdelete; bsch.attended1 = attend1; if (!string.IsNullOrEmpty(attend2)) bsch.attended2 = attend2; if (!string.IsNullOrEmpty(attend3)) bsch.attended3 = attend3; if (!string.IsNullOrEmpty(attend4)) bsch.attended4 = attend4; if (!string.IsNullOrEmpty(attend5)) bsch.attended5 = attend5; if (!string.IsNullOrEmpty(note1)) bsch.note1 = note1; if (!string.IsNullOrEmpty(note2)) bsch.note2 = note2; if (!string.IsNullOrEmpty(note3)) bsch.note3 = note3; if (!string.IsNullOrEmpty(note4)) bsch.note4 = note4; if (!string.IsNullOrEmpty(note5)) bsch.note5 = note5; if (!string.IsNullOrEmpty(progGuid1)) bsch.progGuid1 = new Guid(progGuid1); else bsch.progGuid1 = null; if (!string.IsNullOrEmpty(progGuid2)) bsch.progGuid2 = new Guid(progGuid2); else bsch.progGuid2 = null; if (!string.IsNullOrEmpty(progGuid3)) bsch.progGuid3 = new Guid(progGuid3); else bsch.progGuid3 = null; if (!string.IsNullOrEmpty(progGuid4)) bsch.progGuid4 = new Guid(progGuid4); else bsch.progGuid4 = null; if (!string.IsNullOrEmpty(progGuid5)) bsch.progGuid5 = new Guid(progGuid5); else bsch.progGuid5 = null; if (!string.IsNullOrEmpty(tutorattend)) bsch.tutorattend = tutorattend; if (!string.IsNullOrEmpty(stuGuid1) && !string.IsNullOrEmpty(progGuid1)) bsch.Amount1 = getProgramAmount(bsch.stuGuid1, bsch.progGuid1); else bsch.Amount1 = 0; if (!string.IsNullOrEmpty(stuGuid2) && !string.IsNullOrEmpty(progGuid2)) bsch.Amount2 = getProgramAmount(bsch.stuGuid2, bsch.progGuid2); else bsch.Amount2 = 0; if (!string.IsNullOrEmpty(stuGuid3) && !string.IsNullOrEmpty(progGuid3)) bsch.Amount3 = getProgramAmount(bsch.stuGuid3, bsch.progGuid3); else bsch.Amount3 = 0; if (!string.IsNullOrEmpty(stuGuid4) && !string.IsNullOrEmpty(progGuid4)) bsch.Amount4 = getProgramAmount(bsch.stuGuid4, bsch.progGuid4); else bsch.Amount4 = 0; if (!string.IsNullOrEmpty(stuGuid5) && !string.IsNullOrEmpty(progGuid5)) bsch.Amount5 = getProgramAmount(bsch.stuGuid5, bsch.progGuid5); else bsch.Amount5 = 0; bsch.CenterId = Utils.User.CenterId; if (bsch.CurrentRow.Save()) { Response.Write("{result:true,guid:'" + bsch.CurrentRow.Fields["guidfield"].fieldValue + "'}"); } else { Response.Write("{result:false,Message:'" + Utils.EnquoteJS( bsch.CurrentRow.lastError )+ "'}"); } }
private Decimal getProgramAmount(Guid? stuguid, Guid? progGuid) { Decimal result = 0; BestField p1 = new BestField() { fieldName = "studentguid", fieldType = "System.Guid", fieldSize = 40, paramOledbType = System.Data.OleDb.OleDbType.Guid }; p1.fieldValue = stuguid.ToString(); BestField p2 = new BestField() { fieldName = "guidfield", fieldType = "System.Guid", fieldSize = 40, paramOledbType = System.Data.OleDb.OleDbType.Guid }; p2.fieldValue = progGuid.ToString(); List<BestField> bparams = new List<BestField>(); bparams.Add(p1); bparams.Add(p2); BestStudentPrograms bstdProgs = new BestStudentPrograms(); bstdProgs.LoadRows("studentguid=? and guidfield=?", bparams); if (bstdProgs.HasRows) { bstdProgs.currentRowId = 0; result = bstdProgs.Amount; } return result; }
private void SavePickupInfo(Guid studentGuid) { string pickupData = Request.Form["pickupInfoData"]; if (!string.IsNullOrEmpty(pickupData)) { string[] aryPick = pickupData.Split('\n'); for (int i = 0; i < aryPick.Length; i++) { string[] aryFields = aryPick[i].Split('\t'); if (aryFields[0].Length > 16) { /* Edit or Delete */ BestStudentPickup bstdPickup = new BestStudentPickup(); 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 = aryFields[0]; bparams.Add(guid); if (!string.IsNullOrEmpty(guid.fieldValue)) { bstdPickup.LoadRows("guidfield=?", bparams); } bstdPickup.contactName = aryFields[1]; bstdPickup.contactPhone = aryFields[2]; bstdPickup.relationship = aryFields[3]; bstdPickup.CurrentRow.IsDelete = aryFields[4].Equals("true\r"); bstdPickup.CurrentRow.Save(); } else if (aryFields[0].Length != 0) { /* Add */ BestStudentPickup bstdPick = new BestStudentPickup(); bstdPick.CenterId = this.CenterId.Value; bstdPick.studentGuid = studentGuid; bstdPick.StudentId = this.StudentId.Value; bstdPick.contactName = aryFields[1]; bstdPick.contactPhone = aryFields[2]; bstdPick.relationship = aryFields[3]; bstdPick.CurrentRow.Save(); } } } }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.TutorMenu("tutorreports"); if (!Utils.User.UserRoleByName("Tutor - Reports").allowView) { ltrValidateMsg.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); string fromdate = Request.Form["fromdate"]; if (string.IsNullOrEmpty(fromdate)) fromdate = DateTime.Today.ToString("MM/dd/yyyy"); string todate = Request.Form["todate"]; if (string.IsNullOrEmpty(todate)) todate = DateTime.Today.AddMonths(1).AddDays(-1).ToString("MM/dd/yyyy"); StringBuilder rowshtml = new StringBuilder(); if (IsPostBack) { bool canReport = true; if (!string.IsNullOrEmpty(fromdate)) { try { DateTime fromdt = Convert.ToDateTime(fromdate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("From Date is Required."); canReport = false; } if (!string.IsNullOrEmpty(todate)) { try { DateTime todt = Convert.ToDateTime(todate); } catch (Exception ex) { ltrValidateMsg.Text = Utils.WarningMessage(ex.Message); canReport = false; } } else { ltrValidateMsg.Text = Utils.WarningMessage("To Date is Required."); canReport = false; } if (canReport) { BestField bffromdate = new BestField() { fieldName = "fromdate", fieldSize = 40, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false }; bffromdate.fieldValue = fromdate.Substring(6, 4) + fromdate.Substring(0, 2) + fromdate.Substring(3, 2); BestField bftodate = new BestField() { fieldName = "todate", fieldSize = 40, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar, displayField = false }; bftodate.fieldValue = todate.Substring(6, 4) + todate.Substring(0, 2) + todate.Substring(3, 2); BestField GuidField = new BestField(){ fieldName="guidfield", fieldSize=40, fieldType="System.Guid", paramOledbType= OleDbType.Guid, displayField=false}; string tutorGuid = Request.Form["TutorGuid"]??""; GuidField.fieldValue = tutorGuid; string tsql = @"Select schdate, tutorid, BestTutors.firstName + ' ' + BestTutors.lastName as tutorName, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid1) as name1, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid2) as name2, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid3) as name3, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid4) as name4, (select BestStudents.firstName + ' ' + SubString(BestStudents.lastName,1,1) From BestStudents where BestStudents.guidField = BestSchedules.stuguid5) as name5, case BestSchedules.tutorattend when 0 then 1 when 1 then 1 when 2 then 0 end as tutorattend, BestTutors.perHour, BestTutors.salary From BestSchedules Inner Join BestTutors on BestTutors.guidfield = BestSchedules.tutGuid where BestSchedules.schdate >= ? and BestSchedules.schdate <= ? and BestTutors.CenterId = ?"; if(! string.IsNullOrEmpty(tutorGuid)) { tsql += " and BestTutors.guidfield = ? "; } tsql += " order by tutorname, schdate"; BestDatabase db = new BestDatabase(); OleDbCommand myCmd = db.dbCmd; myCmd.CommandText = tsql; myCmd.Parameters.Add(bffromdate.Param); myCmd.Parameters.Add(bftodate.Param); myCmd.Parameters.Add(Utils.User.CenterIdField.Param); if (!string.IsNullOrEmpty(tutorGuid)) { myCmd.Parameters.Add(GuidField.Param); } OleDbDataReader tblReader = myCmd.ExecuteReader(); int Cnt = 0; string tutorName = ""; string tutorid = ""; rowshtml.Append("<br /><div id=\"tutorReport\"><table class=\"tblreports\" cellspacing=\"0\" cellpadding=\"0\">"); rowshtml.Append("<thead><tr><td colspan=\"9\" style=\"font-weight:bold;font-size:12px;\">" + Utils.User.CenterId + " Tutors Report</td></thead>"); rowshtml.Append("<tr>"); rowshtml.Append("<th>Date</th>"); rowshtml.Append("<th>Tutor Id</th>"); rowshtml.Append("<th>Tutor Name</th>"); rowshtml.Append("<th>Students</th>"); rowshtml.Append("<th>Hours</th>"); rowshtml.Append("<th>Per Hour</th>"); rowshtml.Append("<th>Amount</th>"); rowshtml.Append("<th>Salary</th>"); rowshtml.Append("</tr>"); Decimal totalHrs = 0; Decimal totalAmount = 0; bool showSalary = true; Decimal grandTotal = 0; Decimal salaryTotal = 0; while (tblReader.Read()) { string tutid = tblReader[1].ToString(); if (!tutorid.Equals(tutid) && (Cnt > 0)) { rowshtml.Append("<tr><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"4\">" + tutorName + " Totals</td><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" >" + totalHrs.ToString("0") + "</td>"); rowshtml.Append("<td style=\"text-align:right;background-color:#fff;font-weight:bold;\" >" + totalAmount.ToString("$0.00") + "</td><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"2\"> </td></tr>"); totalHrs = 0; totalAmount = 0; showSalary = true; } tutorid = tutid; Cnt++; string schdate = tblReader[0].ToString(); schdate = schdate.Substring(4, 2) + "/" + schdate.Substring(6, 2) + "/" + schdate.Substring(0, 4); tutorName = tblReader[2].ToString(); string name1 = tblReader[3].ToString(); string name2 = tblReader[4].ToString(); string name3 = tblReader[5].ToString(); string name4 = tblReader[6].ToString(); string name5 = tblReader[7].ToString(); string studentNames = name1; if(!string.IsNullOrEmpty(name2)) studentNames += ", " + name2 ; if(!string.IsNullOrEmpty(name3)) studentNames += ", " + name3 ; if(!string.IsNullOrEmpty(name4)) studentNames += ", " + name4 ; if(!string.IsNullOrEmpty(name5)) studentNames += ", " + name5 ; string tutAttend = tblReader[8].ToString(); string perhour = tblReader[9].ToString(); string salary = tblReader[10].ToString(); Decimal perHour; Decimal.TryParse(perhour, out perHour); Decimal Salary; Decimal.TryParse(salary, out Salary); Decimal attendHour; Decimal.TryParse(tutAttend, out attendHour); totalHrs += attendHour; totalAmount += (perHour * attendHour); grandTotal += (perHour * attendHour); rowshtml.Append("<tr><td>" + schdate + "</td>"); rowshtml.Append("<td>" + tutorid + "</td>"); rowshtml.Append("<td>" + tutorName + "</td>"); rowshtml.Append("<td>" + studentNames + "</td>"); rowshtml.Append("<td style=\"text-align:right;\">" + attendHour.ToString("0") + "</td>"); rowshtml.Append("<td style=\"text-align:right;\">" + perHour.ToString("$0.00") + "</td>"); rowshtml.Append("<td style=\"text-align:right;\">" + (attendHour * perHour).ToString("$0.00") + "</td>"); if (showSalary) { salaryTotal += Salary; rowshtml.Append("<td style=\"text-align:right;\">" + ((Salary > 0) ? Salary.ToString("$0.00") : "") + "</td>"); } else { rowshtml.Append("<td> </td>"); } showSalary = false; } rowshtml.Append("<tr><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"4\">" + tutorName + " Totals</td><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" >" + totalHrs.ToString("0") + "</td>"); rowshtml.Append("<td style=\"text-align:right;background-color:#fff;font-weight:bold;\" >" + totalAmount.ToString("$0.00") + "</td><td style=\"text-align:right;background-color:#fff;font-weight:bold;\" colspan=\"2\"> </td></tr>"); rowshtml.Append("<tr><td style=\"font-weight:bold;\">Grand Total</td><td>" + Server.HtmlEncode(fromdate + " to " + todate) + "</td><td colspan=\"5\" style=\"text-align:right;font-weight:bold;\">" + grandTotal.ToString("$0.00") + "</td><td style=\"text-align:right;font-weight:bold;\">" + salaryTotal.ToString("$0.00") + "</td></tr>"); rowshtml.Append("</table></div><br />"); rowshtml.Append("<div><input type=\"button\" value=\"Print\" onclick=\"PrintTable('tutorReport');\" /></div>"); } } StringBuilder sb = new StringBuilder(); sb.Append("<div class=\"centered\">"); sb.Append("<table class=\"bestgrid\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">"); sb.Append("<tr><td style=\"text-align:center;\" colspan=\"2\">Tutor Reports</td></tr>"); sb.Append("<tr><td>From Date <input type=\"text\" id=\"fromdate\" name=\"fromdate\" size=\"9\" maxlength=\"10\" value=\"" + fromdate + "\" /></td><td>To Date <input type=\"text\" id=\"todate\" name=\"todate\" size=\"9\" maxlength=\"10\" value=\"" + todate + "\" /></td></tr>"); sb.Append("<tr><td colspan=\"2\">Tutor <select id=\"TutorGuid\" name=\"TutorGuid\">" + TutorOptions() + "</select></td></tr>"); sb.Append("<tr><td colspan=\"2\" style=\"text-align:center;\" ><input type=\"button\" value=\"Submit\" onclick=\"submit();\" /></td></tr>"); sb.Append("</table>"); ltrGrid.Text = sb.ToString() + rowshtml.ToString() + "</div>"; }
private void SavePrograms(Guid studentGuid) { string programsData = Request.Form["programsData"]; if (!string.IsNullOrEmpty(programsData)) { string[] aryProgs = programsData.Split('\n'); for (int i = 0; i < aryProgs.Length; i++) { string[] aryFields = aryProgs[i].Split('\t'); Decimal ddamt; if (aryFields[0].Length > 16) { /* Edit or Delete */ BestStudentPrograms bstdProg = new BestStudentPrograms(); 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 = aryFields[0]; bparams.Add(guid); if (!string.IsNullOrEmpty(guid.fieldValue)) { bstdProg.LoadRows("guidfield=?", bparams); } bstdProg.programguid = (Guid)Utils.getNullableGuid(aryFields[1]); Decimal.TryParse(aryFields[2], out ddamt); bstdProg.Amount = ddamt; bstdProg.CurrentRow.IsDelete = aryFields[3].Equals("true\r"); bstdProg.CurrentRow.Save(); } else if(aryFields[0].Length != 0) { /* Add */ Guid? programguid = Utils.getNullableGuid(aryFields[1]); if (programguid != null) { BestStudentPrograms bstdProg = new BestStudentPrograms(); bstdProg.studentGuid = studentGuid; bstdProg.programguid = new Guid(aryFields[1]); Decimal.TryParse(aryFields[2], out ddamt); bstdProg.Amount = ddamt; bstdProg.StudentId = this.StudentId.Value; bstdProg.CenterId = this.CenterId.Value; bstdProg.CurrentRow.Save(); } } } } }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } ltrSubMenu.Text = UtilMenu.SetupSubMenu("services"); if (!Utils.User.UserRoleByName("Setup - Services").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; this.ltrMScript.Text = Utils.MenuSelectScript(ms); string saveClicked = Request.Form["SaveClicked"] ?? ""; if (IsPostBack && saveClicked.Equals("1")) { BestServices bs = new BestServices(); 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.Service = Request.Form["g_Service"]; bs.CenterId = Request.Form["g_CenterId"]; if (string.IsNullOrEmpty(bs.Service)) { ltrValidateMsg.Text = Utils.WarningMessage("Service is Required."); cansave = false; } if (cansave) { if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Services Information"; bsGrid.GridTable = new BestServices(); bsGrid.securityPage = "Setup - Services"; bsGrid.orderby = "service"; ltrGrid.Text = bsGrid.ToHTML(); }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } if (! Utils.User.UserRoleByName("Setup - Users").allowView) { Response.Write("You do not have view rights for this page."); return; } ltrSubMenu.Text = UtilMenu.SetupSubMenu("userinfo"); string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); ltrState.Text = Utils.StateOptions(); if (IsPostBack) { BestUser bs = new BestUser(); 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.userName = Request.Form["g_userName"]; bs.emailId = Request.Form["g_emailId"]; } if (string.IsNullOrEmpty(bs.userName)) { ltrValidateMsg.Text = Utils.WarningMessage("User Name is Required."); cansave = false; } if (string.IsNullOrEmpty(bs.emailId)) { ltrValidateMsg.Text = Utils.WarningMessage("EMail Address is Required."); cansave = false; } if (cansave) { bs.firstName = Request.Form["g_firstName"]; bs.lastName = Request.Form["g_lastName"]; 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.gender = Request.Form["g_gender"]; bs.Centers = Request.Form["g_Centers"]; bs.userType = Request.Form["g_userType"]; string randPwd = RandomString(8); bs.password = Utils.GetMD5Hash(randPwd); bs.passwordExpiration = DateTime.Today.AddDays(3); if (bs.CurrentRow.Save()) { Utils.User.emailUtil.Send(bs.emailId, "BLC Login Information", @"<h2>Welcome to Bali Learning Center!</h2><br><h3>Your login information is enclosed.</h3> <b>Accessing Your Account</b><br> Step 1:<br> Click the link below or enter the URL below into your web browser<br> Address: <a href=""http://best.vasbal.com"">Bali Learning Center Login</a><br><br> Step 2:<br> Enter the following user name and temporary password.<br> User Name: <b>" + bs.userName + @"</b><br> Password: <b>" + randPwd + @"</b><br><br> <h3>This temporary password expires in 24 hours.</h3><br><br> You will be prompted to change your user name and password during your initial log in as well as answer a few security related questions. <br> <br> <br> <br> Thank you,<br> Bali Learning Center", bs.firstName + " " + bs.lastName); } else { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "User Information"; bsGrid.GridTable = new BestUser(); bsGrid.whereClause = "usertype not in ('Student', 'Tutor')"; bsGrid.securityPage = "Setup - Users"; bsGrid.AfterAddHTML="<input type=\"button\" id=\"btnReserPwd\" onclick=\"resetPassword();\" value=\"Reset Password\" />"; 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.ProgramMenu("programinfo"); if (!Utils.User.UserRoleByName("Program - Information").allowView) { ltrGrid.Text = "You do not have rights to view."; return; } string ms = Request.QueryString["ms"]; ltrMScript.Text = Utils.MenuSelectScript(ms); string saveClicked = Request.Form["SaveClicked"] ?? ""; if (IsPostBack && saveClicked.Equals("1")) { BestPrograms bs = new BestPrograms(); 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.programName = Request.Form["g_programName"]; bs.programType = Request.Form["g_programType"]; if (string.IsNullOrEmpty(bs.programType)) { ltrValidateMsg.Text = Utils.WarningMessage("Program Type is Required."); cansave = false; } if (cansave) { bs.amount = Request.Form["g_amount"]; bs.amountType = Request.Form["g_amountType"]; if (!bs.CurrentRow.Save()) { ltrValidateMsg.Text = Utils.WarningMessage(bs.CurrentRow.lastError); } } } } StringBuilder sb = new StringBuilder(); ProgramTypes bprgTypes = new ProgramTypes(); bprgTypes.LoadRows(); sb.Append("<option value=\"\"></option>"); for(int rowNum = 0; rowNum < bprgTypes.TableRows.Count; rowNum++) { sb.Append("<option value=\"" + HttpUtility.HtmlEncode(bprgTypes.TableRows[rowNum].Fields["programType"].fieldValue) + "\">" + HttpUtility.HtmlEncode(bprgTypes.TableRows[rowNum].Fields["programType"].fieldValue) + "</option>"); } ltrprgTypeOptions.Text = sb.ToString(); BestGrid bsGrid = new BestGrid(); bsGrid.PageRequest = Page.Request; bsGrid.Title = "Programs Information"; bsGrid.GridTable = new BestPrograms(); bsGrid.securityPage = "Program - Information"; ltrGrid.Text = bsGrid.ToHTML(); }
public void Add(BestField field) { _fields.Add(field); }
protected void Page_LoadComplete(object sender, EventArgs e) { if (HttpContext.Current.Session["CurrentUser"] == null) { Response.Redirect("Logout.aspx"); } BestField sid = new BestField() { fieldName = "studentid", fieldSize = 50, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar }; sid.fieldValue = Request.QueryString["sid"]; BestField cid = new BestField() { fieldName = "centerid", fieldSize = 50, fieldType = "System.String", paramOledbType = System.Data.OleDb.OleDbType.VarChar }; cid.fieldValue = Request.QueryString["cid"]; BestStudentPicture studPic = new BestStudentPicture(); List<BestField> bparams = new List<BestField>(); bparams.Add(sid); bparams.Add(cid); studPic.LoadRows("studentid = ? and centerid = ?", bparams); object stdname = studPic.CurrentRow.Fields["studentGuid"].displayFormatFunc.Invoke(studPic.CurrentRow); ltrStdName.Text = stdname.ToString(); if (!String.IsNullOrEmpty(Request.Form["uploadPhoto"])) { if (Request.Files.Count > 0) { HttpPostedFile File = Request.Files[0]; if (File.ContentLength > 0) { string resizeTo = Request.Form["resizePhoto"]; int MaxDimension = 120; int.TryParse(resizeTo, out MaxDimension); MaxDimension = Math.Min(120, MaxDimension); Size maxSize = new Size(MaxDimension, MaxDimension); System.Drawing.Image myImage = System.Drawing.Image.FromStream(File.InputStream, false); if (myImage.Height > maxSize.Height || myImage.Width > maxSize.Width) { //resize image var hOver = Convert.ToDouble(myImage.Height) / Convert.ToDouble(maxSize.Height); var wOver = Convert.ToDouble(myImage.Width) / Convert.ToDouble(maxSize.Width); double pOver = Math.Max(hOver, wOver); maxSize.Height = Convert.ToInt32(myImage.Height / pOver); maxSize.Width = Convert.ToInt32(myImage.Width / pOver); myImage = resizeImage(myImage, maxSize); } var imgByte = imageToByteArray(myImage); //new Byte[File.ContentLength]; File.InputStream.Read(imgByte, 0, imgByte.Length); OleDbCommand myCmd = studPic.dbCmd; if (studPic.CurrentRow.IsNew) { myCmd.CommandText = "insert into BestStudentPicture (picture, photosize, photoname, studentid, centerid) values (?,?,?,?,?)"; } else { myCmd.CommandText = "update BestStudentPicture set picture = ?, photosize = ?, photoname = ? where studentid=? and centerid=?"; } object tvalue = imgByte; OleDbParameter p1 = new OleDbParameter("picture", OleDbType.LongVarBinary, -1, System.Data.ParameterDirection.Input, false, 0, 0, null, System.Data.DataRowVersion.Current, tvalue); OleDbParameter p2 = new OleDbParameter("photosize", OleDbType.VarChar, 12); p2.Value = File.ContentLength; OleDbParameter p3 = new OleDbParameter("photoname", OleDbType.VarChar, 200); p3.Value = File.FileName; myCmd.Parameters.Clear(); myCmd.Parameters.Add(p1); myCmd.Parameters.Add(p2); myCmd.Parameters.Add(p3); myCmd.Parameters.Add(sid.Param); myCmd.Parameters.Add(cid.Param); try { myCmd.ExecuteNonQuery(); } catch (Exception ex) { this.errorDisplay.Text = "<div class=\"err\">There was an error saving the photo.<br />" + HttpUtility.HtmlEncode(ex.Message) + "</div>"; } } } } this.defaultResizeOptionScript.Text = "<script type=\"text/javascript\">\nvar defaultSize = '90'; \n</script>"; this.photoDisplay.Text = "<img id=\"empPhoto\" alt=\"Employee Photo\" src=\"getPhoto.aspx?sid=" + Server.UrlEncode(sid.fieldValue) + "&cid=" + Server.UrlEncode(cid.fieldValue) + "\" />"; }