protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { OrderIDHidden.Value = ""; Session["CreditDetailTable"] = null; NameValueCollection coll = Request.QueryString; if (coll["InvoiceNo"] != null) { //get invoice //http://10.1.36.34/SOE/packingandplating.aspx?ItemNumber=00200-2400-021&ShipLoc=10&RequestedQty=5&AltQty=50&AvailableQty=33 InvoiceNoTextBox.Text = coll["InvoiceNo"].ToString(); GetDocument(coll["InvoiceNo"].ToString(), ""); } else { CreditRGAScriptManager.SetFocus("InvoiceNoTextBox"); } // Call the function to fill the search bar BindOrderTypes(); BindReasons(); RGAReturnToDropDown.DataSource = custDet.GetLocationDetails(); RGAReturnToDropDown.DataBind(); MakeCreditButt.Visible = false; MakeRGAButt.Visible = false; RGAReturnToLabel.Visible = false; RGAReturnToDropDown.Visible = false; } else { } }
protected void GetDocument(string InvoiceNo, string SONo) { try { OrderIDHidden.Value = ""; Session["CreditDetailTable"] = null; ClearPageMessages(); // get the data. ds = SqlHelper.ExecuteDataset(connectionString, "pSOEGetCreditRGA", new SqlParameter("@PassedInvoice", InvoiceNo), new SqlParameter("@PassedOrder", SONo)); if (ds.Tables.Count >= 1) { if (ds.Tables.Count == 1) { // We only go one table back, something is wrong dt = ds.Tables[0]; if (dt.Rows[0]["ErrorType"].ToString().Trim() + dt.Rows[0]["ErrorCode"].ToString() == "E0081") { ShowPageMessage("Document is on file but is the wrong type", 2); CreditRGAScriptManager.SetFocus("InvoiceNoTextBox"); return; } if (dt.Rows[0]["ErrorType"].ToString().Trim() + dt.Rows[0]["ErrorCode"].ToString() == "E0001") { ShowPageMessage("Document not found. " + InvoiceNo + "," + SONo, 2); CreditRGAScriptManager.SetFocus("InvoiceNoTextBox"); return; } if (dt.Rows.Count > 0) { ShowPageMessage("GetCreditRGA processing error. " + InvoiceNo + "," + SONo, 2); return; } } else { dt = ds.Tables[1]; if (dt.Rows.Count == 0) { HeaderGridView.DataBind(); HeaderUpdatePanel.Update(); DetailGridView.DataBind(); DetailUpdatePanel.Update(); ShowPageMessage("Invoice/Order not found.", 2); CreditRGAScriptManager.SetFocus("InvoiceNoTextBox"); } else { DetailGridView.DataSource = dt; DetailGridView.DataBind(); Session["CreditDetailTable"] = dt; OrderIDHidden.Value = ds.Tables[2].Rows[0]["FoundID"].ToString().Trim(); ShipLocHidden.Value = ds.Tables[2].Rows[0]["ShipLoc"].ToString().Trim(); try { RGAReturnToDropDown.SelectedValue = ShipLocHidden.Value.ToString(); } catch { } ShowMakeButton(); DetailUpdatePanel.Update(); dt = ds.Tables[2]; HeaderGridView.DataSource = dt; HeaderGridView.DataBind(); HeaderUpdatePanel.Update(); } } } ScriptManager.RegisterClientScriptBlock(InvoiceNoTextBox, InvoiceNoTextBox.GetType(), "SizeUpdate", "SetHeight();", true); } catch (Exception e2) { ShowPageMessage("GetCreditRGA Error " + e2.Message + ", " + e2.ToString(), 2); } }