//function that handles the deleting of items from the cart public string delete_from_cart(string user_id, string cart_id) { Database_Connection con = new Database_Connection(); string response = con.ExecuteProcedure("DELETE_FROM_CART", ("@CART_ID;" + cart_id + "-@USER_ID;" + user_id), user_id); return(response); }
//function that handles the clear of the cart information public string clear_cart(string user_id) { Database_Connection con = new Database_Connection(); string response = con.ExecuteProcedure("CLEAR_CART", ("@USER_ID;" + user_id), user_id); return(response); }
public string complete_order(string user_id, string tran_id) { string response = ""; Database_Connection con = new Database_Connection(); string variables = "@USERID;" + user_id + "-@TRANSACTION_NUMER;" + tran_id; response = con.ExecuteProcedure("COMPLETE_ORDER", variables, user_id); //retreiving the response return(response); //returning the response }
//retriving the available amount per item public string item_purchase_limit(string user_id, string prod_id) { string response = ""; Database_Connection con = new Database_Connection(); string variables = "@PROD_ID;" + prod_id; if (user_id != "0") { response = con.ExecuteProcedure("GET_PROD_AVAIL_COUNT", variables, user_id);//retreiving the response } else { response = con.ExecuteProcedure("GET_PROD_AVAIL_COUNT", variables);//retreiving the response } con.closeSqlData(); //closing the connection stream return(response); //returning the response }
//retrieving user name public string get_user_name(string user_id) { Database_Connection con = new Database_Connection(); //retrieving user name string response = con.ExecuteProcedure("GET_USER_NAME", "@user_id;" + user_id, user_id); con.closeSqlData(); return(response);//returning the username }
//function that handles the login into the website public string log_in(string username, string password) { string response = null; Database_Connection con = new Database_Connection(); string variables = "@user_name;" + username + "-@password;" + password; response = con.ExecuteProcedure("USER_LOGIN", variables); con.closeSqlData(); return(response); }
//retrieving the total amount of items in the customers cart public string cart_items_count(string user_id) { string response = ""; Database_Connection con = new Database_Connection(); string variables = "@USERID;" + user_id; response = con.ExecuteProcedure("CART_ITEMS_COUNT", variables, user_id); //retreiving the response con.closeSqlData(); //closing the connection stream return(response); //returning the response }
//insert data into cart public string insert_into_cart(string user_id, string prod_id, string amt) { string response = ""; Database_Connection con = new Database_Connection(); string variables = "@PRODUCT_ID;" + prod_id + "-@USERID;" + user_id + "-@PURCHASED_AMOUNT;" + amt; response = con.ExecuteProcedure("ADD_PRODUCTS_TO_CART", variables, user_id); //retreiving the response con.closeSqlData(); //closing the connection stream return(response); //returning the response }
//function that handles the adding of customer shipping information public string Add_Shipping_Info(string userid, string deliver_info, string address_id) { //all the requred information to create a user string variabes = "@DELIVERY_INSTRUCTIONS;" + deliver_info + "-@ADDRESS_ID;" + address_id + "@USERID;" + userid; Database_Connection con = new Database_Connection(); string response = con.ExecuteProcedure("ADD_CUSTOMER_SHIPPING_DATA", variabes); con.closeSqlData(); return(response); }
//function that handles the adding of customer card information public string Add_Customer_Card_Info ( string userid, string cardholder_name, string card_no, string card_type, string address_id ) { //all the requred information to create a user string variabes = "@CARD_HOLDER_NAME;" + cardholder_name + "-@CARD_NO;" + card_no + "-@CARD_TYPE;" + card_type + "-@ADDRESS_ID;" + address_id + "-@USERID;" + userid; Database_Connection con = new Database_Connection(); string response = con.ExecuteProcedure("ADD_CUSTOMER_CARD_DATA", variabes); return(response); }
//function that handles user creation public string User_Creation ( string email, string username, string firstname, string middlename, string lastname, string phonenumber, string userpassword ) { //all the requred information to create a user string variabes = "@FIRST_NAME;" + firstname + "-@MIDDLE_NAME;" + middlename + "-@LAST_NAME;" + lastname + "-@PHONE_NUMBER;" + phonenumber + "-@EMAIL_ADDRESS1;" + email + "-@USERNAME;" + username + "-@USERPASSWORD;" + userpassword + "-@USER_TYPE;NON:ADMIN"; Database_Connection con = new Database_Connection(); string response = con.ExecuteProcedure("USER_CREATION", variabes); return(response); }
//adding the user address to the database for user that are logged in public string User_Address_Insertion ( string resident_name, string user_id, string streetNo, string city, string state, string country, string zip_code ) { //all the requred information to create a user string variabes = "@RESIDENT_NAME;" + resident_name + "-@USERID;" + user_id + "-@STREET_NO;" + streetNo + "-@CITY;" + city + "-@STATE_OF_RESIDENCES;" + state + "-@COUNTRY;" + country + "-@ZIP_CODE;" + zip_code; Database_Connection con = new Database_Connection(); string response = con.ExecuteProcedure("ADD_CUSTOMER_ADDRESSES", variabes); return(response); }
//adding the user address to the database for user that are not logged in public string User_Address_Insertion ( string resident_name, string username, string userpassword, string streetNo, string city, string state, string country, string zip_code ) { //checking if the user was successfully created by retrieving the user id string user_id = log_in(username, userpassword); //all the requred information to create a user string variabes = "@RESIDENT_NAME;" + resident_name + "-@USERID;" + user_id + "-@STREET_NO;" + streetNo + "-@CITY;" + city + "-@STATE_OF_RESIDENCES;" + state + "-@COUNTRY;" + country + "-@ZIP_CODE;" + zip_code; Database_Connection con = new Database_Connection(); string response = con.ExecuteProcedure("ADD_CUSTOMER_ADDRESSES", variabes); con.closeSqlData(); return(response); }