protected void ClearBtn_Click(object sender, EventArgs e) { OrderNumber.Text = null; ReturnGV.DataSource = null; ReturnGV.DataBind(); MessageUserControl.ShowInfo("Refund Cancelled.", "Please input the original order number."); Subtotal.Text = 0.00.ToString("C"); GST.Text = 0.00.ToString("C"); Total.Text = 0.00.ToString("C"); Invoice.Text = null; ReturnGV.Enabled = true; }
protected void LookupBtn_Click(object sender, EventArgs e) { int orderNumber; bool isNumeric = int.TryParse(OrderNumber.Text, out orderNumber); if (isNumeric.Equals(false)) { MessageUserControl.ShowInfo("Error", "Order Number is a numeric only field."); } else { if (string.IsNullOrEmpty(OrderNumber.Text)) { MessageUserControl.ShowInfo("Error", "Please input the original order number."); } else { int orderID = int.Parse(OrderNumber.Text); var controller = new SalesController(); var refundList = controller.RefundbyOrderNumber(orderID); if (refundList.Count == 0) { MessageUserControl.ShowInfo("No Results Found", "Order Number does not exist."); } else { ReturnGV.DataSource = refundList; ReturnGV.DataBind(); foreach (GridViewRow row in ReturnGV.Rows) { HiddenField isRefund = row.FindControl("IsRefundable") as HiddenField; CheckBox restock = row.FindControl("RestockSelect") as CheckBox; CheckBox reasonCheck = row.FindControl("ReasonSelect") as CheckBox; TextBox reasonTB = row.FindControl("Reason") as TextBox; if (isRefund.Value == "False") { restock.Visible = false; reasonCheck.Visible = false; reasonTB.Visible = false; } } ReturnGV.Enabled = true; } } } }