Ejemplo n.º 1
0
    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 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 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 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";
        }
    }