protected void Page_Load(object sender, EventArgs e) { if (Session["id"] == null) { Response.Redirect("~/views/Login.aspx"); } if (UserHandler.IsAdmin(Session["id"].ToString()) == false) { Response.Redirect("~/views/Homeaspx.aspx"); } if (Page.IsPostBack == false) { if (Request.QueryString["payId"] != null) { int payId = Int32.Parse(Request.QueryString["payId"]); PaymentType paytype = PaymentTypeHandler.GetPaymentType(payId); PaymentTypeName.Text = paytype.Type; paytypeTxt.Text = paytype.Type; //payIdTxt.Text = payId.ToString(); } else { Response.Redirect("~/PaymentType/ViewPaymentType.aspx"); } } }
public static Response CheckOut(List <DetailedCart> Cart, string paymentId, int userId) { if (paymentId == "" || paymentId.All(char.IsDigit) != true) { return(new Response(false, "Payment ID cannot be empty or non numeric")); } int _paymentId = Int32.Parse(paymentId); if (PaymentTypeHandler.GetPaymentType(_paymentId) == null) { return(new Response(false, "Wrong Payment Type ID")); } if (Cart == null) { return(new Response(false, "Cart Cannot be empty")); } TransactionHandler.CheckOut(Cart, _paymentId, userId); return(new Response(true, "Cart successfully checked out")); }