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.
 
 
 
 
 

114 lines
4.5 KiB

using Swift.DAL.BL.AgentPanel.Send;
using Swift.DAL.SwiftDAL;
using Swift.web.Library;
using System;
using System.Data;
using System.Text;
namespace Swift.web.AgentNew.SendTxn
{
public partial class FormLoader : System.Web.UI.Page
{
private string _bankId = GetStatic.ReadQueryString("bankId", "");
private string _isBranchByName = GetStatic.ReadQueryString("isBranchByName", "");
private string _branchSelected = GetStatic.ReadQueryString("branchSelected", "");
private readonly SwiftLibrary sl = new SwiftLibrary();
private SendTranIRHDao st = new SendTranIRHDao();
protected void Page_Load(object sender, EventArgs e)
{
sl.CheckSession();
ReturnValue();
}
private void ReturnValue()
{
switch (GetQueryType())
{
case "bb":
PopulateBranchName();
break;
}
}
private string GetQueryType()
{
return GetStatic.ReadQueryString("type", "");
}
private void PopulateBranchName()
{
string bankId = GetStatic.ReadQueryString("bankId", "");
string partnerId = GetStatic.ReadQueryString("partnerId", "");
string pMode = GetStatic.ReadQueryString("pMode", "");
string receivingCountryId = GetStatic.ReadQueryString("receivingCountryId", "");
var dao = new RemittanceDao();
var html = new StringBuilder();
if (string.IsNullOrEmpty(_bankId) || _bankId == "undefined")
{
html.Append("<select id=\"branch\" class=\"form-control\" >");
html.Append("<option value = \"\">Select</option>");
}
else
{
DataTable dt = null;
string sql = "EXEC proc_dropDownLists @flag = 'pickBranchById', @agentId=" + dao.FilterString(_bankId);
dt = dao.ExecuteDataset(sql).Tables[0];
if (dt == null || dt.Rows.Count == 0)
{
if(receivingCountryId == "151")
{
html.Append("<select id=\"branch\" class=\"form-control\"><option value = \"0\">Any Branch</option></select>");
}
else
{
html.Append("<select id=\"branch\" class=\"form-control\"><option value = \"-1\">No Branches Found</option></select>");
}
Response.Write(html.ToString());
return;
}
html.Append("<select id=\"branch\" class=\"form-control\" >");
html.Append("<option value = \"\">Select</option>");
if (string.IsNullOrEmpty(_isBranchByName))
{
foreach (DataRow dr in dt.Rows)
{
html.Append("<option value = \"" + dr["agentId"] + "\">" + dr["agentName"] + "</option>");
}
}
else
{
foreach (DataRow dr in dt.Rows)
{
if (_isBranchByName.ToUpper() == "Y")
{
if (_branchSelected.ToUpper() == dr["agentName"].ToString().ToUpper())
{
html.Append("<option value = \"" + dr["agentId"] + "\" selected=\"selected\">" + dr["agentName"] + "</option>");
}
else
{
html.Append("<option value = \"" + dr["agentId"] + "\">" + dr["agentName"] + "</option>");
}
}
else
{
if (_branchSelected == dr["agentId"].ToString())
{
html.Append("<option value = \"" + dr["agentId"] + "\" selected=\"selected\">" + dr["agentName"] + "</option>");
}
else
{
html.Append("<option value = \"" + dr["agentId"] + "\">" + dr["agentName"] + "</option>");
}
}
}
}
html.Append("</select>");
}
Response.Write(html.ToString());
}
}
}