Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int certificateId = GetIdFromQueryString();

            if (certificateId > 0)
            {
                CertificateTableAdapter certificateAdapter = new CertificateTableAdapter();

                DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCertificate(certificateId);

                if (certificateTable.Rows.Count == 1)
                {
                    DollarSaverDB.CertificateRow certificate = certificateTable[0];

                    if (certificate.Advertiser.StationId != StationId)
                    {
                        RedirectToHomePage();
                    }

                    certificateDetail.DisplayCertificate = certificate;
                }
                else
                {
                    RedirectToHomePage();
                }
            }
            else
            {
                RedirectToHomePage();
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            certificateId = GetIdFromQueryString();

            CertificateTableAdapter certificateAdapter = new CertificateTableAdapter();


            DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCertificate(certificateId);

            if (certificateTable.Count != 1)
            {
                Response.Redirect("~/admin/AdvertiserList.aspx");
            }

            certificate = certificateTable[0];

            if (certificate.Advertiser.StationId != StationId)
            {
                Response.Redirect("~/admin/AdvertiserList.aspx");
            }

            if (certificate.Advertiser.IsDeleted)
            {
                InfoMessage = "Sorry, this advertiser has been deleted";
                Response.Redirect("~/admin/AdvertiserList.aspx");
            }

            if (!Page.IsPostBack)
            {
                returnToCertificateLink.NavigateUrl = "~/admin/CertificateEdit.aspx?id=" + certificate.CertificateId;

                advertiserNameLabel.Text  = certificate.Advertiser.Name;
                certificateNameLabel.Text = certificate.ShortName;

                DollarSaverDB.CertificateNumberDataTable usedNumbers = certificate.UsedNumbers;



                usedCountLabel.Text = usedNumbers.Count.ToString();

                usedNumbers.DefaultView.Sort = "CreateDate";

                var sortedNumbers = from DollarSaverDB.CertificateNumberRow cn in usedNumbers
                                    orderby cn.CreateDate.ToString("yyyyMMdd") descending, cn.OrderId ascending select cn;

                usedNumberGrid.DataSource = sortedNumbers;
                usedNumberGrid.DataBind();
            }
        }
        void sendSoldoutNoticeButton_Click(object sender, EventArgs e)
        {
            int certificateId = Convert.ToInt32(certificateIdBox.Text);


            CertificateTableAdapter certificateAdapter = new CertificateTableAdapter();

            DollarSaverDB.CertificateDataTable certificateLookup = certificateAdapter.GetCertificate(certificateId);

            if (certificateLookup.Count == 1)
            {
                NotifySoldOut(certificateLookup[0]);

                InfoMessage = "Sent Sold Out Notice for Certificate " + certificateLookup[0].ShortName;
            }
            else
            {
                ErrorMessage = "Certificate Not Found";
            }
        }
        void saveButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                int    advertiserId = Int32.Parse(advertiserIdHidden.Value);
                String shortName    = nameBox.Text.Trim();
                String description  = descriptionBox.Text.Trim();

                if (shortName == String.Empty)
                {
                    ErrorMessage = "Name is required";
                    return;
                }

                if (shortName.Length > 100)
                {
                    shortName = shortName.Substring(0, 100);
                }

                if (description == String.Empty)
                {
                    ErrorMessage = "Description is required";
                    return;
                }

                if (description.Length > 500)
                {
                    description = description.Substring(0, 500);
                }


                int minPurchaseQty = 0;

                try {
                    minPurchaseQty = Int32.Parse(minPurchaseQtyBox.Text);
                } catch {
                    ErrorMessage = "Min Purchase Qty must be an integer";
                    return;
                }

                if (minPurchaseQty <= 0)
                {
                    ErrorMessage = "Min Purchase Qty must be a postive number";
                    return;
                }


                int maxPurchaseQty = 0;

                try {
                    maxPurchaseQty = Int32.Parse(maxPurchaseQtyBox.Text);
                } catch {
                    ErrorMessage = "Max Purchase Qty must be an integer";
                    return;
                }

                if (maxPurchaseQty < 0)
                {
                    ErrorMessage = "Min Purchase Qty must be greater than or equal to 0";
                    return;
                }



                decimal faceValue = 0;
                try {
                    faceValue = Decimal.Parse(faceValueBox.Text);
                } catch {
                    ErrorMessage = "Face Value must be a decimal";
                    return;
                }

                if (faceValue <= 0)
                {
                    ErrorMessage = "Face Value be a postive";
                    return;
                }

                decimal discount = 0;
                try {
                    discount = Decimal.Parse(discountBox.Text);
                } catch {
                    ErrorMessage = "Discount must be a decimal";
                    return;
                }

                if (discount <= 0)
                {
                    ErrorMessage = "Discount be a postive";
                    return;
                }

                int discountTypeId = Int32.Parse(discountList.SelectedValue);

                String onSaleDateStr = String.Empty;

                if (Station.StationSiteType == SiteType.DealOfTheWeek)
                {
                    onSaleDateStr = onSaleDateList.SelectedValue;
                }
                else
                {
                    onSaleDateStr = onSaleDateBox.Text.Trim();
                }

                if (onSaleDateStr == String.Empty)
                {
                    ErrorMessage = "On Sale Date is required";
                    return;
                }

                if (Station.StationSiteType == SiteType.Standard)
                {
                    onSaleDateStr += " " + onSaleHourList.SelectedValue + ":" + onSaleMinuteList.SelectedValue + ":00 ";
                }

                DateTime onSaleDate;
                try {
                    onSaleDate = Convert.ToDateTime(onSaleDateStr);
                } catch {
                    ErrorMessage = "On Sale Date must by in the format MM/DD/YYYY";
                    return;
                }

                onSaleDate = TimeZoneInfo.ConvertTime(onSaleDate, Station.StationTimeZoneInfo, TimeZoneInfo.Local);

                int lowStockAmount = 0;

                try {
                    lowStockAmount = Int32.Parse(lowStockAmountBox.Text);
                } catch {
                    ErrorMessage = "Low Stock Amount must be an integer";
                    return;
                }

                if (lowStockAmount < 0)
                {
                    ErrorMessage = "Low Stock Amount must be greater than or equal to 0";
                    return;
                }

                int numberLength = Convert.ToInt32(numberLengthList.SelectedValue);

                int    deliveryTypeId = Convert.ToInt32(deliveryList.SelectedValue);
                string deliveryNote   = deliveryNoteBox.Text.Trim();


                if (deliveryNote.Length > 500)
                {
                    deliveryNote = deliveryNote.Substring(0, 500);
                }

                bool isActive = isActiveBox.Checked;

                CertificateTableAdapter certificateAdapter = new CertificateTableAdapter();

                if (idHidden.Value != String.Empty)
                {
                    certificateId = Int32.Parse(idHidden.Value);

                    certificate = certificateAdapter.GetCertificate(certificateId)[0];

                    certificate.ShortName      = shortName;
                    certificate.Description    = description;
                    certificate.MinPurchaseQty = minPurchaseQty;
                    certificate.MaxPurchaseQty = maxPurchaseQty;

                    certificate.FaceValue      = faceValue;
                    certificate.Discount       = discount;
                    certificate.DiscountTypeId = discountTypeId;
                    certificate.OnSaleDate     = onSaleDate;
                    certificate.LowStockAmount = lowStockAmount;
                    certificate.NumberLength   = numberLength;
                    certificate.DeliveryTypeId = deliveryTypeId;
                    certificate.DeliveryNote   = deliveryNote;
                    certificate.IsActive       = isActive;

                    certificateAdapter.Update(certificate);

                    CertificateNumberTableAdapter certificateNumberAdapter = new CertificateNumberTableAdapter();

                    InfoMessage = "Certificate updated";
                }
                else
                {
                    int quantity = 0;

                    try {
                        quantity = Int32.Parse(qtyBox.Text.Trim());
                    } catch {
                        ErrorMessage = "Quantity must be an integer";
                        return;
                    }

                    if (quantity <= 0)
                    {
                        ErrorMessage = "Quantity must be a postive";
                        return;
                    }

                    certificateId = Convert.ToInt32(certificateAdapter.InsertPK(advertiserId, shortName, description,
                                                                                minPurchaseQty, maxPurchaseQty, faceValue, discount, discountTypeId, deliveryTypeId, deliveryNote, isActive,
                                                                                onSaleDate, lowStockAmount, numberLength));


                    CertificateNumberTableAdapter certificateNumberAdapter = new CertificateNumberTableAdapter();
                    certificateNumberAdapter.Generate(certificateId, quantity);

                    InfoMessage = "Certificate created";
                }

                Response.Redirect("~/admin/AdvertiserEdit.aspx?id=" + advertiserId);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            saveButton.Click   += new EventHandler(saveButton_Click);
            cancelButton.Click += new EventHandler(cancelButton_Click);
            deleteButton.Click += new EventHandler(deleteButton_Click);
            deleteButton.Attributes["onclick"] = "javascript: return confirm('Are you sure want to delete this item?');";

            emailButton.Click         += new EventHandler(emailButton_Click);
            addNumbersButton.Click    += new EventHandler(addNumbersButton_Click);
            removeNumbersButton.Click += new EventHandler(removeNumbersButton_Click);

            createHistoryRepeater.ItemDataBound += new RepeaterItemEventHandler(createHistoryRepeater_ItemDataBound);
            availableNumberGrid.RowDataBound    += new GridViewRowEventHandler(availableNumberGrid_RowDataBound);

            certificateId = GetIdFromQueryString();

            int advertiserId = 0;


            CertificateTableAdapter certificateAdapter = new CertificateTableAdapter();

            if (certificateId > 0)
            {
                DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCertificate(certificateId);

                if (certificateTable.Count != 1)
                {
                    Response.Redirect("~/admin/AdvertiserList.aspx");
                }

                certificate = certificateTable[0];

                advertiserId = certificate.AdvertiserId;
            }
            else
            {
                advertiserId = GetValueFromQueryString("advertiserId");
            }

            if (!Page.IsPostBack)
            {
                if (Station.StationSiteType == SiteType.DealOfTheWeek)
                {
                    standardDateHolder.Visible = false;
                    onSaleDateBoxRFV.Enabled   = false;
                    onSaleDateList.Visible     = true;

                    ArrayList onSaleDates = new ArrayList();
                    onSaleDates = certificateAdapter.GetDealDates(StationId);

                    onSaleDateList.DataSource           = onSaleDates;
                    onSaleDateList.DataTextFormatString = "{0:MM/dd/yyyy hh:mm:ss tt}";
                    onSaleDateList.DataBind();

                    DateTime onSaleNow = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, Station.StationTimeZoneInfo);
                    onSaleNow = onSaleNow.AddDays(-14);

                    onSaleDateList.Items.Add(new ListItem("-- On Sale Now --", onSaleNow.ToString("MM/dd/yyyy hh:mm:ss tt")));
                }
                else
                {
                    standardDateHolder.Visible = true;
                    onSaleDateBoxRFV.Enabled   = true;
                    onSaleDateList.Visible     = false;

                    for (int i = 0; i <= 23; i++)
                    {
                        String hour;

                        if (i % 12 == 0)
                        {
                            hour = "12";
                        }
                        else
                        {
                            hour = (i % 12).ToString("00");
                        }

                        onSaleHourList.Items.Add(new ListItem(hour + " " + (i < 12 ? "AM" : "PM"), i.ToString("00")));
                    }

                    for (int i = 0; i <= 59; i++)
                    {
                        onSaleMinuteList.Items.Add(new ListItem(i.ToString("00"), i.ToString("00")));
                    }
                }

                AdvertiserTableAdapter            advertiserAdapter = new AdvertiserTableAdapter();
                DollarSaverDB.AdvertiserDataTable advertiserTable   = advertiserAdapter.GetAdvertiser(advertiserId);

                if (advertiserTable.Count != 1)
                {
                    Response.Redirect("~/admin/AdvertiserList.aspx");
                }

                DollarSaverDB.AdvertiserRow advertiser = advertiserTable[0];

                if (advertiser.StationId != StationId)
                {
                    Response.Redirect("~/admin/AdvertiserList.aspx");
                }

                if (advertiser.IsDeleted)
                {
                    InfoMessage = "Sorry, this advertiser has been deleted";
                    Response.Redirect("~/admin/AdvertiserList.aspx");
                }

                discountList.Items.Add(new ListItem("Percentage", "1"));
                discountList.Items.Add(new ListItem("Flat Amount", "2"));


                advertiserNameLabel.Text = advertiser.Name;
                advertiserIdHidden.Value = advertiserId.ToString();

                if (certificateId > 0)
                {
                    createEditLabel.Text  = "Edit";
                    newCertHolder.Visible = false;

                    idHidden.Value = certificateId.ToString();

                    nameBox.Text = certificate.ShortName;
                    descriptionLengthLabel.Text = certificate.Description.Length.ToString();
                    descriptionBox.Text         = certificate.Description;
                    minPurchaseQtyBox.Text      = certificate.MinPurchaseQty.ToString();
                    maxPurchaseQtyBox.Text      = certificate.MaxPurchaseQty.ToString();

                    faceValueBox.Text          = certificate.FaceValue.ToString("0.00");
                    discountBox.Text           = certificate.Discount.ToString("0.00");
                    discountList.SelectedValue = certificate.DiscountTypeId.ToString();

                    if (CurrentUser.Role == AdminRole.Manager || CurrentUser.Role == AdminRole.SalesRep)
                    {
                        faceValueBox.Enabled = false;
                        discountBox.Enabled  = false;
                        discountList.Enabled = false;
                    }


                    deliveryList.SelectedValue = certificate.DeliveryTypeId.ToString();
                    deliveryNoteBox.Text       = certificate.DeliveryNote;
                    isActiveBox.Checked        = certificate.IsActive;
                    lowStockAmountBox.Text     = certificate.LowStockAmount.ToString();

                    if (numberLengthList.Items.FindByValue(certificate.NumberLength.ToString()) != null)
                    {
                        numberLengthList.SelectedValue = certificate.NumberLength.ToString();
                    }

                    if (Station.StationSiteType == SiteType.DealOfTheWeek)
                    {
                        ListItem dateItem = onSaleDateList.Items.FindByText(certificate.AdjustedOnSaleDate.ToString("MM/dd/yyyy hh:mm:ss tt}"));
                        if (dateItem != null)
                        {
                            onSaleDateList.SelectedIndex = onSaleDateList.Items.IndexOf(dateItem);
                        }
                        else
                        {
                            onSaleDateList.Items.Insert(0, new ListItem(certificate.AdjustedOnSaleDate.ToString("MM/dd/yyyy hh:mm:ss tt"),
                                                                        certificate.AdjustedOnSaleDate.ToString("M/d/yyyy h:mm:ss tt")));
                        }
                    }
                    else
                    {
                        onSaleDateBox.Text             = certificate.AdjustedOnSaleDate.ToString("MM/dd/yyyy");
                        onSaleHourList.SelectedValue   = certificate.AdjustedOnSaleDate.Hour.ToString("00");
                        onSaleMinuteList.SelectedValue = certificate.AdjustedOnSaleDate.Minute.ToString("00");
                    }

                    CertificateNumberTableAdapter certificateNumberAdapter = new CertificateNumberTableAdapter();

                    ArrayList createDates = certificateNumberAdapter.GetDates(certificateId);

                    createDateList.DataSource           = createDates;
                    createDateList.DataTextFormatString = "{0:MM/dd/yyyy}";
                    createDateList.DataBind();

                    createDateList.Items.Insert(0, new ListItem("-- All Dates --", ""));

                    certificateNumberHolder.Visible = true;

                    createHistoryRepeater.DataSource = createDates;
                    createHistoryRepeater.DataBind();

                    if (certificate.DeliveryType == DeliveryType.Print)
                    {
                        printableHolder.Visible    = true;
                        notPrintableHolder.Visible = false;

                        String queryString = "sample_id=" + certificate.CertificateId;

                        String encryptedString = Server.UrlEncode(Cipher.Encrypt(queryString));

                        viewSampleLink.NavigateUrl = "~/ViewCertificate.aspx?x=" + encryptedString;

                        BindNumbers();
                    }
                    else
                    {
                        printableHolder.Visible    = false;
                        notPrintableHolder.Visible = true;

                        availableCountLabel.Text = certificate.AvailableNumbers.Count.ToString();
                        usedCountLabel.Text      = certificate.UsedNumbers.Count.ToString();
                    }
                }
                else
                {
                    deleteButton.Visible            = false;
                    saveButton.Text                 = "Create";
                    createEditLabel.Text            = "Create";
                    certificateNumberHolder.Visible = false;
                    newCertHolder.Visible           = true;
                    onSaleDateBox.Text              = DateTime.Now.ToString("MM/dd/yyyy");
                }
            }
        }
        private void LoadCertificateNumber()
        {
            CertificateNumberTableAdapter certificateNumberAdapter = new CertificateNumberTableAdapter();

            int id       = 0;
            int orderId  = 0;
            int sampleId = 0;

            String cipherText = Request.QueryString["x"];

            if (cipherText != null && cipherText != String.Empty)
            {
                try {
                    String plainText = Server.UrlDecode(Cipher.Decrypt(cipherText));

                    String[] keysAndValues = plainText.Split('&');

                    foreach (String keyAndValueStr in keysAndValues)
                    {
                        String[] keyAndValue = keyAndValueStr.Split('=');

                        if (keyAndValue.Length == 2)
                        {
                            if (keyAndValue[0] == "id")
                            {
                                try {
                                    id = Convert.ToInt32(keyAndValue[1]);
                                } catch { }
                            }
                            else if (keyAndValue[0] == "order_id")
                            {
                                try {
                                    orderId = Convert.ToInt32(keyAndValue[1]);
                                } catch { }
                            }
                            else if (keyAndValue[0] == "sample_id")
                            {
                                try {
                                    sampleId = Convert.ToInt32(keyAndValue[1]);
                                } catch { }
                            }
                        }
                    }
                } catch { }
            }

            if (sampleId == 0)
            {
                if (id == 0 || orderId == 0)
                {
                    // check for old parameters for backward compatibility
                    // viewcertificate?orderNum=13651&certNum=755426&backBtn=no
                    orderId = GetValueFromQueryString("orderNum");
                    id      = 0;

                    // cut off backward compatibility after certain order id
                    if (orderId < 17000)
                    {
                        String number = Convert.ToString(Request.QueryString["certNum"]);

                        if (orderId == 0 || number == String.Empty)
                        {
                            return;
                        }

                        DollarSaverDB.CertificateNumberDataTable numberSearch = certificateNumberAdapter.GetBackward(orderId, number);

                        if (numberSearch.Count == 1)
                        {
                            id = numberSearch[0].CertificateNumberId;
                        }
                        else
                        {
                            return;
                        }
                    }
                }

                DollarSaverDB.CertificateNumberDataTable certNumberTable = certificateNumberAdapter.GetCertificateNumber(id);

                if (certNumberTable.Count != 1)
                {
                    return;
                }

                DollarSaverDB.CertificateNumberRow checkCertNumber = certNumberTable[0];

                OrderTableAdapter orderAdapter = new OrderTableAdapter();

                DollarSaverDB.OrderDataTable orderTable = orderAdapter.GetOrder(orderId);

                if (orderTable.Count != 1)
                {
                    return;
                }

                DollarSaverDB.OrderRow order = orderTable[0];

                if (order.OrderStatusId != (int)OrderStatus.Complete)
                {
                    return;
                }

                if (checkCertNumber.IsOrderLineItemIdNull() || !order.LineItems.Contains(checkCertNumber.OrderLineItemId))
                {
                    return;
                }

                certNumber  = checkCertNumber;
                certificate = certNumber.Certificate;
            }
            else
            {
                CertificateTableAdapter            certAdapter      = new CertificateTableAdapter();
                DollarSaverDB.CertificateDataTable certificateTable = certAdapter.GetCertificate(sampleId);

                if (certificateTable.Count != 1)
                {
                    return;
                }

                certificate = certificateTable[0];
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lineItemRepeater.ItemDataBound += new RepeaterItemEventHandler(lineItemRepeater_ItemDataBound);
            lineItemRepeater.ItemCommand   += new RepeaterCommandEventHandler(lineItemRepeater_ItemCommand);

            updateButton.Click   += new EventHandler(updateButton_Click);
            continueButton.Click += new EventHandler(continueButton_Click);

            /*
             * if (Order != null &&
             *  (Order.OrderStatusId != 1 || Order.StationId != StationId)) {
             *  Order = null;
             *  Response.Redirect("~/Cart.aspx");
             * }*/

            if (displayCookieMessage)
            {
                itemHolder.Visible          = false;
                emptyCartHolder.Visible     = false;
                cookieMessageHolder.Visible = true;
                homeLink.NavigateUrl       += "?station_id=" + StationId;
                return;
            }
            else
            {
                cookieMessageHolder.Visible = false;
            }

            if (!Page.IsPostBack)
            {
                OrderTableAdapter orderAdapter = new OrderTableAdapter();

                int certificateId = GetCertificateIdFromQueryString();

                if ((Order == null && certificateId > 0) ||
                    (Order != null && Order.OrderStatusId != 1) ||
                    (Order != null && Order.StationId != StationId))
                {
                    Order = GenerateOrder();
                }


                if (certificateId > 0)
                {
                    CertificateTableAdapter certificateAdapter = new CertificateTableAdapter();

                    DollarSaverDB.CertificateDataTable certificateTable = certificateAdapter.GetCertificate(certificateId);

                    if (certificateTable.Count != 1)
                    {
                        Response.Redirect("~/Cart.aspx");
                    }

                    DollarSaverDB.CertificateRow certificate = certificateTable[0];

                    if (certificate.Advertiser.StationId != StationId)
                    {
                        Response.Redirect("~/Cart.aspx");
                    }

                    if (!certificate.IsActive || !certificate.Advertiser.IsActive)
                    {
                        InfoMessage = "Sorry, this certificate is no longer available";
                        Response.Redirect("~/Cart.aspx");
                    }

                    if (certificate.OnSaleDate > DateTime.Now)
                    {
                        InfoMessage = "Sorry, this certificate is not yet available";
                        Response.Redirect("~/Cart.aspx");
                    }

                    int quantity = GetValueFromQueryString("qty");

                    if (quantity == 0)
                    {
                        quantity = 1;
                    }

                    OrderLineItemTableAdapter orderLineItemAdapter = new OrderLineItemTableAdapter();

                    DollarSaverDB.OrderLineItemRow lineItem = Order.LineItems.GetLineItem(certificateId);


                    if (lineItem == null)
                    {
                        quantity = CheckQuantity(quantity, certificate);

                        if (quantity > 0)
                        {
                            Order.LineItems.AddOrderLineItemRow(Order.OrderId, -1, quantity,
                                                                certificate.CertificateId, certificate.ShortName, certificate.Description,
                                                                certificate.FaceValue, certificate.Discount, certificate.DiscountTypeId,
                                                                false, certificate.DeliveryTypeId, certificate.DeliveryNote);

                            orderLineItemAdapter.Update(Order.LineItems);
                        }
                    }
                    else
                    {
                        quantity += lineItem.Quantity;

                        quantity = CheckQuantity(quantity, certificate);

                        if (quantity == 0)
                        {
                            orderLineItemAdapter.Delete(lineItem.OrderLineItemId);
                        }
                        else
                        {
                            lineItem.Quantity = quantity;
                            orderLineItemAdapter.Update(lineItem);
                        }
                    }

                    UpdateLineItemModifiedDate();

                    if (InfoMessage == String.Empty)
                    {
                        InfoMessage = "Certificate(s) added to your cart";
                    }

                    // reload the cart
                    Response.Redirect("~/Cart.aspx");
                }


                if (Order != null && Order.LineItems.Count > 0)
                {
                    itemHolder.Visible      = true;
                    emptyCartHolder.Visible = false;

                    lineItemRepeater.DataSource = Order.LineItems.Rows;
                    lineItemRepeater.DataBind();

                    subTotalLabel.Text = Order.LineItems.SubTotal.ToString("$#,0.00");

                    continueShoppingLink.NavigateUrl = "~/Default.aspx?station_id=" + StationId;
                }
                else
                {
                    itemHolder.Visible      = false;
                    emptyCartHolder.Visible = true;
                }
            }
            else
            {
                // if page is postback, make sure the order is still in the session
                if (Order == null)
                {
                    InfoMessage = "Sorry, your session has timed out";
                    Response.Redirect("~/Cart.aspx");
                }
            }
        }