web s
using Google.Apis.Json;
using Newtonsoft.Json;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.EnterpriseServices;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Policy;
using System.Text;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
using System.Xml.Serialization;
namespace CCBL_WS
{
public struct CmnResponse {
public string StatusCode { get; set; }
public string StatusMsg { get; set; }
}
public struct ReconcileReportResponse
{
public CmnResponse CmnResponse { get; set; }
public string CustomerAccountNumber { get; set; }
public string CustomerAccountCreateDate { get; set; }
}
public struct BlackListParams
{
public string IndividualName { get; set; }
public string CitizenshipNo { get; set; }
public string FatherName { get; set; }
public string CitizenshipIssuedDate { get; set; }
public string CitizenshipIssuedDistrict { get; set; }
public string ConsumerDOB { get; set; }
public string PassportNo { get; set; }
public string IndianEmbassyNo { get; set; }
}
public struct BlackListInd
{
public string BlackListNo { get; set; }
public string BlackListedDate { get; set; }
public string IndividualName { get; set; }
public string CitizenshipNo { get; set; }
public string FatherName { get; set; }
public string CitizenshipIssuedDate { get; set; }
public string CitizenshipIssuedDistrict { get; set; }
public string ConsumerDOB { get; set; }
public string PassportNo { get; set; }
public string IndianEmbassyNo { get; set; }
}
public struct SanctionList
{
public string Name { get; set; }
public string Source { get; set; }
public string OriginalSource { get; set; }
public string Value { get; set; }
public string CreatedDate { get; set; }
public string LastUpdatedDate { get; set; }
}
public struct PepList
{
public string EntityID { get; set; }
public string EntityName { get; set; }
public string EntitySource { get; set; }
public string OriginalSource { get; set; }
public string CreatedDate { get; set; }
public string LastUpdateDate { get; set; }
}
public struct BlockList
{
public string EntityID { get; set; }
public string EntityName { get; set; }
public string EntitySource { get; set; }
public string OriginalSource { get; set; }
public string CreatedDate { get; set; }
public string LastUpdateDate { get; set; }
}
public struct BlockResponse
{
public CmnResponse CmnResponse { get; set; }
public List<BlockList> BlockListResponse { get; set; }
}
public struct SanctionResponse
{
public CmnResponse CmnResponse { get; set; }
public List<SanctionList> SanctionListResponse { get; set; }
}
public struct SearchBlackListIndResponse
{
public CmnResponse CmnResponse { get; set; }
public List<BlackListInd> BlackListIndResponse { get; set; }
}
public struct PepResponse
{
public CmnResponse CmnResponse { get; set; }
public List<PepList> PepListResponse { get; set; }
}
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class WebService1 : System.Web.Services.WebService
{
public int randomNumber { get; set; }
public string merchantID { get; set; }
public string apiKey { get; set; }
public string apiURL { get; set; }
public string accURL { get; set; }
public string accAuthUserName { get; set; }
public string accAuthUserPwd { get; set; }
public string accUserID { get; set; }
public string accStationId { get; set; }
public string dbConnString { get; set; }
CmnFunc cmnFunc;
public WebService1()
{
Random objRandom = new Random();
randomNumber = objRandom.Next(-2147483648, 2147483647);
merchantID = System.Configuration.ConfigurationManager.AppSettings["MerchantID"];
apiKey = System.Configuration.ConfigurationManager.AppSettings["API_KEY"];
apiURL = System.Configuration.ConfigurationManager.AppSettings["API_URL"];
accURL = System.Configuration.ConfigurationManager.AppSettings["ACC_URL"];
accAuthUserName = System.Configuration.ConfigurationManager.AppSettings["ACC_AUTH_USER_NAME"];
accAuthUserPwd = System.Configuration.ConfigurationManager.AppSettings["ACC_AUTH_USER_PWD"];
accUserID = System.Configuration.ConfigurationManager.AppSettings["ACC_USER_ID"];
accStationId = System.Configuration.ConfigurationManager.AppSettings["ACC_STATION_ID"];
dbConnString = System.Configuration.ConfigurationManager.AppSettings["DBConnString"];
cmnFunc = new CmnFunc();
}
//public string GetCallerIdentity()
//{
// The client certificate is not mapped to a Windows identity by default.
// ServiceSecurityContext.PrimaryIdentity is populated based on the information
// in the certificate that the client used to authenticate itself to the service.
//return ServiceSecurityContext.Current.PrimaryIdentity.Name;
//}
[WebMethod]
public SearchBlackListIndResponse SearchBlackListInd(BlackListParams blackListIndRequest)
{
SearchBlackListIndResponse searchBlackListIndResponse = new SearchBlackListIndResponse();
List<BlackListInd> blackListIndividualsList = new List<BlackListInd>();
CmnResponse cmnResponse = new CmnResponse();
if (string.IsNullOrEmpty(blackListIndRequest.IndividualName))
{
cmnResponse.StatusCode = "101";
cmnResponse.StatusMsg = "Individual Name Cannot Be Empty!";
searchBlackListIndResponse.CmnResponse = cmnResponse;
return searchBlackListIndResponse;
}
cmnResponse = cmnFunc.SoapReqLog("SearchBlackListInd", "", cmnFunc.SerializeToXml(blackListIndRequest), "ShiranTech");
if (cmnResponse.StatusCode != "0")
{
searchBlackListIndResponse.CmnResponse = cmnResponse;
return searchBlackListIndResponse;
}
string soapID = cmnResponse.StatusMsg;
string DATA = "<BlackListVerify>";
DATA = DATA + "<SerialNumber>" + randomNumber.ToString() + "</SerialNumber>";
DATA = DATA + "<RequestType>Individual</RequestType>";
DATA = DATA + "<Name>" + blackListIndRequest.IndividualName + "</Name>";
DATA = DATA + "<CitizenshipNo>" + blackListIndRequest.CitizenshipNo + "</CitizenshipNo>";
DATA = DATA + "<FatherName>" + blackListIndRequest.FatherName + "</FatherName>";
DATA = DATA + "<CitizenshipIssuedDate>" + blackListIndRequest.CitizenshipIssuedDate + "</CitizenshipIssuedDate>";
DATA = DATA + "<CitizenshipIssuedDistrict>" + blackListIndRequest.CitizenshipIssuedDistrict + "</CitizenshipIssuedDistrict>";
DATA = DATA + "<ConsumerDOB>" + blackListIndRequest.ConsumerDOB + "</ConsumerDOB>";
DATA = DATA + "<PassportNo>" + blackListIndRequest.PassportNo + "</PassportNo>";
DATA = DATA + "<IndianEmbassyNo>" + blackListIndRequest.IndianEmbassyNo + "</IndianEmbassyNo>";
DATA = DATA + "</BlackListVerify>";
try
{
CmnFunc objComnFunc = new CmnFunc();
string hashValue = objComnFunc.HmacSha256Digest(DATA, apiKey.Trim());
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiURL.Trim());
request.Method = "POST";
request.Headers.Add("MERCHANTID", merchantID.Trim());
request.Headers.Add("HASH", hashValue);
byte[] data = Encoding.UTF8.GetBytes(DATA);
request.ContentType = "application/x-www-form-urlencoded";
request.Accept = "text/xml";
request.ContentLength = data.Length;
using (System.IO.Stream requestStream = request.GetRequestStream())
{
requestStream.Write(data, 0, data.Length);
}
using (WebResponse response = request.GetResponse())
{
System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream());
string newestversion = sr.ReadToEnd();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(newestversion);
XmlNodeList nodes = xmlDoc.SelectNodes("BlackListVerify/BlackListDetails");
foreach (XmlNode BlackListDetails in nodes)
{
if (BlackListDetails != null)
{
if (BlackListDetails["BlackListStatus"].InnerText == "YES")
{
cmnResponse.StatusCode = "0";
cmnResponse.StatusMsg = "Report Generated";
BlackListInd blackListIndividual = new BlackListInd();
blackListIndividual.BlackListNo = BlackListDetails["BlackListNo"].InnerText;
blackListIndividual.BlackListedDate = BlackListDetails["BlackListedDate"].InnerText;
blackListIndividual.IndividualName = BlackListDetails["Name"].InnerText;
blackListIndividual.FatherName = BlackListDetails["FatherName"].InnerText;
blackListIndividual.CitizenshipNo = BlackListDetails["CitizenshipNumber"].InnerText;
blackListIndividual.PassportNo = BlackListDetails["PassportNumber"].InnerText;
blackListIndividual.IndianEmbassyNo = BlackListDetails["IndianEmbassyNumber"].InnerText;
blackListIndividualsList.Add(blackListIndividual);
}
else
{
cmnResponse.StatusCode = "100";
cmnResponse.StatusMsg = "No Result Found!";
}
}
}
searchBlackListIndResponse.CmnResponse = cmnResponse;
searchBlackListIndResponse.BlackListIndResponse = blackListIndividualsList;
}
}
catch (Exception ex)
{
cmnResponse.StatusCode = "111";
cmnResponse.StatusMsg = ex.Message;
searchBlackListIndResponse.CmnResponse = cmnResponse;
}
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(searchBlackListIndResponse), "CCBL");
return searchBlackListIndResponse;
}
[WebMethod]
public CmnResponse SendSMSRequest(string AppID, string MobileNumber, string SMSContent)
{
CmnResponse cmnResponse = new CmnResponse();
if (string.IsNullOrEmpty(AppID))
{
cmnResponse.StatusCode = "201";
cmnResponse.StatusMsg = "APP ID Is Mandatory";
return cmnResponse;
}
if (string.IsNullOrEmpty(MobileNumber))
{
cmnResponse.StatusCode = "202";
cmnResponse.StatusMsg = "Mobile Number Is Mandatory";
return cmnResponse;
}
if (string.IsNullOrEmpty(SMSContent))
{
cmnResponse.StatusCode = "203";
cmnResponse.StatusMsg = "SMS Content Is Mandatory";
return cmnResponse;
}
try
{
SqlConnection objConn = new SqlConnection(dbConnString);
string sqlText = "Exec uspSMSUsageDetail @ProjectID='" + AppID.Trim() + "',@MobileNumber='" + MobileNumber.Trim() + "', @SMSContent='" + SMSContent + "'";
objConn.Open();
SqlCommand command = new SqlCommand(sqlText, objConn);
command.CommandTimeout = 0;
SqlDataReader sqlDataReader = command.ExecuteReader();
if (sqlDataReader.HasRows)
{
while (sqlDataReader.Read())
{
cmnResponse.StatusCode = Convert.ToString(sqlDataReader["StatusCode"]);
cmnResponse.StatusMsg = Convert.ToString(sqlDataReader["StatusMsg"]);
}
}
sqlDataReader.Close();
objConn.Close();
}
catch (Exception ex)
{
cmnResponse.StatusCode = "222";
cmnResponse.StatusMsg = ex.Message;
return cmnResponse;
}
return cmnResponse;
}
[WebMethod]
public SanctionResponse SearchSanctionList(string SearchName)
{
SanctionResponse _searchSanctionListResponse = new SanctionResponse();
List<SanctionList> sanctionLists = new List<SanctionList>();
CmnResponse cmnResponse = new CmnResponse();
if (string.IsNullOrEmpty(SearchName))
{
cmnResponse.StatusCode = "301";
cmnResponse.StatusMsg = "Search Name Is Mandatory";
_searchSanctionListResponse.CmnResponse = cmnResponse;
return _searchSanctionListResponse;
}
try
{
SqlConnection objConn = new SqlConnection(dbConnString);
string sqlText = "Exec uspTMLSanctionList @CustomerName='" + SearchName.Trim() + "'";
objConn.Open();
SqlCommand command = new SqlCommand(sqlText, objConn);
command.CommandTimeout = 0;
SqlDataReader sqlDataReader = command.ExecuteReader();
if (sqlDataReader.HasRows)
{
while (sqlDataReader.Read())
{
SanctionList sanctionList = new SanctionList();
sanctionList.Name = Convert.ToString(sqlDataReader["name"]);
sanctionList.Source = Convert.ToString(sqlDataReader["source"]);
sanctionList.OriginalSource = Convert.ToString(sqlDataReader["OriginalSource"]);
sanctionList.Value = Convert.ToString(sqlDataReader["value"]);
sanctionList.CreatedDate = Convert.ToString(sqlDataReader["createdDate"]);
sanctionList.LastUpdatedDate = Convert.ToString(sqlDataReader["lastUpdateDate"]);
sanctionLists.Add(sanctionList);
}
cmnResponse.StatusCode = "0";
cmnResponse.StatusMsg = "Search Result Found";
_searchSanctionListResponse.CmnResponse = cmnResponse;
_searchSanctionListResponse.SanctionListResponse = sanctionLists;
}
else
{
cmnResponse.StatusCode = "302";
cmnResponse.StatusMsg = "No Data Found";
_searchSanctionListResponse.CmnResponse = cmnResponse;
}
sqlDataReader.Close();
objConn.Close();
}
catch (Exception ex)
{
cmnResponse.StatusCode = "333";
cmnResponse.StatusMsg = ex.Message;
_searchSanctionListResponse.CmnResponse = cmnResponse;
return _searchSanctionListResponse;
}
return _searchSanctionListResponse;
}
[WebMethod]
public PepResponse SearchPepList(string SearchName)
{
PepResponse _searchPepListResponse = new PepResponse();
List<PepList> pepLists = new List<PepList>();
CmnResponse cmnResponse = new CmnResponse();
if (string.IsNullOrEmpty(SearchName))
{
cmnResponse.StatusCode = "401";
cmnResponse.StatusMsg = "Search Name Is Mandatory";
_searchPepListResponse.CmnResponse = cmnResponse;
return _searchPepListResponse;
}
try
{
SqlConnection objConn = new SqlConnection(dbConnString);
string sqlText = "Exec uspTMLPepList @CustomerName='" + SearchName.Trim() + "'";
objConn.Open();
SqlCommand command = new SqlCommand(sqlText, objConn);
command.CommandTimeout = 0;
SqlDataReader sqlDataReader = command.ExecuteReader();
if (sqlDataReader.HasRows)
{
while (sqlDataReader.Read())
{
PepList pepList = new PepList();
pepList.EntityID = Convert.ToString(sqlDataReader["EntityID"]);
pepList.EntityName = Convert.ToString(sqlDataReader["EntityName"]);
pepList.EntitySource = Convert.ToString(sqlDataReader["EntitySource"]);
pepList.OriginalSource = Convert.ToString(sqlDataReader["OriginalSource"]);
pepList.CreatedDate = Convert.ToString(sqlDataReader["CreatedDate"]);
pepList.LastUpdateDate = Convert.ToString(sqlDataReader["LastUpdateDate"]);
pepLists.Add(pepList);
}
cmnResponse.StatusCode = "0";
cmnResponse.StatusMsg = "Search Result Found";
_searchPepListResponse.CmnResponse = cmnResponse;
_searchPepListResponse.PepListResponse = pepLists;
}
else
{
cmnResponse.StatusCode = "402";
cmnResponse.StatusMsg = "No Data Found";
_searchPepListResponse.CmnResponse = cmnResponse;
}
sqlDataReader.Close();
objConn.Close();
}
catch (Exception ex)
{
cmnResponse.StatusCode = "444";
cmnResponse.StatusMsg = ex.Message;
_searchPepListResponse.CmnResponse = cmnResponse;
return _searchPepListResponse;
}
return _searchPepListResponse;
}
[WebMethod]
public BlockResponse SearchBlockList(string SearchName)
{
BlockResponse _searchBlockListResponse = new BlockResponse();
List<BlockList> blockLists = new List<BlockList>();
CmnResponse cmnResponse = new CmnResponse();
if (string.IsNullOrEmpty(SearchName))
{
cmnResponse.StatusCode = "501";
cmnResponse.StatusMsg = "Search Name Is Mandatory";
_searchBlockListResponse.CmnResponse = cmnResponse;
return _searchBlockListResponse;
}
try
{
SqlConnection objConn = new SqlConnection(dbConnString);
string sqlText = "Exec uspTMLBlockList @CustomerName='" + SearchName.Trim() + "'";
objConn.Open();
SqlCommand command = new SqlCommand(sqlText, objConn);
command.CommandTimeout = 0;
SqlDataReader sqlDataReader = command.ExecuteReader();
if (sqlDataReader.HasRows)
{
while (sqlDataReader.Read())
{
BlockList blockList = new BlockList();
blockList.EntityID = Convert.ToString(sqlDataReader["EntityID"]);
blockList.EntityName = Convert.ToString(sqlDataReader["EntityName"]);
blockList.EntitySource = Convert.ToString(sqlDataReader["EntitySource"]);
blockList.OriginalSource = Convert.ToString(sqlDataReader["OriginalSource"]);
blockList.CreatedDate = Convert.ToString(sqlDataReader["CreatedDate"]);
blockList.LastUpdateDate = Convert.ToString(sqlDataReader["LastUpdateDate"]);
blockLists.Add(blockList);
}
cmnResponse.StatusCode = "0";
cmnResponse.StatusMsg = "Search Result Found";
_searchBlockListResponse.CmnResponse = cmnResponse;
_searchBlockListResponse.BlockListResponse = blockLists;
}
else
{
cmnResponse.StatusCode = "502";
cmnResponse.StatusMsg = "No Data Found";
_searchBlockListResponse.CmnResponse = cmnResponse;
}
sqlDataReader.Close();
objConn.Close();
}
catch (Exception ex)
{
cmnResponse.StatusCode = "555";
cmnResponse.StatusMsg = ex.Message;
_searchBlockListResponse.CmnResponse = cmnResponse;
return _searchBlockListResponse;
}
return _searchBlockListResponse;
}
//public CustomSoapHeader customSoapHeader;
// Receive all SOAP headers besides the CustomSoapHeader SOAP header.
//public SoapUnknownHeader[] unknownHeaders;
[WebMethod]
//[SoapHeader("customSoapHeader", Direction = SoapHeaderDirection.InOut)]
public CmnResponse CreateAccount(ProjectDetail projectDetail, ClientDetail clientDetail)
{
CmnResponse cmnResponse = new CmnResponse();
//if (customSoapHeader == null)
//{
// cmnResponse.StatusCode = "600";
// cmnResponse.StatusMsg = "Soap Header Is Mandatory";
// return cmnResponse;
//}
//else
//{
// cmnResponse.StatusCode = customSoapHeader.CustomPublicKey;
// cmnResponse.StatusMsg = customSoapHeader.CustomCertificate;
// return cmnResponse;
//}
//string IpAddress = HttpContext.Current.Request.UserHostAddress;
//string domain = HttpContext.Current.Request.UrlReferrer.ToString();
//string originalPath = new Uri(HttpContext.Current.Request.Url.AbsoluteUri).OriginalString;
//string parentDirectory = originalPath.Substring(0, originalPath.LastIndexOf("/"));
//cmnResponse = new ProjectDetail().ProjectValidationChk(projectDetail);
//if (cmnResponse.StatusCode != "0")
// return cmnResponse;
cmnResponse = new ClientDetail().ClientValidationCheck(clientDetail);
if (cmnResponse.StatusCode != "0")
return cmnResponse;
cmnResponse = cmnFunc.SoapReqLog("CreateAccount", "", cmnFunc.SerializeToXml(clientDetail), projectDetail.ProjectID);
if (cmnResponse.StatusCode != "0")
return cmnResponse;
string soapID = cmnResponse.StatusMsg;
var client = new RestClient(accURL);
client.RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.RequestFormat = DataFormat.Json;
try
{
string authValue = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(accAuthUserName + ":" + accAuthUserPwd));
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddHeader("Authorization", authValue);
request.AddParameter("UserId", accUserID);
request.AddParameter("StationId", accStationId);
request.AddParameter("BranchCode", clientDetail.BranchCode);
request.AddParameter("AcType", clientDetail.AccountType);
request.AddParameter("CyCode", clientDetail.CyCode);
request.AddParameter("ProvinceCode", clientDetail.PermanentProvinceCode);
request.AddParameter("Nationality", clientDetail.Nationality);
request.AddParameter("CountryCode", clientDetail.PermanentCountryCode);
request.AddParameter("GFathersName", clientDetail.GFatherName);
request.AddParameter("GFatherDOB", clientDetail.GFatherDateOfBirthAD);
request.AddParameter("GFatherCitizenShipNo", clientDetail.GFatherCitizenShipNo);
request.AddParameter("GFatherCitizenShipIssueDate", clientDetail.GFatherCitizenShipIssueDateAD);
request.AddParameter("GFatherCitizenShipIssueDistrictCode", clientDetail.GFatherCitizenShipIssueDistrictCode);
request.AddParameter("FathersName", clientDetail.FatherName);
request.AddParameter("FatherDOB", clientDetail.FatherDateOfBirthAD);
request.AddParameter("FatherCitizenShipNo", clientDetail.FatherCitizenShipNo);
request.AddParameter("FatherCitizenShipIssueDate", clientDetail.FatherCitizenShipIssueDateAD);
request.AddParameter("FatherCitizenShipIssueDistrictCode", clientDetail.FatherCitizenShipIssueDistrictCode);
request.AddParameter("MotherName", clientDetail.MotherName);
request.AddParameter("MotherDOB", clientDetail.MotherDateOfBirthAD);
request.AddParameter("MotherCitizenShipNo", clientDetail.MotherCitizenShipNo);
request.AddParameter("MotherCitizenShipIssueDate", clientDetail.MotherCitizenShipIssueDateAD);
request.AddParameter("MotherCitizenShipIssueDistrictCode", clientDetail.MotherCitizenShipIssueDistrictCode);
request.AddParameter("FirstName", clientDetail.FirstName);
request.AddParameter("MiddleName", clientDetail.MiddleName);
request.AddParameter("LastName", clientDetail.LastName);
request.AddParameter("DOB", clientDetail.DateOfBirthAD);
request.AddParameter("Gender", clientDetail.GenderCode);
request.AddParameter("MaritalStatus", clientDetail.MaritalStatusCode);
request.AddParameter("Salutation", clientDetail.SalutationCode);
request.AddParameter("IsFromOutsideCountry", clientDetail.IsFromOutsideCountry);
request.AddParameter("ForeignCountryCode", clientDetail.ForeignCountryCode);
request.AddParameter("ForeignCountryCity", clientDetail.ForeignCountryCity);
request.AddParameter("ForeignCountryAddress", clientDetail.ForeignCountryAddress);
request.AddParameter("ForeignCountryHouseNo", clientDetail.ForeignCountryHouseNo);
request.AddParameter("IsTempAddPermanent", clientDetail.IsTempAddPermanent);
request.AddParameter("TempCountryCode", clientDetail.TempCountryCode);
request.AddParameter("TempDistrictCode", clientDetail.TempDistrictCode);
request.AddParameter("TempCity", clientDetail.TempCity);
request.AddParameter("TempVDC", clientDetail.TempLocalBody);
request.AddParameter("TempWardNo", clientDetail.TempWardNo);
request.AddParameter("TempAddress", clientDetail.TempAddress);
request.AddParameter("TempHouseBlockNo", clientDetail.TempHouseBlockNo);
request.AddParameter("District", clientDetail.PermanentDistrictCode);
request.AddParameter("VDC", clientDetail.PermanentLocalBody);
request.AddParameter("WardNo", clientDetail.PermanentWardNo);
request.AddParameter("HouseBlockNo", clientDetail.PermanentHouseBlockNo);
request.AddParameter("IDType", clientDetail.IDType);
request.AddParameter("CitizenshipNo", clientDetail.IDValue);
request.AddParameter("CitizenNumIssued", clientDetail.IDIssueAuthority);
request.AddParameter("CitizenDistrict", clientDetail.FatherCitizenShipIssueDistrictCode);
request.AddParameter("MobileNo", clientDetail.PermanentMobileNo);
request.AddParameter("eMail", clientDetail.PermanentEmail);
request.AddParameter("ExtraInfo", clientDetail.ExtraInfo);
request.AddParameter("PANNo", clientDetail.PanNo);
request.AddParameter("PANIssueDistrictCode", clientDetail.PanNoIssueDistrictCode);
request.AddParameter("PANIssueDate", clientDetail.PanNoIssueDateAD);
request.AddParameter("Religion", clientDetail.ReligionCode);
request.AddParameter("Occupation", clientDetail.Occupation);
request.AddParameter("Education", clientDetail.EducationCode);
request.AddParameter("PurposeOfAccount", clientDetail.PurposeOfAccount);
request.AddParameter("SourceOfFunds", clientDetail.SourceOfIncome);
request.AddParameter("SourceofFundDesc", clientDetail.SourceOfIncomeOthers);
var jsonRequestBody = JsonConvert.SerializeObject(request);
IRestResponse response = client.Execute(request);
string[] responseArray = response.Content.Split('|');
if (responseArray[0].ToString().Trim().Replace("\"", "") != "100")
{
cmnResponse.StatusCode = responseArray[0].ToString().Trim().Replace("\"", "");
cmnResponse.StatusMsg = responseArray[1].ToString().Trim().Replace("\"", "");
return cmnResponse;
}
cmnResponse.StatusCode = "0";
cmnResponse.StatusMsg = responseArray[1].ToString().Trim().Replace("\"", "");
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(cmnResponse), "CCBL");
}
catch (Exception ex)
{
cmnResponse.StatusCode = "666";
cmnResponse.StatusMsg = ex.Message;
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(cmnResponse), "CCBL");
}
return cmnResponse;
}
public struct CheckDuplicateAccountReq
{
public string CustomerName { get; set; }
public string DOB { get; set; }
public string FatherName { get; set; }
public string GFatherName { get; set; }
public string CitizenshipNo { get; set; }
}
[WebMethod]
public CmnResponse CheckDuplicateAccount(string CustomerName, string DOB, string FatherName, string GFatherName, string CitizenshipNo)
{
CmnResponse cmnResponse = new CmnResponse();
CheckDuplicateAccountReq objReq = new CheckDuplicateAccountReq();
objReq.CustomerName = CustomerName;
objReq.DOB = DOB;
objReq.FatherName = FatherName;
objReq.GFatherName = GFatherName;
objReq.CitizenshipNo = CitizenshipNo;
cmnResponse = cmnFunc.SoapReqLog("CheckDuplicateAccount", "", cmnFunc.SerializeToXml(objReq), "ShiranTech");
if (cmnResponse.StatusCode != "0")
{
return cmnResponse;
}
string soapID = cmnResponse.StatusMsg;
if (string.IsNullOrEmpty(CustomerName))
{
cmnResponse.StatusCode = "701";
cmnResponse.StatusMsg = "Customer Name Cannot Be Empty!";
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(cmnResponse), "CCBL");
return cmnResponse;
}
if (string.IsNullOrEmpty(DOB))
{
cmnResponse.StatusCode = "702";
cmnResponse.StatusMsg = "Customer DOB Cannot Be Empty!";
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(cmnResponse), "CCBL");
return cmnResponse;
}
if (string.IsNullOrEmpty(FatherName))
{
cmnResponse.StatusCode = "703";
cmnResponse.StatusMsg = "Father Name [FatherName] Cannot Be Empty!";
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(cmnResponse), "CCBL");
return cmnResponse;
}
if (string.IsNullOrEmpty(GFatherName))
{
cmnResponse.StatusCode = "704";
cmnResponse.StatusMsg = "Grand Father Name [GFatherName] Cannot Be Empty!";
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(cmnResponse), "CCBL");
return cmnResponse;
}
if (string.IsNullOrEmpty(CitizenshipNo))
{
cmnResponse.StatusCode = "705";
cmnResponse.StatusMsg = "CitizenshipNo Cannot Be Empty!";
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(cmnResponse), "CCBL");
return cmnResponse;
}
try
{
SqlConnection objConn = new SqlConnection(dbConnString);
string sqlText = "Exec uspCheckAccount @CustomerName='" + CustomerName.Trim() + "',@DOB='" + DOB.Trim() + "',@FathersName='" + FatherName.Trim() + "',@GFathersName='" + GFatherName.Trim() + "',@CitizenshipNo='" + CitizenshipNo.Trim() + "'";
objConn.Open();
SqlCommand command = new SqlCommand(sqlText, objConn);
command.CommandTimeout = 0;
SqlDataReader sqlDataReader = command.ExecuteReader();
if (sqlDataReader.HasRows)
{
while (sqlDataReader.Read())
{
cmnResponse.StatusCode = Convert.ToString(sqlDataReader["StatusCode"]);
cmnResponse.StatusMsg = Convert.ToString(sqlDataReader["StatusMsg"]);
}
}
sqlDataReader.Close();
objConn.Close();
}
catch (Exception ex)
{
cmnResponse.StatusCode = "777";
cmnResponse.StatusMsg = ex.Message;
}
cmnFunc.SoapResLog(soapID, cmnFunc.SerializeToXml(cmnResponse), "CCBL");
return cmnResponse;
}
//[WebMethod]
//public ReconcileReportResponse ReconcileReport(string AppID, string CustomerName, string CustomerFatherName, string CustomerGFatherName, string CustomerDOB, string CustomerCitizenshipNo, string CustomerCitizenshipIssuedDate, string CustomerEmail, string CustomerMobileNo)
//{
// ReconcileReportResponse reconcileReportResponse = new ReconcileReportResponse();
// CmnResponse cmnResponse = new CmnResponse();
// try
// {
// SqlConnection objConn = new SqlConnection("Data Source=intdbsrv;Initial Catalog=CCBL ReportingDB;User Id=sa;Password=software;");
// string sqlText = "Exec uspCustomerAccDetailReconciliation @AppID='"+ AppID.Trim() + "',@CustomerName='"+ CustomerName.Trim() + "',@CustomerFatherName='"+ CustomerFatherName.Trim() + "',@CustomerGFatherName='"+ CustomerGFatherName.Trim() + "',@CustomerDOB='" + CustomerDOB.Trim() + "',@CustomerCitizenshipNo='"+ CustomerCitizenshipNo.Trim()+ "',@CustomerCitizenshipIssuedDate='" + CustomerCitizenshipIssuedDate + "', @CustomerEmail ='" + CustomerEmail.Trim() + "',@CustomerMobileNo='" + CustomerMobileNo.Trim() + "'";
// objConn.Open();
// SqlCommand command = new SqlCommand(sqlText, objConn);
// command.CommandTimeout = 0;
// SqlDataReader sqlDataReader = command.ExecuteReader();
// if (sqlDataReader.HasRows)
// {
// cmnResponse.StatusCode = "0";
// cmnResponse.StatusMsg = "Search Result Found";
// reconcileReportResponse.CmnResponse = cmnResponse;
// }
// else
// {
// cmnResponse.StatusCode = "801";
// cmnResponse.StatusMsg = "No Data Found";
// reconcileReportResponse.CmnResponse = cmnResponse;
// }
// sqlDataReader.Close();
// objConn.Close();
// }
// catch (Exception ex)
// {
// cmnResponse.StatusCode = "888";
// cmnResponse.StatusMsg = ex.Message;
// reconcileReportResponse.CmnResponse = cmnResponse;
// return reconcileReportResponse;
// }
// return reconcileReportResponse;
//}
//public struct ApplicantStatusMonitorRequestDetails
//{
// public string AppID { get; set;}
// public string ApplicantAccNo { get; set; }
// public string ApplicantStatus { get; set; }
//}
//[WebMethod]
//public CmnResponse ApplicantStatusMonitor(ApplicantStatusMonitorRequestDetails applicantStatusMonitorRequestDetails)
//{
// CmnResponse cmnResponse = new CmnResponse();
// cmnResponse = SoapReqLog("ApplicantStatusMonitor", "", SerializeToXml(applicantStatusMonitorRequestDetails), "ShiranTech");
// if (cmnResponse.StatusCode != "0")
// {
// return cmnResponse;
// }
// string soapID = cmnResponse.StatusMsg;
// if (string.IsNullOrEmpty(applicantStatusMonitorRequestDetails.AppID))
// {
// cmnResponse.StatusCode = "901";
// cmnResponse.StatusMsg = "AppID Is Mandatory";
// SoapResLog(soapID, SerializeToXml(cmnResponse), "CCBL");
// return cmnResponse;
// }
// if (string.IsNullOrEmpty(applicantStatusMonitorRequestDetails.ApplicantAccNo))
// {
// cmnResponse.StatusCode = "902";
// cmnResponse.StatusMsg = "ApplicantAccNo Is Mandatory";
// SoapResLog(soapID, SerializeToXml(cmnResponse), "CCBL");
// return cmnResponse;
// }
// if (string.IsNullOrEmpty(applicantStatusMonitorRequestDetails.ApplicantStatus))
// {
// cmnResponse.StatusCode = "903";
// cmnResponse.StatusMsg = "ApplicantStatus Is Mandatory";
// SoapResLog(soapID, SerializeToXml(cmnResponse), "CCBL");
// return cmnResponse;
// }
// try
// {
// SqlConnection objConn = new SqlConnection("Data Source=intdbsrv;Initial Catalog=CCBL ReportingDB;User Id=sa;Password=software;");
// string sqlText = "Exec uspApplicantStatusMonitor @AppID='" + applicantStatusMonitorRequestDetails.AppID.Trim()
// + "',@ApplicantAccNo='" + applicantStatusMonitorRequestDetails.ApplicantAccNo.Trim()
// + "',@ApplicantStatus='" + applicantStatusMonitorRequestDetails.ApplicantStatus.Trim() + "'";
// objConn.Open();
// SqlCommand command = new SqlCommand(sqlText, objConn);
// command.CommandTimeout = 0;
// SqlDataReader sqlDataReader = command.ExecuteReader();
// if (sqlDataReader.HasRows)
// {
// while (sqlDataReader.Read())
// {
// cmnResponse.StatusCode = sqlDataReader["StatusCode"].ToString();
// cmnResponse.StatusMsg = sqlDataReader["StatusMsg"].ToString();
// }
// }
// else
// {
// cmnResponse.StatusCode = "904";
// cmnResponse.StatusMsg = "No Data Found";
// }
// sqlDataReader.Close();
// objConn.Close();
// }
// catch (Exception ex)
// {
// cmnResponse.StatusCode = "999";
// cmnResponse.StatusMsg = ex.Message;
// }
// SoapResLog(soapID, SerializeToXml(cmnResponse), "CCBL");
// return cmnResponse;
//}
}
}
Comments
Post a Comment