Esempio n. 1
0
        protected void checkActive_CheckedChanged(object sender, EventArgs e)
        {
            ListViewItem item  = (sender as CheckBox).NamingContainer as ListViewItem;
            int          index = Convert.ToInt32((item.FindControl("lblPostageID") as Label).Text);

            PostageOption.togglePostageOptionActivity(index);
            lsvPostage.DataSource = PostageOption.getPostageOptions();
            lsvPostage.DataBind();
        }
Esempio n. 2
0
        // selects postage option
        protected void ddlPostageOption_SelectedIndexChanged(object sender, EventArgs e)
        {
            PostageOption postageOption = new PostageOption();
            double        amount;

            if (ddlPostageOption.SelectedValue != "")
            {
                postageOption            = postageOption.getPostageOptionInformation(Convert.ToInt32(ddlPostageOption.SelectedValue));
                Session["PostageOption"] = postageOption;
                amount = Convert.ToDouble((Session["ShoppingCart"] as ShoppingCart).Amount) + postageOption.postageCost;
            }
            else
            {
                amount = Convert.ToDouble((Session["ShoppingCart"] as ShoppingCart).Amount);
            }
        }
Esempio n. 3
0
        protected void CreatePostageOption(object sender, EventArgs e)
        {
            if (IsValid)
            {
                PostageOption postageOption = new PostageOption
                {
                    postageType = txtPostageType.Text,
                    postageCost = Convert.ToDouble(txtPostageCost.Text),
                    postageDays = Convert.ToInt32(txtPostageDays.Text)
                };

                PostageOption.addPostageOption(postageOption);

                // Redirect to updated postage options
                Response.Redirect("~/UL/Admin/PostageOptionManagement");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.IsSecureConnection)
            {
                if (Session["AccountStatus"].Equals("UserAccount"))
                {
                    // checks if any items are in the cart
                    ShoppingCart shoppingCart = Session["ShoppingCart"] as ShoppingCart;

                    if (!shoppingCart.isEmpty())
                    {
                        // sends receipt
                        PostageOption postageOption = Session["PostageOption"] as PostageOption;

                        string mailbody = Payment.generateOrderReceipt("Fellow Customer", shoppingCart, postageOption);

                        try
                        {
                            Email.SendEmail(Session["UserAccount"].ToString(), "Order Receipt - JerseyZone", mailbody);
                        }
                        catch (Exception ex)
                        {
                            Response.Redirect("~/UL/Error");
                        }

                        // Remove cart from session
                        Session["ShoppingCart"] = "";
                        Session["ShoppingCart"] = new ShoppingCart();
                    }
                    else
                    {
                        Response.Redirect("~/UL/Error");
                    }
                }
                else
                {
                    Response.Redirect("~/UL/Error");
                }
            }
            else
            {
                string url = ConfigurationManager.AppSettings["SecurePath"] + "Confirmed";
                Response.Redirect(url);
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.IsSecureConnection)
            {
                if (Session["AccountStatus"].Equals("UserAccount"))
                {
                    ShoppingCart shoppingCart = Session["ShoppingCart"] as ShoppingCart;

                    // checks if shopping cart is empty
                    if (!shoppingCart.isEmpty())
                    {
                        if (!IsPostBack)
                        {
                            // returns cost of all items
                            double amount = Convert.ToDouble((Session["ShoppingCart"] as ShoppingCart).Amount);

                            lblAmount.Text = string.Format("{0:C}", amount);

                            ddlPostageOption.DataSource = PostageOption.getPostageOptionSet();
                            ddlPostageOption.DataBind();

                            Accounts userAccount = Session["CurrentAccount"] as Accounts;

                            lblFirstName.Text = userAccount.userFirstName;
                            lblLastName.Text  = userAccount.userLastName;
                        }
                    }
                    else
                    {
                        Response.Redirect("~/UL/Error");
                    }
                }
                else
                {
                    Response.Redirect("~/UL/Error");
                }
            }
            else
            {
                string url = ConfigurationManager.AppSettings["SecurePath"] + "Checkout";
                Response.Redirect(url);
            }
        }
Esempio n. 6
0
        // adds postage option
        public int addPostageOption(PostageOption option)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["JerseyZoneDBConnectionString"].ConnectionString;
            int    rows;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand("uspAddPostageOption", connection);

                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.AddWithValue("@postageType", option.postageType);
                command.Parameters.AddWithValue("@postageDays", option.postageDays);
                command.Parameters.AddWithValue("@postageCost", option.postageCost);

                connection.Open();

                rows = command.ExecuteNonQuery();
            }

            return(rows);
        }
Esempio n. 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.IsSecureConnection)
     {
         if (Session["AccountStatus"].Equals("AdminAccount"))
         {
             if (!IsPostBack)
             {
                 lsvPostage.DataSource = PostageOption.getPostageOptions();
                 lsvPostage.DataBind();
             }
         }
         else
         {
             Response.Redirect("~/UL/Error");
         }
     }
     else
     {
         string url = ConfigurationManager.AppSettings["SecurePath"] + "AdminPostageOptionManagement";
         Response.Redirect(url);
     }
 }