Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            brPayments = new BrPayments();
            string ans = brPayments.GetComissionUsers();

            Response.Write(ans);
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = string.Empty;
            string answer = string.Empty;

            action = Request["action"];

            var arrayLogin = User.Identity.Name.Split('¬');

            if (action == "reject")
            {
                int id = int.Parse(Request["id"]);

                if (id > 0)
                {
                    BrPayments brPayments = new BrPayments();

                    bool dataAnsw = brPayments.QuoteRefuse(id, arrayLogin[1]);

                    if (dataAnsw)
                    {
                        answer = "La operacion se realizo com exito";
                    }
                }
            }

            Response.Write(answer);
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            brPayments = new BrPayments();
            string table = brPayments.GetListPayDefault();

            Response.Write(table);
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // var obj = HttpContext.Current.User.Identity.Name.Split('¬');
            var        obj        = (string)(Request["params"]);
            BrPayments brPayments = new BrPayments();
            bool       data       = brPayments.PayComissions(obj);


            Response.Write(data);
            return;
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string _aux = Request["id"];
            // var _aux2 = Request["id"];
            Int32 value = Int32.Parse(_aux);

            brPayments = new BrPayments();
            bool ans = brPayments.UpdateComissionStatus(value);

            Response.Write(ans);
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BrPayments brPayments = new BrPayments();
            String     parametro  = Request["id"];

            var    login = HttpContext.Current.User.Identity.Name.Split('¬');
            string data  = brPayments.GetListPayments(login[1]);


            Response.Write(data);
            return;
        }
Ejemplo n.º 8
0
        protected void btnEnviarAhora_Click(object sender, EventArgs e)
        {
            if (Session["servicio"] != null)
            {
                string dataPerson = Session["servicio"].ToString();

                if (string.IsNullOrEmpty(dataPerson))
                {
                    Response.Redirect("Register.aspx");
                }

                if (!fuRecibo.HasFile)
                {
                    //no hay imagen en el control
                    return;
                }
                //si hay una archivo.

                string[] arraydata           = dataPerson.Split('|');
                string[] arraynombreArchivo2 = fuRecibo.FileName.Split('.');

                int    indice    = (arraynombreArchivo2.Length - 1);
                string extension = arraynombreArchivo2[indice];
                nombreArchivo = arraydata[0] + "." + extension;

                string ruta = "~/Resources/ImgServices/" + nombreArchivo;
                fuRecibo.SaveAs(Server.MapPath(ruta));
                brPayment = new BrPayments();
                var log = HttpContext.Current.User.Identity.Name.Split('¬');

                var fAdqui     = Session["fAdqui"];
                var IdServicio = Session["IdServicio"];
                newUserName = obj[3];
                var emailNewUser = "******";
                var amountPay    = (int)Session["precio"];
                oEmail      = new Email();
                brUser      = new BrUser();
                nombreBenef = arraydata[0];
                vigencia    = arraydata[1];

                cantidad = int.Parse(arraydata[2]);
                bool awnserEmailDoc = oEmail.SubmitEmailNotFiles3(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.EmailPago(), true);
                var  reg            = nombreBenef + "|" + vigencia + "|" + CodigoReserva + "|" + cantidad + "|" + fAdqui + "|" + IdServicio + "|" + obj[3] + "|" + "2" + "|" + nombreArchivo + "|" + amountPay;
                brUser.RegisterService(reg);

                Response.Redirect("EndPaymentServices.aspx", true);
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string[] arrayLogin = User.Identity.Name.Split('¬');
            var      value      = (Request["Key"]);

            value = value.Replace('Â', ' ').Trim();
            var parameters = value.Split('¬')[1];

            brPayments = new BrPayments();
            string stackFb = brPayments.GetPointsGeneral(arrayLogin[1]);

            if (string.IsNullOrEmpty(stackFb))
            {
                stackFb = "there is a trouble";
            }
            Response.Write(stackFb);
        }
Ejemplo n.º 10
0
        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;
        }
Ejemplo n.º 11
0
        public void registerTodo(int metodo)
        {
            brUser = new BrUser();
            int typeRegister = 0;

            typeRegister = int.Parse(Session["typeRegister"].ToString());
            //REGISTER
            string[] dataLogin   = HttpContext.Current.User.Identity.Name.Split('¬');
            string   userCurrent = dataLogin[0];

            if (dataLogin.Length > 1)
            {
                userCurrent = dataLogin[1];
            }
            string dataBdd        = Session["datos"].ToString();
            string TypeMembership = (dataBdd.Split('$')[3]).Split('|')[7];
            string data2          = (string)Session["civilState"];

            string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, data2).Split('¬');

            if (oIdMembreship_amount.Length < 2)
            {
                //  Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                Response.Redirect("Pagos.aspx");
                return;
            }

            string[] parameterPerson  = dataBdd.Split('$');
            string[] arraydata        = parameterPerson[0].Split('|');
            string[] arrayTypeaccount = parameterPerson[2].Split('|');
            string[] arrayaccount     = parameterPerson[3].Split('|');

            string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];

            //'999999999999|1|sa|1'
            newUserName = brUser.GenerateAccount(parameterAccount);
            bool ans = brUser.ActivateAccount(newUserName);

            // bool notAvilable = brUser.NotAvailableUser(newUserName);
            if (string.IsNullOrEmpty(newUserName))
            {
                //Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                Response.Redirect("Pagos.aspx");
                return;
            }

            //END REGISTER
            if (typeRegister == 1)
            {
                string arrayKit = Session["arrayKit"].ToString() + "¬" + newUserName;
                //'2018-10-19¬31¬31¬31¬userName'
                string data3        = Session["financedAmount"].ToString();
                string codeCurrency = Session["TypeCurrency"].ToString();

                Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data3, 1, codeCurrency);
                bool  isRegister    = brUser.PutRegisterkIT(arrayKit, ansNmembershi);
                if (lblSubTotal.Text == "S/0")
                {
                    bool payInitial = brUser.PayInitial(newUserName);
                }
                //monto a pagar
                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                /*subidaDeRecibo con newUserName*/
                BrPayments brPayments = new BrPayments();
                // bool upload = brPayments.UploadReceipt(newUserName + '|' + nombreArchivo);

                int    idMemberDetails = int.Parse(username_idmen_amount_email[1]);
                double amountPay       = double.Parse(username_idmen_amount_email[2]);
                string emailNewUser    = username_idmen_amount_email[3];
                username_idmen_amount_email = null;
            }

            if (typeRegister == 2)
            {
                string dataKitMember = Session["cronograma"].ToString();

                string     date       = dataKitMember.Split('$')[1];
                BrPayments brPayments = new BrPayments();
                string     respData   = brPayments.PersonGetData(newUserName);
                respData = respData + '^' + dataKitMember;
                brUser   = new BrUser()
                ; //  bool ansNmembershi = brUser.RegisterNmembership(respData+'|'+ newUserName);
                string data3        = Session["financedAmount"].ToString();
                string codeCurrency = Session["TypeCurrency"].ToString();

                Int32  ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data3, 1, codeCurrency);
                string exchange      = Session["carrito"].ToString().Split('|')[4];
                bool   isRegister    = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, exchange, 0);
                if (lblSubTotal.Text == "S/0")
                {
                    bool payInitial = brUser.PayInitial(newUserName);
                }
                /*subidaDeRecibo con newUserName*/
                //  bool upload = brPayments.UploadReceipt(newUserName + '|' + nombreArchivo);

                //validamos si tiene consumo


                if (!isRegister)
                {
                    // Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                    Response.Redirect("Pagos.aspx");
                    return;
                }
                //obtengo el monto a pagar
                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    //  Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    Response.Redirect("Pagos.aspx");
                    return;
                }
                //idMemberDetails = int.Parse(username_idmen_amount_email[1]);
                //amountPay = double.Parse(username_idmen_amount_email[2]);
                //emailNewUser = username_idmen_amount_email[3];
                date = null;
                username_idmen_amount_email = null;
                dataKitMember = null;
                respData      = null;
            }
            //si se efectuo el envio
            //Response.Redirect("EndPayments3.aspx",true);
            return;
            /*TRY MERGE*/
        }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = string.Empty;
            string answer = "";

            action = Request["action"];
            if (action == "verificar")
            {
                string userName = Request["userName"];
                BrUser brPerson = new BrUser();
                answer = brPerson.GetPersonalInformation(userName);
                if (answer == null)
                {
                    answer = "error";
                }
                brPerson = null;
            }

            if (action == "register")
            {
                BrUser brUser       = new BrUser();
                var    data         = "";
                var    _username    = Request["username"];
                var    _name        = Request["name"];
                var    _lastname    = Request["lastname"];
                var    _birthday    = Request["birthday"];
                var    _nrodoc      = Request["nrodoc"];
                var    _email       = Request["email"];
                var    _phone       = Request["phone"];
                var    _country     = Request["country"];
                var    _city        = Request["city"];
                var    _district    = Request["district"];
                var    _address     = Request["address"];
                var    _gender      = Request["gender"];
                var    _typedoc     = Request["typedoc"];
                var    _statuscivil = Request["statuscivil"];

                data = _username + "|" +
                       _name + "|" +
                       _lastname + "|" +
                       _birthday + "|" +
                       _gender + "|" +
                       _email + "|" +
                       _phone + "|" +
                       "" + "|" +
                       _country + "|" +
                       _district + "|" +
                       _city + "|" +
                       _address;
                var response = brUser.PutPersonalInformation(data);

                var membership = brUser.GetMembershipFirts(_username);
                if (response)
                {
                    Session["datos"] = _name + "|" +
                                       _lastname + "|" +
                                       _birthday + "|" +
                                       _gender + "|" +
                                       _typedoc + "|" +
                                       _nrodoc + '$' +
                                       "" + " |" +
                                       "" + " |" +
                                       "1" + "|" +
                                       "" + "|" +
                                       "" + "$" +
                                       "EMPTY" + "|" +
                                       "EMPTY" + "|" +
                                       "" + "|" +
                                       "EMPTY" + "|" +
                                       "EMPTY" + "|" +
                                       "EMPTY" + "|" +
                                       "EMPTY" + "|" +
                                       "" + "$" +
                                       _email + "|" +
                                       _phone + "|" +
                                       "" + " |" +
                                       _country + "|" +
                                       _city + "|" +
                                       _city + "|" +
                                       _address + "|" +
                                       membership + "|" + "0$0";


                    MyConstants mc = new MyConstants();
                    //cronograma
                    var dataCron = brUser.GetCronograma(membership, _username).Split('$');

                    var arrayData     = dataCron[0].Split('¬');
                    var numCuotasU    = dataCron[1];
                    var currencyCode  = dataCron[2];
                    var descripcionDB = dataCron[3].ToUpper();

                    decimal cuotaInicialmontoS = 0;
                    decimal totalMembership    = 0;
                    decimal quoteInicial       = 0;
                    decimal typeChange         = 0;
                    string  fechaSale          = "";

                    var    cadenaInitial        = "";
                    var    item                 = arrayData.Length - 1;
                    var    QuoteInitialquantity = arrayData.Length;
                    string fechaDentro          = DateTime.Parse(arrayData[item].Split('|')[0]).AddMonths(1).ToString(mc.DateFormatBd);
                    for (int i = 0; i < arrayData.Length; i++)
                    {
                        var row = arrayData[i].Split('|');
                        cuotaInicialmontoS += decimal.Parse(row[4]);
                        fechaSale           = arrayData[0].Split('|')[0];
                        totalMembership     = decimal.Parse(arrayData[0].Split('|')[1]);
                        typeChange          = decimal.Parse(arrayData[0].Split('|')[5]);

                        if (i == 0)
                        {
                            cadenaInitial += row[0] + "|" + row[4];
                        }
                        else
                        {
                            cadenaInitial += "|" + row[0] + "|" + row[4];
                        }
                    }

                    //el monto que viene es soles necesitamos convertirlo a dolares
                    totalMembership = totalMembership / typeChange;

                    Session["cronograma"] = totalMembership.ToString("0.00") + "|" + typeChange.ToString() + "|empty|empty|" + numCuotasU + "|" + fechaSale + "|" + cuotaInicialmontoS.ToString() + "|" +
                                            mc.AmountInteresAnual.ToString() + "|" + QuoteInitialquantity.ToString() + "|empty^" + cadenaInitial + "~" + _name + "|" + _lastname + "|1" + _nrodoc + "|" +
                                            _nrodoc + "$" + fechaDentro;



                    var respData = "^" + (string)Session["cronograma"];

                    string     showReport = "";
                    BrPayments brPayments = new BrPayments();
                    showReport = brPayments.GetCalculatePaymentScheduleString(respData, _username, QuoteInitialquantity.ToString(), "0", false);


                    Session["cronogramaYa"] = showReport;

                    Session["TypeCurrency"] = currencyCode;

                    Session["CivilState"] = _statuscivil.ToUpper() + "(A)";


                    Session["carrito"] = totalMembership.ToString("0.00") + "|" + descripcionDB + "|" + numCuotasU + "|" + cuotaInicialmontoS.ToString("0.00") + "|" + typeChange.ToString("0.00") +
                                         "|10|" + membership;

                    Session["corregirdatos"] = _username;

                    answer = "bien¬" + membership;
                }
            }

            Response.Write(answer);
        }
