You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using Swift.DAL.BL.System.GeneralSettings; using Swift.web.Library; using System; using System.Data; using System.Text; using System.Text.RegularExpressions; using System.Web; using System.Web.Script.Serialization;
namespace Swift.web { public partial class Font : System.Web.UI.Page { private SwiftLibrary sl = new SwiftLibrary(); protected string HighChart = ""; protected string HighChart2 = ""; protected string HighChart3 = ""; protected string HighChart4 = ""; protected string HighChart5 = ""; protected string countryName = ""; protected string countryName2 = ""; protected string countryName3 = ""; protected string countryName4 = ""; protected string countryName5 = ""; private int oldValue = 0;
protected void Page_Load(object sender, EventArgs e) {
Response.Redirect("/DashboardV2/Dashboard.aspx",true);
var MethodName = Request.Form["MethodName"]; switch (MethodName) { case "Messages": PopulateMessageDetail(); break;
default: break; }
sl.CheckSession(); if (!IsPostBack) { Load_TransactionCount(); PopulateMessages(); LoadExrate(); } PopulateChart(); }
private void LoadExrate() { var obj = new MessageSettingDao(); var dt = obj.GetExRate(GetStatic.GetUser());
if (dt.Rows.Count == 0 || dt == null) { return; }
StringBuilder sb = new StringBuilder(); sb.AppendLine("<table class=\"table table-responsive table-bordered\"><thead><tr>"); for (int i = 0; i < dt.Columns.Count; i++) { sb.AppendLine("<th>" + dt.Columns[i] + "</th>"); } sb.AppendLine("</tr></thead>");
sb.AppendLine("<tbody>"); for (int i = 0; i < dt.Rows.Count; i++) { sb.AppendLine("<tr>"); for (int j = 0; j < dt.Columns.Count; j++) { sb.AppendLine("<td style='text-align:center;'>" + (string.IsNullOrEmpty(Convert.ToString(dt.Rows[i][j]))?"-": dt.Rows[i][j]) + "</td>"); } sb.AppendLine("</tr>"); } sb.AppendLine("</tbody></table>");
tblExRate.InnerHtml = sb.ToString(); }
private void PopulateChart() { barDiv.Visible = false; var obj = new MessageSettingDao(); DataSet ds = obj.GetHighChartData(GetStatic.GetUser()); if (null == ds) { return; } if (ds.Tables.Count == 0) { return; } barDiv.Visible = true; if (ds.Tables.Count >= 2) { countryName = ds.Tables[0].Rows[0][0].ToString(); HighChart = GetHighChartData(ds.Tables[1]); }
if (ds.Tables.Count >= 4) { countryName2 = ds.Tables[2].Rows[0][0].ToString(); HighChart2 = GetHighChartData(ds.Tables[3]); }
if (ds.Tables.Count >= 6) { countryName3 = ds.Tables[4].Rows[0][0].ToString(); HighChart3 = GetHighChartData(ds.Tables[5]); }
if (ds.Tables.Count >= 8) { countryName4 = ds.Tables[6].Rows[0][0].ToString(); HighChart4 = GetHighChartData(ds.Tables[7]); }
if (ds.Tables.Count >= 10) { countryName5 = ds.Tables[8].Rows[0][0].ToString(); HighChart5 = GetHighChartData(ds.Tables[9]); } }
protected string GetHighChartData(DataTable dt) { string retData = ""; int j = 0; int count = 0; int rowCount = 0; for (int i = 0; i < dt.Columns.Count - 1; i++) { int rowCounts = 0; oldValue = 0; string oldValues = "0"; foreach (DataRow item in dt.Rows) { if (j == 0) { retData += "{name: '" + dt.Columns[i + 1].ColumnName + "',"; retData += "data: ["; } if (DataExists(dt, rowCounts, i + 1)) { retData += GetValue(oldValues, item[dt.Columns[i + 1].ColumnName].ToString()) + ","; } if (item[dt.Columns[i + 1].ColumnName].ToString() != "0") { oldValues = item[dt.Columns[i + 1].ColumnName].ToString(); } j++; rowCounts++; rowCount++; }
if (count == 11) { retData += "]}"; } else { retData += "]},"; } j = 0; rowCount = 0; count++; }
return retData; }
private bool DataExists(DataTable dataTable, int rowIndex, int colCount) { bool retVal = false; rowIndex = (rowIndex.Equals(0)) ? 1 : rowIndex; for (int i = rowIndex; i < dataTable.Rows.Count; i++) { if (dataTable.Rows[i][colCount].ToString() != "0") { retVal = true; } } return retVal; }
private string GetValue(string oldVal, string newVal) { if (newVal == "0") { if (oldVal != "0") { oldValue = Convert.ToInt16(oldVal); }
return oldValue.ToString(); } else { return newVal; } }
private void PopulateMessageDetail() { string msgId = Request.Form["MessageId"]; var obj = new MessageSettingDao(); DataRow dr = obj.GetNewsFeederMessage(msgId); if (dr == null) { return; } MessageData _data = new MessageData();
_data.CreatedBy = dr["createdBy"].ToString(); _data.CreatedDate = dr["createdDate"].ToString(); _data.Message = dr["newsFeederMsg"].ToString();
var json = new JavaScriptSerializer().Serialize(_data); JsonSerialize(json); }
private void JsonSerialize<T>(T obk) { JavaScriptSerializer jsonData = new JavaScriptSerializer(); string jsonString = jsonData.Serialize(obk); HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.Write(jsonString); HttpContext.Current.Response.End(); }
public class MessageData { public string CreatedBy { get; set; } public string CreatedDate { get; set; } public string Message { get; set; } }
protected String GetDate() { return DateTime.Now.ToString("yyyy-MM-dd"); }
protected void Load_TransactionCount() { var obj = new MessageSettingDao(); var ds = obj.Get_TransactionCount(GetStatic.GetUser()); divPopulateTxnCount.Visible = false; TxnWiseStatus.Visible = false;
if (null == ds) { return; } if (ds.Tables.Count == 0) { return; }
var dr = ds.Tables[0].Rows[0]; iCancel.Text = dr["iCancel"].ToString(); iSend.Text = dr["iSend"].ToString(); iPaid.Text = dr["intPaidCount"].ToString();
divPopulateTxnCount.Visible = true; TxnWiseStatus.Visible = true;
var dt = ds.Tables[1]; int sn = 0; var sb = ""; sb += "<table class='table table-responsive table-bordered'>"; sb += "<tr>"; sb += "<th>S.N</th>"; sb += "<th>NO OF TXN</th>"; sb += "<th>STATUS</th>"; sb += "</tr>"; foreach (DataRow item in dt.Rows) { sn++; sb += "<tr>"; sb += "<td>" + sn + "</td>"; sb += "<td><a onclick=\"ShowReport('" + item["tranStatus"] + "')\">" + item["TxnNo"] + "</a></td>"; sb += "<td>" + item["tranStatus"] + "</td>"; sb += "</tr>"; } sb += "</table>"; if (dt.Rows.Count > 0) { TxnWiseStatus.InnerHtml = sb; } }
protected void PopulateMessages() { var obj = new MessageSettingDao(); var dt = obj.GetNewsFeeder(GetStatic.GetUser(), GetStatic.GetUserType(), GetStatic.GetCountryId(), GetStatic.GetAgent(), GetStatic.GetBranch()); if (dt.Rows.Count == 0 || dt == null) { return; }
StringBuilder sb = new StringBuilder(); foreach (DataRow item in dt.Rows) { string msgId = item["msgId"].ToString(); sb.AppendLine("<li class=\"list-group-item\">"); sb.AppendLine("<a href=\"javascript:void(0);\" onclick=\"ShowMessage('" + msgId + "')\" data-toggle=\"modal\">" + GetMessageToShow(item["newsFeederMsg"].ToString()) + "</a>"); sb.AppendLine("<small><i class=\"fa fa-clock-o\"></i> " + item["msgDate"].ToString() + "</small>"); sb.AppendLine("</li>"); } //messages.InnerHtml = sb.ToString();
}
private string GetMessageToShow(string message) { string pureString = Regex.Replace(message, "<.*?>", String.Empty); return pureString.Substring(0, Math.Min(pureString.Length, 40)); } } }
|