示例#1
0
    public string ReSet(string EMail)
    {
        //used to generate a re-set password email message
        //string to store any message
        String Message = "";

        //if the email exists
        if (EMailTaken(EMail) == true)
        {
            //generate a new email message
            mEMailMessage           = new clsEMail();
            mEMailMessage.Subject   = "Instructions for re-setting your password";
            mEMailMessage.Recipient = EMail;
            mEMailMessage.Sender    = "*****@*****.**";
            //get the temp password
            string TempPW = GetTempPW();
            mEMailMessage.Body = "<a href=ChangePassword.aspx?EMail=" + EMail + "&TempPW=" + TempPW + ">Re Set Password</a>";
            //updat the temp password in the database
            clsDataConnection DB = new clsDataConnection();
            DB.AddParameter("@AccountEMail", EMail.ToLower());
            DB.AddParameter("@TempPW", TempPW);
            DB.Execute("sproc_tblAccount_UpdateTempPW");
            //send the email
            mEMailMessage.SendEMail();
            //set the return message
            Message = "An email has been sent to your acccount with instructions on how to re-set your password.";
        }
        else
        {
            //send error
            Message = "Account not found";
        }
        //return any messages
        return(Message);
    }
示例#2
0
    private void SendActivationEMail(string EMail)
    {
        //sends an activation email to the user when email confirmation is required
        //generate a new email message
        mEMailMessage = new clsEMail();
        //set the subject
        mEMailMessage.Subject = "Instructions for activating your account";
        //set the recipient
        mEMailMessage.Recipient = EMail;
        //set the sender
        mEMailMessage.Sender = "*****@*****.**";
        //generate a temporary system password
        string TempPW = GetTempPW();

        //set the body of the email
        mEMailMessage.Body = "<a href=ActivateAccount.aspx?EMail=" + EMail + "&TempPW=" + TempPW + ">Activate Account</a>";
        //connect to the database
        clsDataConnection DB = new clsDataConnection();

        DB.AddParameter("@AccountEMail", EMail.ToLower());
        DB.AddParameter("@TempPW", TempPW);
        //update the temporary password
        DB.Execute("sproc_tblAccount_UpdateTempPW");
        //send the email
        mEMailMessage.SendEMail();
    }
    private void RejectOffer()
    {
        //sends an email to the person making the offer and delete the offer from the database
        //
        //var to store the email address of the person making the offer
        string OfferEMail;
        //var to store the user name of the person making the offer
        string OfferUserName;
        //var to store the title of the offer
        string OfferTitle;
        //declare an instance of my email object
        clsEMail AnEMail = new clsEMail();
        //var to store successful sending of the email
        Boolean Success;

        //get the email address of the person making the offer
        OfferEMail = GetOfferEMail(OfferNo);
        //get the user name of the person making the offer
        OfferUserName = GetOfferUserName(OfferNo);
        //get the title of the item on offer
        OfferTitle = GetOfferTitle(OfferNo);
        //send a rejection email to the person who made the offer
        Success = AnEMail.SendEMail("dvd.mdb", OfferEMail, "Your swap shop offer", ThisSite.SiteOwner + " has declined your offer of " + OfferTitle);
        //find the record for this offer in the database
        clsDataConnection AnOffer = new clsDataConnection("select * from offer where offerno=" + OfferNo);

        //if the record is found
        if (AnOffer.Count == 1)
        {
            //delete it
            AnOffer.RemoveRecord(0);
            //save the changes
            AnOffer.SaveChanges();
        }
    }
示例#4
0
    private bool SendPassword(string EMail, string Password)
    {
        //this function sends the password to the specified email address
        Boolean Success;
        //create an instance of my email object
        clsEMail AnEMail = new clsEMail();

        //send the email - success will contain true or fals depending on if it works or not
        Success = AnEMail.SendEMail("*****@*****.**", EMail, "Your swap shop password", "Your password is " + Password);
        //return success
        return(Success);
    }
示例#5
0
    private void AcceptOffer(int SwapNo, int OfferNo)
    {
        //this sub accepst an offer made on a swap
        //it accepts two parameters the swap number and the offer number
        //it sends an email to the person making the offer
        //and another email to the site owner
        //the offer is date stamped so that the site owner knows when the offer was accepted
        //
        //my email object used to send emails
        clsEMail AnEmail = new clsEMail();
        //var to store the email address of the person making the offer
        string OfferEMail;
        //var to store the title of the offered item
        string OfferTitle;
        //var to store the title of the swap
        string SwapTitle;
        //var to store the name of the person making the offer
        string OfferUserName;

        //get the email address of the person making the offer
        OfferEMail = GetOfferEMail(OfferNo);
        //get the title of the item being swapped
        SwapTitle = GetSwapTitle(SwapNo);
        //get the title of the item being offered
        OfferTitle = GetOfferTitle(OfferNo);
        //get the name of the person making the offer
        OfferUserName = GetOfferUserName(OfferNo);
        //construct and send an acceptance email to the person making the offer
        AnEmail.SendEMail(ThisSite.OwnerEMail, OfferEMail, "Your offer has been accepted", ThisSite.SiteOwner + " has accepted your offer of " + OfferTitle + " for " + SwapTitle + " please reply to this email to arrange the exchange.");
        //construct and send an email to the owner of the site
        AnEmail.SendEMail(OfferEMail, ThisSite.OwnerEMail, "You have accepted my offer", OfferUserName + " is going to swap " + OfferTitle + " for " + SwapTitle + " reply to this message to arrange an exchange.");
        //date stamp the swap
        //open a connection to the database finding the record for this offer
        clsDataConnection AnOffer = new clsDataConnection("select * from Offer where OfferNo = " + OfferNo);

        //date stamp the offer
        AnOffer.DataTable.Rows[0]["AcceptanceDate"] = DateTime.Now.Day + "/" + DateTime.Now.Month + "/" + DateTime.Now.Year;
        //save the changes
        AnOffer.SaveChanges();
    }
示例#6
0
    private bool EMailOwner(string UserName, string EMail, string OfferTitle)
    {
        //this function sends an email to the site owner
        //it returns true or false if the email was sent or not
        //
        //var to store success
        Boolean Success;
        //instance of the email object
        clsEMail AnEmail = new clsEMail();

        //send the email
        Success = AnEmail.SendEMail(EMail, ThisSite.OwnerEMail, "An offer has been made on one of your swaps", UserName + " has made an offer on " + OfferTitle);
        //return the outcome
        return(Success);
    }
    private Boolean SendPassword(string FirstName, string LastName, string EMail, string Password)
    {
        //this function sends the password for the new account to the user
        //if the email is sent ok then it returns true, else false
        //it accepts four parameters FirstName, LastName, EMail and Password
        //
        //create a new instance of the MyEmail object
        clsEMail AnEmail = new clsEMail();
        //var to record success of email send
        Boolean AllOk;

        //send the email to the user containing the password
        AllOk = AnEmail.SendEMail("*****@*****.**", EMail, "Your DVD swap shop password", FirstName + " Your password is " + Password);
        //return the status of the action
        return(AllOk);
    }