Ejemplo n.º 13
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            bool   exonerarKit   = false;
            string amountInicial = "";
            bool   eligioMen     = false;
            var    resp          = "";
            var    memb          = "";

            Session["flag"]    = "1";
            Session["typeBuy"] = "store";

            //if (rbtExp.Checked)
            //{
            //    dataBdd = str("EXP");
            //    amountInicial = txtInitialEXP.Text.Trim();
            //    Session["Amount"] = amountInicial;
            //    numCuotas = txtNumCuEXP.Text.Trim();
            //    txtp1 = textPag1.Text.Trim();
            //    memb = "Experience";
            //    eligioMen = true;
            //    //Membership= str("EXP");
            //    Membership = "EXP";
            //}
            //if (rbtStd.Checked == true)
            //{
            //    dataBdd = str("STD");
            //    amountInicial = txtInitialSTA.Text.Trim();
            //    Session["Amount"] = amountInicial;
            //    numCuotas = txtNumCuSTA.Text.Trim();
            //    txtp1 = textPag2.Text.Trim();
            //    memb = "Stantard";
            //    eligioMen = true;
            //    //Membership = str("STD");
            //    Membership ="STD";
            //}

            //if (rbtPlus.Checked)
            //{
            //    dataBdd = str("PLUS");
            //    amountInicial = txtInitialPLU.Text;
            //    Session["Amount"] = amountInicial;
            //    numCuotas = txtNumCuPLU.Text;
            //    txtp1 = textPag3.Text.Trim();
            //    memb = "Plus";
            //    eligioMen = true;
            //    //Membership = str("PLUS");
            //    Membership = "PLUS";


            //}
            //if (rbtTop.Checked == true)
            //{
            //    dataBdd = str("TOP");
            //    amountInicial = txtInitialTOP.Text;
            //    Session["Amount"] = amountInicial;
            //    numCuotas = txtNumCuTOP.Text;
            //    txtp1 = txtTopCuotaInicial.Text.Trim();
            //    memb = "Top";
            //    eligioMen = true;
            //    //Membership = str("TOP");
            //    Membership = "TOP";

            //}
            //if (rbtLight.Checked)
            //{
            //    dataBdd = str("LHT");
            //    amountInicial = txtInitialLigh.Text.Trim();
            //    Session["Amount"] = amountInicial;
            //    numCuotas = txtNumCuLigh.Text.Trim();
            //    txtp1 = textPag2.Text.Trim();
            //    memb = "Light";
            //    eligioMen = true;
            //    //Membership = str("LHT");
            //    Membership = "LHT";

            //}

            //if (rdrEx.SelectedValue == "Exonerar")
            //{
            //    Session["StatusExonerar"] = 1;
            //}
            //else if (rdrEx.SelectedValue == "NoExonerar")
            //{
            //    Session["StatusExonerar"] = 0;
            //}
            //else
            //{

            //    Session["StatusExonerar"] = 0;
            //}

            Session["membresia"] = memb;

            BrTypeMembership brTypeMembership = new BrTypeMembership();

            //Register Payment si es kit  inserte unico 'montodolaresKit¬tipocambio¬fecha'
            string[] kitData   = brTypeMembership.GetKitData().Split('¬');
            double   amountKit = double.Parse(kitData[0]);
            double   tpKit     = double.Parse(kitData[1]);
            string   date      = kitData[2];

            //if (string.IsNullOrEmpty(this.CodeMembership) && isExonerar.Checked == false)
            //{
            //    dataBdd = str("KIT");
            //    Session["datos"] = dataBdd;

            //    double totalKit = TwoDecimas(amountKit * tpKit);
            //    string arrayKit = date + "¬" + totalKit.ToString("0.00") + "¬" + totalKit.ToString("0.00") + "¬" + totalKit.ToString("0.00");

            //    Session["QuoteAux"] = "0";
            //    Session["Amount"] = totalKit;
            //    Session["arrayKit"] = arrayKit;
            //    Session["carrito"] = amountKit.ToString("0.00") + "|" + "" + "|" + "0" + "|" + amountKit.ToString("0.00") + "|" + tpKit.ToString("0.00") + "|" + "10" + "|" + CodeMembership;
            //    Session["typeRegister"] = "1";
            //    //Response.Redirect("PoliticsKit.aspx?name=" + txtName.Text + "&lastNama=" + txtLastName.Text + "&pais=" + txtCountry.Text + "&dni=" + txtNumDoc.Text);
            //    Response.Redirect("Politics.aspx");

            //    var storeT = Session["tienda"].ToString();
            //    var plop = int.Parse(storeT.ToString());
            //}


            //solo exonerar si es el administrador
            string[] arrayLogin = HttpContext.Current.User.Identity.Name.Split('¬');
            if (arrayLogin.Length > 2)
            {
                if (int.Parse(arrayLogin[2]) == 1)
                {
                    //if (isExonerar.Checked)
                    //{
                    //    if (eligioMen == true)
                    //    {
                    //        BrInformacion brInformacion = new BrInformacion();
                    //        string textExonerarDB = brInformacion.GetTextExonerarDB();
                    //        brInformacion = null;
                    //        if (txtContaExonerar.Text.Trim() == textExonerarDB.Trim())
                    //        {
                    //            if (eligioMen == true)
                    //            {
                    //                exonerarKit = true;////////////////////////**********************
                    //            }
                    //            else
                    //            {
                    //                lblMessagge.Text = "Debe Comprar al menos una Membresia";
                    //                return;
                    //            }
                    //        }
                    //        else
                    //        {
                    //            lblMessagge.Text = "Codigo Incorrecto";
                    //            return;
                    //        }
                    //    }
                    //    else
                    //    {
                    //        lblMessagge.Text = "Debe Comprar al menos una Membresia";
                    //        return;
                    //    }
                    //}
                }
            }
            if (eligioMen == true)
            {
                if (string.IsNullOrEmpty(dataBdd))
                {
                    return;
                }
                BrPayments brPayments = new BrPayments();
                var        arraydata  = dataBdd.Split('|');

                //amount¬quoteInitial¬numQuotes¬descripcioon¬fecha¬tipocambio  ---se le envia el code de la membership

                //string[] arrayMontoTotal = brPayments.GetAmountTotal(this.CodeMembership).Split('¬');
                //brPayments = null;

                //double amountTotalDB = double.Parse(arrayMontoTotal[0]);
                //double amountInicialDB = double.Parse(arrayMontoTotal[1]);
                //int numCuotasDB = int.Parse(arrayMontoTotal[2]);
                //string descripcionDB = arrayMontoTotal[3];
                //string fecha = arrayMontoTotal[4];
                //double tipoCambio = double.Parse(arrayMontoTotal[5]);

                //double amountInicialU = TwoDecimas(double.Parse(amountInicial));

                ////validar que la cuota inicial debe ser mayor al valor asignado como minimo
                //if (amountInicialU < amountInicialDB)
                //{
                //    //txtMessagge.Text = "El Monto de la Inicial debe ser Mayor";
                //    return;
                //}
                ////validar que el numero de las cuotas debe ser menor a las asignadas como maximo
                //if (int.Parse(numCuotas) > numCuotasDB || int.Parse(numCuotas) <= 0)
                //{
                //    //txtMessagge.Text = "El Numero de Las Cuotas debe ser Menor";
                //    return;
                //}
                //if ((int.Parse(textPlusQuoteInitial.Text) > 2 || int.Parse(textPlusQuoteInitial.Text) < 1) && CodeMembership == "PLUS")
                //{
                //    // txtMessagge.Text = "El Numero de Las Cuotas INITIAL debe ser Menor";
                //    return;
                //}

                //if ((int.Parse(textPlusQuoteInitial.Text) > 3 || int.Parse(textPlusQuoteInitial.Text) < 1) && CodeMembership == "TOP")
                //{
                //    //txtMessagge.Text = "El Numero de Las Cuotas INITIAL debe ser Menor";
                //    return;
                //}
                //HGHG
                //string exonerarkit = Session["StatusExonerar"].ToString();

                //double cuotaInicialS = TwoDecimas(amountInicialU * tipoCambio);
                //if (!exonerarKit)
                //{
                //    //suma el monto del kit de unicio
                //    amountTotalDB += TwoDecimas(amountKit);
                //    cuotaInicialS += TwoDecimas(amountKit * tipoCambio);
                //}
                //int numCuotasU = int.Parse(numCuotas);
                //datos para mostrar en la parte de pasarela de pagos
                //string Req = "";
                //brConsuption = new BrConsuption();
                //if (consumePack1.Checked)
                //{
                //    Req = brConsuption.GetAmountConsuption("PB1");
                //}
                //else if (ConsumePack2.Checked)
                //{
                //    Req = brConsuption.GetAmountConsuption("PB2");
                //}
                //else if (ConsumePack3.Checked)
                //{
                //    Req = brConsuption.GetAmountConsuption("PB3");
                //}
                //else if (ConsumePack4.Checked)
                //{
                //    Req = brConsuption.GetAmountConsuption("PB4");
                //}
                //else if (ConsumePack5.Checked)
                //{
                //    Req = brConsuption.GetAmountConsuption("PB5");
                //}

                //Session["carrito"] = amountTotalDB.ToString("0.00") + "|" + descripcionDB + "|" + numCuotasU + "|" + amountInicialU.ToString("0.00") + "|" + tipoCambio.ToString("0.00") + "|" + amountKit.ToString() + '|' + CodeMembership;

                //monto total de la membresia debe estar en dolares
                //la cuota inicial debe estar en soles
                //"gfdgdf|gdfgdfg|20/11/2018|M|1|77777738$navacito | |1|$EMPTY|EMPTY|CORRIENTE|EMPTY|EMPTY|EMPTY|EMPTY|[email protected]|960614917| |Peru|fs|sf|fs|STD|admin$1"
                string data = arrayLogin[1] + '|' + Membership;
                brUser = new BrUser();
                string dataPerson = brUser.GetDataPerson(data);
                Session["datos"] = dataPerson;

                //william
                //if (rbtTop.Checked)
                //{
                //    QuoteInitial = Int32.Parse(txtTopCuotaInicial.Text);
                //    amount = Double.Parse(txtInitialTOP.Text) * 3.37;
                //    amount = amount / QuoteInitial;
                //    Session["Amount"] = amount;
                //}
                //else if (rbtPlus.Checked)
                //{
                //    QuoteInitial = Int32.Parse(textPlusQuoteInitial.Text);
                //    amount = Double.Parse(txtInitialPLU.Text) * 3.37;
                //    amount = amount / QuoteInitial;
                //    Session["Amount"] = amount;
                //}
                //else if (rbtStd.Checked)
                //{
                //    QuoteInitial = 1;
                //    amount = Double.Parse(txtInitialSTA.Text) * 3.37;
                //    amount = amount / QuoteInitial;
                //    Session["Amount"] = amount;
                //}
                //else if (rbtLight.Checked)
                //{
                //    QuoteInitial = 1;
                //    amount = Double.Parse(txtInitialLigh.Text) * 3.37;
                //    amount = amount / QuoteInitial;
                //    Session["Amount"] = amount;
                //}
                //else if (rbtExp.Checked)
                //{
                //    QuoteInitial = 1;
                //    amount = Double.Parse(txtInitialEXP.Text) * 3.37;
                //    amount = amount / QuoteInitial;
                //    Session["Amount"] = amount;
                //}
                //strDate = "";
                //for (var i = 0; i < QuoteInitial; i++)
                //{
                //    if (i > 0)
                //    {
                //        strDate += '|' + fecha + '|' + amount.ToString();
                //    }
                //    else
                //    {
                //        strDate += fecha + '|' + amount.ToString();
                //    }

                //    var dateAux = ((Convert.ToDateTime(fecha)).AddMonths(i)).ToString("yyyy-MM-dd");
                //    fecha = dateAux;
                //}

                ///////// CAGADA START  para analizarrr samir!!! //////////////
                //Session["cronograma"] = (amountTotalDB - 10).ToString() + "|" + tipoCambio.ToString() + "|empty|empty|" + numCuotasU + "|" + fecha + "|" + cuotaInicialS.ToString() + "|10|1|empty^" + strDate + "~" +
                //   "$" + "2018-11-01";
                ////////// CAGADA START ////////////
                ///
                Session["typeRegister"] = "2";

                ///
                var    auxData  = brPayment.PersonGetData(userLog);//problem
                var    idPerson = auxData.Split('|')[0];
                string respData = idPerson.ToString() + '|' + memb;


                string flag = (string)Session["flag"];
                // string showReport = brPayment.GetCalculatePaymentScheduleString(respData, userName, QuoteInitial.ToString(), flag);
                //Session["cronograma"] = showReport;


                //Session["cronograma"] = ((amountTotalDB - 10).ToString()+ "|" + tipoCambio.ToString() + "|empty|empty|" + numCuotasU + "|" + fecha + "|" + cuotaInicialS.ToString() + "|10|1|empty^" + strDate + "~" +
                //  "nombre de prueba" + "|" + "apellido de prueba" + "|1" + "222222" + "|" + "22222" + "$" + "2018-11-01");
                //brPayment = new BrPayments();

                //Session["exchange"] = tipoCambio;
                ///
                //brPayment = new BrPayments();
                ////string respData = brPayment.PersonGetData(userName);
                //respData = respData + '^' + (string)Session["cronograma"];
                //string showReport = brPayment.GetCalculatePaymentScheduleString(respData, userName, QuoteInitial.ToString(), "0");
                //Session["cronogramaYa"] = showReport;
                //var macro = showReport.Split('^');
                //var micro = macro[1].Split('¬');
                //string quoteReference = "";
                //for (int i = 0; i <= micro.Length; i++)
                //{
                //    var listRegisters = micro[i].Split('|');
                //    if (listRegisters[0] == "Cuota nro: 1")
                //    {
                //        quoteReference = listRegisters[5];
                //        break;
                //    }
                //}
                //Session["QuoteAux"] = quoteReference;

                ///
                //var ej = "2500|3.25|VE034|VE035|23|2018-09-19|1944|10|1|obs^2018-09-19|1944~nombre|apellido|1|45345345|45345345$2018-10-19";
                Session["JustKit"] = 0;
                // Response.Redirect("Politics.aspx?name=" + txtName.Text + "&lastNama=" + txtLastName.Text + "&pais=" + txtCountry.Text + "&dni=" + txtNumDoc.Text);
                Response.Redirect("Politics.aspx");
            }
            else
            {
                //lblMessagge.Text = "Debe Comprar al menos una Membresia";
                //Session["JustKit"] = 1;
                //Response.Redirect("PoliticsKit.aspx?name=" + txtName.Text + "&lastNama=" + txtLastName.Text + "&pais=" + txtCountry.Text + "&dni=" + txtNumDoc.Text);
                //Response.Redirect("Politics.aspx");
                return;
            }
        }
Ejemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    string nombre = "", dni = "", domicilio = "", distrito = "", memexp = " ", memmvc = " ", memlight = " ", memsta = " ", memplus = " ", memtop = " ", memvit = " ";
                    string duracion = "", fechafin = "", montototaldolareletras = "", tipocambio = "", montototalsoles = "", numerodecuotas = "", opcontado = "", op6cuotas = "", op12cuotas = "";
                    string op24cuotas = "", op36cuotas = "", op48cuotas = "", op60cuotas = "", opotros = "", porcentajefinan = "", porprimcuo = "", soles6cuotas = "", soles12cuotas = "", soles24cuotas = "", soles36cuotas = "", soles48cuotas = "";
                    string soles60cuotas = "", solesotros = " Otros";
                    string code = "", username = "";
                    string coname = "", civilState = "";
                    string memevolu = " ";
                    /*push*/
                    //Session["datos"] = "Nombre|Apellidos|birthDay|M|DocumentType|NroDoc$NombreC|ApellidoC|1|313231c$bankName|nombreBankAccount|TypeAccount|nroAccount|nroTaxer|SocialReason|fiscalAdress|UserType$email|nroCell|nroCell2|country|State|City|Adress";
                    //Session["carrito"] = "6000.00|descripcionDB|60|9750.00|3.25|10|TOP";
                    //Session["cronograma"] = "6000|222";

                    string currencyCode = Session["TypeCurrency"].ToString();

                    civilState = Session["CivilState"].ToString().ToUpper();

                    string[] datos   = Session["datos"].ToString().Split('$');
                    string[] carrito = Session["carrito"].ToString().Trim().Split('|');
                    string[] cronograma;
                    string   totaldolares = "";
                    int      flag         = 0;
                    string   test         = (string)Session["cronograma"];
                    if (!string.IsNullOrEmpty(test))
                    {
                        cronograma   = Session["cronograma"].ToString().Split('|');
                        totaldolares = ((Double.Parse(cronograma[0])).ToString());
                        flag++;
                    }

                    string[] arrayperson   = datos[0].Split('|');
                    string[] arraycoperson = datos[1].Split('|');
                    string[] arraycontacto = datos[3].Split('|');
                    //  string totaldolares = ((Double.Parse(cronograma[0])).ToString());
                    string primeracuota = carrito[3];

                    coname = arraycoperson[0].ToUpper() + " " + arraycoperson[1].ToUpper();
                    if (string.IsNullOrEmpty(coname.Trim()))
                    {
                        coname = "__________________________________________";
                    }


                    tipocambio = carrito[4];
                    double typeChange = double.Parse(tipocambio);
                    numerodecuotas = carrito[2];
                    nombre         = arrayperson[0].ToUpper() + " " + arrayperson[1].ToUpper();
                    dni            = arrayperson[5];

                    username  = arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni;
                    domicilio = arraycontacto[6].ToUpper();
                    distrito  = arraycontacto[5].ToUpper();


                    //vamos al servidor por el tiempo de duracion
                    BrMembershipPayDetail brPayDetail = new BrMembershipPayDetail();
                    duracion = brPayDetail.GetDuration(carrito[6]);
                    /*resconpesa= wilii*/
                    if (carrito[6] == "EVO")
                    {
                        //duracion = "15";
                        memevolu = "X";
                        //fechafin = "______";
                    }
                    if (carrito[6] == "MVC")
                    {
                        memmvc = "X";
                        //duracion = "1";
                    }
                    if (carrito[6] == "EXP")
                    {
                        memexp = "X";
                        //duracion = "2";
                    }
                    if (carrito[6] == "LHT")
                    {
                        //duracion = "4";
                        memlight = "X";
                    }
                    if (carrito[6] == "STD")
                    {
                        //duracion = "7";
                        memsta = "X";
                    }
                    if (carrito[6] == "PLUS")
                    {
                        //duracion = "10";
                        memplus = "X";
                    }
                    if (carrito[6] == "TOP")
                    {
                        //duracion = "15";
                        memtop = "X";
                        //fechafin = "______";
                    }
                    if (carrito[6] == "VIT")
                    {
                        duracion = "VITALICIO";
                        memvit   = "X";
                        fechafin = "--";
                    }
                    else
                    {
                        //para que la suma sea menos un dia 2021-08-22
                        DateTime fecha = DateTime.Parse("2022-08-21");

                        int duracion1 = int.Parse(duracion.Split('.')[0]);
                        int duracion2 = int.Parse(duracion.Split('.')[1]);

                        fecha = fecha.AddYears(duracion1);
                        if (duracion2 > 0)
                        {
                            fecha = fecha.AddMonths(duracion2);
                        }

                        fechafin = Convert.ToDateTime(fecha).ToString("dd/MM/yyyy");
                        duracion = " DE " + duracion1 + " AÑOS";
                    }
                    Numalet numalet       = new Numalet();
                    double  totaldolaresv = numalet.TwoDecimas(double.Parse(totaldolares));
                    montototaldolareletras  = numalet.ToCustomCardinal(totaldolaresv).ToUpper();
                    montototaldolareletras += " Dolares ( " + totaldolaresv.ToString("###,###,##0.00") + " USD ).".ToUpper();
                    double totalsolesv = numalet.TwoDecimas(double.Parse(totaldolares) * double.Parse(tipocambio));
                    montototalsoles  = numalet.ToCustomCardinal(totalsolesv).ToUpper();
                    montototalsoles += " Soles ( " + totalsolesv.ToString("###,###,##0.00") + " PEN).".ToUpper();


                    //la primera cuota viene en soles y tenemos el total en soles
                    porprimcuo      = numalet.TwoDecimas((((double.Parse(primeracuota) * Double.Parse(tipocambio)) * 100) / totalsolesv)).ToString();
                    porcentajefinan = numalet.TwoDecimas((100 - double.Parse(porprimcuo))).ToString();

                    BrPayments brPayments   = new BrPayments();
                    double     interesanual = brPayments.CalculateMonthlyRate(10);

                    double montofinanciar = totalsolesv - (double.Parse(primeracuota) * double.Parse(tipocambio));

                    /*asdasdasd*/
                    string[] array1   = Session["cronogramaYa"].ToString().Split('^');
                    string[] datosMem = array1[0].Split('|');
                    string[] array2   = array1[1].Split('~');
                    string[] cuotas   = array2[0].Split('¬');

                    int    interruptor    = 0;
                    string cuotasMenSoles = "";
                    for (int i = 0; i < cuotas.Length - 1; i++)
                    {
                        var fila = cuotas[i].Split('|');
                        if (fila[0].Substring(0, 7) != "Inicial" && fila[0].Substring(0, 7) != "Upgrade")
                        {
                            if (interruptor != 1)
                            {
                                interruptor    = 1;
                                cuotasMenSoles = fila[5].Replace("S/.", "");
                            }
                        }
                    }
                    string montoletrastercero = "";
                    montoletrastercero = " un valor de " + montototaldolareletras + " los cuales al tipo de cambio del día " + tipocambio +
                                         " , serían " + montototalsoles;

                    double amountSoles = double.Parse(cuotasMenSoles);
                    if (currencyCode == "USD")
                    {
                        amountSoles        = amountSoles / typeChange;
                        montoletrastercero = " un valor de " + montototaldolareletras;
                    }
                    /*asdasdasd*/

                    // double mothycuod = brPayments.CalculeMonthlyQuote(montofinanciar, int.Parse(numerodecuotas), interesanual);
                    string mothycuo = numalet.TwoDecimas(amountSoles).ToString();
                    //double sd =  brPayments.CalculateFinancingPercentage(1, 1);


                    switch (int.Parse(numerodecuotas))
                    {
                    case 1: opcontado = "X"; break;

                    case 6: op6cuotas = "X"; soles6cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 12: op12cuotas = "X"; soles12cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 24: op24cuotas = "X"; soles24cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 36: op36cuotas = "X"; soles36cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 48: op48cuotas = "X"; soles48cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    case 60: op60cuotas = "X"; soles60cuotas = " ( " + mothycuo.ToString() + " " + currencyCode + ")"; break;

                    default:
                        opotros = "X"; solesotros = numerodecuotas + " Cuotas – Cada cuota de (S/." + mothycuo.ToString() + " )";
                        break;
                    }

                    //un valor de [@montototaldolaresletras] los cuales al tipo de cambio del día [@tipocambio] , serían [@montototalsoles]

                    string fechahoy = DateTime.Now.ToString("dd/MM/yyyy");

                    //reportViewer1.LocalReport.ReportPath = @"http://localhost:50447/Views/FilesContratos/Contrato.rdlc";
                    //ReportViewer1.LocalReport.DataSources.Clear();
                    //ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", _midetalle_venta))TRY MERGE;
                    //reportViewer1.
                    tipocambio = "( " + tipocambio + " )";
                    ReportParameter[] parametros = new ReportParameter[37];
                    parametros[0]  = new ReportParameter("name", nombre);
                    parametros[1]  = new ReportParameter("dni", dni);
                    parametros[2]  = new ReportParameter("estadocivil", civilState);
                    parametros[3]  = new ReportParameter("domicilio", domicilio);
                    parametros[4]  = new ReportParameter("distrito", distrito);
                    parametros[5]  = new ReportParameter("memexp", memexp);
                    parametros[6]  = new ReportParameter("memlight", memlight);
                    parametros[7]  = new ReportParameter("memsta", memsta);
                    parametros[8]  = new ReportParameter("memplus", memplus);
                    parametros[9]  = new ReportParameter("memtop", memtop);
                    parametros[10] = new ReportParameter("duracion", duracion);
                    parametros[11] = new ReportParameter("fechafin", fechafin);
                    parametros[12] = new ReportParameter("montototaldolaresletras", montototaldolareletras);
                    parametros[13] = new ReportParameter("tipocambio", tipocambio);
                    parametros[14] = new ReportParameter("montototalsoles", montototalsoles);
                    parametros[15] = new ReportParameter("numerodecuotas", numerodecuotas);
                    parametros[16] = new ReportParameter("opcontado", opcontado);
                    parametros[17] = new ReportParameter("op6cuotas", op6cuotas);
                    parametros[18] = new ReportParameter("op12cuotas", op12cuotas);
                    parametros[19] = new ReportParameter("op24cuotas", op24cuotas);
                    parametros[20] = new ReportParameter("op36cuotas", op36cuotas);
                    parametros[21] = new ReportParameter("op48cuotas", op48cuotas);
                    parametros[22] = new ReportParameter("op60cuotas", op60cuotas);
                    parametros[23] = new ReportParameter("opotros", opotros);
                    // parametros[24] = new ReportParameter("porcentajefinan", porcentajefinan);
                    // parametros[25] = new ReportParameter("porprimcuo", porprimcuo);
                    parametros[24] = new ReportParameter("soles6cuotas", soles6cuotas);
                    parametros[25] = new ReportParameter("soles12cuotas", soles12cuotas);
                    parametros[26] = new ReportParameter("soles24cuotas", soles24cuotas);
                    parametros[27] = new ReportParameter("soles36cuotas", soles36cuotas);
                    parametros[28] = new ReportParameter("soles48cuotas", soles48cuotas);
                    parametros[29] = new ReportParameter("soles60cuotas", soles60cuotas);
                    parametros[30] = new ReportParameter("solesotros", solesotros);
                    parametros[31] = new ReportParameter("coname", coname);
                    parametros[32] = new ReportParameter("memmvc", memmvc);
                    parametros[33] = new ReportParameter("fechahoy", fechahoy);
                    parametros[34] = new ReportParameter("memvit", memvit);
                    parametros[35] = new ReportParameter("montoletrastercero", montoletrastercero);
                    parametros[36] = new ReportParameter("memevolu", memevolu);

                    reportViewer1.LocalReport.SetParameters(parametros);
                    reportViewer1.LocalReport.Refresh();


                    //reportViewer1.Enabled = false;


                    ////Le indicamos al Control que la invocación del reporte será de modo remoto
                    //reportViewer1.ProcessingMode = ProcessingMode.Remote;
                    ////Le indicamos la URL donde se encuentra hospedado Reporting Services
                    //reportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/ReportServer");
                    ////Le indicamos la carpeta y el Reporte que deseamos Ver
                    //reportViewer1.ServerReport.ReportPath = "/DemoRS/Contacto";
                    ////Definimos los parámetros
                    //ReportParameter parametro = new ReportParameter();
                    //parametro.Name = "name";
                    //parametro.Values.Add("2");//txtContactID.Text
                    //                          //Aqui le indicaremos si queremos que el parámetro
                    //                          //sea visible para el usuario o no
                    //parametro.Visible = false;

                    ////Crearemos un arreglo de parámetros
                    //ReportParameter[] rp = { parametro };
                    ////Ahora agregamos el parámetro en al reporte
                    //reportViewer1.ServerReport.SetParameters(rp);
                    //reportViewer1.ServerReport.Refresh();


                    byte[] bytes       = reportViewer1.LocalReport.Render("PDF");
                    string correlativo = "";
                    correlativo = Session["correlativoDoc"].ToString();
                    string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/" + "CON" + username + correlativo);
                    if (File.Exists(ruta))
                    {
                        File.Delete(ruta);
                    }
                    using (FileStream fs = new FileStream(ruta + ".pdf", FileMode.Create))
                    {
                        fs.Write(bytes, 0, bytes.Length);
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Redirect("Error.aspx?error=" + ex.Message, true);
            }
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Declaracion de variables
            string[] dataLogin = null;
            string[] obj = HttpContext.Current.User.Identity.Name.Split('¬');
            int      typeRegister = 0, numberQuotes = 0, formPay = 0, idMemberDetails = 0;

            //string dataKit = null, dataKitMember = null, dataMemberSinKit;
            string token = null, userCurrent = null, newUserName = null, emailNewUser = null;
            int    amountPay = 0;
            //bool isRegister = false;
            BrUser brUser = null;
            //BrTypeMembership brTypeMembership = null;
            Email      oEmail     = null;
            BrPayments brPayments = null;
            //BrConsuption brConsuption;

            #endregion

            #region Entradas de valores

            //var _var = (string)Session["typeRegister"];
            //if (!string.IsNullOrEmpty(_var))
            //{
            //    typeRegister = int.Parse(Session["typeRegister"].ToString());
            //}
            formPay      = int.Parse("1");
            token        = Request["token"].ToString();
            numberQuotes = int.Parse(Request["numcuotes"].ToString());
            brUser       = new BrUser();
            //brTypeMembership = new BrTypeMembership();
            dataLogin  = HttpContext.Current.User.Identity.Name.Split('¬');
            oEmail     = new Email();
            brPayments = new BrPayments();
            //brConsuption = new BrConsuption();
            #endregion

            #region Realizar Pago Culqi

            if (formPay == 1)
            {
                amountPay = (int)Session["precio"];
                if (amountPay <= 0)
                {
                    Response.Write("false¬Ha Ocurrido Un Error id idMemberDetails vacio,amountPay vacio");
                    return;
                }
                PayCulqi   payCulqi   = new PayCulqi();
                MyMessages myMessages = new MyMessages();

                newUserName  = obj[3];
                emailNewUser = "******";

                string   currencyCode = "PEN";
                string[] culqiAnwser  = payCulqi.newPayment(newUserName, emailNewUser, amountPay, token, numberQuotes, currencyCode).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }
                //marcar como pagado en la tabla membershipdetails
                // bool habiliAccount = brUser.enableAcount(idMemberDetails);

                //int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                //Cronograma2(nAfiliate);

                // enviar el email de confirmacion con la data y lo redirecciona al post register
                //if (!habiliAccount)
                //{
                //    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.Sin embargo su Pago fue Exitoso");
                //    return;
                //}

                //string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");
                //enviar email con los documentos
                string nombreBenef = Session["servicio"].ToString().Split('|')[0];
                string vigencia    = Session["servicio"].ToString().Split('|')[1];
                string cantidad    = Session["servicio"].ToString().Split('|')[2];
                string fAdqui      = Session["servicio"].ToString().Split('|')[3];
                amountPay = int.Parse(Session["precio"].ToString());

                var  IdServicio     = Session["IdServicio"];
                bool awnserEmailDoc = oEmail.SubmitEmailNotFiles3(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.EmailPago(), true);
                var  reg            = nombreBenef + "|" + vigencia + "|" + CodigoReserva + "|" + cantidad + "|" + fAdqui + "|" + IdServicio + "|" + obj[3] + "|" + "2" + "|" + "culqui.png" + "|" + amountPay;
                bool qwe            = brUser.RegisterService(reg);

                //bool awnserEmail = oEmail.submitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());

                //ejecutamos el core para los puntos de equipo
                // BrCore_Automation brCore_Automation = new BrCore_Automation();
                //bool isCoreRegister = brCore_Automation.ExecuteCore();

                Response.Write("true¬" + culqiAnwser[1]);
                return;
            }

            #endregion
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string token        = string.Empty;
                string currencyCode = string.Empty;
                int    numberQuotes = 0;

                token        = Request["tokenid"];
                numberQuotes = int.Parse(Request["ddlQuote"]);
                currencyCode = Request["ddlcurrencyCode"];

                if (currencyCode != "USD" && currencyCode != "PEN")
                {
                    Response.Write("false¬ocurrio un error.");
                    return;
                }

                string[] dataLogin   = HttpContext.Current.User.Identity.Name.Split('¬');
                string   userCurrent = dataLogin[0];

                if (dataLogin.Length > 1)
                {
                    userCurrent = dataLogin[1];
                }

                BrUser brUser = new BrUser();

                var arraycar   = Session["carrito"].ToString().Split('|');
                var tipocambio = double.Parse(arraycar[4]);

                string dataBdd        = Session["datos"].ToString();
                var    TypeMembership = (dataBdd.Split('$')[3]).Split('|')[7];
                // string data2 = (string)Session["civilStatus"];
                string   data2 = (string)Session["civilState"];
                string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, data2).Split('¬');

                if (oIdMembreship_amount.Length < 2)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                    return;
                }

                string[] parameterPerson  = dataBdd.Split('$');
                string[] arraydata        = parameterPerson[0].Split('|');
                string[] arrayTypeaccount = parameterPerson[2].Split('|');
                string[] arrayaccount     = parameterPerson[3].Split('|');

                string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];
                //'999999999999|1|sa|1'
                var newUserName = brUser.GenerateAccount(parameterAccount);

                if (string.IsNullOrEmpty(newUserName))
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                    return;
                }

                var dataKitMember = Session["cronograma"].ToString();

                string[] datos = Session["datos"].ToString().Split('$');

                if (Session["datos"] == null)
                {
                    Response.Write("false¬Ha Ocurrido Un Error, no hay datos.");
                    return;
                }
                string[] arraycontacto = datos[3].Split('|');
                string[] arrayperson   = datos[0].Split('|');

                var amountPay = double.Parse(Session["FirtsPay"].ToString());


                if (amountPay <= 0)
                {
                    Response.Write("false¬Ha Ocurrido Un Error id idMemberDetails vacio,amountPay vacio");
                    return;
                }

                //amount pay es un valor en soles
                if (currencyCode == "USD")
                {
                    amountPay = amountPay / tipocambio;
                }

                string dni = arrayperson[5];

                newUserName = arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni;
                var emailNewUser = arraycontacto[0].Trim();


                PayCulqi   payCulqi   = new PayCulqi();
                MyMessages myMessages = new MyMessages();
                //string currencyCode = "PEN";
                string[] culqiAnwser = payCulqi.newPayment(newUserName, emailNewUser, amountPay, token, numberQuotes, currencyCode).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }

                /*=====================================================================================================================================================================*/

                //correo = arraycontacto[0];
                var namePeson = arrayperson[0] + " " + arrayperson[1];


                string date = dataKitMember.Split('$')[1];

                string[] array1          = Session["cronogramaYa"].ToString().Split('^');
                string[] datosMem        = array1[0].Split('|');
                string[] array2          = array1[1].Split('~');
                string[] cuotas          = array2[0].Split('¬');
                string   cronoActiv      = "";
                var      quotesPendiente = (cuotas.Length - 2).ToString();
                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") + "¬";
                    }
                }

                BrPayments brPayments = new BrPayments();

                string respData = brPayments.PersonGetData(newUserName);
                respData = respData + '^' + dataKitMember;
                // isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName);
                string financedAmount = Session["financedAmount"].ToString();
                string codeCurrency   = Session["TypeCurrency"].ToString();

                Int32  ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, financedAmount, 1, codeCurrency);
                string exchange      = Session["carrito"].ToString().Split('|')[4];
                var    isRegister    = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, exchange, 1);

                //validamos si tiene consumo


                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, newUserName, ansNmembershi);

                //obtengo el monto a pagar

                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                var idMemberDetails = int.Parse(username_idmen_amount_email[1]);
                amountPay    = double.Parse(username_idmen_amount_email[2]);
                emailNewUser = username_idmen_amount_email[3];

                date = null;
                username_idmen_amount_email = null;
                dataKitMember = null;
                respData      = null;


                /*=============================================================================================================================*/

                var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                string tranferId    = culqiAnwser[2] == null ? "" : culqiAnwser[2];
                string numReceipt   = "0";
                string datecomplete = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                string nAffiliate   = "";

                string hour    = DateTime.Now.ToString("HH:mm:ss");
                string detalle = amountPay.ToString();


                //cvbc
                string nameTicket = GetRecibo(tranferId, newUserName, numReceipt, datecomplete, nAffiliate, TypeMembership, namePeson, hour, detalle, quotesPendiente, " Inicial 1");


                //marcar como pagado en la tabla membershipdetails
                bool habiliAccount = brUser.enableAcount(idMemberDetails, nameTicket);

                int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                Cronograma2(nAfiliate, currencyCode);

                // enviar el email de confirmacion con la data y lo redirecciona al post register
                if (!habiliAccount)
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.Sin embargo su Pago fue Exitoso");
                    return;
                }


                string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");
                //enviar email con los documentos
                //bool awnserEmailDoc = oEmail.SubmitEmailKit(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta);

                Email oemail         = new Email();
                bool  awnserEmailDoc = oemail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta, newUserName);
                bool  awnserEmail    = oemail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());

                //ejecutamos el core para los puntos de equipo
                // BrCore_Automation brCore_Automation = new BrCore_Automation();
                //bool isCoreRegister = brCore_Automation.ExecuteCore();

                Response.Write("true¬" + culqiAnwser[1]);
            }
            catch (Exception ex)
            {
                Response.Write("false¬ocurrio un error¬" + ex.Message);
            }
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyConstants mc = new MyConstants();

            try
            {
                string token        = "";
                int    numberQuotes = 0;

                token        = Request["token"].ToString();
                numberQuotes = int.Parse(Request["numcuotes"].ToString());

                //pagar con wallet
                BrWallet brWallet      = new BrWallet();
                var      amountWalletc = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));

                var amountTotal = 0m;

                if (Session["MontoWallet"] != null)
                {
                    amountTotal = decimal.Parse(Session["MontoWallet"].ToString());
                }


                var amountRestan = amountTotal - amountWalletc;

                //if (amountWalletc < quota)
                //{
                //    MessageError.Text = "No tiene el monto suficiente para realizar Pago.";
                //    return;
                //}

                var methods2 = "CULQI";

                var recibe = string.Empty;



                BrPayments brPayments    = new BrPayments();
                BrUser     brUser        = new BrUser();
                string     dataKitMember = Session["cronograma"].ToString();


                string date = dataKitMember.Split('$')[1];

                var cart = Session["carrito"].ToString();

                var arrayCart = cart.Split('|');
                var codeMemb  = arrayCart[6];

                string[] datos   = Session["datos"].ToString().Split('$');
                var      dataBdd = Session["datos"].ToString();



                if (Session["datos"] == null)
                {
                    Response.Write("false¬Ha Ocurrido Un Error, no hay datos.");
                    return;
                }
                string[] arraycontacto = datos[3].Split('|');
                string[] arrayperson   = datos[0].Split('|');


                string dni = arrayperson[5];

                var newUserName     = User.Identity.Name.Split('¬')[1];
                var emailNewUser    = arraycontacto[0].Trim();
                var codeCurrencyPay = Session["TypeCurrency"].ToString();



                string[] array1          = Session["cronogramaYa"].ToString().Split('^');
                string[] datosMem        = array1[0].Split('|');
                string[] array2          = array1[1].Split('~');
                string[] cuotas          = array2[0].Split('¬');
                string   cronoActiv      = "";
                var      quotesPendiente = (cuotas.Length - 2).ToString();
                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") + "¬";
                    }
                }

                var respDataper = brPayments.PersonGetData(newUserName);

                string respData = string.Empty;
                respData = respData + '^' + dataKitMember;

                // isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName);
                //string data2 = Session["financedAmount"].ToString();

                string data2 = "0";
                //string codeCurrency = Session["TypeCurrency"].ToString();



                var currencyCode = Session[""].ToString();

                PayCulqi payCulqi = new PayCulqi();

                string[] culqiAnwser = payCulqi.newPayment(newUserName, emailNewUser, double.Parse(amountRestan.ToString()), token, numberQuotes, codeCurrencyPay).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }


                Int32 ansNmembershi = brUser.RegisterNmembership(codeMemb + '|' + newUserName, data2, 1, codeCurrencyPay);

                BrTypeMembership brTypeMemb = new BrTypeMembership();
                string           typeChange = arrayCart[4];

                //var isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, typeChange, 1);
                bool isRegister = false;
                if (Session["codeUpgrate"] != null)
                {
                    //si es upgrate

                    isRegister = brPayments.GetCalculatePaymentScheduleUpgrate(respData, newUserName, ansNmembershi, typeChange, 1);
                    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);
                    }

                    //registramos si upgrate para
                }
                else
                {
                    //si no es upgrate

                    isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, typeChange, 1);
                    if (!isRegister)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                        return;
                    }
                    //cronograma de activacion
                    BrActivation brActivation = new BrActivation();
                    bool         registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);
                }

                if (Session["codeUpgrate"] != null)
                {
                    //el id de account n membership del upgrate ¬ y el nuevo
                    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, newUserName, ansNmembershi, codeUpgrate);
                }
                //validamos si tiene consumo


                if (!isRegister)
                {
                    // "Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario";
                    return;
                }

                //BrActivation brActivation = new BrActivation();
                //bool registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);

                //obtengo el monto a pagar

                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    // "false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar";
                    return;
                }
                var idMemberDetails = int.Parse(username_idmen_amount_email[1]);
                var amountPay       = double.Parse(username_idmen_amount_email[2]);
                emailNewUser                = username_idmen_amount_email[3];
                codeCurrencyPay             = username_idmen_amount_email[4];
                date                        = null;
                username_idmen_amount_email = null;
                dataKitMember               = null;
                respData                    = null;


                var namePeson = arrayperson[0].Trim() + " " + arrayperson[1].Trim();

                var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                string tranferId    = "";
                string numReceipt   = "0";
                string datecomplete = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                string nAffiliate   = "";

                string     hour       = DateTime.Now.ToString("HH:mm:ss");
                string     detalle    = amountRestan.ToString();
                MyMessages myMessages = new MyMessages();
                namePeson = myMessages.ToCapitalize(namePeson);
                //cvbc
                var imgTicket = GetRecibo(tranferId, newUserName, numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, detalle, quotesPendiente, " Inicial 1");


                /*=============================================================================================================================*/

                //var currencyCode = Session["CurrencyCode"].ToString();
                BrMembershipPayDetail brMembership = new BrMembershipPayDetail();
                var response = brMembership.GetQuote(idMemberDetails, User.Identity.Name.Split('¬')[1]).Split('|');

                if (decimal.Parse(response[0]) == 0)
                {
                    // "Ocurrio un error.";
                    return;
                }
                var amount = decimal.Parse(response[0]).ToString();


                if (codeCurrencyPay == "USD")
                {
                    amount = (decimal.Parse(amount) * decimal.Parse(typeChange)).ToString();
                }


                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)
                {
                    // "Tu Cuota ya esta Pagada.Verifica tu cronograma de pagos.";
                    return;
                }


                var amountWallet = decimal.Parse(brWallet.GetAmount(User.Identity.Name.Split('¬')[1]));

                //if (amountWallet < decimal.Parse(amount))
                //{
                //    MessageError.Text = "No tiene el monto suficiente para realizar Pago.";
                //    return;
                //}

                imgTicket += recibe;

                var moneyStatus = 0;

                if (amountWallet > 0)
                {
                    var imgTicketWalle = GetRecibo(idMemberDetails.ToString(), newUserName, numReceipt, datecomplete, nAffiliate, codeMemb, namePeson, hour, amountWalletc.ToString(), quotesPendiente, " Inicial 1");
                    imgTicket += $"~{imgTicketWalle}";
                    //amount | @idInfo | @typeInfo | @walletOperationId | @currencyCode | @typeChange | idmembershipDetail | imgTicket
                    string data   = $"{amountWalletc}|{idInfo}|{typeInfo}|{walleOperationId}|PEN|{typeChange}|{idMemberDetails.ToString()}|{imgTicket}";
                    bool   answer = brWallet.Put(data, User.Identity.Name.Split('¬')[1], moneyStatus);

                    //Extorno

                    if (!answer)
                    {
                        // = "Ocurrio un error.";
                        return;
                    }
                }
                //MessageSucces.Text = "Su Pago de Realizo Con Exito.";

                /*=============================================================================================================================*/

                var amountOthers = amount;
                //esta en estado pendienete
                var statusPay = 1;

                //marcar como pagado en la tabla membershipdetails

                //TODO: Agregar los detalles del pago


                bool habiliAccount = brUser.BiPayQuote(idMemberDetails, imgTicket, amountWalletc, amountRestan, "WALLET", methods2, statusPay, decimal.Parse(typeChange));

                int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                BrTypeMembership brTypeMembership = new BrTypeMembership();
                var correlativo = int.Parse(brTypeMembership.GetTotalMemberships(User.Identity.Name.Split('¬')[1]));

                correlativo--;

                if (correlativo < 0)
                {
                    correlativo = 0;
                }

                Cronograma2(nAfiliate, codeCurrencyPay, correlativo.ToString());

                // enviar el email de confirmacion con la data y lo redirecciona al post register
                if (!habiliAccount)
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.Sin embargo su Pago fue Exitoso");
                    return;
                }


                var urlRedirect = "EndPaymendMbs";

                if (codeMemb == "EXP" || codeMemb == "LHT" || codeMemb == "STD" ||
                    codeMemb == "PLUS" || codeMemb == "TOP" || codeMemb == "VIT")
                {
                    urlRedirect = "EndPaymendMbs";
                }
                if (codeMemb == "EVOL" || codeMemb == "MVC")
                {
                    urlRedirect = "EndPaymendMbs";
                }
                if (codeMemb == "SBY")
                {
                    urlRedirect = "EndPaymentSby";
                }


                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");
            }
        }
