private void LoadData(string NewPassword) { string Receiver = Session["SecurityEmail"].ToString(); string Name = Session["SecurityName"].ToString(); // Hashing password string HashPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(NewPassword, "SHA1"); Binus.Common.Data.Student Data = new Binus.Common.Data.Student(); Data.studentEmail = Receiver; Data.studentPassword = Session["SecurityPassword"].ToString(); try { // Hash password update to DB and non-hashing password send to email. if (new StudentSystem().Student_ChangePassword(Data, HashPassword)) { SendEmail(Receiver, Name, NewPassword); } } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { Binus.Common.Data.Student Data = new Binus.Common.Data.Student { studentEmail = Session["ActiveStudentEmail"].ToString() }; Binus.Common.Data.Student GetDetail = new StudentSystem().Student_GetDetail(Data); lblStudentID.Text = GetDetail.studentID; lblStudentName.Text = GetDetail.studentName; lblCourseName.Text = GetDetail.courseName; }
protected void Page_Load(object sender, EventArgs e) { Binus.Common.Data.Student Data = new Binus.Common.Data.Student { studentEmail = Session["ActiveStudentEmail"].ToString() }; Binus.Common.Data.Student GetDetail = new StudentSystem().Student_GetDetail(Data); lblStudentName.Text = "Welcome, " + GetDetail.studentName + '!'; lblCourseName.Text = GetDetail.courseName; lblCourseProgress.Text = GetDetail.courseProgress.ToString() + '%'; string ConStr = @"Data Source=.;Initial Catalog=LapakMikir;Integrated Security=True"; SqlConnection Conn = new SqlConnection(ConStr); SqlCommand sqlCommand = new SqlCommand("dbo.bn_student_readDetail", Conn); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add("Email", SqlDbType.VarChar).Value = Session["ActiveStudentEmail"].ToString(); Conn.Open(); SqlDataReader Reader = sqlCommand.ExecuteReader(); if (Reader.HasRows) { while (Reader.Read()) { try { byte[] ImgData = (byte[])Reader["studentPicture"]; string ImgUrl = Convert.ToBase64String(ImgData, 0, ImgData.Length); imgProfile.ImageUrl = "data:image/png;base64," + ImgUrl; } catch { imgProfile.ImageUrl = "~/Assets/ppDefault.png"; } } Reader.Close(); } }
protected void btnChange_Click(object sender, EventArgs e) { Binus.Common.Data.Student Data = new Binus.Common.Data.Student(); Data.studentEmail = Session["ActiveStudentEmail"].ToString(); Data.courseName = ddlCourse.SelectedValue.ToString(); try { if (new StudentSystem().Student_ChangeCourse(Data)) { Response.Redirect(Request.RawUrl); lblSuccessMessage.Text = "Success.."; } } catch (Exception ex) { throw ex; } }