Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            runningLowGrid.RowDataBound += new GridViewRowEventHandler(runningLowGrid_RowDataBound);

            if (!Page.IsPostBack)
            {
                if (CurrentUser.Role == AdminRole.SalesRep)
                {
                    managerHolder.Visible = false;
                }
                else
                {
                    managerHolder.Visible = true;

                    OrderTableAdapter            orderAdapter = new OrderTableAdapter();
                    DollarSaverDB.OrderDataTable recentOrders = orderAdapter.GetRecent(StationId, 10);

                    DollarSaverDB.OrderDataTable nonPrintableOrders = orderAdapter.GetRecentUnprintable(StationId, 10);

                    nonPrintableOrderGrid.DataSource = nonPrintableOrders.Rows;
                    nonPrintableOrderGrid.DataBind();

                    recentOrderGrid.DataSource = recentOrders.Rows;
                    recentOrderGrid.DataBind();
                }

                CertificateTableAdapter            certificateAdapter     = new CertificateTableAdapter();
                DollarSaverDB.CertificateDataTable runningLowCertificates = certificateAdapter.GetRunningLow(StationId);

                runningLowGrid.DataSource = runningLowCertificates.Rows;
                runningLowGrid.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            certificateRepeater.ItemDataBound += new RepeaterItemEventHandler(certificateRepeater_ItemDataBound);

            pickUpRepeater.ItemDataBound   += new RepeaterItemEventHandler(pickUpRepeater_ItemDataBound);
            shippingRepeater.ItemDataBound += new RepeaterItemEventHandler(shippingRepeater_ItemDataBound);

            if (IsDev && Request.QueryString["order_id"] != null)
            {
                try {
                    int orderId = Convert.ToInt32(Request.QueryString["order_id"]);
                    if (orderId > 0)
                    {
                        OrderTableAdapter            orderAdapter = new OrderTableAdapter();
                        DollarSaverDB.OrderDataTable orderTable   = orderAdapter.GetOrder(orderId);
                        if (orderTable.Count == 1)
                        {
                            Order = orderTable[0];
                        }
                    }
                } catch { }
            }



            if (Order == null || Order.StationId != StationId || Order.OrderStatusId != (int)OrderStatus.Complete)
            {
                OrderId = 0;
                Response.Redirect("~/Default.aspx");
            }

            if (!Page.IsPostBack)
            {
            }
        }
