protected void btnEnviarDespues_Click(object sender, EventArgs e) { decimal amount = 0; string currencyCodecro = ""; string currencyCode = ""; bool answer = false; amount = decimal.Parse(Session["Amount"].ToString()); currencyCodecro = Session["CurrencyCode"].ToString(); currencyCode = ddlMoneda.SelectedValue; int id = int.Parse(Session["IdImg"].ToString()); string description = Session["numCuota"].ToString(); if (currencyCodecro == "USD") { if (currencyCode == "USD") { answer = SendEmailAmountPay(amount.ToString(), id.ToString(), description, "USD"); } if (currencyCode == "PEN") { BrTypeChange brTypeChange = new BrTypeChange(); var arraychanges = brTypeChange.GetTypesChange().Split('|'); var tcVenta = decimal.Parse(arraychanges[0]); var tcCompra = decimal.Parse(arraychanges[1]); amount = amount * tcCompra; answer = SendEmailAmountPay(amount.ToString("0.00"), id.ToString(), description, "PEN"); } } if (currencyCodecro == "PEN") { if (currencyCode == "PEN") { answer = SendEmailAmountPay(amount.ToString(), id.ToString(), description, "PEN"); } if (currencyCode == "USD") { BrMembershipPayDetail brMembershipPayDetail = new BrMembershipPayDetail(); var data = brMembershipPayDetail.GetQuote(id, User.Identity.Name.Split('¬')[1]).Split('|'); var tc = decimal.Parse(data[4]); amount = amount / tc; answer = SendEmailAmountPay(amount.ToString(), id.ToString(), description, "USD"); } } if (answer) { Response.Redirect("EndPaymentSendLater.aspx"); } }
protected void PayByWallet_Click(object sender, EventArgs e) { var arrayLogin = User.Identity.Name.Split('¬'); BrWallet brWallet = new BrWallet(); BrUser brUser = new BrUser(); BrTypeChange brTypeChange = new BrTypeChange(); var arrayTypes = brTypeChange.GetTypesChange().Split('|'); var tcCompra = decimal.Parse(arrayTypes[1]); var amountWallet = decimal.Parse(brWallet.GetAmount(arrayLogin[1])); var objServices = Session["servicio"]; var objPrice = Session["precio"]; var amountWalletSoles = amountWallet * tcCompra; string[] service; string description = string.Empty; decimal price = 0; if (amountWallet == 0) { MessageError.Text = "Wallet insuficiente"; return; } if (objServices != null || objPrice != null) { service = objServices.ToString().Split('|'); description = service[5]; price = decimal.Parse(objPrice.ToString()); if (price == 0) { MessageError.Text = "ocurrio un error"; return; } if (amountWalletSoles < price) { MessageError.Text = "Wallet insuficiente"; return; } var referenceData = "Compra de Paquete : " + service[5]; var data = $"{price}|{tcCompra}|{arrayLogin[4]}|{referenceData}"; var answer = brWallet.PutPayService(data, arrayLogin[1]); if (answer) { //Samir Pazo|18/01/2020|4|22/07/2019|6|Full Day Todo Incluido|35|25 var reg = service[0] + "|" + service[1] + "|" + "" + "|" + service[2] + "|" + service[3] + "|" + service[4] + "|" + arrayLogin[1] + "|" + "2" + "|" + "" + "|" + price; var response = brUser.RegisterService(reg); } Response.Redirect("EndPaymentServices.aspx", true); } }
protected void PayByWallet_Click(object sender, EventArgs e) { var values = (string)Session["dataAmort"]; if (!string.IsNullOrEmpty(values)) { var arrayValues = values.Split('|'); BrPayments brPayment = new BrPayments(); // (int TypePay, string IdMembershipDetail, int nQuotes, decimal NewAmort, int Rate) var arrayLogin = HttpContext.Current.User.Identity.Name.Split('¬'); string User = arrayLogin[1]; BrTypeChange brTypeChange = new BrTypeChange(); var arrayChanges = brTypeChange.GetTypesChange().Split('|'); BrUser brUser = new BrUser(); var nroDoc = brUser.getDoc(arrayLogin[1]); int id = int.Parse(Session["IdImg"].ToString()); var amountAmort = decimal.Parse(arrayValues[2]); var tcBuy = decimal.Parse(arrayChanges[1]); BrWallet brWallet = new BrWallet(); var amountWallet = decimal.Parse(brWallet.GetAmount(arrayLogin[1])); amountWallet = amountWallet * tcBuy; var currencyCode = arrayValues[5]; if (currencyCode == "USD") { amountAmort = amountAmort * tcBuy; } if (amountWallet < amountAmort) { MessageError.Text = "Wallet Insuficiente"; return; } var data = brWallet.PutPayAmortization(amountAmort, tcBuy, arrayLogin[1]); if (data) { var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');; string date = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0]; var hour = DateTime.Now.ToShortTimeString(); var description = amountAmort + " " + currencyCode; var nombreArchivo = GetRecibo(arrayLogin[1], date, arrayLogin[1], hour, "Adelanto de Cuotas", description); decimal value2 = decimal.Parse(arrayValues[2]); bool ans = brPayment.Amortization(2, arrayValues[0], Int32.Parse(arrayValues[1]), value2, Int32.Parse(arrayValues[3]), nombreArchivo); } Response.Redirect("EndPaymentQuote.aspx"); return; } }
protected void Page_Load(object sender, EventArgs e) { decimal venta = 0; decimal compra = 0; bool anwser = false; venta = decimal.Parse(Request["value"].ToString()); compra = decimal.Parse(Request["compra"]); if (venta < 2 || compra < 2) { Response.Write("Se Produjo un Error"); return; } venta = venta + 0.044m; compra = compra - 0.022m; BrTypeChange oTypeChange = new BrTypeChange(); anwser = oTypeChange.PutTypeChange(venta, compra); if (!anwser) { Response.Write("Se Produjo un Error"); return; } if (string.IsNullOrEmpty((string)Session["auxRef"])) { Response.Write("false¬no esta la variballe aux"); return; } Response.Write("true¬si esta la variballe aux"); Response.Write("Se Inserto Con Exito"); return; }
protected void Page_Load(object sender, EventArgs e) { MyConstants mc = new MyConstants(); try { var dataSche = (Dictionary <string, object>)Session["changingschedule"]; string token = ""; int numberQuotes = 0; token = Request["token"].ToString(); numberQuotes = int.Parse(Request["numcuotes"].ToString()); string codeCurrency = Request["typeCurrency"].ToString(); var newUserName = User.Identity.Name.Split('¬')[1]; var idMemberDetails = 0; BrTypeChange brTypeChange = new BrTypeChange(); var arrayTypes = brTypeChange.GetTypesChange().Split('|'); var tcBuy = decimal.Parse(arrayTypes[1]); var tcSale = decimal.Parse(arrayTypes[0]); if (Session["quotePay"] == null || Session["numCuota"] == null) { //MessageError.Text = "Ocurrio un error."; return; } var totalPay = decimal.Parse(Session["quotePay"].ToString()); var description = Session["numCuota"].ToString(); var methods2 = "CULQI"; var recibe = string.Empty; if (Session["StatusCalendar"] == null || Session["CurrencyCode"] == null) { //MessageError.Text = "Ocurrio un error."; return; } idMemberDetails = int.Parse(Session["StatusCalendar"].ToString()); //monto| fecha de expiration |codecurrency | description| typechange BrMembershipPayDetail brMembership = new BrMembershipPayDetail(); var response = brMembership.GetQuote(idMemberDetails, User.Identity.Name.Split('¬')[1]).Split('|'); if (decimal.Parse(response[0]) == 0) { //MessageError.Text = "Ocurrio un error."; return; } var amountCro = decimal.Parse(response[0]); var codeCurrencyCro = response[2]; var tcCrono = decimal.Parse(response[4]); var idInfo = idMemberDetails.ToString(); //dos es que wallet es una parte del pago de una cuota var typeInfo = "2"; var walleOperationId = "2"; bool IsPay = brMembership.IsPayQuote(idMemberDetails.ToString()); if (!IsPay) { //MessageWarning.Text = "Tu Cuota ya esta Pagada.Verifica tu cronograma de pagos."; return; } BrWallet brWallet = new BrWallet(); MyMessages myMessages = new MyMessages(); MyFunctions mf = new MyFunctions(); var amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1])); BrPerson brPerson = new BrPerson(); var dataPerson = brPerson.GetByUserName(newUserName).Split('|'); PayCulqi payCulqi = new PayCulqi(); decimal surcharge = (1 + mc.Surcharge); var amountRestan = 0m; var amountPayCulqires = 0d; var tcSend = 0m; if (codeCurrencyCro == "USD") { if (codeCurrency == "PEN") { tcSend = tcSale; amountRestan = ((amountCro - amountWallet) * tcSale) * surcharge; amountPayCulqires = double.Parse(amountRestan.ToString()); } if (codeCurrency == "USD") { tcSend = tcBuy; amountRestan = (amountCro - amountWallet) * surcharge; amountPayCulqires = double.Parse(amountRestan.ToString()); } } if (codeCurrencyCro == "PEN") { if (codeCurrency == "USD") { tcSend = tcCrono; amountRestan = ((amountCro * tcCrono) - amountWallet) * surcharge; amountPayCulqires = double.Parse(amountRestan.ToString()); } if (codeCurrency == "PEN") { tcSend = tcBuy; amountRestan = (amountCro - (amountWallet * tcBuy)) * surcharge; amountPayCulqires = double.Parse(amountRestan.ToString()); } } string[] culqiAnwser = payCulqi.newPayment(newUserName, dataPerson[1], amountPayCulqires, token, numberQuotes, codeCurrency).Split('¬'); if (culqiAnwser[0] == "false") { Response.Write("false¬" + culqiAnwser[1]); return; } var namePeson = User.Identity.Name.Split('¬')[0]; var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-'); string tranferId = ""; string numReceipt = "0"; string datecomplete = dateCurrent[2] + " de " + mf.GetMonth(dateCurrent[1]) + " del " + dateCurrent[0]; string nAffiliate = ""; string hour = DateTime.Now.ToString("HH:mm:ss"); namePeson = myMessages.ToCapitalize(namePeson); var moneyStatus = 1; string imgTicketWalle = ""; var action = dataSche["Action"]; var valueQuote = Convert.ToDouble(dataSche["ValueQuote"]); var numQuote = Convert.ToDouble(dataSche["NumQuote"]); var idMembership = Convert.ToInt32(dataSche["IdMembership"]); var lastpaydate = Convert.ToDateTime(dataSche["PayDate"]); var smallDate = DateTime.Now - lastpaydate; var numberDays = smallDate.Days; int numQuotes = int.Parse(numQuote.ToString()); BrMembershipPayDetail payDetail = new BrMembershipPayDetail(); bool responseb = payDetail.PutQuotesChangingSchedule(idMembership, numQuotes, recibe, 2); if (numberDays > 0) { BrDaysFree brDaysFree = new BrDaysFree(); var dataanw = brDaysFree.Put(User.Identity.Name.Split('¬')[1], numberDays, idMembership); } if (amountWallet > 0) { imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWallet.ToString() + $" USD Atravez de Wallet.", "", $" {description}", "WL"); //amount | @idInfo | @typeInfo | @walletOperationId | @currencyCode | @typeChange | idmembershipDetail | imgTicket string data = $"{(amountWallet * tcSend).ToString()}|{idInfo}|{typeInfo}|{walleOperationId}|PEN|{tcSend}|{idMemberDetails.ToString()}|{imgTicketWalle}"; bool answer = brWallet.Put(data, User.Identity.Name.Split('¬')[1], moneyStatus); //Extorno if (!answer) { //MessageError.Text = "Ocurrio un error."; return; } } //MessageSucces.Text = "Su Pago de Realizo Con Exito."; /*=============================================================================================================================*/ var amountOthers = amountCro; //esta en estado pendienete var statusPay = 1; //marcar como pagado en la tabla membershipdetails //TODO: Agregar los detalles del pago BrUser brUser = new BrUser(); var recibeCulqi = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountRestan.ToString("0.00") + $" {codeCurrency} Atravez de Culqi.", "", $" {description}", "CQ"); //recibe bool habiliAccount = brUser.BiPayQuote(idMemberDetails, imgTicketWalle + '~' + recibeCulqi, amountWallet, amountRestan, "WALLET", methods2, statusPay, tcBuy); var urlRedirect = "EndPaymendMbs"; Response.Write($"true¬{urlRedirect}.aspx"); } catch (Exception ex) { Email email = new Email(); email.SendEmail(mc.ErrorEmail, "error-inresorts", ex.StackTrace + '¬' + DateTime.Now.ToLongDateString(), false); Response.Write("false¬ocurrio un error"); } }
protected void Page_Load(object sender, EventArgs e) { var arrayLogin = User.Identity.Name.Split('¬'); var token = string.Empty; var numberQuotes = 0; int id = 0; token = Request["TokenId"]; numberQuotes = int.Parse(Request["ddlQuote"]); var currencyCodePay = Request["ddlcurrencyCode"].ToString().Trim(); var amountPay = 0d; var currencyCodecro = string.Empty; if (Session["quotePay"] != null) { amountPay = double.Parse(Session["quotePay"].ToString()); } if (Session["CurrencyCode"] != null) { currencyCodecro = Session["CurrencyCode"].ToString(); } id = int.Parse(Session["IdImg"].ToString()); BrTypeChange brTypeChange = new BrTypeChange(); MyConstants mc = new MyConstants(); PayCulqi payCulqi = new PayCulqi(); MyFunctions mf = new MyFunctions(); var arrayTypes = brTypeChange.GetTypesChange().Split('|'); var tcSale = double.Parse(arrayTypes[0]); var tcBuy = double.Parse(arrayTypes[1]); var tcCro = double.Parse(Session["tcCro"].ToString()); if (currencyCodecro == "USD") { if (currencyCodePay == "PEN") { amountPay = amountPay * tcSale; } } if (currencyCodecro == "PEN") { if (currencyCodePay == "USD") { amountPay = amountPay * tcCro; } } var amountTotal = amountPay * double.Parse((1 + mc.Surcharge).ToString()); amountTotal = double.Parse(amountTotal.ToString("0.00")); var respoonsePay = payCulqi.newPayment(arrayLogin[1], arrayLogin[8], amountTotal, token, numberQuotes, currencyCodecro).Split('¬'); var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');; string date = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0]; var hour = DateTime.Now.ToShortTimeString(); var description = amountTotal + " " + currencyCodePay + " Atravez de Culqi."; var ticketImage = GetRecibo(arrayLogin[1], date, mf.ToCapitalize(arrayLogin[0]), hour, "Pago de Cuota", description); string answer = ""; if (respoonsePay[0] == "true") { BrMembershipPayDetail brMembershipPayDetail = new BrMembershipPayDetail(); var answerPay = brMembershipPayDetail.PayQuote(id, arrayLogin[1], ticketImage); answer = "true"; } Response.Write(answer); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { MyConstants mc = new MyConstants(); LblBankAccount.Text = mc.BankAccount; LblBankAccountDolar.Text = mc.BankAccountDolar; LblInterbankAccount.Text = mc.InterbankAccount; LblInterbankAccountDolar.Text = mc.InterbankAccountDolar; var qwe = Session["formPayd"].ToString(); var asd = int.Parse(qwe.ToString()); if (asd == 2) { imgfpd.ImageUrl = "~/Views/img/agente.jpg"; lbpaso1.Text = "Acercarse a una oficina del BCP o Agente BCP"; lbpaso2.Text = "Realizar el abono correspondiente en nuestra cuenta corriente"; lbpaso3.Text = "Subir el comprobante de pago en la sección de validación"; lbpaso4.Text = "Su pago estara validado dentro de las proximas 24 horas"; } else if (asd == 3) { imgfpd.ImageUrl = "~/Views/img/banco.png"; lbpaso1.Text = "Ir a la sección pagar y transferir - Hacer una transferencia"; lbpaso2.Text = "Seleccionar la opción a otras cuentas BCP"; lbpaso3.Text = "Poner la cuenta corriente de la compañia en cuenta destino y pagar"; lbpaso4.Text = "Subir el comprobante de pago en la sección de validación. Su pago estara validado dentro de las proximas 24 horas"; } else if (asd == 4) { imgfpd.ImageUrl = "~/Views/img/logosf2.png"; lbpaso1.Text = "Acercarse a la oficina o al Club"; lbpaso2.Text = "Realizar el abono correspondiente ya se en efectivo o con tarjeta de debito o credito"; lbpaso3.Text = "Un encargado de la compañia subira el comprobante de pago en la sección de validación"; lbpaso4.Text = "Su pago estara validado en el momento."; } var typeChange = decimal.Parse(User.Identity.Name.Split('¬')[5]); string currencyCode = Session["TypeCurrency"].ToString(); string showReport = Session["cronogramaYa"].ToString(); string[] macro = showReport.Split('^'); string[] micro = macro[1].Split('¬'); decimal quoteReference = 0; for (int i = 0; i <= micro.Length; i++) { string[] listRegisters = micro[i].Split('|'); if (listRegisters[0] == "Inicial nro: 1") { quoteReference += decimal.Parse(listRegisters[5].Replace("S/. ", "")); break; } if (listRegisters[0] == "Upgrade") { quoteReference += decimal.Parse(listRegisters[5].Replace("S/. ", "")); //break; } } decimal amountTotal = quoteReference; if (currencyCode == "USD") { amountTotal = amountTotal / typeChange; } lblAmount.Text = Math.Floor(amountTotal).ToString("###,###,##0.00"); BrTypeChange brTypeChange = new BrTypeChange(); var arrayTypes = brTypeChange.GetTypesChange().Split('|'); decimal typeChangeCompra = decimal.Parse(arrayTypes[0]); Typechange.Text = typeChangeCompra.ToString(); } } catch (Exception ex) { MyConstants mc = new MyConstants(); Email email = new Email(); email.SendEmail(mc.ErrorEmail, "error-inresorts", ex.StackTrace + '¬' + DateTime.Now.ToLongDateString(), false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var obj = HttpContext.Current.User.Identity.Name.Split('¬'); this.lblUser.Text = "Hola " + obj[0]; this.lblUserName.Text = obj[0]; this.imgProfile.ImageUrl = "~/Resources/Images/profile.png"; this.imgProfileFl.ImageUrl = "~/Resources/Images/profile.png"; // Imagen de PErfil var rutaImgP = HttpContext.Current.Server.MapPath("~/Resources/imguser"); DirectoryInfo di1 = new DirectoryInfo(rutaImgP); nombreu = obj[1]; foreach (var fi2 in di1.GetFiles()) { var archivo = fi2.Name.Split('.'); name = archivo[archivo.Length - 2]; extension = archivo[archivo.Length - 1]; if (name == nombreu) { def = nombreu + "." + extension; } } if (!string.IsNullOrEmpty(def)) { imgProfile.ImageUrl = "~/Resources/imguser/" + def; imgProfile.Style.Add("width", "40px"); imgProfile.Style.Add("height", "40px"); imgProfile.Style.Add("margin", "0 auto"); imgProfileFl.ImageUrl = "~/Resources/imguser/" + def; imgProfileFl.Style.Add("width", "80px"); imgProfileFl.Style.Add("height", "80px"); imgProfileFl.Style.Add("margin", "0 auto"); } for (int i = 0; i < 32; i++) { ddlQuote.Items.Add((i + 1).ToString()); } var description = string.Empty; var amountPay = string.Empty; var currencyCodecro = string.Empty; if (Session["numCuota"] != null) { description = Session["numCuota"].ToString(); } if (Session["quotePay"] != null) { amountPay = Session["quotePay"].ToString(); } if (Session["CurrencyCode"] != null) { currencyCodecro = Session["CurrencyCode"].ToString(); } MyConstants mc = new MyConstants(); var amountTotal = decimal.Parse(amountPay) * (1 + mc.Surcharge); Description.Text = description; AmountTotal.Text = $"{amountTotal.ToString("0.00")}"; Note.Text = $"Se asume un recargo del {(mc.Surcharge * 100).ToString("0.00")}% en el monto, El cual ya ha sido incluido en el monto mostrado."; Session["amountpaywallet"] = amountTotal.ToString("0.00"); CurrencyCode.Text = currencyCodecro; BrTypeChange brTypeChange = new BrTypeChange(); var array_ = brTypeChange.GetTypesChange().Split('|'); TypeChange.Text = decimal.Parse(array_[0]).ToString(); var tcCro = decimal.Parse(Session["tcCro"].ToString()); if (currencyCodecro == "PEN") { DivType.Style.Add("display", "none"); ddlcurrencyCode.Style.Add("display", "none"); TypeChange.Text = tcCro.ToString(); } if (currencyCodecro == "USD") { TypeChange.Text = decimal.Parse(array_[0]).ToString(); } } }
protected void ProcesarPay_Click(object sender, EventArgs e) { var dataSche = (Dictionary <string, object>)Session["changingschedule"]; var idMemberDetails = 0; var typeChangeSend = 0m; var typeChangecurrent = 0m; typeChangecurrent = decimal.Parse(User.Identity.Name.Split('¬')[4]); BrWallet brWallet = new BrWallet(); var amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1])); if (!(amountWallet > 0)) { MessageError.Text = "ocurrio un error"; return; } string currencyCode = ddlcurrencyCode.SelectedValue; if (Session["quotePay"] == null || Session["numCuota"] == null) { MessageError.Text = "Ocurrio un error."; return; } var totalPay = decimal.Parse(Session["quotePay"].ToString()); var description = Session["numCuota"].ToString(); var methods2 = "AFTER"; var recibe = string.Empty; if (NowReceipt.Checked) { if (!Recibo.HasFile) { MessageError.Text = "No hay imagen."; return; } string[] arraynombreArchivo2 = Recibo.FileName.Split('.'); int indice = (arraynombreArchivo2.Length - 1); string extension = arraynombreArchivo2[indice]; var nameFile = Guid.NewGuid().ToString(); recibe = $"{nameFile}.{extension}"; string filePath = "~/Resources/RecibosRegister/" + recibe; Recibo.SaveAs(Server.MapPath(filePath)); methods2 = "NOW"; } if (Session["StatusCalendar"] == null || Session["CurrencyCode"] == null) { MessageError.Text = "Ocurrio un error."; return; } idMemberDetails = int.Parse(Session["StatusCalendar"].ToString()); BrMembershipPayDetail brMembership = new BrMembershipPayDetail(); var response = brMembership.GetQuote(idMemberDetails, User.Identity.Name.Split('¬')[1]).Split('|'); if (decimal.Parse(response[0]) == 0) { MessageError.Text = "Ocurrio un error."; return; } var amount = decimal.Parse(response[0]); var currencycodecro = response[2]; var typechangecro = decimal.Parse(response[4]); BrTypeChange tc = new BrTypeChange(); MyMessages mm = new MyMessages(); MyFunctions mf = new MyFunctions(); var arraytypechan = tc.GetTypesChange().Split('|'); var typeChangeVentaCurrent = decimal.Parse(arraytypechan[0]); var typechangecompraCurrent = decimal.Parse(arraytypechan[1]); decimal amountRestan = 0; decimal amountWalletSoles = 0; var idInfo = idMemberDetails.ToString(); var imgTicketWalle = ""; var namePeson = User.Identity.Name.Split('¬')[0]; var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-'); string tranferId = ""; string numReceipt = "0"; string datecomplete = dateCurrent[2] + " de " + mf.GetMonth(dateCurrent[1]) + " del " + dateCurrent[0]; string nAffiliate = ""; string hour = DateTime.Now.ToString("HH:mm:ss"); namePeson = mm.ToCapitalize(namePeson); var moneyStatus = 1; if (currencycodecro == "PEN") { if (currencyCode == "PEN") { typeChangeSend = typechangecompraCurrent; amountWalletSoles = amountWallet * typechangecompraCurrent; amountRestan = amount - amountWalletSoles; imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWalletSoles.ToString("0.00") + " PEN Atravez del Wallet", "", $" {description}"); if (!NowReceipt.Checked) { SendEmailAmountRestante(amountRestan.ToString("0.00"), amountWalletSoles.ToString("0.00"), amount.ToString("0.00"), idInfo, description, currencyCode); } } if (currencyCode == "USD") { typeChangeSend = typechangecro; amountRestan = (amount / typechangecro) - amountWallet; imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWallet.ToString() + " USD Atravez del Wallet", "", $" {description}"); if (!NowReceipt.Checked) { SendEmailAmountRestante(amountRestan.ToString("0.00"), amountWallet.ToString("0.00"), (amount / typechangecro).ToString("0.00"), idInfo, description, currencyCode); } } } if (currencycodecro == "USD") { if (currencyCode == "USD") { amountRestan = amount - amountWallet; imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWallet.ToString() + " USD Atravez del Wallet", "", $" {description}"); if (!NowReceipt.Checked) { SendEmailAmountRestante(amountRestan.ToString("0.00"), amountWallet.ToString("0.00"), amount.ToString("0.00"), idInfo, description, currencyCode); } } amount = amount * typechangecompraCurrent; typeChangeSend = typechangecompraCurrent; if (currencyCode == "PEN") { amountWalletSoles = amountWallet * typechangecompraCurrent; amountRestan = amount - amountWalletSoles; imgTicketWalle = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, "", namePeson, hour, amountWalletSoles.ToString() + " PEN Atravez del Wallet", "", $" {description}"); if (!NowReceipt.Checked) { SendEmailAmountRestante(amountRestan.ToString("0.00"), amountWalletSoles.ToString("0.00"), amount.ToString("0.00"), idInfo, description, currencyCode); } } } //dos es que wallet es una parte del pago de una cuota var typeInfo = "2"; var walleOperationId = "2"; MessageError.Text = string.Empty; MessageWarning.Text = string.Empty; MessageSucces.Text = string.Empty; bool IsPay = brMembership.IsPayQuote(idMemberDetails.ToString()); if (!IsPay) { MessageWarning.Text = "Tu Cuota ya esta Pagada.Verifica tu cronograma de pagos."; return; } var action = dataSche["Action"]; var valueQuote = Convert.ToDouble(dataSche["ValueQuote"]); var numQuote = Convert.ToDouble(dataSche["NumQuote"]); var idMembership = Convert.ToInt32(dataSche["IdMembership"]); var lastpaydate = Convert.ToDateTime(dataSche["PayDate"]); var smallDate = DateTime.Now - lastpaydate; var numberDays = smallDate.Days; int numQuotes = int.Parse(numQuote.ToString()); BrMembershipPayDetail payDetail = new BrMembershipPayDetail(); bool responseb = payDetail.PutQuotesChangingSchedule(idMembership, numQuotes, recibe, 2); if (numberDays > 0) { BrDaysFree brDaysFree = new BrDaysFree(); var dataanw = brDaysFree.Put(User.Identity.Name.Split('¬')[1], numberDays, idMembership); } if (amountWallet > 0) { if (string.IsNullOrEmpty(recibe)) { recibe += $"{imgTicketWalle}"; } else { recibe += $"~{imgTicketWalle}"; } //amount | @idInfo | @typeInfo | @walletOperationId | @currencyCode | @typeChange | idmembershipDetail | imgTicket string data = $"{(amountWallet * typeChangeSend).ToString()}|{idInfo}|{typeInfo}|{walleOperationId}|PEN|{typeChangeSend}|{idMemberDetails.ToString()}|{recibe}"; bool answer = brWallet.Put(data, User.Identity.Name.Split('¬')[1], moneyStatus); //Extorno if (!answer) { MessageError.Text = "Ocurrio un error."; return; } } //MessageSucces.Text = "Su Pago de Realizo Con Exito."; /*=============================================================================================================================*/ var amountOthers = amount; //esta en estado pendienete var statusPay = 4; if (methods2 == "NOW") { statusPay = 2; } //marcar como pagado en la tabla membershipdetails //TODO: Agregar los detalles del pago BrUser brUser = new BrUser(); bool habiliAccount = brUser.BiPayQuote(idMemberDetails, recibe, amountWallet * typeChangeSend, amountRestan, "WALLET", methods2, statusPay, typeChangeSend); var amountTot = amountWallet + amountRestan; if (habiliAccount) { Response.Redirect("EndPaymentQuote.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MyConstants mc = new MyConstants(); try { //login con usuario y contraseña MessageError.Text = string.Empty; MessageSucces.Text = string.Empty; MessageWarning.Text = string.Empty; BrTypeChange brTypeChange = new BrTypeChange(); var arraytypes = brTypeChange.GetTypesChange().Split('|'); var typechangeVenta = decimal.Parse(arraytypes[0]); var typechangeCompra = decimal.Parse(arraytypes[1]); BrWallet brWallet = new BrWallet(); var amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1])); //borrar cuando cambias el monto a dolares el wallet //amountWallet = amountWallet / typechangeCompra; Wallet.Text = $"Wallet: {amountWallet.ToString(mc.NumberFormat)}"; var obj = HttpContext.Current.User.Identity.Name.Split('¬'); this.lblUser.Text = "Hola " + obj[0]; this.lblUserName.Text = obj[0]; if (obj.Length > 2) { this.lblNumPartner.Text = "N° Asociado: " + obj[4]; } this.imgProfile.ImageUrl = "~/Resources/Images/profile.png"; this.imgProfileFl.ImageUrl = "~/Resources/Images/profile.png"; var description = string.Empty; var amountPay = string.Empty; var currencyCodecro = string.Empty; if (Session["numCuota"] != null) { description = Session["numCuota"].ToString(); } if (Session["quotePay"] != null) { amountPay = Session["quotePay"].ToString(); } if (Session["CurrencyCode"] != null) { currencyCodecro = Session["CurrencyCode"].ToString(); } Description.Text = description; Monto.Text = $"{amountPay} {currencyCodecro}"; var amountTotal = decimal.Parse(amountPay); Session["amountpaywallet"] = amountTotal.ToString(); if (Session["StatusCalendar"] == null || Session["CurrencyCode"] == null) { MessageError.Text = "Ocurrio un error."; return; } //monto del wallet viene en dolares decimal resta = 0; CurrencyCode.Text = currencyCodecro; CurrencyCode1.Text = currencyCodecro; CurrencyCode2.Text = currencyCodecro; ddlcurrencyCode.SelectedValue = currencyCodecro; var tcCro = decimal.Parse(Session["tcCro"].ToString()); if (currencyCodecro == "PEN") { amountWallet = (amountWallet * typechangeCompra); resta = amountTotal - amountWallet; PayIn.Style.Add("display", "none"); TypeChange.Text = tcCro.ToString(); } //AmountSolesRes.Style.Add("display","none"); //AmountSolesRes2.Style.Add("display","none"); decimal surcharge = (1 + mc.Surcharge); if (currencyCodecro == "USD") { resta = amountTotal - amountWallet; TypeChange.Text = typechangeVenta.ToString(); //AmountSolesRes.Style.Add("display", "inline-block"); //AmountSolesRes2.Style.Add("display", "inline-block"); AmountSolesRes.Text = (resta * typechangeVenta).ToString("0.00"); AmountSolesRes2.Text = ((resta * surcharge) * typechangeVenta).ToString("0.00"); } LblAmountWallet.Text = $"{amountWallet.ToString("0.00")}"; LblAmountCulqi.Text = $"{(resta * surcharge).ToString("0.00")}"; LblAmountDeposit.Text = $"{resta.ToString("0.00")}"; PnWallet.Style.Add("display", "none"); PnOthers.Style.Add("display", "none"); if (amountWallet > amountTotal) { PnWallet.Style.Add("display", "block"); } else { PnOthers.Style.Add("display", "block"); } // Imagen de PErfil var rutaImgP = HttpContext.Current.Server.MapPath("~/Resources/imguser"); DirectoryInfo di1 = new DirectoryInfo(rutaImgP); nombreu = obj[1]; foreach (var fi2 in di1.GetFiles()) { var archivo = fi2.Name.Split('.'); name = archivo[archivo.Length - 2]; extension = archivo[archivo.Length - 1]; if (name == nombreu) { def = nombreu + "." + extension; } } imgProfile.ImageUrl = "~/Resources/imguser/" + def; imgProfile.Style.Add("width", "40px"); imgProfile.Style.Add("height", "40px"); imgProfile.Style.Add("margin", "0 auto"); imgProfileFl.ImageUrl = "~/Resources/imguser/" + def; imgProfileFl.Style.Add("width", "80px"); imgProfileFl.Style.Add("height", "80px"); imgProfileFl.Style.Add("margin", "0 auto"); for (int i = 0; i < 32; i++) { DdlQuote.Items.Add((i + 1).ToString()); } } catch (Exception ex) { Email email = new Email(); //email.SendEmail(mc.ErrorEmail, "error-inresorts", ex.Message + '¬' + DateTime.Now.ToLongDateString(), false); } } }
protected void PayByWallet_Click(object sender, EventArgs e) { decimal amount = 0, typeChangeVentaCurrent = 0, typechangecompraCurrent = 0; string numcuota = string.Empty; string idInfo = string.Empty, typeInfo = string.Empty, walleOperationId = string.Empty; string currencyCode = string.Empty; string imgTicket = string.Empty; decimal amountWallet = 0; string idMembershipDetail = string.Empty; decimal typechangesend = 0; currencyCode = ddlcurrencyCode.SelectedValue.Trim(); if (currencyCode != "USD" && currencyCode != "PEN") { MessageError.Text = "ocurrio un error."; return; } if (Session["StatusCalendar"] == null || Session["CurrencyCode"] == null) { MessageError.Text = "Ocurrio un error."; return; } idMembershipDetail = int.Parse(Session["StatusCalendar"].ToString()).ToString(); imgTicket = $"{idMembershipDetail}{DateTime.Now.ToString("yyyyMMdd")}"; // BrTypeChange tc = new BrTypeChange(); var arraytypechan = tc.GetTypesChange().Split('|'); typeChangeVentaCurrent = decimal.Parse(arraytypechan[0]); typechangecompraCurrent = decimal.Parse(arraytypechan[1]); BrMembershipPayDetail brMembership = new BrMembershipPayDetail(); var response = brMembership.GetQuote(int.Parse(idMembershipDetail), User.Identity.Name.Split('¬')[1]).Split('|'); if (decimal.Parse(response[0]) == 0) { MessageError.Text = "Ocurrio un error."; return; } //el monto llega deacuerdo al currency code del cronograma amount = decimal.Parse(response[0]); var currencyCodeCro = response[2]; var typechangeCro = decimal.Parse(response[4]); idInfo = "1"; typeInfo = "1"; walleOperationId = "2"; MessageError.Text = string.Empty; MessageWarning.Text = string.Empty; MessageSucces.Text = string.Empty; bool IsPay = brMembership.IsPayQuote(idMembershipDetail); if (!IsPay) { MessageWarning.Text = "Tu Cuota ya esta Pagada.Verifica tu cronograma de pagos."; return; } BrWallet brWallet = new BrWallet(); MyMessages myMessages = new MyMessages(); MyFunctions mf = new MyFunctions(); var namePeson = mf.ToCapitalize(User.Identity.Name.Split('¬')[0].ToLower()); var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');; string tranferId = ""; string numReceipt = "0"; string datecomplete = dateCurrent[2] + " de " + mf.GetMonth(dateCurrent[1]) + " del " + dateCurrent[0]; string nAffiliate = ""; string hour = DateTime.Now.ToString("HH:mm:ss"); string detalle = amount.ToString() + $" {currencyCode}"; string quotesPendiente = ""; string codeMemb = ""; string descripcion = string.Empty; if (Session["numCuota"] != null) { descripcion = Session["numCuota"].ToString(); } namePeson = myMessages.ToCapitalize(namePeson); //cvbc amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1])); //el monto de wallet viene en dolares. if (currencyCodeCro == "PEN") { if ((amountWallet * typechangeCro) < amount) { MessageError.Text = "No tiene el monto suficiente para realizar Pago."; return; } detalle = amount.ToString() + $" {currencyCode}"; //tipo de moneda en soles imgTicket = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, detalle, quotesPendiente, $" {descripcion}"); //en este caso el amount esta en soles y le aplicamos elm tipo de cambioo typechangesend = typechangeCro; } if (currencyCodeCro == "USD") { if (amountWallet < amount) { MessageError.Text = "No tiene el monto suficiente para realizar Pago."; return; } //tipo de moneda en dolares if (currencyCode == "USD") { detalle = amount.ToString() + $" {currencyCode}"; imgTicket = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, detalle, quotesPendiente, $" {descripcion}"); } amount = amount * typechangecompraCurrent; typechangesend = typechangecompraCurrent; if (currencyCode == "PEN") { detalle = amount.ToString() + $" {currencyCode}"; imgTicket = GetRecibo(tranferId, User.Identity.Name.Split('¬')[1], numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, detalle, quotesPendiente, $" {descripcion}"); } } //amount|@idInfo|@typeInfo|@walletOperationId|@currencyCode|@typeChange|idmembershipDetail|imgTicket string data = $"{amount}|{idInfo}|{typeInfo}|{walleOperationId}|{currencyCode}|{typechangesend}|{idMembershipDetail}|{imgTicket}"; bool answer = brWallet.Put(data, User.Identity.Name.Split('¬')[1]); if (!answer) { MessageError.Text = "Ocurrio un error."; return; } MessageSucces.Text = "Su Pago de Realizo Con Exito."; var urlRedirect = "EndPaymentQuote"; //Email oEmail = new Email(); //bool awnserEmail = oEmail.submitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago()); //MessageSucces.Text += " - y se le envio un correo con su confirmacion. "; var dataSche = (Dictionary <string, object>)Session["changingschedule"]; var action = dataSche["Action"]; var valueQuote = Convert.ToDouble(dataSche["ValueQuote"]); var numQuote = Convert.ToDouble(dataSche["NumQuote"]); var idMembership = Convert.ToInt32(dataSche["IdMembership"]); var lastpaydate = Convert.ToDateTime(dataSche["PayDate"]); var smallDate = DateTime.Now - lastpaydate; var numberDays = smallDate.Days; if (numberDays > 0) { BrDaysFree brDaysFree = new BrDaysFree(); var dataanw = brDaysFree.Put(User.Identity.Name.Split('¬')[1], numberDays, idMembership); } Response.Redirect($"{urlRedirect}.aspx"); }
protected void PayByWallet_Click(object sender, EventArgs e) { var arrayLogin = HttpContext.Current.User.Identity.Name.Split('¬'); BrWallet brWallet = new BrWallet(); BrTypeChange brTypeChange = new BrTypeChange(); BrMembershipPayDetail payDetail = new BrMembershipPayDetail(); var amountWallet = decimal.Parse(brWallet.GetAmount(arrayLogin[1])); var arrayTypes = brTypeChange.GetTypesChange().Split('|'); var tcBuy = decimal.Parse(arrayTypes[1]); var objadvancePay = Session["advancePay"]; if (objadvancePay == null) { MessageError.Text = "ocurrio un error"; return; } var advancePay = (Dictionary <string, object>)Session["advancePay"]; var valueQuote = decimal.Parse(advancePay["ValueQuote"].ToString()); var numQuote = int.Parse(advancePay["NumQuote"].ToString()); var idMembership = int.Parse(advancePay["IdMembership"].ToString()); var currencyCode = advancePay["CurrencyCode"].ToString(); var typeChangeCro = decimal.Parse(advancePay["TypeChangeCro"].ToString()); var amountTotal = valueQuote * numQuote; if (currencyCode == "PEN") { amountTotal = amountTotal / tcBuy; } if (amountWallet < amountTotal) { MessageError.Text = "wallet insuficiente"; return; } var answer = brWallet.PutAdvancePay(amountTotal * tcBuy, tcBuy, arrayLogin[1], idMembership); if (!answer) { MessageError.Text = "ocurrio un error."; return; } var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');; string date = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0]; var hour = DateTime.Now.ToShortTimeString(); var description = amountTotal + " " + currencyCode; var nameImage = GetRecibo(arrayLogin[1], date, arrayLogin[0], hour, "Adelanto de Cuotas", description); bool responseb = payDetail.PutQuotes(idMembership, numQuote, nameImage, 2); string message = ""; if (responseb) { message = "La operación se realizó con éxito."; } Response.Redirect("Payments.aspx?msg=" + message); }