コード例 #1
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);
        }