public List <mTransaction> SettlementReport() { List <mTransaction> ts = new List <mTransaction>(); using (SqlConnection consql = new SqlConnection(ConfigurationManager.ConnectionStrings[""].ConnectionString)) { consql.Open(); SqlCommand cmd = new SqlCommand("", consql); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("", TrxDate); cmd.Parameters.AddWithValue("", RecordType); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { mTransaction m = new mTransaction(); } } } return(ts); }
//To use Report->TransactionQuery as stored procedure public List <mTransaction> transaction_query(string searchkey, DateTime startdate, DateTime enddate) { List <mTransaction> Trans = new List <mTransaction>(); using (SqlConnection consql = new SqlConnection(ConfigurationManager.ConnectionStrings["MerchantServiceDB"].ConnectionString)) { consql.Open(); SqlCommand cmd = new SqlCommand("sp_r_tranquery", consql); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@searchkey", searchkey); cmd.Parameters.AddWithValue("@startdate", startdate); cmd.Parameters.AddWithValue("@enddate", enddate); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { mTransaction tran = new mTransaction(); tran.MPU_Merchant_ID = dt.Rows[i]["MPU_Merchant_ID"].ToString(); tran.Merchant_Name = dt.Rows[i]["Merchant_Name"].ToString(); tran.TrxDate = Convert.ToDateTime(dt.Rows[i]["TrxDate"].ToString()); string cno = dt.Rows[i]["CardNo"].ToString(); tran.CardNo = cno.Substring(0, 6) + "xxxxxx" + cno.Substring(cno.Length - 4, 4); tran.CardType = dt.Rows[i]["CardType"].ToString(); tran.TrxAmount = Convert.ToDouble(dt.Rows[i]["TrxAmount"].ToString()); tran.MDRValue = Convert.ToDouble(dt.Rows[i]["MDRValue"].ToString()); tran.SettAmount = Convert.ToDouble(dt.Rows[i]["SettAmount"].ToString()); if (!String.IsNullOrEmpty(dt.Rows[i]["TRXMDRRate"].ToString())) { tran.TRXMDRRate = Convert.ToDouble(dt.Rows[i]["TRXMDRRate"].ToString()); } Trans.Add(tran); } } } return(Trans); }