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.
 
 
 
 
 

171 lines
6.5 KiB

using Common.Helper;
using JMEAgentSystem.Library;
using Repository.DAO;
using Repository.DAO.SendTxnIRHDao;
using Repository.ThirdPartyApiServices;
using Swift.API.Common;
using Swift.API.Common.ExRate;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace JMEAgentSystem.WebPages.Calculator
{
public partial class Calculator : System.Web.UI.Page
{
private readonly SendTxnIRHDao st = new SendTxnIRHDao();
private readonly StaticDataDdl _sdd = new StaticDataDdl();
RemittanceDao _rdao = new RemittanceDao();
protected void Page_Load(object sender, EventArgs e)
{
populateDdl();
var methodName = GetStatic.ReadFormData("MethodName", "");
if (methodName != "")
{
switch (methodName)
{
case "PaymentModePcountry":
LoadDataFromDdl("pMode");
break;
case "CalculateTxn":
Calculate();
break;
}
}
}
protected void Calculate()
{
DataTable dt = new DataTable();
ExRateRequest exRate = new ExRateRequest();
ExchangeRateAPIService ExService = new ExchangeRateAPIService();
exRate.RequestedBy = "core";
exRate.isExRateCalcByPartner = (Request.Form["IsExrateFromPartner"] == "true") ? true : false;
//exRate.isExRateCalcByPartner = true;
exRate.PCountry = Request.Form["pCountry"];
exRate.pCountryName = Request.Form["pCountrytxt"];
exRate.ServiceType = Request.Form["pMode"];
exRate.PaymentType = Request.Form["pModetxt"];
exRate.PAgent = Request.Form["pAgent"];
var pAgentBranch = Request.Form["pAgentBranch"];
exRate.CAmount = Request.Form["collAmt"];
exRate.PAmount = Request.Form["payAmt"];
exRate.SCurrency = Request.Form["collCurr"];
exRate.PCurrency = Request.Form["payCurr"];
exRate.CustomerId = Request.Form["senderId"];
exRate.SchemeId = Request.Form["schemeCode"];
exRate.ForexSessionId = Request.Form["couponId"];
exRate.IsManualSc = (Request.Form["isManualSc"] == "N" ? false : true);
exRate.ManualSc = Request.Form["sc"];
if (exRate.isExRateCalcByPartner)
{
exRate.SCountry = GetStatic.GetCountryId();
exRate.SSuperAgent = "393877";
exRate.SAgent = "394390";
exRate.SBranch = "394390";
exRate.CollCurrency = Request.Form["collCurr"];
exRate.pCountryCode = Request.Form["pCountry"];
exRate.ProviderId = "394130";
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":transfast:exRate";
exRate.ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40);
JsonResponse res = ExService.GetExchangeRate(exRate);
ExRateResponse _exrate = (ExRateResponse)res.Data;
//dt = st.GetExRateTP(GetStatic.GetUser()
// , GetStatic.GetCountryId()
// , GetStatic.GetSuperAgent()
// , GetStatic.GetAgent()
// , GetStatic.GetBranch()
// , exRate.SCurrency
// , exRate.PCountry
// , exRate.PAgent
// , exRate.PCurrency
// , exRate.ServiceType
// , exRate.CAmount
// , exRate.PAmount
// , exRate.SchemeId
// , exRate.CustomerId
// //, GetStatic.GetSessionId()
// , exRate.ForexSessionId
// , Request.Form["isManualSc"]
// , exRate.ManualSc
// , _exrate.exRate
// , exRate.PCurrency
// );
}
else
{
dt = st.GetExRate(GetStatic.GetUser()
, GetStatic.GetCountryId()
, "393877"
, "394390"
, "394390"
, exRate.SCurrency
, exRate.PCountry
, exRate.PAgent
, exRate.PCurrency
, exRate.ServiceType
, exRate.CAmount
, exRate.PAmount
, exRate.SchemeId
, exRate.CustomerId
//, GetStatic.GetSessionId()
, exRate.ForexSessionId
, "N"
, "N"
);
}
Response.ContentType = "text/plain";
var json = _rdao.DataTableToJson(dt);
Response.Write(json);
Response.End();
}
public void populateDdl()
{
LoadReceiverCountry(ref pCountry, "", "SELECT");
}
private void LoadReceiverCountry(ref DropDownList ddl, string defaultValue, string label)
{
var sql = "EXEC proc_sendPageLoadData @flag='pCountry',@countryId='" + GetStatic.GetCountryId() + "',@agentid='" + GetStatic.GetAgentId() + "'";
_sdd.SetDDL(ref ddl, sql, "countryId", "countryName", defaultValue, label);
}
private void LoadDataFromDdl(string type)
{
var pAgentFv = Request.Form["pAgent"];
var pModeFv = Request.Form["pmode"];
var pCountryFv = Request.Form["pCountry"];
DataTable dt = null;
switch (type)
{
case "pMode":
dt = st.LoadDataFromDdl(GetStatic.GetCountryId(), pCountryFv, pModeFv, GetStatic.GetAgent(), "recModeByCountry", GetStatic.GetUser());
break;
}
Response.ContentType = "text/plain";
var json = _rdao.DataTableToJson(dt);
Response.Write(json);
Response.End();
}
}
}