Ejemplo n.º 18
0
        public bool RegistarSinPagarInicial()
        {
            string newUserName = "", TypeMembership = "", userCurrent = "";

            string[]    dataLogin;
            BrUser      brUser      = new BrUser();
            MyConstants myConstants = new MyConstants();

            dataLogin   = HttpContext.Current.User.Identity.Name.Split('¬');
            userCurrent = dataLogin[0];
            if (dataLogin.Length > 1)
            {
                userCurrent = dataLogin[1];
            }

            string dataKitMember = "";

            dataKitMember = Session["cronograma"].ToString();
            //1050 | 3.31 | empty | empty | 12 | 2019 - 03 - 15 | 311.14 | 10 | 1 | empty ^ 2019 - 03 - 15 | 278.04~jorge samir | pazo torres | 165894515 | 65894515$2019 - 04 - 15
            string datecrono   = dataKitMember.Split('^')[1];
            string dateinitial = datecrono.Split('|')[0];
            string currentDate = DateTime.Now.ToString(myConstants.DateFormatBd);

            if (dateinitial == currentDate)
            {
                return(false);
            }


            string dataBdd = Session["datos"].ToString();

            TypeMembership = (dataBdd.Split('$')[3]).Split('|')[7];
            // string data2 = (string)Session["civilStatus"];
            string civilState = (string)Session["civilState"];

            string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, civilState).Split('¬');

            if (oIdMembreship_amount.Length < 2)
            {
                return(false);
            }

            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");
                    break;
                }
                else
                {
                    cronoActiv += DateTime.Parse(fila[1]).ToString("yyyy-MM-dd") + "¬";
                }
            }

            string[] parameterPerson  = dataBdd.Split('$');
            string[] arraydata        = parameterPerson[0].Split('|');
            string[] arrayTypeaccount = parameterPerson[2].Split('|');
            string[] arrayaccount     = parameterPerson[3].Split('|');

            string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];

            //'999999999999|1|sa|1'
            newUserName = brUser.GenerateAccount(parameterAccount);

            BrPayments brPayments = new BrPayments();


            string respData = brPayments.PersonGetData(newUserName);

            respData = respData + '^' + dataKitMember;
            // isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName);
            string financedAmount = Session["financedAmount"].ToString();
            string codeCurrency   = Session["TypeCurrency"].ToString();

            Int32  ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, financedAmount, 1, codeCurrency);
            string exchange      = Session["carrito"].ToString().Split('|')[4];
            //5 cualqier numero
            bool isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, exchange, 5);

            //validamos si tiene consumo


            if (!isRegister)
            {
                return(false);
            }
            //obtengo el monto a pagar
            string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
            if (username_idmen_amount_email.Length < 4)
            {
                Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                return(false);
            }
            int    idMemberDetails = int.Parse(username_idmen_amount_email[1]);
            double amountPay       = double.Parse(username_idmen_amount_email[2]);
            string emailNewUser    = username_idmen_amount_email[3];

            username_idmen_amount_email = null;
            dataKitMember = null;
            respData      = null;
            Email      oEmail     = new Email();
            MyMessages myMessages = new MyMessages();
            //habilitar hasta la fecha de pago de su inicial
            bool isActive = brUser.GetNotPayInitial(dateinitial, newUserName, ansNmembershi);

            BrActivation brActivation = new BrActivation();
            bool         registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);

            string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");

            //bool awnserEmailDoc = oEmail.submitEmail(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta, newUserName);

            var email          = SendEmailPay();
            var awnserEmailDoc = SendEmailFounder(arraydata[0], arraydata[3], newUserName + "0", ruta, emailNewUser);



            if (awnserEmailDoc)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string[]         dataLogin = null;
            int              typeRegister = 0, numberQuotes = 0, formPay = 0, idMemberDetails = 0;
            string           dataKit = null, dataKitMember = null, dataMemberSinKit;
            string           token = null, userCurrent = null, newUserName = null, emailNewUser = null;
            double           amountPay        = 0;
            bool             isRegister       = false;
            BrUser           brUser           = null;
            BrTypeMembership brTypeMembership = null;
            Email            oEmail           = null;
            BrPayments       brPayments       = null;
            BrConsuption     brConsuption;

            if (Session["typeRegister"] == null)
            {
                Session["typeRegister"] = 0;
            }

            typeRegister = int.Parse(Session["typeRegister"].ToString());
            //formPay = int.Parse(Session["formPay"].ToString());
            formPay = int.Parse("1");
            // token = Request["token"].ToString();
            numberQuotes     = 1;
            brUser           = new BrUser();
            brTypeMembership = new BrTypeMembership();
            dataLogin        = HttpContext.Current.User.Identity.Name.Split('¬');
            oEmail           = new Email();
            brPayments       = new BrPayments();
            brConsuption     = new BrConsuption();
            string TypeMembership = "";



            userCurrent = dataLogin[0];
            if (dataLogin.Length > 1)
            {
                userCurrent = dataLogin[1];
            }



            if (formPay == 1)
            {
                string dataBdd = Session["datos"].ToString();
                TypeMembership = (dataBdd.Split('$')[3]).Split('|')[7];
                string   data2 = (string)Session["civilState"];
                string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, data2).Split('¬');

                if (oIdMembreship_amount.Length < 2)
                {
                    //Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario1");
                    Response.Redirect("Pagos.aspx");
                    return;
                }

                string[] parameterPerson  = dataBdd.Split('$');
                string[] arraydata        = parameterPerson[0].Split('|');
                string[] arrayTypeaccount = parameterPerson[2].Split('|');
                string[] arrayaccount     = parameterPerson[3].Split('|');

                string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];
                //'999999999999|1|sa|1'
                newUserName = brUser.GenerateAccount(parameterAccount);

                if (string.IsNullOrEmpty(newUserName))
                {
                    //Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario2");
                    //Response.Redirect("Pagos.aspx");
                    return;
                }
            }


            if (typeRegister == 1)
            {
                // string arrayKit = Session["arrayKit"].ToString() + "¬" + newUserName;
                //'2018-10-19¬31¬31¬31¬userName'
                //isRegister = brUser.PutRegisterkIT(arrayKit);
                string arrayKit = Session["arrayKit"].ToString() + "¬" + newUserName;
                //'2018-10-19¬31¬31¬31¬userName'
                string data2        = Session["financedAmount"].ToString();
                string codeCurrency = Session["TypeCurrency"].ToString();

                Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data2, 1, codeCurrency);
                isRegister = brUser.PutRegisterkIT(arrayKit, ansNmembershi);
                //monto a pagar
                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                /*UPDATE*/
                bool resp = brPayments.InitialExoneration(newUserName);
                // bool notAvilable = brUser.NotAvailableUser(newUserName);
                Response.Redirect("EndPayments.aspx");
            }

            if (typeRegister == 2)
            {
                dataKitMember = Session["cronograma"].ToString();

                string date = dataKitMember.Split('$')[1];

                string respData = brPayments.PersonGetData(newUserName);


                respData = respData + '^' + dataKitMember;
                // isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName);
                string data2        = Session["financedAmount"].ToString();
                string codeCurrency = Session["TypeCurrency"].ToString();

                Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data2, 1, codeCurrency);
                var   exchange      = Session["exchange"];
                if (string.IsNullOrEmpty(exchange.ToString()))
                {
                    exchange = "0.00";
                }
                isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, exchange.ToString(), 1);

                //validamos si tiene consumo
                if (!isRegister)
                {
                    // Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                    //Response.Redirect("Pagos.aspx");
                    return;
                }
                //obtengo el monto a pagar
                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    //Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    //Response.Redirect("Pagos.aspx");
                    return;
                }
                idMemberDetails             = int.Parse(username_idmen_amount_email[1]);
                amountPay                   = double.Parse(username_idmen_amount_email[2]);
                emailNewUser                = username_idmen_amount_email[3];
                date                        = null;
                username_idmen_amount_email = null;
                dataKitMember               = null;
                respData                    = null;
                /*UPDATE*/
                bool resp = brPayments.InitialExoneration(newUserName);
                //  bool notAvilable = brUser.NotAvailableUser(newUserName);
                Response.Redirect("EndPayments.aspx");
            }
        }
