protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OnlineAuctionSvc.Product product;

                int ProductID = (int)Session["Product ID"];
                lblProductName.Text = ProductID.ToString();


                OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();

                pxy.RetrieveProductDB(ProductID);


                product = pxy.RetrieveProductDB(ProductID);

                lblProductName.Text        = product.productname;
                lblProductDescription.Text = product.productdescription;
                lblReservePrice.Text       = product.reserveprice.ToString();
                lblCurrentBid.Text         = product.Currentbid.ToString();
                lblSellerUsername.Text     = product.Sellerusername;
                lblAuctionEndDate.Text     = product.auctionenddate.ToString();
            }
        }
Exemple #2
0
        protected void btnSubmitEdit_Click(object sender, EventArgs e)
        {
            string  productname        = txtProductName.Text;
            string  productdescription = txtProductDescription.Text;
            decimal reserveprice       = decimal.Parse(txtReservePrice.Text, NumberStyles.AllowCurrencySymbol | NumberStyles.Number);
            int     productID          = (int)Session["ProductID"];



            OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();

            int x = pxy.ModifyProductDB(productID, productname, productdescription, reserveprice);

            if (x > 0)
            {
                HideEditFunctions();

                Customer user;
                user = (Customer)Session["User"];
                string username = user.username;
                lblMessage.Text = "Success. You have edited that product";
                DBConnect objDB = new DBConnect();
                DataSet   myDS  = pxy.ViewMyAuctions(username);

                gvMyAuctions.DataSource = myDS;
                gvMyAuctions.DataBind();
            }
            else
            {
                lblMessage.Text = "Error, please try again.";
            }
        }
Exemple #3
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < gvMyAuctions.Rows.Count; i++)       //Input Validation to make sure one and only one checkbox is selected
            {
                CheckBox cb;
                cb = (CheckBox)gvMyAuctions.Rows[i].FindControl("cbSelect");

                if (cb.Checked)
                {
                    amountchecked = amountchecked + 1;
                }
            }

            if (amountchecked < 1)
            {
                lblMessage.Text = "Please Select a product to work with";
            }

            if (amountchecked > 1)
            {
                lblMessage.Text = "Please Select only one product to work with";
            }
            else
            {
                for (int i = 0; i < gvMyAuctions.Rows.Count; i++)                             //If all conditions are good pull the information from the one selected
                {
                    CheckBox cb;
                    cb = (CheckBox)gvMyAuctions.Rows[i].FindControl("cbSelect");

                    if (!cb.Checked)
                    {
                        continue;
                    }
                    else
                    {
                        Customer user;
                        user = (Customer)Session["User"];
                        string username = user.username;


                        ShowEditFunctions();
                        txtProductName.Text        = gvMyAuctions.Rows[i].Cells[1].Text;
                        txtProductDescription.Text = gvMyAuctions.Rows[i].Cells[2].Text;
                        txtReservePrice.Text       = gvMyAuctions.Rows[i].Cells[3].Text;

                        string productname        = txtProductName.Text;
                        string productdescription = txtProductDescription.Text;


                        OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();
                        int productID = pxy.GetProductID(productname, productdescription);
                        Session["ProductID"] = productID;
                    }
                }
            }
        }
        protected void btnSearchbyCategory_Click(object sender, EventArgs e)
        {
            DataSet myDS     = new DataSet();
            string  category = ddlProductCategory.Text;

            OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();

            myDS = pxy.SearchByCategory(category);
            gvProducts.DataSource = myDS;
            gvProducts.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();

            user = (Customer)Session["User"];
            string username = user.username;

            DataSet myDS = pxy.GetMyBids(username);

            gvBids.DataSource = myDS;
            gvBids.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();



                DataSet myDS = pxy.UpdateForDate();

                gvProducts.DataSource = myDS;
                gvProducts.DataBind();
            }
        }
Exemple #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataSet myDS = new DataSet();
                OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();

                c = (Customer)Session["User"];
                string username = c.username;


                myDS = pxy.ViewMyAuctions(username);

                gvMyAuctions.DataSource = myDS;
                gvMyAuctions.DataBind();
            }
        }
        protected void btnSubmitBid_Click(object sender, EventArgs e)
        {
            HideAddFunctions();

            int productID = (int)Session["Product ID"];

            decimal bidamount = Convert.ToDecimal(txtAddBidPrice.Text);

            Customer c        = (Customer)Session["User"];
            string   username = c.username;



            OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();

            pxy.UpdateProductBidsDB(productID, bidamount, username);
            pxy.AddBidDB(productID, bidamount, username);


            lblMessage.Text = "Success, your bid has been added.";
        }
        protected void btnAddItem_Click(object sender, EventArgs e)
        {
            if (txtProductName.Text == "" || txtProductDescription.Text == "" || txtStartPrice.Text == "" || txtReservePrice.Text == "")
            {
                lblErrorMessage.Text = "Please write a name for the product.";
                return;
            }
            else
            {
                string   productname        = txtProductName.Text;
                string   productdescription = txtProductDescription.Text;
                decimal  startprice         = Convert.ToDecimal(txtStartPrice.Text);
                decimal  reserveprice       = Convert.ToDecimal(txtReservePrice.Text);
                string   category           = ddlProductCategory.SelectedValue;
                string   subcategory        = ddlProductSubCategory.Text;
                DateTime date = calTime.SelectedDate;

                Customer c        = (Customer)Session["User"];
                string   username = c.username;


                OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();


                pxy.AddNewProductDB(productname, productdescription, startprice, reserveprice, username, category, subcategory, date);

                lblErrorMessage.Text = "Success. You have added an item.";



                txtReservePrice.Text       = "";
                txtProductName.Text        = "";
                txtStartPrice.Text         = "";
                txtProductDescription.Text = "";
            }
        }
