Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bczm8703
Starting Member
2 Posts |
Posted - 2010-12-13 : 03:01:35
|
as shown in the image.. previous there shld be some data shown.. eg: Fee: 3.00 Booking Status: Pendingetc..but one fine day everything is empty and no1 has touch the code... need help on this phenomenon..below is the page load coding;protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (Request.QueryString["BookingID"] != null) { this.btnPay.Attributes.Add("onclick", "return confirm('The Amount will be deduct from your account? Proceed?');"); string bookcode = Request.QueryString["BookingID"].ToString(); lblblock.Visible = false; Callback obj = new Callback(); DataView bal = obj.GetBalance(bookcode); if (bal.Table.Rows.Count > 0) { lblbalance.Text = bal.Table.Rows[0]["Balance"].ToString(); } DataView dt = obj.PayDetail(bookcode); if (dt.Table.Rows.Count > 0) { lblApplicant.Text = dt.Table.Rows[0]["Applicant"].ToString(); lblUnit.Text = dt.Table.Rows[0]["Unit"].ToString(); lblFacility.Text = dt.Table.Rows[0]["Facility"].ToString(); lblBookedDate.Text = Convert.ToDateTime(dt.Table.Rows[0]["BookedDate"].ToString()).ToShortDateString(); lblSession.Text = dt.Table.Rows[0]["Session"].ToString(); lblFee.Text = dt.Table.Rows[0]["Fee"].ToString(); lblDeposit.Text = dt.Table.Rows[0]["Amount"].ToString(); lblBookingOn.Text = dt.Table.Rows[0]["BookedOn"].ToString(); lblBookedCode.Text = dt.Table.Rows[0]["BookCode"].ToString(); lblBookingStatus.Text = dt.Table.Rows[0]["Status"].ToString(); if (lblBookingStatus.Text.Equals("CFN")) { lblBookingStatus.Text = "CONFIRMED"; btnPay.Visible = false; btnCancel.ImageUrl = "~/images/fm-btn-close.gif"; } else if (lblBookingStatus.Text.Equals("PEN")) { lblBookingStatus.Text = "PENDING"; } else if (lblBookingStatus.Text.Equals("CCL")) { lblBookingStatus.Text = "CANCELLED"; btnPay.Visible = false; btnCancel.ImageUrl = "~/images/fm-btn-close.gif"; } else if (lblBookingStatus.Text.Equals("WAI")) { lblBookingStatus.Text = "Waiting list"; btnPay.Visible = false; btnCancel.ImageUrl = "~/images/fm-btn-close.gif"; } else { lblBookingStatus.Text = "Unknown Status"; btnPay.Visible = false; btnCancel.ImageUrl = "~/images/fm-btn-close.gif"; } lblInvoice.Text = dt.Table.Rows[0]["Invoice"].ToString(); lblPaymentOn.Text = dt.Table.Rows[0]["PayOn"].ToString(); if (lblInvoice.Text.Length > 2) { lblMessage.Text = "This Booking has already been pay."; btnPay.Visible = false; btnPrint.Visible = true; HtmlTableRow a = (HtmlTableRow)Page.FindControl("a"); a.Visible = Convert.ToBoolean("True"); HtmlTableRow b = (HtmlTableRow)Page.FindControl("b"); b.Visible = Convert.ToBoolean("True"); } else { HtmlTableRow c = (HtmlTableRow)Page.FindControl("a"); c.Visible = Convert.ToBoolean("false"); HtmlTableRow d = (HtmlTableRow)Page.FindControl("b"); d.Visible = Convert.ToBoolean("false"); } } } else { TablePay.Visible = false; } } } catch (Exception ex) { lblError.Text = ex.Message; } } |
|
bczm8703
Starting Member
2 Posts |
Posted - 2010-12-20 : 06:38:03
|
hi... i kind of solve this error... but another error occur...Callback obj = new Callback(); string bookcode = Request.QueryString["BookingID"].ToString(); int i = obj.iPayBooking(bookcode); if (i > 0) { Response.Redirect("AfterConfirmPage.aspx?BookingID=" + bookcode + "&Status=Pay"); } else { Page.RegisterStartupScript("Error", "<script language=javascript>alert('Transaction Failed.');</script>"); } the code keep entering the else-loop no matter what happen and it updated the db with the correct changes which is to deduct the amount from user account...need helpedited: i found out that the db has being updated by the query returned 0.. how do i solve this? |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2010-12-23 : 16:27:43
|
Very simple, although you didnt state the code in the other classes you are instantiating.Change this if (i > 0)to thisif (i == 0) |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2010-12-23 : 16:29:42
|
Am assuming the value of obj.iPayBooking(bookcode);is what you are retreiving from your db, as the code is not complete |
|
|
|
|
|