Ejemplo n.º 20
0
        public void registerTodo(int metodo)
        {
            brPayment = new BrPayments();
            brUser    = new BrUser();
            int typeRegister = 0;

            if (Session["typeRegister"] == null)
            {
                Session["typeRegister"] = 0;
            }

            typeRegister = int.Parse(Session["typeRegister"].ToString());
            //REGISTER
            string[] dataLogin   = HttpContext.Current.User.Identity.Name.Split('¬');
            string   userCurrent = dataLogin[0];

            if (dataLogin.Length > 1)
            {
                userCurrent = dataLogin[1];
            }
            string dataBdd        = Session["datos"].ToString();
            string TypeMembership = (dataBdd.Split('$')[3]).Split('|')[7];

            if (!string.IsNullOrEmpty((string)Session["tienda"]))
            {
                if (Session["tienda"].ToString() != "1")
                {
                    string   data2 = (string)Session["civilState"];
                    string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, data2).Split('¬');

                    if (oIdMembreship_amount.Length < 2)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                        return;
                    }
                    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[] parameterPerson  = dataBdd.Split('$');
                    string[] arraydata        = parameterPerson[0].Split('|');
                    string[] arrayTypeaccount = parameterPerson[2].Split('|');
                    string[] arrayaccount     = parameterPerson[3].Split('|');

                    string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];

                    newUserName = brUser.GenerateAccount(parameterAccount);
                    bool notAvilable = brUser.NotAvailableUser(newUserName);
                    if (string.IsNullOrEmpty(newUserName))
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                        return;
                    }


                    //END REGISTER
                    if (typeRegister == 1)
                    {
                        string arrayKit = Session["arrayKit"].ToString() + "¬" + newUserName;
                        //'2018-10-19¬31¬31¬31¬userName'
                        string data3        = Session["financedAmount"].ToString();
                        string codeCurrency = Session["TypeCurrency"].ToString();

                        Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data3, 1, codeCurrency);

                        if (ansNmembershi > 0)
                        {
                            //GeneracionDePuntos
                            bool isRegister = brUser.PutRegisterkIT(arrayKit, ansNmembershi);
                        }

                        //monto a pagar

                        /*subidaDeRecibo con newUserName*/
                        brUser = new BrUser();
                        BrPayments brPayments = new BrPayments();
                        bool       upload     = brPayments.UploadReceipt(ansNmembershi.ToString() + '|' + nombreArchivo);
                        if (!string.IsNullOrEmpty(newUserName))
                        {
                            bool UpdateD = brUser.UpdateInitialQuoteDescription(newUserName);
                        }
                        else
                        {
                            bool UpdateD = brUser.UpdateInitialQuoteDescription(userCurrent);
                        }

                        BrActivation brActivation = new BrActivation();
                        bool         registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);

                        string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                        if (username_idmen_amount_email.Length < 4)
                        {
                            Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                            return;
                        }
                        idMemberDetails = int.Parse(username_idmen_amount_email[1]);

                        double amountPay    = double.Parse(username_idmen_amount_email[2]);
                        string emailNewUser = username_idmen_amount_email[3];
                        username_idmen_amount_email = null;
                    }

                    if (typeRegister == 2)
                    {
                        string     dataKitMember = Session["cronograma"].ToString();
                        string     date          = dataKitMember.Split('$')[1];
                        BrPayments brPayments    = new BrPayments();
                        string     respData      = brPayments.PersonGetData(newUserName);
                        respData = respData + '^' + dataKitMember;
                        brUser   = new BrUser();
                        string data3        = Session["financedAmount"].ToString();
                        string codeCurrency = Session["TypeCurrency"].ToString();

                        Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data3, 1, codeCurrency);
                        //GeneracionDePuntosConLaInicialDeLaMembresia
                        //string exchange2 = "";
                        var exchange = Session["exchange"];

                        bool isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, exchange.ToString(), 0);
                        brUser = new BrUser();
                        //TODO: la fecha de pago debe ser el dia de subida del voucher
                        bool upload = brPayments.UploadReceipt(ansNmembershi.ToString() + '|' + nombreArchivo);


                        BrActivation brActivation = new BrActivation();
                        bool         registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);



                        if (!isRegister)
                        {
                            Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                            return;
                        }
                        //obtengo el monto a pagar

                        string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                        if (username_idmen_amount_email.Length < 4)
                        {
                            Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                            return;
                        }
                        idMemberDetails = int.Parse(username_idmen_amount_email[1]);


                        date = null;
                        username_idmen_amount_email = null;
                        dataKitMember = null;
                        respData      = null;
                    }
                }
            }
            else
            {
                //entra aqui pagar despues
                string   data2 = (string)Session["civilState"];
                string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, data2).Split('¬');

                if (oIdMembreship_amount.Length < 2)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                    return;
                }

                string[] parameterPerson  = dataBdd.Split('$');
                string[] arraydata        = parameterPerson[0].Split('|');
                string[] arrayTypeaccount = parameterPerson[2].Split('|');
                string[] arrayaccount     = parameterPerson[3].Split('|');

                string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];

                newUserName = brUser.GenerateAccount(parameterAccount);


                string dataKitMember = "";
                string date          = "";
                if (!string.IsNullOrEmpty((string)Session["cronograma"]))
                {
                    dataKitMember = Session["cronograma"].ToString();
                    date          = dataKitMember.Split('$')[1];
                }

                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 += fila[1];
                        break;
                    }
                    else
                    {
                        cronoActiv += fila[1] + "¬";
                    }
                }

                BrPayments brPayments = new BrPayments();
                string     respData   = brPayments.PersonGetData(dataLogin[0]);
                respData = respData + '^' + dataKitMember;
                brUser   = new BrUser();
                string financedAmountsa = Session["financedAmount"].ToString();
                string codeCurrency     = Session["TypeCurrency"].ToString();

                Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, financedAmountsa, 1, codeCurrency);
                //GeneracionDePuntosConLaInicialDeLaMembresia
                string        exchange      = "";
                BrInformacion brInformacion = new BrInformacion();
                string[]      info          = brInformacion.GetInformation().Split('¬');



                if (!string.IsNullOrEmpty(info[1]))
                {
                    exchange = info[1];
                }
                else
                {
                    exchange = "0.00";
                }
                string   currentUser = "";
                string[] arrayLink   = Session["link"].ToString().Split('|');
                if (arrayLink.Length > 1)
                {
                    currentUser = arrayLink[0];
                }
                else
                {
                    currentUser = dataLogin[0];
                }

                bool isRegister = brPayments.GetCalculatePaymentSchedule(respData, currentUser, ansNmembershi, exchange, 0);

                BrActivation brActivation = new BrActivation();
                bool         registerActi = brActivation.PutCronograma(cronoActiv, newUserName, ansNmembershi);

                /*subidaDeRecibo con newUserName*/
                if (!string.IsNullOrEmpty(nombreArchivo))
                {
                    brUser = new BrUser();
                    bool upload = brPayments.UploadReceipt(currentUser + '|' + nombreArchivo);
                    if (!string.IsNullOrEmpty(newUserName))
                    {
                        bool UpdateD = brUser.UpdateInitialQuoteDescription(newUserName);
                        //bool ans = brPayment.UploadReceiptCalendar(newUserName + '|' + nombreArchivo);
                    }
                    else
                    {
                        bool UpdateD = brUser.UpdateInitialQuoteDescription(userCurrent);
                        //bool ans = brPayment.UploadReceiptCalendar(newUserName + '|' + nombreArchivo);
                    }
                }

                if (!isRegister)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                    return;
                }
                return;
            }
            return;
            /*TRY MERGE*/
        }
