hi
i have developed a web application,having a web form DataTransaction.aspx
when i run this by setting "run as start up" in browser am observing
localhost:3038/DataTransaction.aspx----->upto this fine.
but i want to trace (by keeping break points) with url:
localhost:3038/DataTransaction.aspx?MID=mach1&&CNUM=c1&AMT=1000&TOT=01022014112233&UPWD=op1&TT=1
here is my form code behind code:
<pre lang="c#">using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MySql.Data.MySqlClient;
using System.Web.Configuration;
namespace Online_Billing_System
{
public partial class DataTransaction : System.Web.UI.Page
{
String ConnectionString = WebConfigurationManager.ConnectionStrings["myConnectionString"].ToString();
bool found = false;
String memberid, name, phonenumber;
decimal openbal, due;
protected void Page_Load(object sender, EventArgs e)
{
String machineid = Request.QueryString["MID"];
String cardid = Request.QueryString["CNUM"];
decimal paidamount = Convert.ToDecimal(Request.QueryString["AMT"]);
String paiddate = Request.QueryString["TOT"];
String operatorid = Request.QueryString["UPWD"];
if (machineid != null && cardid != null && paidamount != 0 && paiddate != null && operatorid != null)
{
if (Convert.ToInt32(Request.QueryString["TT"]) == 1)
{
using (MySqlConnection con = new MySqlConnection(ConnectionString))
{
String browseroperatorid = Request.QueryString["UPWD"].ToString();
String query = "select operator_id from operator";
MySqlCommand command = new MySqlCommand(query, con);
con.Open();
using (MySqlDataReader rdr = command.ExecuteReader())
{
while(rdr.Read())
{
String dboperatorid = rdr["operator_id"].ToString();
if (dboperatorid.Equals(browseroperatorid))
{
found = true;
break;
}
}
}
if (found == true)
{
String selectquery = "select * from admin where card_id= '" + cardid + "'";
MySqlCommand command1 = new MySqlCommand(selectquery, con);
using (MySqlDataReader rdr = command1.ExecuteReader())
{
if (rdr.Read())
{
memberid = rdr["member_id"].ToString();
name = rdr["name"].ToString();
phonenumber = rdr["phone_number"].ToString();
openbal = Convert.ToDecimal(rdr["opening_balance"].ToString());
due = openbal - paidamount;
}
else
Response.Write("$TS=2#");
}
String insertquery = "insert into transaction(machine_id,operator_id,member_id,card_id,name,paid_amount,due_amount,paid_date,phone_number) values(@machineid,@operatorid,@memberid,@cardid,@name,@paidamount,@dueamount,@paiddate,@phone) ";
MySqlCommand command2 = new MySqlCommand(insertquery, con);
command2.Parameters.AddWithValue("@machineid", machineid);
command2.Parameters.AddWithValue("@operatorid", operatorid);
command2.Parameters.AddWithValue("@memberid", memberid);
command2.Parameters.AddWithValue("@cardid", cardid);
command2.Parameters.AddWithValue("@name", name);
command2.Parameters.AddWithValue("@paidamount", paidamount);
command2.Parameters.AddWithValue("@dueamount", due);
if (paiddate.Length == 14)
{
string format = "ddMMyyyyHmmss";
DateTime dateTime = DateTime.ParseExact(paiddate, format,
System.Globalization.CultureInfo.InvariantCulture);
String result = dateTime.ToString("yyyy-MM-dd H:mm:ss");
command2.Parameters.AddWithValue("@paiddate", result);
}
else
{
Response.Write("$TS=2#");
}
command2.Parameters.AddWithValue("@phone", phonenumber);
command2.ExecuteNonQuery();
Response.Write("$AMT='" + paidamount + "'|BAL='" + due + "'|TS=1# ");
String updatequery = "update admin set opening_balance='" + due + "' where card_id='" + cardid + "' ";
MySqlCommand command3 = new MySqlCommand(updatequery, con);
command3.ExecuteNonQuery();
}
else
Response.Write("$TS=3#");
}
}
else
if (Convert.ToInt32(Request.QueryString["TT"]) == 2)
{
using (MySqlConnection con = new MySqlConnection(ConnectionString))
{
String browseroperatorid = Request.QueryString["UPWD"].ToString();
String query = "select operator_id from operator";
MySqlCommand command = new MySqlCommand(query, con);
con.Open();
using (MySqlDataReader rdr = command.ExecuteReader())
{
while (rdr.Read())
{
String dboperatorid = rdr["operator_id"].ToString();
if (dboperatorid.Equals(browseroperatorid))
{
found = true;
break;
}
}
}
if (found == true)
{
String query1 = "select opening_balance from admin where card_id='" + cardid + "' ";
MySqlCommand command1 = new MySqlCommand(query1, con);
using (MySqlDataReader rdr = command.ExecuteReader())
{
if (rdr.Read())
{
String bal = rdr["opening_balance"].ToString();
Response.Write("$ BAL='" + bal + "'|TS=1# ");
}
else
Response.Write("$ TS=2# ");
}
}
else
Response.Write("$TS=3#");
}
}
else
if (Convert.ToInt32(Request.QueryString["TT"]) == 3)
{
using (MySqlConnection con = new MySqlConnection(ConnectionString))
{
String browseroperatorid = Request.QueryString["UPWD"].ToString();
String query = "select operator_id from operator";
MySqlCommand command = new MySqlCommand(query, con);
con.Open();
using (MySqlDataReader rdr = command.ExecuteReader())
{
while (rdr.Read())
{
String dboperatorid = rdr["operator_id"].ToString();
if (dboperatorid.Equals(browseroperatorid))
{
found = true;
break;
}
}
}
if (found == true)
{
}
}
}
}
else
Response.Write("$TS=2#");
}
}
}
How to check it.