public void RegisterMembership(string nameImages) { BrPayments brPayments = new BrPayments(); BrUser brUser = new BrUser(); BrTypeMembership brTypeMemb = new BrTypeMembership(); string[] dataLogin = HttpContext.Current.User.Identity.Name.Split('¬'); string userName = dataLogin[0]; if (dataLogin.Length > 1) { userName = dataLogin[1]; } string dataBdd = Session["datos"].ToString(); string[] acarrito = Session["carrito"].ToString().Split('|'); string TypeMembership = acarrito[6]; string cronograma = Session["cronograma"].ToString(); //string respData = brPayments.PersonGetData(userName); string respData = ""; respData = respData + '^' + cronograma; double amountFinanciade = 0; string[] array1 = Session["cronogramaYa"].ToString().Split('^'); string[] datosMem = array1[0].Split('|'); string[] array2 = array1[1].Split('~'); string[] cuotas = array2[0].Split('¬'); string cronoActiv = ""; for (int i = 0; i < cuotas.Length - 1; i++) { var fila = cuotas[i].Split('|'); if (fila[0].Substring(0, 7) != "Inicial") { cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd"); amountFinanciade = double.Parse(fila[2].Replace("S/.", "")); break; } else { cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd") + "¬"; } } string codeCurrency = Session["TypeCurrency"].ToString(); int ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + userName, amountFinanciade.ToString(), Int32.Parse(Session["membPred"].ToString()), codeCurrency); bool isRegister = false; if (Session["codeUpgrate"] != null) { //si es upgrate string exchange = Session["carrito"].ToString().Split('|')[4]; //ultParametroSinCalculoDePuntaje isRegister = brPayments.GetCalculatePaymentScheduleUpgrate(respData, userName, ansNmembershi, exchange, 0); if (!isRegister) { // Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario"); return; } if (Session["dateup"] != null) { string dateup = Session["dateup"].ToString(); bool an = brPayments.PutDateUpgrate(ansNmembershi, dateup); } } else { //si no es upgrate string exchange = Session["carrito"].ToString().Split('|')[4]; isRegister = brPayments.GetCalculatePaymentSchedule(respData, userName, ansNmembershi, exchange, 0); if (!isRegister) { //Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario"); return; } BrActivation brActivation = new BrActivation(); bool registerActi = brActivation.PutCronograma(cronoActiv, userName, ansNmembershi); } if (Session["codeUpgrate"] != null) { int codeUpgrate = int.Parse(Session["codeUpgrate"].ToString()); bool upgrate = brTypeMemb.CancelMembershipUpgrate(codeUpgrate, ansNmembershi); if (!upgrate) { // Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario"); return; } BrActivation brActivation = new BrActivation(); string fechaAnterior = Session["fechaanterior"].ToString(); bool registerActi = brActivation.PutCronogramaUpgrade(fechaAnterior, userName, ansNmembershi, codeUpgrate); //cambia el estado de la cuota upgrate y si el segundo parametro es 1 paga la primera cuota BrMembershipPayDetail brMembershipPayDetail = new BrMembershipPayDetail(); isRegister = brMembershipPayDetail.UpgrateStatusPaymentInitial(ansNmembershi, 0, "upgrade.png"); } if (nameImages != null) { bool upload = brPayments.UploadReceiptUpgradeCerooInitial(ansNmembershi.ToString() + '|' + nameImages); } if (!isRegister) { //Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario"); return; } brPayments = null; brUser = null; }