Exemple #10
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < gvMyAuctions.Rows.Count; i++)       //Input Validation to make sure one and only one checkbox is selected
            {
                CheckBox cb;
                cb = (CheckBox)gvMyAuctions.Rows[i].FindControl("cbSelect");

                if (cb.Checked)
                {
                    amountchecked = amountchecked + 1;
                }
            }

            if (amountchecked < 1 || amountchecked > 1)
            {
                lblMessage.Text = "Please Select only one restaurant to work with at a time.";
            }
            else
            {
                for (int i = 0; i < gvMyAuctions.Rows.Count; i++)                             //If all conditions are good pull the information from the one selected
                {
                    CheckBox cb;
                    cb = (CheckBox)gvMyAuctions.Rows[i].FindControl("cbSelect");

                    if (!cb.Checked)
                    {
                        continue;
                    }
                    else
                    {
                        string productname        = gvMyAuctions.Rows[i].Cells[1].Text;
                        string productdescription = gvMyAuctions.Rows[i].Cells[2].Text;



                        OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();
                        int productID = pxy.GetProductID(productname, productdescription);


                        Customer user;
                        user = (Customer)Session["User"];
                        string username = user.username;



                        int x = pxy.DeleteProductDB(productID);

                        if (x > 0)
                        {
                            lblMessage.Text = "Success. You have deleted that product";
                            DBConnect objDB = new DBConnect();
                            DataSet   myDS  = pxy.ViewMyAuctions(username);

                            gvMyAuctions.DataSource = myDS;
                            gvMyAuctions.DataBind();
                        }
                        else
                        {
                            lblMessage.Text = "Error. Please try again.";
                        }
                    }
                }
            }
        }
        protected void btnCreateAccount_Click(object sender, EventArgs e)
        {
            if (txtDesiredUsername.Text == "")       //CHECKS FOR ANY BLANK FIELDS IN ACCOUNT CREATION
            {
                lblErrorMessage.Text = "Please make sure all fields are filled out correctly.";
                return;
            }
            if (txtNewName.Text == "")
            {
                lblErrorMessage.Text = "Please make sure all fields are filled out correctly.";
                return;
            }
            if (txtNewEmail.Text == "")
            {
                lblErrorMessage.Text = "Please make sure all fields are filled out correctly.";
                return;
            }

            if (txtDesiredPassword1.Text == "")
            {
                lblErrorMessage.Text = "Please make sure all fields are filled out correctly.";
                return;
            }
            if (txtDesiredPassword2.Text == "")
            {
                lblErrorMessage.Text = "Please make sure all fields are filled out correctly.";
                return;
            }
            if (ddlAccountType.Text == "")
            {
                lblErrorMessage.Text = "Please select which account type you are making.";
                return;
            }

            if (txtDesiredPassword1.Text != txtDesiredPassword2.Text)   //Checks to make sure the two passwords match
            {
                lblErrorMessage.Text = "Your passwords do not match.";
                return;
            }



            OnlineAuctionSvc.OnlineAuction pxy = new OnlineAuctionSvc.OnlineAuction();

            DBConnect objDB = new DBConnect();


            string  desiredname = txtDesiredUsername.Text;
            string  sqlCheck    = "SELECT * From Accounts WHERE Username = '******'";
            DataSet myDS        = objDB.GetDataSet(sqlCheck);

            // String checking = myDS.Tables[0].Rows[0][0].ToString();


            if (myDS.Tables[0].Rows.Count > 0)
            {
                lblErrorMessage.Text = "Username is already taken. Please select another.";
            }


            else                                                            //if all fields ok make a new account and redirect to homepage
            {
                CustomerFunctions cf = new CustomerFunctions();

                string name = txtNewName.Text;

                string email       = txtNewEmail.Text;
                string username    = txtDesiredUsername.Text;
                string password    = txtDesiredPassword1.Text;
                string accounttype = ddlAccountType.Text;

                Customer newUser = new Customer(name, email, username, password, accounttype);



                pxy.AddNewUserDB(username, password, name, email, accounttype);

                Session["User"] = newUser;



                Response.Redirect("UserHome.aspx");
            }
        }