using Swift.DAL.SwiftDAL; using Swift.web.Component.Grid; using Swift.web.Library; using System; using System.Data; using System.Text; namespace Swift.web.AgentPanel.Bonus_Management { public partial class List : System.Web.UI.Page { private const string GridName = "gdBonusTXNDetail"; private const string ViewFunctionId = "40122500"; private readonly SwiftGrid _grid = new SwiftGrid(); private readonly SwiftLibrary _sl = new SwiftLibrary(); protected void Page_Load(object sender, EventArgs e) { Authenticate(); LoadStatement(); } private void Authenticate() { _sl.CheckAuthentication(ViewFunctionId); } private void LoadStatement() { var customerId = GetStatic.ReadQueryString("customerId", "0"); //discount.HRef = "DiscountTXNHistory.aspx?membershipId=" + membershipId; var sql = "[proc_bonusRedeemHistoryAgent] @customerId='" + customerId + "',@flag='bonusTXNDetail'"; var dt = new RemittanceDao().ExecuteDataTable(sql); var str = new StringBuilder(); str.Append(""); if (dt.Rows.Count.Equals(0)) { str.Append(""); str.Append(""); str.Append(""); str.Append("
No Records Found.
"); rpt_grid.InnerHtml = str.ToString(); return; } str.Append(""); str.Append("SN"); str.Append("Date"); str.Append("Particulars"); str.Append("Control No"); str.Append("Amount"); str.Append("Bonus Point"); str.Append("Balance Bonus Point"); str.Append(""); var runningBal = 0.00; var rowCount = 1; var sn = 1; foreach (DataRow row in dt.Rows) { var thisBal = GetStatic.ParseDouble(row["bonusPoint"].ToString()); var thisBalText = thisBal >= 0 ? thisBal.ToString() : "(" + Math.Abs(thisBal).ToString() + ")"; runningBal += thisBal; var runningBalText = runningBal >= 0 ? runningBal.ToString() : "(" + Math.Abs(runningBal).ToString() + ")"; str.Append( ++rowCount % 2 == 1 ? "" : "" ); rowCount++; str.Append(string.Format("{0}", sn.ToString())); str.Append(string.Format("{0}", row["createdDate"].ToString())); str.Append(string.Format("{0}", row["remarks"].ToString())); str.Append(string.Format("{0}", row["controlNo"].ToString())); str.Append(string.Format("{0}", GetStatic.FormatData(row["pAmt"].ToString(), "M"))); str.Append(string.Format("{0}", thisBalText)); str.Append(string.Format("{0}", runningBalText)); str.Append(""); sn++; } str.Append(""); rpt_grid.InnerHtml = str.ToString(); } } }