protected void Page_Load(object sender, EventArgs e) { db = new ConDb(); if (Session["Transaction_ID"] == null) { Response.Redirect("CustomerHome.aspx"); } if (!IsPostBack) { db.con.Open(); string qry1 = "update Payment_Details set transaction_id=@tnxid,paymentDate=@PymDate,status='1' where transaction_id=@Transaction_ID "; db.cmd = new System.Data.SqlClient.SqlCommand(qry1, db.con); db.cmd.Parameters.AddWithValue("@tnxid", Request.Form["txnid"]); db.cmd.Parameters.AddWithValue("@Transaction_ID", Session["Transaction_ID"].ToString()); db.cmd.Parameters.AddWithValue("@PymDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); db.cmd.ExecuteNonQuery(); Label1.Text = "Transaction ID :" + Request.Form["txnid"] + " has been successfully Completed of Rs." + Request.Form["amount"]; db.con.Close(); Session["Transaction_ID"] = null; } }
protected void Page_Load(object sender, EventArgs e) { ConDb db = new ConDb(); HttpContext ct = HttpContext.Current; // Response.Write(ct.Request["cid"]); long ss = ((long.Parse(ct.Request["cid"]) / long.Parse(ct.Request["tcode1"]))) / long.Parse(ct.Request["tcode2"]); // Response.Write(" " + ss); data = new List <string>(); try { if (Session["p_id"].Equals("") || Session["p_id"].Equals(null)) { Response.Redirect("ProviderLogin.aspx"); } } catch { Response.Redirect("ProviderLogin.aspx"); } // string cid = ss; db.con.Open(); string qry1 = "select first_name,last_name from customer where c_id=@cid"; db.cmd = new System.Data.SqlClient.SqlCommand(qry1, db.con); db.cmd.Parameters.AddWithValue("@cid", ss.ToString()); db.rdr = db.cmd.ExecuteReader(); if (db.rdr.Read()) { lblDairyName.Text = db.rdr.GetString(0); } db.rdr.Close(); db.con.Close(); db.con.Open(); string qry = "select dateTime,liter,rate_per_liter,amount from milk_transaction where c_id=@cid and p_id=@pid order by dateTime"; db.cmd = new System.Data.SqlClient.SqlCommand(qry, db.con); db.cmd.Parameters.AddWithValue("@pid", Session["p_id"].ToString()); db.cmd.Parameters.AddWithValue("cid", ss.ToString()); db.rdr = db.cmd.ExecuteReader(); while (db.rdr.Read()) { data.Add(db.rdr.GetSqlDateTime(0).ToString().Substring(0, 10) + " " + db.rdr.GetString(1) + " " + db.rdr.GetString(2) + " " + db.rdr.GetString(3)); /* data.Add(db.rdr.GetString(1)); * data.Add(db.rdr.GetString(2)); * data.Add(db.rdr.GetString(3));*/ } db.rdr.Close(); db.con.Close(); }
protected void Page_Load(object sender, EventArgs e) { db = new ConDb(); String datetime = "2000-01-01 10:30:00.000"; db.con.Open(); //DateTime start1 = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff").Substring(0, 10)); //DateTime start1 = DateTime.Parse("12-07-2019 23:20:24"); //DECLARE @today date = GETDATE(); string Date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff").Substring(0, 10); string qry3 = "SELECT first_name,last_name,address,liter from customer join milk_Transaction on customer.c_id=milk_Transaction.c_id WHERE dateTime >= DATEADD(DAY, -1, @today) AND dateTime < @today and p_id=@pid"; // string qry3 = "select first_name,last_name,address,liter from customer join milk_Transaction on customer.c_id=milk_Transaction.c_id where p_id=@pid "; db.cmd = new System.Data.SqlClient.SqlCommand(qry3, db.con); // db.cmd.Parameters.AddWithValue("@cid", cid); db.cmd.Parameters.AddWithValue("@today", Date); db.cmd.Parameters.AddWithValue("@pid", Session["p_id"].ToString()); db.rdr = db.cmd.ExecuteReader(); while (db.rdr.Read()) { cid.Add(db.rdr.GetString(0) + " " + db.rdr.GetString(1) + "$" + db.rdr.GetString(2) + "$" + db.rdr.GetString(3)); //cid.Add(db.rdr.GetString(1)); //cid.Add(db.rdr.GetString(2)); //cid.Add(db.rdr.GetString(3)); totalLiters += double.Parse(db.rdr.GetString(3)); } lblTotalliter.Text = totalLiters.ToString(); lblDate.Text = DateTime.Now.ToShortDateString(); db.rdr.Close(); db.con.Close(); }