protected void Page_Load(object sender, EventArgs e) { Label1.Text = "<h1>Check Your Particulars</h1>"; StudList tdList = new StudList(); StudListDAO tdDAO = new StudListDAO(); if (Session["username"] == null) { Response.Redirect("LoginStudent.aspx"); } else { if (!IsPostBack) { tdList = tdDAO.getRegbyStudAdmin(Session["username"].ToString()); Label14.Text = tdList.studentAdmin.ToString(); Label2.Text = tdList.studentName.ToString(); Label3.Text = tdList.gender.ToString(); Label4.Text = tdList.DOB.ToString("dd/MM/yyyy"); LblDiploma.Text = tdList.school.ToString(); Label5.Text = tdList.pemGroup.ToString(); tdCountry.Text = tdList.nationality.ToString(); tdMobileNo.Text = tdList.MobileNO.ToString(); tdDiet.Text = tdList.DietConstraint.ToString(); tdMedical.Text = tdList.MedicalHistory.ToString(); } } }
protected void Button1_Click(object sender, EventArgs e) { StudList tdList = new StudList(); StudListDAO tdDAO = new StudListDAO(); tdList = tdDAO.getRegbyStudAdmin(Session["username"].ToString()); string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; StringBuilder sqlStr = new StringBuilder(); int result = 0; SqlCommand sqlCmd = new SqlCommand(); sqlStr.AppendLine("UPDATE Student set Nationality = @paraNationality, MobileNO = @paraMobileNO, DietConstraint = @paraDietConstraint, MedicalHistory = @paraMedicalHistory "); sqlStr.AppendLine("WHERE Email = @paraEmail"); SqlConnection myConn = new SqlConnection(DBConnect); sqlCmd = new SqlCommand(sqlStr.ToString(), myConn); sqlCmd.Parameters.AddWithValue("@paraNationality", DdlCountry.SelectedValue.ToString()); sqlCmd.Parameters.AddWithValue("@paraMobileNO", tbMobileNo.Text); sqlCmd.Parameters.AddWithValue("@paraDietConstraint", tbDiet.Text); sqlCmd.Parameters.AddWithValue("@paraMedicalHistory", tbMedical.Text); sqlCmd.Parameters.AddWithValue("@paraEmail", Session["username"].ToString()); myConn.Open(); result = sqlCmd.ExecuteNonQuery(); myConn.Close(); lblResult.Text = "Particulars Updated"; if (Session["page"] != null) { Response.Redirect(Session["page"].ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { //Session["new"] = "Statistics"; Response.Redirect("LoginStudent.aspx"); } if (!IsPostBack) { GetStudentChartInfo(); } StudList studList = new StudList(); StudListDAO studDAO = new StudListDAO(); studList = studDAO.getRegbyStudAdmin(Session["Username"].ToString()); string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; using (SqlConnection myConn = new SqlConnection(DBConnect)) { myConn.Open(); SqlCommand cmd = new SqlCommand("SELECT count(StudentAdmin) FROM Feedback WHERE StudentAdmin = @paraStudAdmin", myConn); cmd.Parameters.AddWithValue("@paraStudAdmin", studList.studentAdmin.ToString()); int UserExist = (int)cmd.ExecuteScalar(); if (UserExist < 1) { Label1.Text = "<h3>You currently have a feedback form that is uncompleted! Complete it <a href='Feedback.aspx'>here</a></h3>"; } else { Label1.Visible = false; } myConn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["studInfo"] != null) { StudList tdList = new StudList(); StudListDAO tdDAO = new StudListDAO(); ProgCode.Text = "<h1>" + Session["Code"].ToString() + "</h1>"; tdList = tdDAO.getTDbyStudAdmin(Session["studInfo"].ToString()); LblAdmin.Text = tdList.studentAdmin.ToString(); LblStudname.Text = tdList.studentName.ToString(); LblGender.Text = tdList.gender.ToString(); LblSchool.Text = tdList.school.ToString(); LblPEMGroup.Text = tdList.pemGroup.ToString(); LblNationality.Text = tdList.nationality.ToString(); Label3.Text = tdList.passportNo.ToString(); Label4.Text = tdList.passportE.ToString("dd/MM/yyyy"); Label5.Text = tdList.DietConstraint.ToString(); Label6.Text = tdList.MedicalHistory.ToString(); Label7.Text = tdList.FASscheme.ToString(); Remarks.Text = tdList.Remarks.ToString(); } else { Response.Redirect("ListofStud.aspx"); } }
protected void gvbind() { StudListDAO tdDAO = new StudListDAO(); List <StudList> tdList = new List <StudList>(); tdList = tdDAO.getTDbyTripID(Session["Code"].ToString()); GridViewTD.DataSource = tdList; GridViewTD.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { if (Session["SSTripID"] != null) { string tripID = Session["SSTripID"].ToString(); trip tripOjb = new trip(); tripDAO tripDAO = new tripDAO(); //tripOjb = tripDAO.getTripById(1); tripOjb = tripDAO.getTrip(tripID); imgTripDetails.ImageUrl = tripOjb.Image; lblCn.Text = tripOjb.Country; lblDesc.Text = tripOjb.Description; lblSD.Text = tripOjb.StartDate.ToShortDateString(); lblED.Text = tripOjb.EndDate.ToShortDateString(); lblPrc.Text = tripOjb.ETripPrice.ToString(); } else { Response.Redirect("TripStudentView.aspx"); } string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; StudList studList = new StudList(); DataSet ds = new DataSet(); DataTable tripData = new DataTable(); StudListDAO StudDao = new StudListDAO(); studList = StudDao.getRegbyStudAdmin(Session["Username"].ToString()); StringBuilder sqlStr = new StringBuilder(); sqlStr.AppendLine("SELECT * FROM RegisteredStudent"); sqlStr.AppendLine("INNER JOIN Trip"); sqlStr.AppendLine("ON RegisteredStudent.TripID = Trip.TripID"); sqlStr.AppendLine("where RegisteredStudent.TripID = @paraTripID AND RegisteredStudent.StudentAdmin = @paraStudentAdmin"); SqlConnection myConn = new SqlConnection(DBConnect); SqlDataAdapter da = new SqlDataAdapter(sqlStr.ToString(), myConn); da.SelectCommand.Parameters.AddWithValue("@paraTripID", Request.QueryString["id"].ToString()); da.SelectCommand.Parameters.AddWithValue("@paraStudentAdmin", studList.studentAdmin); da.Fill(ds, "studList"); int rec_cnt = ds.Tables["studList"].Rows.Count; if (rec_cnt > 0) { btnRegister.CssClass = "btn btn-primary disabled float-right"; btnRegister.Enabled = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Response.Redirect("LoginStudent.aspx"); } else { StudList tdList = new StudList(); StudListDAO tdDAO = new StudListDAO(); tdList = tdDAO.getRegbyStudAdmin(Session["username"].ToString()); tbAdminNo.Text = tdList.studentAdmin.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { StudListDAO tdDAO = new StudListDAO(); List <StudList> tdList = new List <StudList>(); if (!Page.IsPostBack) { tdList = tdDAO.getTDbyTripID(Session["Code"].ToString()); GridViewTD.DataSource = tdList; GridViewTD.DataBind(); ProgCode.Text = "<h1>" + Session["Code"].ToString() + "</h1>"; } countStud(Session["Code"].ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Response.Redirect("LoginStudent.aspx"); } else { StudList tdList = new StudList(); StudListDAO tdDAO = new StudListDAO(); tdList = tdDAO.getRegbyStudAdmin(Session["username"].ToString()); tdName.Text = tdList.studentName.ToString(); Label1.Text = tdList.studentAdmin.ToString(); Label2.Text = tdList.pemGroup.ToString(); Label3.Text = tdList.nationality.ToString(); Label4.Text = tdList.MobileNO.ToString(); Label5.Text = tdList.DietConstraint.ToString(); Label6.Text = tdList.MedicalHistory.ToString(); string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection myConn = new SqlConnection(DBConnect); SqlDataAdapter da; DataSet ds = new DataSet(); //Create Adapter StringBuilder sqlCommand = new StringBuilder(); sqlCommand.AppendLine("Select * from ProfilePic where StudentAdmin = @paraStudentAdmin "); da = new SqlDataAdapter(sqlCommand.ToString(), myConn); da.SelectCommand.Parameters.AddWithValue("paraStudentAdmin", tdList.studentAdmin.ToString()); // fill dataset da.Fill(ds, "stud_table"); int rec_cnt = ds.Tables["stud_table"].Rows.Count; if (rec_cnt > 0) { DataRow row = ds.Tables["stud_table"].Rows[0]; tdList.studentImage = row["Image"].ToString(); idProfile.ImageUrl = tdList.studentImage; } else { idProfile.ImageUrl = "~/ProfilePic/download1.jpg"; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Session["new"] = "Feedback"; Response.Redirect("LoginStudent.aspx"); } StudList studList = new StudList(); StudListDAO studDAO = new StudListDAO(); StudentReg studReg = new StudentReg(); StudRegDAO regDAO = new StudRegDAO(); studList = studDAO.getRegbyStudAdmin(Session["Username"].ToString()); Lblno.Text = studList.studentAdmin.ToString(); studReg = regDAO.getTripID(Lblno.Text); Lblcode.Text = studReg.TripID.ToString(); }
protected void Button1_Click(object sender, EventArgs e) { StudList tdList = new StudList(); StudListDAO tdDAO = new StudListDAO(); tdList = tdDAO.getRegbyStudAdmin(Session["username"].ToString()); if (Encryption.MD5Hash(tbPassword.Text) != tdList.studentPassword.ToString()) { errorMsg.Text = "Your current password is incorrect"; } else if (TextBox1.Text != TextBox2.Text) { errorMsg.Text = "You new password is different than the confirm password"; } else if (TextBox1.Text == "") { errorMsg.Text = "Password field is empty!"; } else { string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; StringBuilder sqlStr = new StringBuilder(); int result = 0; SqlCommand sqlCmd = new SqlCommand(); sqlStr.AppendLine("UPDATE Student set StudentPassword = @paraPassword "); sqlStr.AppendLine("WHERE Email = @paraEmail"); SqlConnection myConn = new SqlConnection(DBConnect); sqlCmd = new SqlCommand(sqlStr.ToString(), myConn); sqlCmd.Parameters.AddWithValue("@paraPassword", Encryption.MD5Hash(TextBox1.Text)); sqlCmd.Parameters.AddWithValue("@paraEmail", Session["username"].ToString()); myConn.Open(); result = sqlCmd.ExecuteNonQuery(); myConn.Close(); errorMsg.Text = "Password change"; Response.AddHeader("Refresh", "5;URL=Account.aspx"); } }
protected void studsearchbtn_Click(object sender, EventArgs e) { if (tbstudsearch.Text == "") { StudListDAO tdDAO = new StudListDAO(); List <StudList> tdList = new List <StudList>(); tdList = tdDAO.getTDbyTripID(Session["Code"].ToString()); GridViewTD.DataSource = tdList; GridViewTD.DataBind(); } else { StudListDAO tdDAO = new StudListDAO(); List <StudList> tdList = new List <StudList>(); tdList = tdDAO.getTDbyStudentAdmin(tbstudsearch.Text.ToString(), Session["Code"].ToString()); GridViewTD.DataSource = tdList; GridViewTD.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Session["new"] = "Survey"; Response.Redirect("LoginStudent.aspx"); } StudList studList = new StudList(); StudListDAO studDAO = new StudListDAO(); SurveyQ tdList = new SurveyQ(); SurveyQDAO tdDAO = new SurveyQDAO(); studList = studDAO.getRegbyStudAdmin(Session["Username"].ToString()); LblNo.Text = studList.studentAdmin.ToString(); tdList = tdDAO.getSurveyQuestions(); if (tdList == null) { tbQ1.Visible = false; tbQ2.Visible = false; tbQ3.Visible = false; tbQ4.Visible = false; LblQ2.Visible = false; LblQ3.Visible = false; LblQ4.Visible = false; submitBtn.Visible = false; resetBtn.Visible = false; LblQ1.Text = "<h1>No survey has been loaded for the moment. Please check back again later!</h1>"; } else { LblQ1.Text = tdList.q1.ToString(); LblQ2.Text = tdList.q2.ToString(); LblQ3.Text = tdList.q3.ToString(); LblQ4.Text = tdList.q4.ToString(); } }
protected void btnCrop_Click(object sender, EventArgs e) { string fileName = Path.GetFileName(imgUpload.ImageUrl); string filePath = Path.Combine(Server.MapPath("~/ProfilePic"), fileName); string cropFileName = ""; string cropFilePath = ""; if (File.Exists(filePath)) { System.Drawing.Image orgImg = System.Drawing.Image.FromFile(filePath); Rectangle CropArea = new Rectangle( Convert.ToInt32(X.Value), Convert.ToInt32(Y.Value), Convert.ToInt32(W.Value), Convert.ToInt32(H.Value)); try { Bitmap bitMap = new Bitmap(CropArea.Width, CropArea.Height); using (Graphics g = Graphics.FromImage(bitMap)) { g.DrawImage(orgImg, new Rectangle(0, 0, bitMap.Width, bitMap.Height), CropArea, GraphicsUnit.Pixel); } cropFileName = "crop_" + fileName; cropFilePath = Path.Combine(Server.MapPath("~/ProfilePic"), cropFileName); bitMap.Save(cropFilePath); //if (System.IO.File.Exists(delFilePath)) //{ // System.IO.File.Delete(delFilePath); //} StudList tdList = new StudList(); StudListDAO tdDAO = new StudListDAO(); tdList = tdDAO.getRegbyStudAdmin(Session["username"].ToString()); SqlConnection myConn = new SqlConnection(DBConnect); StringBuilder sqlCommand = new StringBuilder(); SqlDataAdapter da; DataSet ds = new DataSet(); sqlCommand.AppendLine("Select * from ProfilePic where StudentAdmin = @paraStudAdmin"); da = new SqlDataAdapter(sqlCommand.ToString(), myConn); da.SelectCommand.Parameters.AddWithValue("@paraStudAdmin", tdList.studentAdmin.ToString()); da.Fill(ds, "stud_table"); int rec_cnt = ds.Tables["stud_table"].Rows.Count; if (rec_cnt > 0) { StringBuilder sqlImg = new StringBuilder(); int resultImg = 0; SqlCommand sqlCmdImg = new SqlCommand(); sqlImg.AppendLine("UPDATE ProfilePic set Image = @paraImage "); sqlImg.AppendLine("WHERE StudentAdmin = @paraStudentAdmin"); sqlCmdImg = new SqlCommand(sqlImg.ToString(), myConn); string Imagepath = "crop_" + fileName.ToString(); string Image = "~/ProfilePic/" + Imagepath; sqlCmdImg.Parameters.AddWithValue("@paraImage", Image); sqlCmdImg.Parameters.AddWithValue("@paraStudentAdmin", tdList.studentAdmin.ToString()); myConn.Open(); resultImg = sqlCmdImg.ExecuteNonQuery(); myConn.Close(); Response.Redirect("Account.aspx"); } else { StringBuilder sqlStr = new StringBuilder(); int result = 0; SqlCommand sqlCmd = new SqlCommand(); sqlStr.AppendLine("INSERT INTO ProfilePic (StudentAdmin, Image)"); sqlStr.AppendLine("VALUES (@paraStudAdmin,@paraImage)"); sqlCmd = new SqlCommand(sqlStr.ToString(), myConn); string Imagepath = "crop_" + fileName.ToString(); string Image = "~/ProfilePic/" + Imagepath; sqlCmd.Parameters.AddWithValue("@paraStudAdmin", tdList.studentAdmin.ToString()); sqlCmd.Parameters.AddWithValue("@paraImage", Image); myConn.Open(); result = sqlCmd.ExecuteNonQuery(); myConn.Close(); Response.Redirect("Account.aspx"); } } catch (Exception ex) { throw; } } }
protected void GridViewTD_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Accept") { int rowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridViewTD.Rows[rowIndex]; string studAdmin = row.Cells[1].Text; string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; StringBuilder sqlStr = new StringBuilder(); int result = 0; SqlCommand sqlCmd = new SqlCommand(); sqlStr.AppendLine("UPDATE RegisteredStudent set TripStatus = @paraStatus "); sqlStr.AppendLine("WHERE StudentAdmin = @paraStudentAdmin And TripID = @paraTripID"); SqlConnection myConn = new SqlConnection(DBConnect); sqlCmd = new SqlCommand(sqlStr.ToString(), myConn); sqlCmd.Parameters.AddWithValue("@paraStatus", "Accepted"); sqlCmd.Parameters.AddWithValue("@paraStudentAdmin", studAdmin.ToString()); sqlCmd.Parameters.AddWithValue("@paraTripID", Session["Code"].ToString()); myConn.Open(); result = sqlCmd.ExecuteNonQuery(); myConn.Close(); StudListDAO tdDAO = new StudListDAO(); List <StudList> tdList = new List <StudList>(); tdList = tdDAO.getTDbyTripID(Session["Code"].ToString()); GridViewTD.DataSource = tdList; GridViewTD.DataBind(); countStud(Session["Code"].ToString()); } if (e.CommandName == "Reject") { int rowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridViewTD.Rows[rowIndex]; string studAdmin = row.Cells[1].Text; string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; StringBuilder sqlStr = new StringBuilder(); int result = 0; SqlCommand sqlCmd = new SqlCommand(); sqlStr.AppendLine("UPDATE RegisteredStudent set TripStatus = @paraStatus "); sqlStr.AppendLine("WHERE StudentAdmin = @paraStudentAdmin And TripID = @paraTripID"); SqlConnection myConn = new SqlConnection(DBConnect); sqlCmd = new SqlCommand(sqlStr.ToString(), myConn); sqlCmd.Parameters.AddWithValue("@paraStatus", "Rejected"); sqlCmd.Parameters.AddWithValue("@paraStudentAdmin", studAdmin.ToString()); sqlCmd.Parameters.AddWithValue("@paraTripID", Session["Code"].ToString()); myConn.Open(); result = sqlCmd.ExecuteNonQuery(); myConn.Close(); StudListDAO tdDAO = new StudListDAO(); List <StudList> tdList = new List <StudList>(); tdList = tdDAO.getTDbyTripID(Session["Code"].ToString()); GridViewTD.DataSource = tdList; GridViewTD.DataBind(); countStud(Session["Code"].ToString()); } }