Ejemplo n.º 21
0
        protected void btnEnviarAhora_Click(object sender, EventArgs e)
        {
            string moneda = string.Empty;

            moneda = ddlMoneda.SelectedValue.Trim();

            Session["moneda"] = moneda;

            //if (Session["JustKit"] != null)
            //{

            //string arrayKit = Session["arrayKit"].ToString() + "¬" + newUserName;
            ////'2018-10-19¬31¬31¬31¬userName'
            //string data3 = Session["financedAmount"].ToString();
            //Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data3, 1);

            //if (ansNmembershi > 0)
            //{
            //    //GeneracionDePuntos
            //    bool isRegister = brUser.PutRegisterkIT(arrayKit, ansNmembershi);
            //}

            ////monto a pagar

            ///*subidaDeRecibo con newUserName*/
            //brUser = new BrUser();
            //BrPayments brPayments = new BrPayments();
            //bool upload = brPayments.UploadReceipt(ansNmembershi.ToString() + '|' + nombreArchivo);

            //bool UpdateD = brUser.UpdateInitialQuoteDescription(newUserName);

            //string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
            //if (username_idmen_amount_email.Length < 4)
            //{
            //    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
            //    return;
            //}
            //idMemberDetails = int.Parse(username_idmen_amount_email[1]);

            //double amountPay = double.Parse(username_idmen_amount_email[2]);
            //string emailNewUser = username_idmen_amount_email[3];
            //username_idmen_amount_email = null;
            //}
            //else
            //{
            if (Session["datos"] != null)
            {
                string dataPerson   = Session["datos"].ToString();
                int    typeRegister = 0;
                typeRegister = int.Parse(Session["typeRegister"].ToString());
                if (typeRegister != 1)
                {
                    string dataMember = Session["cronograma"].ToString();

                    if (string.IsNullOrEmpty(dataPerson) || string.IsNullOrEmpty(dataMember))
                    {
                        Response.Redirect("Register.aspx");
                    }
                }
                if (string.IsNullOrEmpty(dataPerson))
                {
                    Response.Redirect("Register.aspx");
                }

                if (!fuRecibo.HasFile)
                {
                    //no hay imagen en el control
                    return;
                }
                //si hay una archivo.
                string[] parameterPerson     = dataPerson.Split('$');
                string[] arraydata           = parameterPerson[0].Split('|');
                string[] arraynombreArchivo2 = fuRecibo.FileName.Split('.');

                int indice = (arraynombreArchivo2.Length - 1);

                string extension = arraynombreArchivo2[indice];

                nombreArchivo = arraydata[5] + "." + extension;

                string ruta = "~/Resources/RecibosRegister/" + nombreArchivo;
                fuRecibo.SaveAs(Server.MapPath(ruta));

                registerTodo(1);

                int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                Cronograma2(nAfiliate);


                brPayment = new BrPayments();
                var log = HttpContext.Current.User.Identity.Name.Split('¬');

                Response.Redirect("EndPayments2.aspx", true);
            }
            else
            {
                var log = HttpContext.Current.User.Identity.Name.Split('¬');
                brUser    = new BrUser();
                brPayment = new BrPayments();
                var nroDoc = brUser.getDoc(log[1]);

                if (!fuRecibo.HasFile)
                {
                    //no hay imagen en el control
                    return;
                }

                int id = int.Parse(Session["IdImg"].ToString());
                nombreArchivo = nroDoc + id.ToString() + "." + "jpg";
                string ruta = "~/Resources/RecibosRegister/" + nombreArchivo;
                fuRecibo.SaveAs(Server.MapPath(ruta));
                string Amount = "";
                if (!string.IsNullOrEmpty((string)Session["quotePay"]))
                {
                    Amount = (string)Session["quotePay"];
                }
                //TODO: la fecha de pago debe ser el dia que el usuario ingresas el voucher
                bool ans = brPayment.UploadReceiptCalendar(id.ToString() + '|' + nombreArchivo);
                Session.Remove("quotePay");
                Session.Remove("StatusCalendar");

                Response.Redirect("EndPayments2.aspx", true);
            }

            //}
        }
Ejemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    string quotesPendiente = "";
                    string namePeson = "";
                    string token = "", emailNewUser = "", userName = "", codeMembers = "";
                    int    numberQuotes = 0, idMemberDetails = 0;
                    double amountPay    = 0;
                    string currencyCode = string.Empty;

                    BrUser           brUser     = new BrUser();
                    BrPayments       brPayments = new BrPayments();
                    BrTypeMembership brTypeMemb = new BrTypeMembership();

                    string[] dataLogin = HttpContext.Current.User.Identity.Name.Split('¬');
                    userName = dataLogin[1];

                    token        = Request["tokenid"].ToString();
                    numberQuotes = int.Parse(Request["ddlQuote"].ToString());
                    currencyCode = Request["ddlcurrencyCode"].ToString();



                    if (numberQuotes < 0 || numberQuotes > 32)
                    {
                        Response.Write("false¬" + "Numero de Cuotas No Valido");
                        return;
                    }

                    codeMembers = Session["carrito"].ToString().Split('|')[6];

                    string   dataBdd       = Session["datos"].ToString();
                    string[] arraycontacto = dataBdd.Split('$')[3].Split('|');
                    string[] arrayperson   = dataBdd.Split('$')[0].Split('|');

                    //correo = arraycontacto[0];
                    namePeson = arrayperson[0] + " " + arrayperson[1];

                    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 cronogramaYa     = Session["cronogramaYa"].ToString();



                    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;
                    string exchange      = Session["carrito"].ToString().Split('|')[4];

                    var typeChange = double.Parse(exchange);

                    if (Session["codeUpgrate"] != null)
                    {
                        //si es upgrate

                        isRegister = brPayments.GetCalculatePaymentScheduleUpgrate(respData, userName, ansNmembershi, exchange, 1);
                        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);
                        }

                        //registramos si upgrate para
                    }
                    else
                    {
                        //si no es upgrate

                        isRegister = brPayments.GetCalculatePaymentSchedule(respData, userName, ansNmembershi, exchange, 1);
                        if (!isRegister)
                        {
                            Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                            return;
                        }
                        //cronograma de activacion
                        BrActivation brActivation = new BrActivation();
                        bool         registerActi = brActivation.PutCronograma(cronoActiv, userName, ansNmembershi);
                    }

                    if (Session["codeUpgrate"] != null)
                    {
                        //el id de account n membership del upgrate ¬ y el nuevo
                        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);
                    }

                    //validamos si tiene consumo
                    if (!isRegister)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                        return;
                    }

                    string[] username_idmen_amount_email = brUser.GetAmountPay(ansNmembershi).Split('|');

                    if (username_idmen_amount_email.Length < 4)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                        return;
                    }
                    idMemberDetails = int.Parse(username_idmen_amount_email[1]);
                    amountPay       = double.Parse(username_idmen_amount_email[2]);
                    emailNewUser    = username_idmen_amount_email[3];

                    username_idmen_amount_email = null;
                    brPayments = null;
                    brUser     = null;

                    if (idMemberDetails <= 0 || amountPay <= 0)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                        return;
                    }

                    if (currencyCode == "USD")
                    {
                        amountPay = amountPay / typeChange;
                    }

                    PayCulqi payCulqi    = new PayCulqi();
                    string[] culqiAnwser = payCulqi.newPayment(userName, emailNewUser, amountPay, token, numberQuotes, currencyCode).Split('¬');
                    if (culqiAnwser[0] == "false")
                    {
                        Response.Write("false¬" + culqiAnwser[1]);
                        return;
                    }
                    //marcar como pagado en la tabla membershipdetails
                    BrMembershipPayDetail brMembershipPayDetail = new BrMembershipPayDetail();

                    if (Session["codeUpgrate"] != null)
                    {
                        bool habiliAccount = brMembershipPayDetail.UpgrateStatusPaymentInitial(ansNmembershi, 1, "");

                        //enviar el email de confirmacion con la data y lo redirecciona al post register
                        if (!habiliAccount)
                        {
                            Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.");
                            return;
                        }
                    }
                    else
                    {
                        var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                        string tranferId  = culqiAnwser[2] == null ? "" : culqiAnwser[2];
                        string numReceipt = "0";
                        string date       = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                        string nAffiliate = "";

                        string hour    = DateTime.Now.ToString("HH:mm:ss");
                        string detalle = amountPay.ToString();


                        //cvbc
                        string nameTicket = GetRecibo(tranferId, userName, numReceipt, date, nAffiliate, TypeMembership, namePeson, hour, detalle, quotesPendiente);


                        bool habiliAccount = brMembershipPayDetail.UpgrateStatusPaymentInitial(ansNmembershi, 0, nameTicket);

                        //enviar el email de confirmacion con la data y lo redirecciona al post register
                        if (!habiliAccount)
                        {
                            Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.");
                            return;
                        }
                    }

                    Email oEmail      = new Email();
                    bool  awnserEmail = oEmail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", "Ud. Ha efectuado su pago en Ribera del Rio con Exito.");
                    if (!awnserEmail)
                    {
                        Response.Write("false¬" + culqiAnwser[1] + "\n" + "Ocurrio un Error al intentar enviar un Email de conformidad con su compra");
                        return;
                    }
                    //ejecutamos el core para los puntos de equipo
                    //BrCore_Automation brCore_Automation = new BrCore_Automation();
                    // bool isCoreRegister = brCore_Automation.ExecuteCore();
                    var urlRedire = string.Empty;

                    var codeMemb = TypeMembership.Trim();

                    if (codeMemb == "EXP" || codeMemb == "LHT" || codeMemb == "STD" ||
                        codeMemb == "PLUS" || codeMemb == "TOP" || codeMemb == "VIT")
                    {
                        urlRedire = "EndPayments";
                    }
                    if (codeMemb == "EVOL" || codeMemb == "MVC")
                    {
                        urlRedire = "EndPaymentQuote";
                    }
                    if (codeMemb == "SBY")
                    {
                        urlRedire = "EndPaymentSby";
                    }

                    Response.Write($"true¬{urlRedire}.aspx");
                    return;
                }
            }
            catch (Exception ex)
            {
                Response.Redirect("error.aspx?error=" + ex.Message, true);
            }
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string TypeMembership = "";

            #region Declaracion de variables
            string           quotesPendiente = "";
            string           codeCurrencyPay = "";
            string           namePeson = "";
            string[]         dataLogin = null;
            int              typeRegister = 0, numberQuotes = 0, formPay = 0, idMemberDetails = 0;
            string           dataKit = null, dataKitMember = null, dataMemberSinKit;
            string           token = null, userCurrent = null, newUserName = null, emailNewUser = null;
            double           amountPay        = 0;
            bool             isRegister       = false;
            BrUser           brUser           = null;
            BrTypeMembership brTypeMembership = null;
            Email            oEmail           = null;
            BrPayments       brPayments       = null;
            BrConsuption     brConsuption;

            #endregion

            #region Entradas de valores

            var _var = (string)Session["typeRegister"];
            if (!string.IsNullOrEmpty(_var))
            {
                typeRegister = int.Parse(Session["typeRegister"].ToString());
            }
            formPay          = int.Parse("1");
            token            = Request["token"].ToString();
            numberQuotes     = int.Parse(Request["numcuotes"].ToString());
            brUser           = new BrUser();
            brTypeMembership = new BrTypeMembership();
            dataLogin        = HttpContext.Current.User.Identity.Name.Split('¬');
            oEmail           = new Email();
            brPayments       = new BrPayments();
            brConsuption     = new BrConsuption();
            #endregion

            #region Procesos

            userCurrent = dataLogin[0];
            if (dataLogin.Length > 1)
            {
                userCurrent = dataLogin[1];
            }

            #endregion

            #region Registrar Usuario Y Generar Cuenta

            if (formPay == 1)
            {
                if (!string.IsNullOrEmpty((string)Session["SwitchAmort"]))
                {
                    var values      = (string)Session["dataAmort"];
                    var arrayValues = values.Split('|');
                    if (!string.IsNullOrEmpty(values))
                    {
                        brPayments = new BrPayments();
                        PayCulqi   payCulqi   = new PayCulqi();
                        MyMessages myMessages = new MyMessages();
                        // (int TypePay, string IdMembershipDetail, int nQuotes, decimal NewAmort, int Rate)
                        //Get the Email
                        string photo     = "culqi.jpeg";
                        string emailUser = brPayments.PayQuoteMembership(arrayValues[0], "10", photo);

                        bool     ans          = brPayments.Amortization(1, arrayValues[0], Int32.Parse(arrayValues[1]), decimal.Parse(arrayValues[2]), Int32.Parse(arrayValues[3]), photo);
                        string   currencyCode = "PEN";
                        string[] culqiAnwser  = payCulqi.newPayment(emailUser, emailUser, double.Parse(arrayValues[2]), token, numberQuotes, currencyCode).Split('¬');

                        if (culqiAnwser[0] == "true")
                        {
                            bool awnserEmail = oEmail.SubmitEmail(emailUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());
                            Response.Write("true¬" + culqiAnwser[1]);
                            Session.Remove("SwitchAmort");
                            return;
                        }
                        Response.Redirect("Payments.aspx");
                        return;
                    }
                }
                else if (Session["StatusCalendar"] == null)
                {
                    string dataBdd = Session["datos"].ToString();
                    TypeMembership = (dataBdd.Split('$')[3]).Split('|')[7];
                    // string data2 = (string)Session["civilStatus"];
                    string   data2 = (string)Session["civilState"];
                    string[] oIdMembreship_amount = brUser.RegisterUser(dataBdd, data2).Split('¬');

                    if (oIdMembreship_amount.Length < 2)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                        return;
                    }

                    string[] parameterPerson  = dataBdd.Split('$');
                    string[] arraydata        = parameterPerson[0].Split('|');
                    string[] arrayTypeaccount = parameterPerson[2].Split('|');
                    string[] arrayaccount     = parameterPerson[3].Split('|');

                    string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + userCurrent + '|' + oIdMembreship_amount[0];
                    //'999999999999|1|sa|1'
                    newUserName = brUser.GenerateAccount(parameterAccount);



                    if (string.IsNullOrEmpty(newUserName))
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                        return;
                    }
                }
                else
                {
                    var    calendar       = (string)Session["StatusCalendar"];
                    var    data           = (string)Session["StatusCalendar"];
                    string numCuota       = Session["numCuota"].ToString();
                    var    listParameters = data.Split('|');
                    var    data2          = listParameters[0];
                    string quotePay       = (string)Session["quotePay"];
                    string userName       = User.Identity.Name.Split('¬')[1];
                    TypeMembership = User.Identity.Name.Split('¬')[7];
                    string   emailUser    = brUser.GetPersonalInformation(userName).Split('|')[5];
                    PayCulqi payCulqi     = new PayCulqi();
                    string   currencyCode = "PEN";
                    if (Session["CurrencyCode"] != null)
                    {
                        currencyCode = Session["CurrencyCode"].ToString();
                    }
                    string[] culqiAnwser = payCulqi.newPayment(userCurrent, emailUser, Double.Parse(quotePay), token, numberQuotes, currencyCode).Split('¬');

                    bool awnserEmail = oEmail.SubmitEmail(emailUser, "[RIBERA DEL RIO - PAGO]", "Ud. Ha efectuado su pago en Ribera del Rio con Exito.");
                    if (culqiAnwser[0] == "true")
                    {
                        //enviar recibo
                        var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                        string tranferId  = culqiAnwser[2];
                        string numReceipt = "0";
                        string date       = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                        string nAffiliate = "";

                        string hour    = DateTime.Now.ToString("HH:mm:ss");
                        string detalle = Double.Parse(quotePay).ToString();

                        namePeson = User.Identity.Name.Split('¬')[0].ToUpper();

                        //cvbc
                        string nameTicket = GetRecibo(tranferId, userName, numReceipt, date,
                                                      nAffiliate, TypeMembership, namePeson, hour, detalle,
                                                      quotesPendiente, " " + numCuota);

                        string EmailUserA = brPayments.PayQuoteMembership(data2, "1", nameTicket);
                        Response.Write("true¬" + culqiAnwser[1]);
                    }
                    else
                    {
                        Response.Write("false¬" + culqiAnwser[1]);
                    }
                    return;
                }
            }
            #endregion

            #region Solo elegio el kit

            if (typeRegister == 1 && formPay == 1)
            {
                string arrayKit = Session["arrayKit"].ToString() + "¬" + newUserName;
                //'2018-10-19¬31¬31¬31¬userName'
                //  isRegister = brUser.PutRegisterkIT(arrayKit);
                string data2 = Session["financedAmount"].ToString();
                if (data2 == "0")
                {
                    data2 = Session["Amount"].ToString();
                }

                string codeCurrency = Session["TypeCurrency"].ToString();

                Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data2, 1, codeCurrency);

                if (ansNmembershi != 0)
                {
                    isRegister = brUser.PutRegisterkIT(arrayKit, ansNmembershi);
                }
                else
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                //monto a pagar
                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                idMemberDetails             = int.Parse(username_idmen_amount_email[1]);
                amountPay                   = double.Parse(username_idmen_amount_email[2]);
                emailNewUser                = username_idmen_amount_email[3];
                username_idmen_amount_email = null;
            }
            #endregion

            #region Elegio kit mas membresia

            if (typeRegister == 2 && formPay == 1)
            {
                dataKitMember = Session["cronograma"].ToString();

                string[] datos = Session["datos"].ToString().Split('$');

                if (Session["datos"] == null)
                {
                    Response.Write("false¬Ha Ocurrido Un Error, no hay datos.");
                    return;
                }
                string[] arraycontacto = datos[3].Split('|');
                string[] arrayperson   = datos[0].Split('|');

                amountPay = double.Parse(Session["FirtsPay"].ToString());


                if (idMemberDetails <= 0 || amountPay <= 0)
                {
                    Response.Write("false¬Ha Ocurrido Un Error id idMemberDetails vacio,amountPay vacio");
                    return;
                }

                string dni = arrayperson[5];

                newUserName     = arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni;
                emailNewUser    = arraycontacto[0].Trim();
                codeCurrencyPay = Session["TypeCurrency"].ToString();


                PayCulqi   payCulqi   = new PayCulqi();
                MyMessages myMessages = new MyMessages();
                //string currencyCode = "PEN";
                string[] culqiAnwser = payCulqi.newPayment(newUserName, emailNewUser, amountPay, token, numberQuotes, codeCurrencyPay).Split('¬');
                if (culqiAnwser[0] == "false")
                {
                    Response.Write("false¬" + culqiAnwser[1]);
                    return;
                }



                /*=====================================================================================================================================================================*/

                //correo = arraycontacto[0];
                namePeson = arrayperson[0] + " " + arrayperson[1];


                string date = dataKitMember.Split('$')[1];

                string[] array1     = Session["cronogramaYa"].ToString().Split('^');
                string[] datosMem   = array1[0].Split('|');
                string[] array2     = array1[1].Split('~');
                string[] cuotas     = array2[0].Split('¬');
                string   cronoActiv = "";
                quotesPendiente = (cuotas.Length - 2).ToString();
                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 respData = brPayments.PersonGetData(newUserName);
                respData = respData + '^' + dataKitMember;
                // isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName);
                string data2        = Session["financedAmount"].ToString();
                string codeCurrency = Session["TypeCurrency"].ToString();

                Int32  ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + newUserName, data2, 1, codeCurrency);
                string exchange      = Session["carrito"].ToString().Split('|')[4];
                isRegister = brPayments.GetCalculatePaymentSchedule(respData, newUserName, ansNmembershi, exchange, 1);

                //validamos si tiene consumo


                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, newUserName, ansNmembershi);

                //obtengo el monto a pagar

                string[] username_idmen_amount_email = brUser.getAmountPay(newUserName).Split('¬');
                if (username_idmen_amount_email.Length < 4)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Obtener el monto a Pagar");
                    return;
                }
                idMemberDetails             = int.Parse(username_idmen_amount_email[1]);
                amountPay                   = double.Parse(username_idmen_amount_email[2]);
                emailNewUser                = username_idmen_amount_email[3];
                codeCurrencyPay             = username_idmen_amount_email[4];
                date                        = null;
                username_idmen_amount_email = null;
                dataKitMember               = null;
                respData                    = null;


                /*=============================================================================================================================*/

                var dateCurrent = DateTime.Now.ToString("yyyy-MM-dd").Split('-');;

                string tranferId    = culqiAnwser[2] == null ? "" : culqiAnwser[2];
                string numReceipt   = "0";
                string datecomplete = dateCurrent[2] + " de " + GetMonth(dateCurrent[1]) + " del " + dateCurrent[0];
                string nAffiliate   = "";

                string hour    = DateTime.Now.ToString("HH:mm:ss");
                string detalle = amountPay.ToString();


                //cvbc
                string nameTicket = GetRecibo(tranferId, newUserName, numReceipt, datecomplete, nAffiliate, TypeMembership, namePeson, hour, detalle, quotesPendiente, " Inicial 1");


                //marcar como pagado en la tabla membershipdetails
                bool habiliAccount = brUser.enableAcount(idMemberDetails, nameTicket);

                int nAfiliate = int.Parse(brUser.GetNafiliate(idMemberDetails));

                Cronograma2(nAfiliate, codeCurrencyPay);

                // enviar el email de confirmacion con la data y lo redirecciona al post register
                if (!habiliAccount)
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.Sin embargo su Pago fue Exitoso");
                    return;
                }


                string ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");
                //enviar email con los documentos
                if (typeRegister == 2 && formPay == 1)
                {
                    bool awnserEmailDoc = oEmail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta, newUserName);
                }
                else
                {
                    bool awnserEmailDoc = oEmail.SubmitEmailKit(emailNewUser, "[RIBERA DEL RIO - BIENVENIDO]", myMessages.DocumentosRegister(newUserName), true, ruta);
                }


                bool awnserEmail = oEmail.SubmitEmail(emailNewUser, "[RIBERA DEL RIO - PAGO]", myMessages.EmailPago());

                //ejecutamos el core para los puntos de equipo
                // BrCore_Automation brCore_Automation = new BrCore_Automation();
                //bool isCoreRegister = brCore_Automation.ExecuteCore();

                Response.Write("true¬" + culqiAnwser[1]);
                return;
            }
            #endregion
        }
Ejemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //declaracion de variables
            int        opcionRegister = 0;
            BrUser     brUser;
            BrPayments brPayments;

            string parameterToken = null;
            string oNumberQuotes  = null;

            this.NumberQuotes = int.Parse(Request["numcuotes"]);

            parameterToken    = Request["token"];
            oNumberQuotes     = Request["numcuotes"];
            this.NumberQuotes = int.Parse(Request["numcuotes"]);
            this.CodeIgnore   = 0;

            //string parameterToken = "";
            if (string.IsNullOrEmpty(parameterToken))
            {
                Response.Write("false¬Ha Ocurrido un Error Al Intentar Token");
                return;
            }
            if (string.IsNullOrEmpty(oNumberQuotes))
            {
                Response.Write("false¬Ha Ocurrido un Error,el numero de Cuotas es Invalido");
                return;
            }


            if (this.NumberQuotes < 1)
            {
                Response.Write("false¬Ha Ocurrido un Error,el numero de Cuotas es Invalido");
                return;
            }
            if (this.NumberQuotes > 32)
            {
                Response.Write("false¬Ha Ocurrido un Error,el numero de Cuotas es Invalido");
                return;
            }

            //Session["datos"] = "samir|torres|cuarto|15-04-2018|M|[email protected]|111112122212|ubigeo|1|20202020845454|EXP|knava|1|50|24";
            /*registes user and general account*/
            if (Session["datos"] != null)
            {
                //cuando va a registrar
                string dataBdd              = Session["datos"].ToString();
                string TypeMembership       = (dataBdd.Split('$')[3]).Split('|')[7];
                BrUser obrUser              = new BrUser();
                string data2                = (string)Session["civilState"];
                string idMembreship_amount  = obrUser.RegisterUser(dataBdd, data2);
                var    oIdMembreship_amount = idMembreship_amount.Split('¬');

                if (oIdMembreship_amount.Length < 2)
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar al Usuario");
                    return;
                }

                var parameterPerson = dataBdd.Split('$');

                var arraydata        = parameterPerson[0].Split('|');
                var arrayTypeaccount = parameterPerson[2].Split('|');
                var arrayaccount     = parameterPerson[3].Split('|');

                var arrayInfo = HttpContext.Current.User.Identity.Name.Split('¬');

                string padre = arrayInfo[0];
                if (arrayInfo.Length > 1)
                {
                    padre = arrayInfo[1];
                }/*merge*/

                string parameterAccount = arraydata[5].Trim() + "|" + arrayTypeaccount[7].Trim() + '|' + padre + '|' + oIdMembreship_amount[0];
                //'999999999999|1|sa|1'
                this.NewUserName = obrUser.GenerateAccount(parameterAccount);

                if (string.IsNullOrEmpty(this.NewUserName))
                {
                    Response.Write("false¬Ha Ocurrido Un Error al Intentar Generar la Cuenta de Usuario");
                    return;
                }

                brPayments = new BrPayments();

                //IdPerson | empty ^ amountDollars | changeTo | empty | empty | nQuote | InititalDate | InitalAmount | PercentInterest | default:1 | Empty ^ QuoteDate | InitalAmountQuote ~vvhvbnvbnvb|nvbnvbnvbnvb|1|6756575|67567567$2018-09-19
                var listParameters = HttpContext.Current.User.Identity.Name.Split('¬'); //fullName,userName

                var userName = listParameters[0];

                if (listParameters.Length > 1)
                {
                    userName = listParameters[1];
                }
                //sacar monto

                if (!string.IsNullOrEmpty((string)Session["SwitchAmort"]))
                {
                    var values      = (string)Session["dataAmort"];
                    var arrayValues = values.Split('|');
                    if (!string.IsNullOrEmpty(values))
                    {
                        brPayments = new BrPayments();
                        // (int TypePay, string IdMembershipDetail, int nQuotes, decimal NewAmort, int Rate)
                        bool ans = brPayments.Amortization(2, arrayValues[0], Int32.Parse(arrayValues[1]), decimal.Parse(arrayValues[2]), Int32.Parse(arrayValues[3]), "culqi");

                        Response.Redirect("Payments.aspx");
                        return;
                    }
                }
                else if (Session["cronograma"] != null)
                {
                    var  ej = Session["cronograma"].ToString();
                    bool registerCronograma = false;
                    //si es kit  inserte unico '2018-10-19¬31¬31¬31¬HOLA'

                    string fecha = ej.Split('$')[1];

                    //double amountKit = double.Parse("10");
                    //double tpKit = double.Parse(ej.Split('|')[1]);

                    //double totalKit = (amountKit * tpKit);
                    //string arrayKit = fecha + "¬" + totalKit.ToString() + "¬" + totalKit.ToString() + "¬" + totalKit.ToString() + "¬" + this.UserName;

                    //registerCronograma = brPayments.PutRegisterkIT(arrayKit);

                    //if (!registerCronograma)
                    //{
                    //    Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Kit de Inicio");
                    //    return;
                    //}
                    //var ej = "2500|3.25|VE034|VE035|23|2018-09-19|1944|10|1|obs^2018-09-19|1944~nombre|apellido|1|45345345|45345345$2018-10-19";
                    //1|EXP  ^6300.00|3.25|empty|empty|60|2018-10-17|2047.5|10|1|empty^2018-10-17|2047.5~Jose|dcvsdf|1966660000|966660000$2018-11-01
                    string respData = brPayments.PersonGetData(userName);  //1|EXP|knava vs|CLB^3000|3.2|VE034|VE035|24|2018-10-10|soles1000|10|1|obs^2018-10-11|1000~nombres|apellidos|1|73680066|963258741$2018-10-12
                    respData = respData + '^' + ej;
                    brUser   = new BrUser();
                    string data3 = Session["financedAmount"].ToString();
                    //  Int32 ansNmembershi = brUser.RegisterNmembership(TypeMembership + '|' + userName, data3);
                    // registerCronograma = brPayments.GetCalculatePaymentSchedule(respData, this.NewUserName, ansNmembershi);


                    if (!registerCronograma)
                    {
                        Response.Write("false¬Ha Ocurrido Un Error al Intentar Registrar el Cronograma de Pagos del Usuario");
                        return;
                    }

                    this.IsCronograma = 1;
                    // en el caso que tenga cronograma de pagos
                    BrUser brUser2 = new BrUser();
                    //this.UserName = "******";
                    //monto a pagar en el registro
                    this.username_idmen_amount_email = brUser2.getAmountPay(this.NewUserName).Split('¬');
                    //username¬amount¬email
                    brUser2 = null;

                    if (this.username_idmen_amount_email.Length < 4)
                    {
                        Response.Write("false¬Ha Ocurrido un Error al Intentar Verificar el Monto a Pagar");
                        return;
                    }

                    if (Session["exonerar"] != null)
                    {
                        if (Session["exonerar"].ToString() == "true")
                        {
                            this.Exonerar = 1;
                        }
                    }


                    var change = HttpContext.Current.User.Identity.Name.Split('¬')[5];
                    //le agrego el monto del kit
                    //username_idmen_amount_email[2] = (double.Parse(username_idmen_amount_email[2]) + (double.Parse("10") * double.Parse(change))).ToString();
                }
                else
                {
                    this.CodeIgnore = 1;
                }
                Email email2 = new Email();
                if (!email2.SubmitEmail(arrayaccount[0].Trim(), "[USUARIO_REGISTRADO]", "Tu usuario Es :" + this.NewUserName.ToUpper() + "\n" + "Tu contraseña es:" + this.NewUserName.ToUpper()))
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Enviarle un Email Con Sus Datos de su Cuenta");
                    return;
                }
                email2 = null;
            }
            else
            {
                if (Session["kit"] != null)
                {
                    this.CodeIgnore = 1;
                }
                else
                {
                    var login = HttpContext.Current.User.Identity.Name.Split('¬');
                    if (login.Length > 1)
                    {
                        this.IdMembreship = int.Parse(Session["numMembershipDet"].ToString());
                        BrUser brUser1 = new BrUser();
                        this.NewUserName = login[1];
                        this.username_idmen_amount_email = brUser1.getAmountPay(this.IdMembreship, this.NewUserName).Split('¬');
                        brUser1 = null;
                        if (this.username_idmen_amount_email.Length < 4)
                        {
                            Response.Write("false¬Ha Ocurrido un Error al Intentar Verificar el Monto a Pagar");
                            return;
                        }
                    }
                    else
                    {
                        Response.Write("false¬Intentelo mas Tarde");
                        return;
                    }
                }
            }
            /*end register user and general account*/


            /*page on line*/

            if (this.CodeIgnore == 0)
            {
                if (username_idmen_amount_email.Length < 4)
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Verificar el Monto a Pagar");
                    return;
                }
            }


            double monto = 0;

            //solo el kit
            if (this.CodeIgnore == 1)
            {
                monto = double.Parse("10") * double.Parse(Session["tipocambio"].ToString());
            }

            if (this.CodeIgnore == 0)
            {
                if (this.Exonerar != 1)
                {
                    monto = double.Parse(username_idmen_amount_email[2]) + (double.Parse("10") * double.Parse(Session["tipocambio"].ToString()));
                }

                else
                {
                    monto = double.Parse(username_idmen_amount_email[2]);
                }
            }


            PayCulqi payCulqi     = new PayCulqi();
            string   currencyCode = "PEN";

            string[] culqiAnwser = payCulqi.newPayment(this.NewUserName, "*****@*****.**", monto, parameterToken, this.NumberQuotes, currencyCode).Split('¬');


            string miemail = "";

            if (this.CodeIgnore == 1)
            {
                miemail = Session["email"].ToString();
            }
            else
            {
                miemail = username_idmen_amount_email[3];
                brUser  = new BrUser();
                bool habiliAccount = brUser.enableAcount(int.Parse(username_idmen_amount_email[1]), "");
                brUser = null;
                //enviar el email de confirmacion con la data y lo redirecciona al post register
                if (!habiliAccount)
                {
                    Response.Write("false¬Ha Ocurrido un Error al Intentar Habilitar Su Cuenta.");
                    return;
                }
            }

            Email email = new Email();

            if (email.SubmitEmail(miemail, "[RIBERA DEL RIO - PAGO]", "Ud. Ha efectuado su pago en Ribera del Rio con Exito."))
            {
                email = null;
                Response.Clear();
                Response.Write("true¬" + culqiAnwser[1]);
                Session["datos"] = null;
                return;
            }
            Response.Write("false");
            return;
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool   anwser = false;
            string ruta   = string.Empty;

            BrPayments brPayment = new BrPayments();
            //
            var _aux    = Request["action"];
            int _action = int.Parse(Request["action"].ToString());

            if (_action == 0)
            {
                var    _var = (Session["params"].ToString());
                string data = brPayment.getPayDetailByPerson(_var);
                Response.Write(data);
                return;
            }

            int    _id       = int.Parse(Request["id"]);
            string quote     = Request["quote"];
            string parameter = _action.ToString() + "|" + _id.ToString();

            BrInformacion brInformacion = new BrInformacion();

            string[] arrayData = brInformacion.GetBYIdMembershipDetail(_id).Split('|');

            string userName  = arrayData[0];
            string emailUser = arrayData[1];
            string name      = arrayData[2];
            string lastname  = arrayData[3];
            string gender    = arrayData[4];
            string codeMemb  = arrayData[5].Trim();

            auxidafi      = int.Parse(arrayData[6]);
            auxnameafi    = arrayData[7];
            auxmembership = arrayData[8];


            if (_action == 1)
            {
                BrMembershipPayDetail brMembershipPayDetail = new BrMembershipPayDetail();
                anwser = brMembershipPayDetail.EnableByInitial(parameter, quote);
                if (!anwser)
                {
                    Response.Write("false¬Ha Ocurrido un Error en cambiar el estado");
                    return;
                }

                //TODO: aqui se hace la actualizacion del rango
                anwser = brMembershipPayDetail.UpdateRange(userName);

                var isInitial = brMembershipPayDetail.GetDescriptionQuote(_id).Substring(0, 5);

                if (isInitial != "Cuota")
                {
                    ruta = HttpContext.Current.Server.MapPath("~/Resources/PoliticsPdf/");
                    int correlativo = 0;

                    BrTypeMembership brTypeMembership = new BrTypeMembership();
                    correlativo = int.Parse(brTypeMembership.GetTotalMemberships(userName));
                    correlativo--;

                    if (correlativo < 0)
                    {
                        correlativo = 0;
                    }

                    userName = userName + correlativo.ToString();

                    if (codeMemb == "KIT")
                    {
                        anwser = this.SendEmailKit(name, gender, userName, ruta, emailUser);
                    }
                    if (codeMemb == "EXP" || codeMemb == "LHT" || codeMemb == "STD" ||
                        codeMemb == "PLUS" || codeMemb == "TOP" || codeMemb == "VIT")
                    {
                        anwser = this.SendEmailClub(name, gender, userName, ruta, emailUser);
                    }
                    if (codeMemb == "EVOL" || codeMemb == "MVC")
                    {
                        anwser = this.SendEmailVacational(name, gender, userName, ruta, emailUser);
                    }
                    if (codeMemb == "SBY")
                    {
                        anwser = this.SendEmailFounder(name, gender, userName, ruta, emailUser);
                    }
                    if (!anwser)
                    {
                        Response.Write("false¬Ocurrio un error al envio de email.");
                        return;
                    }
                }
                Response.Write("true¬La Operacion se ha efectuado con exito");
                return;
            }

            //RECHAZAR
            if (_action == 3)
            {
                string messagge = "", subjet = "";
                BrMembershipPayDetail brMembershipPayDetail = new BrMembershipPayDetail();
                anwser = brMembershipPayDetail.EnableByInitial(parameter, "0");
                if (!anwser)
                {
                    Response.Write("false¬Ha Ocurrido un Error en cambiar el estado");
                    return;
                }
                messagge = "Su Recibo Fue rechazado.Por Favor subir un recibo valido.";
                subjet   = "[RIBERA DEL RIO - RECIBO RECHAZADO]";
                Email oemail = new Email();
                oemail.SendEmail(emailUser, subjet, messagge, false);
            }

            Response.Write("true¬La Operacion se ha efectuado con exito");
            return;
        }
Ejemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty((string)Session["datos"]))
                {
                    string nombre = "", dni = "", username = "", correo = "";

                    //Session["datos"] = "Aaaaa|Aaaa|birthDay|M|DocumentType|88884444$NombreC|ApellidoC|1|313231c$bankName|nombreBankAccount|TypeAccount|nroAccount|nroTaxer|SocialReason|fiscalAdress|[email protected]|nroCell|nroCell2|country|State|City|Adress";
                    //Session["carrito"] = "6000.00|descripcionDB|60|9750.00|3.25|10|TOP";
                    //Session["cronograma"] = "6000|222";

                    string[] datos = Session["datos"].ToString().Split('$');

                    string[] arraycontacto = datos[3].Split('|');
                    string[] arrayperson   = datos[0].Split('|');

                    correo   = arraycontacto[0];
                    nombre   = arrayperson[0] + " " + arrayperson[1];
                    dni      = arrayperson[5];
                    username = arrayperson[0].Substring(0, 1).ToUpper() + arrayperson[1].Substring(0, 1).ToUpper() + dni;

                    string fullname = arrayperson[0].Trim().ToLower() + " " + arrayperson[1].Trim().ToLower();
                    fullname = ToCapitalize(fullname);
                    string[] sepName    = arrayperson[0].Split(' ');
                    var      fName      = ToCapitalize(sepName[0]);
                    var      bienvenido = "Bienvenido";
                    if (arrayperson[3] == "F")
                    {
                        bienvenido = "Bienvenida";
                    }

                    var cuerpo = "<html><head><title></title></head><body style='color:black'>";

                    cuerpo += "<div style='width: 100%'>";
                    cuerpo += "<div style='display:flex;'>";
                    cuerpo += "<div style='width:50%;'>";
                    cuerpo += " <img src='http://www.inresorts.club/Views/img/novologo.png' align='left' style='width: 98px;'>";
                    cuerpo += "</div>";
                    cuerpo += "<div style='width:50%;'>";
                    cuerpo += "<img src='http://cieneguillariberadelrio.com/riberadelrio/img/image006.png' align='right' style='width: 120px;padding-top: 7px;'>";
                    cuerpo += "</div>";
                    cuerpo += "</div>";

                    cuerpo += "<img style='width: 100%' src='http://www.inresorts.club/Views/img/fondo.png'>";
                    cuerpo += "<h1 style='margin-top: 2px ;text-align: center;font-weight: bold;font-style: italic;'>" + bienvenido + " " + fName + "</h1>";
                    cuerpo += "<h2 style='text-align: center;'>Estamos Validando tu comprobante, se te estará enviando tus credenciales dentro de las proximas 24 horas.</h2>";
                    cuerpo += "<center><p style='margin-left: 10%;margin-right: 10%;'> </p></center> ";
                    cuerpo += "";
                    //cuerpo += "<div style='width: 100%'>";
                    //cuerpo += "<p style='margin-left: 10%;margin-right: 10%; '> </p>";
                    //cuerpo += "<a href='http://www.inresorts.club'>";
                    //cuerpo += "<center><img src='http://www.inresorts.club/Views/img/recibo.png' align='left' style='width: 100%'></center>";
                    //cuerpo += "</a></div>";

                    cuerpo += "<div style='margin-left: 0%;'>";
                    cuerpo += "<p style=''>Saludos Cordiales</p><p  style=''>Equipo inResorts</p> <p  style=''></p></div>";
                    //cuerpo += "<div style='margin: 5%; width: 70%;background-image: url('https://lh3.googleusercontent.com/NSDQDl8ytJrWSwMe0b3b9DlxubIal-RBEPIWI1a-15f9ynEGQ9eYjTnm-PVqst26f4KJThmjOEPK4lcVoaUw=w1016-h917-rw');'></ div > ";
                    cuerpo += "<img style='width: 100%' src='https://www.inresorts.club/views/img/fondo.png'>";
                    cuerpo += "</div>";

                    cuerpo += "</body>";
                    cuerpo += "</html>";

                    Email email = new Email();
                    bool  ssa   = email.SubmitEmail(correo, "[Ribera del Rio - Inresorts, Registro en Proceso] ", cuerpo);

                    string correoOamr = "*****@*****.**";
                    ssa = email.SubmitEmail(correoOamr, "[Ribera del Rio - Inresorts, Registro en Proceso] ", cuerpo);
                    Session.Contents.RemoveAll();
                }
            }
            else if (Session["SwitchEmailPayQuote"] != null && (string)Session["SwitchEmailPayQuote"] == "1")
            {
                var    calendar       = (string)Session["StatusCalendar"];
                var    data           = (string)Session["StatusCalendar"];
                var    listParameters = data.Split('|');
                var    data2          = listParameters[0];
                string quotePay       = (string)Session["quotePay"];
                brPayments = new BrPayments();
                string EmailUser = brPayments.PayQuoteMembership(data2, "0", "recibo.png");
            }
            else
            {
                Response.Redirect("Index.aspx");
            }
            Session.RemoveAll();

            Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
            Response.Cache.SetAllowResponseInBrowserHistory(false);
            Response.Cache.SetNoStore();
            Session.Clear();
        }
Ejemplo n.º 27
0
        protected void btnEnviarAhora_Click(object sender, EventArgs e)
        {
            var data = (string)Session["dataQuote"];

            if (!string.IsNullOrEmpty(data))
            {
                string IdMembershipPayDetail = data.Split('|')[0];
                var    log  = HttpContext.Current.User.Identity.Name.Split('¬');
                string User = log[1];
                if (!string.IsNullOrEmpty(IdMembershipPayDetail))
                {
                    // string[] parameterPerson = dataPerson.Split('$');
                    // string[] arraydata = parameterPerson[0].Split('|');
                    string[] arraynombreArchivo2 = fuRecibo.FileName.Split('.');

                    int indice = (arraynombreArchivo2.Length - 1);

                    string extension = arraynombreArchivo2[indice];

                    string nombreArchivo = User + "." + extension;

                    brUser = new BrUser();
                    var nroDoc = brUser.getDoc(log[1]);
                    int id     = int.Parse(Session["IdImg"].ToString());
                    nombreArchivo = nroDoc + id.ToString() + "." + extension;

                    string ruta = "~/Resources/RecibosRegister/" + nombreArchivo;
                    fuRecibo.SaveAs(Server.MapPath(ruta));
                    brPayment = new BrPayments();
                    bool ans = brPayment.UploadReceiptCalendar(IdMembershipPayDetail + '|' + nombreArchivo);
                    if (ans)
                    {
                        Session["SwitchEmailPayQuote"] = "1";
                        Response.Redirect("EndPaymentQuote.aspx");
                    }
                    else
                    {
                        Response.Redirect("Index.aspx");
                    }
                }
                else
                {
                    Response.Redirect("Index.aspx");
                }
            }
            else
            {
                var values = (string)Session["dataAmort"];

                if (!string.IsNullOrEmpty(values))
                {
                    var arrayValues = values.Split('|');
                    brPayment = new BrPayments();
                    // (int TypePay, string IdMembershipDetail, int nQuotes, decimal NewAmort, int Rate)
                    string[] arraynombreArchivo2 = fuRecibo.FileName.Split('.');
                    var      log       = HttpContext.Current.User.Identity.Name.Split('¬');
                    string   User      = log[1];
                    int      indice    = (arraynombreArchivo2.Length - 1);
                    string   extension = arraynombreArchivo2[indice];

                    brUser = new BrUser();
                    var    nroDoc        = brUser.getDoc(log[1]);
                    int    id            = int.Parse(Session["IdImg"].ToString());
                    string nombreArchivo = nroDoc + id.ToString() + "." + extension;

                    //string nombreArchivo = arraynombreArchivo2[0] + "." + extension;
                    string ruta = "~/Resources/RecibosRegister/" + nombreArchivo;

                    fuRecibo.SaveAs(Server.MapPath(ruta));
                    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;
                }
            }
        }