private DollarSaverDB.OrderRow GenerateOrder() { OrderTableAdapter orderAdapter = new OrderTableAdapter(); DollarSaverDB.OrderRow newOrder = orderAdapter.GenerateOrder(StationId)[0]; String customerIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (customerIpAddress == null || customerIpAddress == String.Empty) { customerIpAddress = Request.ServerVariables["REMOTE_ADDR"]; } if (customerIpAddress != null) { if (customerIpAddress.Contains(",")) { char[] seperator = { ',' }; String[] ipAddresses = customerIpAddress.Split(seperator); customerIpAddress = ipAddresses[0]; } newOrder.IPAddress = customerIpAddress; orderAdapter.Update(newOrder); } return(newOrder); }
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"); } }
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; } } }