Exemplo n.º 3
0
        private void BindData()
        {
            timerBottomLabel.Text = now.ToString("MM/dd/yyyy hh:mm:ss tt");

            bool inactive = Globals.ConvertToBool(Request.QueryString["inactive"]);

            DollarSaverDB.StationDataTable stations;

            if (inactive)
            {
                mainTimer.Enabled = false;

                activeLinkHolder.Visible       = true;
                inactiveLinkHolder.Visible     = false;
                headerCell.Attributes["class"] = "inactive_header";
                headerCell.InnerText           = "Inactive Stations";

                recentOrderHolder.Visible = false;

                StationTableAdapter stationAdapter = new StationTableAdapter();
                stations = stationAdapter.GetInactive();
            }
            else
            {
                activeLinkHolder.Visible   = false;
                inactiveLinkHolder.Visible = true;

                StationTableAdapter stationAdapter = new StationTableAdapter();
                stations = stationAdapter.GetActive();

                recentOrderHolder.Visible = true;
                OrderTableAdapter            orderAdapter = new OrderTableAdapter();
                DollarSaverDB.OrderDataTable recentOrders = orderAdapter.GetSuperRecent(15);
                recentOrderGrid.DataSource = recentOrders.Rows;
                recentOrderGrid.DataBind();
            }

            if (stations.Count > 0)
            {
                stationHolder.Visible    = true;
                noStationsHolder.Visible = false;

                stationGrid.DataSource = stations.Rows;
                stationGrid.DataBind();
            }
            else
            {
                stationHolder.Visible    = false;
                noStationsHolder.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // fix this mess
            if (ReadOnly)
            {
                Response.Redirect("~/admin/");
            }

            saveButton.Click += new EventHandler(saveButton_Click);
            saveButton.Attributes["onclick"] = "javascript: return confirm('Are you sure want to return selected items?');";
            cancelButton.Click += new EventHandler(cancelButton_Click);

            lineItemRepeater.ItemDataBound += new RepeaterItemEventHandler(lineItemRepeater_ItemDataBound);

            orderId = GetIdFromQueryString();

            if (orderId > 0)
            {
                OrderTableAdapter orderAdapter = new OrderTableAdapter();

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

                if (orderTable.Count == 1)
                {
                    order = orderTable[0];
                }
                else
                {
                    Response.Redirect("~/admin/OrderList.aspx");
                }



                if (order.StationId != StationId)
                {
                    Response.Redirect("~/admin/OrderList.aspx");
                }
            }
            else
            {
                Response.Redirect("~/admin/OrderList.aspx");
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // fix this mess
            if (ReadOnly)
            {
                Response.Redirect("~/admin/");
            }

            saveButton.Click   += new EventHandler(saveButton_Click);
            cancelButton.Click += new EventHandler(cancelButton_Click);

            //lineItemRepeater.ItemDataBound += new RepeaterItemEventHandler(lineItemRepeater_ItemDataBound);

            orderId = GetIdFromQueryString();

            if (orderId > 0)
            {
                OrderTableAdapter orderAdapter = new OrderTableAdapter();

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

                if (orderTable.Count == 1)
                {
                    order = orderTable[0];
                }
                else
                {
                    Response.Redirect("~/admin/OrderList.aspx");
                }



                if (order.StationId != StationId)
                {
                    Response.Redirect("~/admin/OrderList.aspx");
                }
            }
            else
            {
                Response.Redirect("~/admin/OrderList.aspx");
            }
        }
        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)
        {
            toggleButton.Click += new EventHandler(toggleButton_Click);
            saveButton.Click   += new EventHandler(saveButton_Click);
            cancelButton.Click += new EventHandler(cancelButton_Click);

            issueId = GetIdFromQueryString();

            if (issueId <= 0)
            {
                RedirectToIssueList();
            }

            DollarSaverDB.IssueDataTable issueSearch = issueAdapter.GetIssue(issueId);

            if (issueSearch.Count != 1)
            {
                RedirectToIssueList();
            }

            issue = issueSearch[0];

            if (!Page.IsPostBack)
            {
                toggleButton.Text = issue.IsOpen ? "Close Issue" : "Reopen Issue";

                issueIdLabel.Text = issue.IssueId.ToString();
                stationLabel.Text = issue.Station.Name;
                statusLabel.Text  = issue.IsOpen ? "Open" : "Closed";
                dateLabel.Text    = issue.IssueDate.ToString("MM/dd/yyyy hh:mm:ss tt");

                if (!issue.IsAdvertiserIdNull())
                {
                    advertiserLink.Text        = issue.Advertiser.Name;
                    advertiserLink.NavigateUrl = "~/admin/AdvertiserEdit.aspx?station_id=" + issue.StationId + "&id=" + issue.AdvertiserId;
                }
                else
                {
                    advertiserLink.Visible = false;
                }

                if (!issue.IsOrderIdNull())
                {
                    OrderTableAdapter orderAdpater = new OrderTableAdapter();

                    DollarSaverDB.OrderDataTable orderSearch = orderAdpater.GetOrder(issue.OrderId);

                    if (orderSearch.Count == 0)
                    {
                        orderLink.Visible    = false;
                        orderIdLabel.Visible = true;
                        orderIdLabel.Text    = issue.OrderId.ToString() + " - Order not found";
                    }
                    else
                    {
                        DollarSaverDB.OrderRow order = orderSearch[0];

                        orderLink.Visible     = true;
                        orderLink.Text        = order.OrderId.ToString();
                        orderLink.NavigateUrl = "~/admin/OrderView.aspx?station_id=" + order.StationId + "&id=" + order.OrderId;

                        if (order.StationId != issue.StationId)
                        {
                            orderIdLabel.Visible = true;
                            orderIdLabel.Text    = " - Order station does not match issue station!";
                        }
                        else
                        {
                            orderIdLabel.Visible = false;
                        }
                    }
                }

                nameLabel.Text    = Server.HtmlEncode(issue.FullName);
                emailLabel.Text   = Server.HtmlEncode(issue.Email);
                messageLabel.Text = Server.HtmlEncode(issue.Message).Replace(Environment.NewLine, "<BR>");

                if (!issue.IsAdminNotesNull())
                {
                    adminNotesBox.Text = issue.AdminNotes;
                }
            }
        }