Exemple #1
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;
        }