Esempio n. 1
0
    //create SignUp here

    //Create GetHashString here
    public string SignUp(string Email, string Password, string PasswordConfirm)
    //public method allowing the user to sign up for an account
    {
        //var to store any errors
        string ErrorMsg = "";

        //if the two passwords match
        if (Password == PasswordConfirm)
        {
            //get the hash of the plain text password
            string HashPassword = GetHashString(Password + Email);
            //add the record to the database
            clsDataConnection DB = new clsDataConnection("select * from Users");
            DB.NewRecord["Email"]        = Email;
            DB.NewRecord["UserPassword"] = HashPassword;
            DB.AddNewRecord();
            DB.SaveChanges();
        }
        //if the passwords do not match
        else
        {
            //generate an error message
            ErrorMsg = "The passwords do not match.";
        }
        //return the error message (if there is one)
        return(ErrorMsg);
    }
    public bool SendEMail(string SenderEMail, string RecipientEMail, string SubjectLine, string Message)
    {
        clsDataConnection DB = new clsDataConnection("select * from tblEmail");

        DB.NewRecord["SenderEMail"]    = SenderEMail;
        DB.NewRecord["RecipientEMail"] = RecipientEMail;
        DB.NewRecord["SubjectLine"]    = SubjectLine;
        DB.NewRecord["Message"]        = Message;
        DB.AddNewRecord();
        DB.SaveChanges();
        return(true);
    }
    private void AddWishListItem(string WishListItem)
    {
        //this sub adds a wish list item to the database
        //
        //open the wish list table
        clsDataConnection WishList = new clsDataConnection("select * from wishlist");

        //set the description
        WishList.NewRecord["Description"] = WishListItem;
        //add the record
        WishList.AddNewRecord();
        //save the changes
        WishList.SaveChanges();
    }
    private void AddSwap(string SwapTitle, string SwapDescription, string ImageFile)
    {
        //this sub adds a new swap to the swap table
        //
        //open a connection to the swap table
        clsDataConnection Swaps = new clsDataConnection("select * from swap");

        //set the title
        Swaps.NewRecord["Title"] = SwapTitle;
        //set the description
        Swaps.NewRecord["Description"] = SwapDescription;
        //set the name of the image file
        Swaps.NewRecord["ImageFile"] = ImageFile;
        //add the record
        Swaps.AddNewRecord();
        //save the changes
        Swaps.SaveChanges();
    }
Esempio n. 5
0
    private void SaveOffer(int SwapNo, int UserNo, string OfferTitle, string OfferDescription)
    {
        //this sub saves the offer to the database
        //
        //open a connection to the database table
        clsDataConnection Offers = new clsDataConnection("select * from offer");

        //save the swap no to the new record
        Offers.NewRecord["SwapNo"] = SwapNo;
        //save the user no to the new record
        Offers.NewRecord["UserNo"] = UserNo;
        //save the offer title to the new record
        Offers.NewRecord["Title"] = OfferTitle;
        //save the offer description to the new record
        Offers.NewRecord["Description"] = OfferDescription;
        //add the new record
        Offers.AddNewRecord();
        //save the new record
        Offers.SaveChanges();
    }
    private void CreateAccount(string FirstName, string LastName, string EMail, string Password)
    {
        //this sub creates a new account for the user
        //accepts four parameters FirstName LastName EMail and Password
        //
        //create a connection to the database table users
        clsDataConnection Users = new clsDataConnection("select * from users");

        //store the first name in the new record object
        Users.NewRecord["FirstName"] = FirstName;
        //store the last name in the new record object
        Users.NewRecord["LastName"] = LastName;
        //stor the email in the new record object
        Users.NewRecord["EMail"] = EMail;
        //store the password
        Users.NewRecord["UserPassword"] = Password;
        //add the new record
        Users.AddNewRecord();
        //save the changes (the new user is added to the database)
        Users.SaveChanges();
    }