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.

223 lines
12 KiB

  1. using System;
  2. using System.Data;
  3. using System.Text;
  4. using Swift.DAL.BL.Remit.OFACManagement;
  5. using Swift.web.Library;
  6. namespace Swift.web.Remit.OFACManagement
  7. {
  8. public partial class OFACTracker : System.Web.UI.Page
  9. {
  10. readonly SwiftLibrary _sl = new SwiftLibrary();
  11. OFACDao obj = new OFACDao();
  12. private const string ViewFunctionId = "2019900";
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. Authenticate();
  16. if (!IsPostBack)
  17. {
  18. }
  19. GetStatic.ResizeFrame(Page);
  20. }
  21. private void Authenticate()
  22. {
  23. _sl.CheckAuthentication(ViewFunctionId);
  24. }
  25. private string UppercaseFirst(string s)
  26. {
  27. // Check for empty string.
  28. if (string.IsNullOrEmpty(s))
  29. {
  30. return string.Empty;
  31. }
  32. // Return char and concat substring.
  33. return char.ToUpper(s[0]) + s.Substring(1);
  34. }
  35. protected void btnSearch_Click(object sender, EventArgs e)
  36. {
  37. DataTable dt = obj.SearchSDN(GetStatic.GetUser(), name.Text);
  38. var str = new StringBuilder("<table class=\"table table-responsive table-bordered table-striped\">");
  39. string contentValue = "";
  40. //string searchCriteria = name.Text.Trim().ToUpper().Replace(" ", " ");
  41. string searchCriteria = name.Text.Trim().ToUpper();
  42. string strContent = "";
  43. var strArr = searchCriteria.ToString().Split(' ');
  44. var arrlen = strArr.Length;
  45. var cols = dt.Columns.Count;
  46. if (dt.Rows.Count > 0)
  47. {
  48. str.Append("<tr>");
  49. for (var i = 0; i < cols; i++)
  50. {
  51. str.Append("<th align=\"left\">" + dt.Columns[i].ColumnName + "</th>");
  52. }
  53. str.Append("</tr>");
  54. foreach (DataRow dr in dt.Rows)
  55. {
  56. str.Append("<tr>");
  57. for (var i = 0; i < cols; i++)
  58. {
  59. if (i == 1)
  60. {
  61. contentValue = dr[i].ToString().ToUpper();
  62. for (int j = 0; j < arrlen; j++)
  63. {
  64. if (strArr[j].Length > 2)
  65. {
  66. if (j == 0)
  67. {
  68. contentValue = contentValue.Replace(strArr[j], GetStatic.PutRedBackGround(strArr[j]));
  69. contentValue = contentValue.Replace(strArr[j].ToUpper(), GetStatic.PutRedBackGround((strArr[j].ToUpper())));
  70. contentValue = contentValue.Replace(strArr[j].ToLower(), GetStatic.PutRedBackGround((strArr[j].ToLower())));
  71. contentValue = contentValue.Replace(UppercaseFirst(strArr[j]), GetStatic.PutRedBackGround(UppercaseFirst(strArr[j])));
  72. }
  73. else if (j == 1)
  74. {
  75. contentValue = contentValue.Replace(strArr[j], GetStatic.PutYellowBackGround(strArr[j]));
  76. contentValue = contentValue.Replace(strArr[j].ToUpper(), GetStatic.PutYellowBackGround((strArr[j].ToUpper())));
  77. contentValue = contentValue.Replace(strArr[j].ToLower(), GetStatic.PutYellowBackGround((strArr[j].ToLower())));
  78. contentValue = contentValue.Replace(UppercaseFirst(strArr[j]), GetStatic.PutYellowBackGround(UppercaseFirst(strArr[j])));
  79. }
  80. else if (j == 2)
  81. {
  82. contentValue = contentValue.Replace(strArr[j], GetStatic.PutHalfYellowBackGround(strArr[j]));
  83. contentValue = contentValue.Replace(strArr[j].ToUpper(), GetStatic.PutHalfYellowBackGround((strArr[j].ToUpper())));
  84. contentValue = contentValue.Replace(strArr[j].ToLower(), GetStatic.PutHalfYellowBackGround((strArr[j].ToLower())));
  85. contentValue = contentValue.Replace(UppercaseFirst(strArr[j]), GetStatic.PutHalfYellowBackGround(UppercaseFirst(strArr[j])));
  86. }
  87. else
  88. {
  89. contentValue = contentValue.Replace(strArr[j], GetStatic.PutBlueBackGround(strArr[j]));
  90. contentValue = contentValue.Replace(strArr[j].ToUpper(), GetStatic.PutBlueBackGround((strArr[j].ToUpper())));
  91. contentValue = contentValue.Replace(strArr[j].ToLower(), GetStatic.PutBlueBackGround((strArr[j].ToLower())));
  92. contentValue = contentValue.Replace(UppercaseFirst(strArr[j]), GetStatic.PutBlueBackGround(UppercaseFirst(strArr[j])));
  93. }
  94. }
  95. }
  96. //contentValue = contentValue.Replace(searchCriteria, GetStatic.PutYellowBackGround(searchCriteria));
  97. //contentValue = contentValue.Replace(SCUpper, GetStatic.PutYellowBackGround(SCUpper));
  98. //contentValue = contentValue.Replace(SCLower, GetStatic.PutYellowBackGround(SCLower));
  99. //contentValue = contentValue.Replace(SCFirstUpper, GetStatic.PutYellowBackGround(SCFirstUpper));
  100. str.Append("<td align=\"left\">" + contentValue + "</td>");
  101. }
  102. else
  103. {
  104. str.Append("<td align=\"left\">" + dr[i] + "</td>");
  105. }
  106. }
  107. str.Append("</tr>");
  108. }
  109. }
  110. else
  111. {
  112. str.Append("<tr>");
  113. str.Append("<th align=\"left\">No Record Found!</th>");
  114. str.Append("</tr>");
  115. }
  116. str.Append("</table>");
  117. rpt_grid.InnerHtml = str.ToString();
  118. }
  119. protected void btnSearchFromDJ_Click(object sender, EventArgs e)
  120. {
  121. DataTable dt = obj.SearchSDNFromDj(GetStatic.GetUser(), name.Text);
  122. var str = new StringBuilder("<table class=\"table table-responsive table-bordered table-striped\">");
  123. string contentValue = "";
  124. //string searchCriteria = name.Text.Trim().ToUpper().Replace(" ", " ");
  125. string searchCriteria = name.Text.Trim().ToUpper();
  126. string strContent = "";
  127. var strArr = searchCriteria.ToString().Split(' ');
  128. var arrlen = strArr.Length;
  129. var cols = dt.Columns.Count;
  130. if (dt.Rows.Count > 0)
  131. {
  132. str.Append("<tr>");
  133. for (var i = 0; i < cols; i++)
  134. {
  135. str.Append("<th align=\"left\">" + dt.Columns[i].ColumnName + "</th>");
  136. }
  137. str.Append("</tr>");
  138. foreach (DataRow dr in dt.Rows)
  139. {
  140. str.Append("<tr>");
  141. for (var i = 0; i < cols; i++)
  142. {
  143. if (i == 1)
  144. {
  145. contentValue = dr[i].ToString().ToUpper();
  146. for (int j = 0; j < arrlen; j++)
  147. {
  148. if (strArr[j].Length > 2)
  149. {
  150. if (j == 0)
  151. {
  152. contentValue = contentValue.Replace(strArr[j], GetStatic.PutRedBackGround(strArr[j]));
  153. contentValue = contentValue.Replace(strArr[j].ToUpper(), GetStatic.PutRedBackGround((strArr[j].ToUpper())));
  154. contentValue = contentValue.Replace(strArr[j].ToLower(), GetStatic.PutRedBackGround((strArr[j].ToLower())));
  155. contentValue = contentValue.Replace(UppercaseFirst(strArr[j]), GetStatic.PutRedBackGround(UppercaseFirst(strArr[j])));
  156. }
  157. else if (j == 1)
  158. {
  159. contentValue = contentValue.Replace(strArr[j], GetStatic.PutYellowBackGround(strArr[j]));
  160. contentValue = contentValue.Replace(strArr[j].ToUpper(), GetStatic.PutYellowBackGround((strArr[j].ToUpper())));
  161. contentValue = contentValue.Replace(strArr[j].ToLower(), GetStatic.PutYellowBackGround((strArr[j].ToLower())));
  162. contentValue = contentValue.Replace(UppercaseFirst(strArr[j]), GetStatic.PutYellowBackGround(UppercaseFirst(strArr[j])));
  163. }
  164. else if (j == 2)
  165. {
  166. contentValue = contentValue.Replace(strArr[j], GetStatic.PutHalfYellowBackGround(strArr[j]));
  167. contentValue = contentValue.Replace(strArr[j].ToUpper(), GetStatic.PutHalfYellowBackGround((strArr[j].ToUpper())));
  168. contentValue = contentValue.Replace(strArr[j].ToLower(), GetStatic.PutHalfYellowBackGround((strArr[j].ToLower())));
  169. contentValue = contentValue.Replace(UppercaseFirst(strArr[j]), GetStatic.PutHalfYellowBackGround(UppercaseFirst(strArr[j])));
  170. }
  171. else
  172. {
  173. contentValue = contentValue.Replace(strArr[j], GetStatic.PutBlueBackGround(strArr[j]));
  174. contentValue = contentValue.Replace(strArr[j].ToUpper(), GetStatic.PutBlueBackGround((strArr[j].ToUpper())));
  175. contentValue = contentValue.Replace(strArr[j].ToLower(), GetStatic.PutBlueBackGround((strArr[j].ToLower())));
  176. contentValue = contentValue.Replace(UppercaseFirst(strArr[j]), GetStatic.PutBlueBackGround(UppercaseFirst(strArr[j])));
  177. }
  178. }
  179. }
  180. //contentValue = contentValue.Replace(searchCriteria, GetStatic.PutYellowBackGround(searchCriteria));
  181. //contentValue = contentValue.Replace(SCUpper, GetStatic.PutYellowBackGround(SCUpper));
  182. //contentValue = contentValue.Replace(SCLower, GetStatic.PutYellowBackGround(SCLower));
  183. //contentValue = contentValue.Replace(SCFirstUpper, GetStatic.PutYellowBackGround(SCFirstUpper));
  184. str.Append("<td align=\"left\">" + contentValue + "</td>");
  185. }
  186. else
  187. {
  188. str.Append("<td align=\"left\">" + dr[i] + "</td>");
  189. }
  190. }
  191. str.Append("</tr>");
  192. }
  193. }
  194. else
  195. {
  196. str.Append("<tr>");
  197. str.Append("<th align=\"left\">No Record Found!</th>");
  198. str.Append("</tr>");
  199. }
  200. str.Append("</table>");
  201. rpt_grid.InnerHtml = str.ToString();
  202. }
  203. }
  204. }