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.
 
 
 
 
 

213 lines
10 KiB

using Swift.API.Common;
using Swift.API.Common.SMS;
using Swift.API.ThirdPartyApiServices;
using Swift.DAL.BL.Remit.Transaction;
using Swift.DAL.SwiftDAL;
using Swift.web.Library;
using System;
using System.Data;
namespace Swift.web.AgentNew.SendTxn
{
public partial class WebForm1 : System.Web.UI.Page
{
private readonly ReceiptDao obj = new ReceiptDao();
private readonly SwiftLibrary sl = new SwiftLibrary();
protected void Page_Load(object sender, EventArgs e)
{
sl.CheckSession();
var methodName = Request.Form["MethodName"];
if (methodName == "SendSMS")
SendSMS();
if (!IsPostBack)
{
ShowData();
ShowMultipleReceipt();
}
GetStatic.AlertMessage(this.Page);
}
private void ShowMultipleReceipt()
{
if (GetInvoicePrintMode() != "")
{
if (GetInvoicePrintMode() == "s")
{
divInvoiceSecond.Attributes.Add("style", "margin: 15px 0; display: none;");
divInvoiceSecond1.Attributes.Add("style", "display: none;");
}
}
}
private string GetControlNo()
{
return GetStatic.ReadQueryString("controlNo", "");
}
private string GetInvoicePrintMode()
{
return GetStatic.ReadQueryString("invoicePrint", "");
}
protected void ShowData()
{
//lblControlNo.Text = GetStatic.GetTranNoName();
DataSet ds = obj.GetSendIntlReceipt(GetControlNo(), GetStatic.GetUser(), "S");
if (ds.Tables.Count >= 1)
{
if (ds.Tables[0].Rows.Count > 0)
{
//Load Sender Information
DataRow sRow = ds.Tables[0].Rows[0];
senderName.Text = sRow["senderName"].ToString();
sMemId.Text = sRow["sMemId"].ToString();
sAddress.Text = sRow["sAddress"].ToString();
sNativeCountry.Text = sRow["sNativeCountry"].ToString();
purpose.Text = sRow["purpose"].ToString();
sDob.Text = sRow["sDob"].ToString();
sContactNo.Text = sRow["sContactNo"].ToString();
visaStatus.Text = sRow["visaStatus"].ToString();
txnSenderMobile.Text = sRow["sContactNo"].ToString();
smsToSend.Text = GetSMSText(sRow);
//Load Receiver Information
receiverName.Text = sRow["receiverName"].ToString();
pAgentCountry.Text = sRow["pAgentCountry"].ToString();
paymentMode.Text = sRow["paymentMode"].ToString();
rContactNo.Text = sRow["rContactNo"].ToString();
pBankName.Text = sRow["pBankName"].ToString();
relationShip.Text = sRow["relwithSender"].ToString();
senderDepositType.Text = sRow["depositType"].ToString();
serial1.Text = sRow["tranId"].ToString();
serial2.Text = sRow["tranId"].ToString();
//comment by gunn
//pBranchName.Text = sRow["pBranchName"].ToString();
pBranchName.Text = sRow["BranchName"].ToString();
accountNo.Text = sRow["accountNo"].ToString();
controlNo.Text = sRow["controlNo"].ToString();
createdBy.Text = sRow["companyaddress"].ToString();
approvedDate.Text = DateTime.Parse(sRow["createdDate"].ToString()).ToString("yyyy-MM-dd hh:mm:ss tt");
cAmt.Text = GetStatic.ShowDecimal(sRow["cAmt"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
serviceCharge.Text = GetStatic.ShowTwoDecimal(sRow["serviceCharge"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
tAmt.Text = GetStatic.ShowDecimal(sRow["tAmt"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
exRate.Text = sRow["exRate"].ToString() + "&nbsp" + sRow["payoutCurr"].ToString();
pAmt.Text = GetStatic.ShowDecimal(sRow["pAmt"].ToString()) + "&nbsp" + sRow["payoutCurr"].ToString();
depositType.Text = sRow["collMode"].ToString();
depositType1.Text = sRow["collMode"].ToString();
//operator1.Text = sRow["createdBy"].ToString();
//for second from
//Load Sender Information
senderName1.Text = sRow["senderName"].ToString();
sMemId1.Text = sRow["sMemId"].ToString();
sAddress1.Text = sRow["sAddress"].ToString();
sNativeCountry1.Text = sRow["sNativeCountry"].ToString();
purpose1.Text = sRow["purpose"].ToString();
sContactNo1.Text = sRow["sContactNo"].ToString();
lblOccupation.Text = sRow["occupation"].ToString();
lblOccupation1.Text = sRow["occupation"].ToString();
//Load Receiver Information
receiverName1.Text = sRow["receiverName"].ToString();
pAgentCountry1.Text = sRow["pAgentCountry"].ToString();
paymentMode1.Text = sRow["paymentMode"].ToString();
rContactNo1.Text = sRow["rContactNo"].ToString();
pBankName1.Text = sRow["pBankName"].ToString();
relationship1.Text = sRow["relwithSender"].ToString();
senderDepositType1.Text = sRow["depositType"].ToString();
pBranchName1.Text = sRow["BranchName"].ToString();
accountNo1.Text = sRow["accountNo"].ToString();
controlNo1.Text = sRow["controlNo"].ToString();
createdBy1.Text = sRow["companyaddress"].ToString();
approvedDate1.Text = DateTime.Parse(sRow["createdDate"].ToString()).ToString("yyyy-MM-dd hh:mm:ss tt");
cAmt1.Text = GetStatic.ShowWithoutDecimal(sRow["cAmt"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
serviceCharge1.Text = GetStatic.ShowWithoutDecimal(sRow["serviceCharge"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
tAmt1.Text = GetStatic.ShowWithoutDecimal(sRow["tAmt"].ToString()) + "&nbsp" + sRow["collCurr"].ToString();
exRate1.Text = sRow["exRate"].ToString() + "&nbsp" + sRow["payoutCurr"].ToString();
pAmt1.Text = GetStatic.ShowDecimal(sRow["pAmt"].ToString()) + "&nbsp" + sRow["payoutCurr"].ToString();
operator2.Text = sRow["createdBy"].ToString();
if (sRow["paymentMethod"].ToString().ToUpper().Equals("CASH PAYMENT"))
{
bank3.Attributes.Add("style", "display: none;");
bank4.Attributes.Add("style", "display: none;");
bankAccNo.Attributes.Add("style", "display: none;");
bankAccNo1.Attributes.Add("style", "display: none;");
bank7.Attributes.Add("style", "display: none;");
bank8.Attributes.Add("style", "display: none;");
bankLabel.InnerHtml = "Cash Location";
bankLabel1.InnerHtml = "Cash Location";
}
}
}
}
protected string GetSMSText(DataRow sRow)
{
FullName _fullNameS = GetStatic.ParseName(sRow["senderName"].ToString());
FullName _fullNameR = GetStatic.ParseName(sRow["receiverName"].ToString());
string controlNo = sRow["controlNo"].ToString();
string sms = "";
if (sRow["paymentMethod"].ToString().ToLower() == "bank deposit" || sRow["paymentMethod"].ToString().ToLower() == "Mobile Wallet")
{
FullName _bankName = GetStatic.ParseName(sRow["pBankName"].ToString());
sms += "Dear " + _fullNameS.FirstName + ", Your TXN with Reference Number " + controlNo + " has been completed. If you have already deposited the amount to us your Receiver account will be credited within 1 Working Hour.";
sms += "\nThank you!";
}
else
{
sms += "Dear " + _fullNameS.FirstName + ", Your TXN with Reference Number " + controlNo + " has been completed.If you have already deposited the amount to us your Receiver can collect the transaction from any payout location within 1 hour.";
sms += "\nThank you!";
}
return sms;
}
public void SendSMS()
{
JsonResponse _resp = new JsonResponse();
DbResult _dbRes = obj.CheckForSMSSend(GetStatic.GetUser(), GetControlNo());
if (_dbRes.ErrorCode != "0")
{
_resp.ResponseCode = "1";
_resp.Msg = _dbRes.Msg;
GetStatic.JsonResponse(_resp, this);
return;
}
string ProcessId = Guid.NewGuid().ToString().Replace("-", "") + ":sendSms";
SendSMSApiService _sendAPI = new SendSMSApiService();
//GetSMSTextForTxn
SMSRequestModel _req = new SMSRequestModel
{
ProviderId = "onewaysms",
MobileNumber = Request.Form["mobileNumber"].Trim().Replace("+", ""),
SMSBody = Request.Form["smsToSend"],
ProcessId = ProcessId.Substring(ProcessId.Length - 40, 40),
RequestedBy = GetStatic.GetUser(),
UserName = GetStatic.GetUser(),
method = "send",
ControlNo = GetControlNo()
};
_resp = _sendAPI.SMSTPApi(_req);
string isSuccess = (_resp.ResponseCode == "0") ? "1" : "0";
obj.LogSMS(GetControlNo(), GetStatic.GetUser(), Request.Form["smsToSend"], Request.Form["mobileNumber"].Trim().Replace("+", ""),
ProcessId, _resp.Extra, isSuccess);
GetStatic.JsonResponse(_resp, this);
}
}
}