Пример #1
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*/
        }