protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridView1.DataBind(); // Sending Cancellation Confirmation Email To the Students for information try { String studentID; if (Session["StudentID"] == null) { studentID = "300717754"; } else { studentID = Session["StudentID"].ToString(); } EmailConfirmation obj = new EmailConfirmation(); DatabaseRegistration objdb = new DatabaseRegistration(); String emailID = objdb.getEmailID(studentID); String Subject = "Appointment Cancellation"; String body = "You have Successfully Cancelled Appointment.\n Message Send from Advisor Booking Service System"; obj.sendEmail("*****@*****.**", "Passwordisimportant", emailID, Subject, body); Server.Transfer("StudentCancelAppointment.aspx"); } catch { Server.Transfer("StudentCancelAppointment.aspx"); } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { DatabaseRegistration objdb = new DatabaseRegistration(); if (objdb.update_Password(studentID, txtOldPassword.Text, txtPassword.Text)) { lblMessage.Text = "Password updated Successfully"; } else { lblMessage.Text = "Enter Correct Old Password"; } } catch (Exception obj) { lblMessage.Text = " Password is not updated Successfully. Database Error"; } }
protected void btnRegister_Click(object sender, EventArgs e) { try {String path; studentID = txtStudentID.Text; EmailConfirmation obj = new EmailConfirmation(); DatabaseRegistration objdb = new DatabaseRegistration(); if (objdb.isStudentIDAvailable(studentID) && objdb.isEmailIDAvailable(txtEmailID.Text)) { if (PhotoUpload.HasFile) { PhotoUpload.SaveAs(MapPath("~/Files/Images/Students/" + PhotoUpload.FileName)); path = PhotoUpload.FileName; ; } else { path = " "; } objdb.insert_Student_Info(txtStudentID.Text, txtFName.Text, txtLName.Text, ddlProgram.SelectedValue, txtCurrentSemester.Text, path); objdb.insert_Student_Login_Info(txtEmailID.Text, txtPassword.Text, txtStudentID.Text); String Subject = "Registration Confirmation Email"; String body = "You are Successfully registered with Advisor Booking Service."; body = body + "\n Now You can make an appointment with the advisor"; body = body + "\n Your User Name is =" + txtEmailID.Text; body = body + "\n Your Password is =" + txtPassword.Text; obj.sendEmail("*****@*****.**", "Passwordisimportant", txtEmailID.Text, Subject, body); lblMessage.Text = "Successfully Registered"; /// clear_Fields(); Response.Redirect("UserLogin.aspx"); } else { lblMessage.Text = "StudentID or Email ID is already registered"; clear_Fields(); } } catch (Exception obj) { lblMessage.Text = "Error in Registeration. Please try again"; } }
protected void btnUpdate_Click(object sender, EventArgs e) { try { DatabaseRegistration objdb = new DatabaseRegistration(); if (imgUpload.HasFile) { imgUpload.SaveAs(MapPath("~\\Files\\Images\\Students\\" + imgUpload.FileName)); path = imgUpload.FileName; } else { path = Session["Path"].ToString(); } objdb.update_Student_Info(lblStudentIDValue.Text, txtFName.Text, txtLName.Text, ddlProgramName.SelectedValue, txtCurrentSemester.Text, path); lblMessage.Text = "Profile updated Successfully"; } catch { lblMessage.Text = "Profile is not updated Successfully. Database Error"; } }