private void SavePmntDetails(int PackageID, int UserID) { try { PmntDetailsinfo objPmntDetailsinfo = new PmntDetailsinfo(); objPmntDetailsinfo.PmntType = 1; objPmntDetailsinfo.CardNumber = CardNumber.Text; objPmntDetailsinfo.CardType = CardType.SelectedValue; objPmntDetailsinfo.CardExpDt = ExpMon.SelectedValue + "/" + CCExpiresYear.SelectedValue; objPmntDetailsinfo.CardholderName = GeneralFunc.ToProper(txtCardholderName.Text); objPmntDetailsinfo.CardCode = cvv.Text; objPmntDetailsinfo.BillingAdd = GeneralFunc.ToProper(txtBillAddress.Text); objPmntDetailsinfo.BillingCity = GeneralFunc.ToProper(txtBillCity.Text); objPmntDetailsinfo.BillingState = ddlBillState.SelectedItem.Value; objPmntDetailsinfo.BillingName = GeneralFunc.ToProper(txtBillName.Text); objPmntDetailsinfo.BillingPhone = txtBillPhone.Text; if (txtBillZip.Text.Length == 4) { objPmntDetailsinfo.BillingZip = "0" + txtBillZip.Text; } else { objPmntDetailsinfo.BillingZip = txtBillZip.Text; } String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); objPmntDetailsinfo.IPAddress = strIp; objPmntDetailsinfo.BankRouting = ""; objPmntDetailsinfo.BankName = ""; objPmntDetailsinfo.BankAccountNumber = ""; objPmntDetailsinfo.AuthorizationDt = ""; objPmntDetailsinfo.Amount = ""; objPmntDetailsinfo.PmntStatus = 2; int CarID; if ((Session["CarID"] == null) || (Session["CarID"].ToString() == "")) { CarID = Convert.ToInt32(0); } else { CarID = Convert.ToInt32(Session["CarID"].ToString()); } bool bnew = objBankDetailsBL.SavePmntDetails(objPmntDetailsinfo, PackageID, UserID, CarID); //if (bnew == true) //{ // mpealteruser.Show(); // lblErr.Visible = true; // lblErr.Text = "Payment details saved successfully"; //} } catch (Exception ex) { } }
public bool UpdatePmntStatus(PmntDetailsinfo objPmntDetailsinfo, int PackageID, int UID, int CarID, int UserPackID, int PostingID) { string spNameString = string.Empty; bool bsucess = false; //Setting Connection //Global.INSTANCE_NAME = strCurrentConn; IDataReader ModelsInfoDataReader = null; //Connect to the database Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME); //Assign stored procedure name spNameString = "[Usp_Save_PaymentStatus]"; DbCommand dbCommand = null; try { //@pmntStatus int, //@TransactionID varchar(500), //@Currency varchar(500), //@UID int, //@PackageID int, //@CarID int //Set stored procedure to the command object dbCommand = dbDatabase.GetStoredProcCommand(spNameString); dbDatabase.AddInParameter(dbCommand, "@Amount", DbType.String, objPmntDetailsinfo.Amount); dbDatabase.AddInParameter(dbCommand, "@TransactionID", DbType.String, objPmntDetailsinfo.TransactionID); dbDatabase.AddInParameter(dbCommand, "@pmntStatus", DbType.Int32, objPmntDetailsinfo.PmntStatus); dbDatabase.AddInParameter(dbCommand, "@PackageID", DbType.Int32, PackageID); dbDatabase.AddInParameter(dbCommand, "@UID", DbType.Int32, UID); dbDatabase.AddInParameter(dbCommand, "@CarID", DbType.Int32, CarID); dbDatabase.AddInParameter(dbCommand, "@pmntType", DbType.Int32, objPmntDetailsinfo.PmntType); dbDatabase.AddInParameter(dbCommand, "@IPAddress", DbType.String, objPmntDetailsinfo.IPAddress); dbDatabase.AddInParameter(dbCommand, "@UserPackID", DbType.Int32, UserPackID); dbDatabase.AddInParameter(dbCommand, "@PostingID", DbType.Int32, PostingID); //Executing stored procedure dbDatabase.ExecuteNonQuery(dbCommand); bsucess = true; } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, Global.EXCEPTION_POLICY); if (rethrow) throw; } return bsucess; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["CurrentPage"] = "Home"; Session["CurrentPageConfig"] = null; Session["PageName"] = ""; GeneralFunc.SetPageDefaults(Page); BankDetailsBL objBankDetailsBL = new BankDetailsBL(); ServiceReference objServiceReference = new ServiceReference(); ScriptReference objScriptReference = new ScriptReference(); objServiceReference.Path = "~/CarsService.asmx"; objScriptReference.Path = "~/Static/Js/CarsJScriptNew.js"; scrptmgr.Services.Add(objServiceReference); scrptmgr.Scripts.Add(objScriptReference); PmntDetailsinfo objPmntDetailsinfo = new PmntDetailsinfo(); int CarID; if ((Session["CarID"] == null) || (Session["CarID"].ToString() == "")) { CarID = Convert.ToInt32(0); } else { CarID = Convert.ToInt32(Session["CarID"].ToString()); } int UID = 0; if (Session["RegUSER_ID"] != null) { UID = Convert.ToInt32(Session["RegUSER_ID"].ToString()); } if (UID != 0) { int PackageID = Convert.ToInt32(Request.QueryString["item_number"].ToString()); string packageName = string.Empty; if (PackageID == 1) { packageName = "Basic - FREE"; } else if (PackageID == 2) { packageName = "Standard"; } else if (PackageID == 3) { packageName = "Enhanced"; } else if (PackageID == 4) { packageName = "Silver Deluxe"; } else if (PackageID == 5) { packageName = "Gold Deluxe"; } else if (PackageID == 6) { packageName = "Platinum Deluxe"; } lblPackage.Text = packageName; if (Session["PayBy"] == null) { //Request.QueryString["item_number"] //tx=02R12984CT146441A&st=Completed&amt=0.10&cc=USD&cm=&item_number=2 objPmntDetailsinfo.Currency = Request.QueryString["cc"]; lblamount.Text = Request.QueryString["amt"]; lblCurrency.Text = objPmntDetailsinfo.Currency; lbluser.Text = Session["RegName"].ToString(); objPmntDetailsinfo.Amount = lblamount.Text; txtTran.Text = Request.QueryString["tx"]; objPmntDetailsinfo.TransactionID = Request.QueryString["tx"]; objPmntDetailsinfo.PmntType = 1; if (Request.QueryString["st"] != null) { if (Request.QueryString["st"].ToString() == "Completed") { objPmntDetailsinfo.PmntStatus = 2; } else { objPmntDetailsinfo.PmntStatus = 4; } } else { objPmntDetailsinfo.PmntStatus = 4; } String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); objPmntDetailsinfo.IPAddress = strIp; int PostingID = Convert.ToInt32(Session["PostingID"].ToString()); int UserPackID = Convert.ToInt32(Session["RegUserPackID"].ToString()); bool bnew = objBankDetailsBL.UpdatePmntStatus(objPmntDetailsinfo, PackageID, UID, CarID, UserPackID, PostingID); } else { ///NetCode="+ReturnValues[4].Trim(char.Parse("|"))+"&TransID="+ReturnValues[6].Trim(char.Parse("|")) /// objPmntDetailsinfo.Currency = Request.QueryString["cc"]; lblamount.Text = Request.QueryString["amt"]; lblCurrency.Text = objPmntDetailsinfo.Currency; lbluser.Text = Session["RegName"].ToString(); objPmntDetailsinfo.Amount = lblamount.Text; txtTran.Text = Request.QueryString["NetCode"]; objPmntDetailsinfo.TransactionID = Request.QueryString["NetCode"]; objPmntDetailsinfo.PmntStatus = 2; objPmntDetailsinfo.CardType = Session["PayBy"].ToString(); objPmntDetailsinfo.PmntType = 1; String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); objPmntDetailsinfo.IPAddress = strIp; int PostingID = Convert.ToInt32(Session["PostingID"].ToString()); int UserPackID = Convert.ToInt32(Session["RegUserPackID"].ToString()); bool bnew = objBankDetailsBL.UpdatePmntStatus(objPmntDetailsinfo, PackageID, UID, CarID, UserPackID, PostingID); } string LoginPassword = Session["RegPassword"].ToString(); string LoginName = Session["RegUserName"].ToString(); SendRegisterMail(LoginName, LoginPassword); } //UpdatePmntStatus(PmntDetailsinfo objPmntDetailsinfo, int PackageID, int UID, int CarID) } }
public bool SavePmntDetails(PmntDetailsinfo objPmntDetailsinfo, int PackageID, int UID, int CarID) { string spNameString = string.Empty; bool bsucess = false; //Setting Connection //Global.INSTANCE_NAME = strCurrentConn; IDataReader ModelsInfoDataReader = null; //Connect to the database Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME); //Assign stored procedure name spNameString = "[Usp_Save_BankDetails]"; DbCommand dbCommand = null; try { //Set stored procedure to the command object dbCommand = dbDatabase.GetStoredProcCommand(spNameString); dbDatabase.AddInParameter(dbCommand, "@pmntType", DbType.Int64, objPmntDetailsinfo.PmntType); dbDatabase.AddInParameter(dbCommand, "@cardNumber", DbType.String, objPmntDetailsinfo.CardNumber); dbDatabase.AddInParameter(dbCommand, "@cardType", DbType.String, objPmntDetailsinfo.CardType); dbDatabase.AddInParameter(dbCommand, "@cardExpDt", DbType.String, objPmntDetailsinfo.CardExpDt); dbDatabase.AddInParameter(dbCommand, "@cardholderName", DbType.String, objPmntDetailsinfo.CardholderName); dbDatabase.AddInParameter(dbCommand, "@cardCode", DbType.String, objPmntDetailsinfo.CardCode); dbDatabase.AddInParameter(dbCommand, "@BillingName", DbType.String, objPmntDetailsinfo.BillingName); dbDatabase.AddInParameter(dbCommand, "@BillingPhone", DbType.String, objPmntDetailsinfo.BillingPhone); dbDatabase.AddInParameter(dbCommand, "@BillingZip", DbType.String, objPmntDetailsinfo.BillingZip); dbDatabase.AddInParameter(dbCommand, "@billingAdd", DbType.String, objPmntDetailsinfo.BillingAdd); dbDatabase.AddInParameter(dbCommand, "@billingCity", DbType.String, objPmntDetailsinfo.BillingCity); dbDatabase.AddInParameter(dbCommand, "@billingState", DbType.String, objPmntDetailsinfo.BillingState); dbDatabase.AddInParameter(dbCommand, "@IPAddress", DbType.String, objPmntDetailsinfo.IPAddress); dbDatabase.AddInParameter(dbCommand, "@bankRouting", DbType.String, objPmntDetailsinfo.BankRouting); dbDatabase.AddInParameter(dbCommand, "@bankName", DbType.String, objPmntDetailsinfo.BankName); dbDatabase.AddInParameter(dbCommand, "@bankAccountNumber", DbType.String, objPmntDetailsinfo.BankAccountNumber); dbDatabase.AddInParameter(dbCommand, "@AuthorizationDt", DbType.String, objPmntDetailsinfo.AuthorizationDt); dbDatabase.AddInParameter(dbCommand, "@Amount", DbType.String, objPmntDetailsinfo.Amount); dbDatabase.AddInParameter(dbCommand, "@pmntStatus", DbType.Int32, objPmntDetailsinfo.PmntStatus); dbDatabase.AddInParameter(dbCommand, "@PackageID", DbType.Int32, PackageID); dbDatabase.AddInParameter(dbCommand, "@UID", DbType.Int32, UID); dbDatabase.AddInParameter(dbCommand, "@CarID", DbType.Int32, CarID); //Executing stored procedure dbDatabase.ExecuteNonQuery(dbCommand); bsucess = true; } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, Global.EXCEPTION_POLICY); if (rethrow) throw; } return bsucess; }