public void setDatosProfesor(SessionDB session, EstadodeCuentaWebModel model)
        {
            if (sesion.tipouser == 'P' || sesion.tipouser == 'E')
            {
                //sesion.vdata["ID_PERSONA"] = sesion.pkUser.ToString();
                if (sesion.vdata["HmeAclzn"] == "No")
                {
                    sesion.vdata["Sede"] = model.GetSede(sesion.vdata["IDSIU"]);
                }
                sesion.vdata["ID_PERSONA"] = model.GetIdPersona(sesion.vdata["IDSIU"], sesion.vdata["Sede"]).ToString();
                model.ID_PERSONA           = sesion.vdata["ID_PERSONA"];
                //string sql = "SELECT IDSIU FROM PERSONAS WHERE ID_PERSONA = '" + model.ID_PERSONA + "'";

                //ResultSet res = db.getTable(sql);
                //if (res.Next())
                //    sesion.vdata["IDSIU"] = res.Get("IDSIU");

                //sql = "SELECT TOP 1 CVE_SEDE  FROM ESTADODECUENTA WHERE ID_PERSONA = " + sesion.pkUser + " ORDER BY FECHA_R";
                //sql = "SELECT TOP 1 CVE_SEDE  FROM ESTADODECUENTA WHERE ID_PERSONA = " + model.ID_PERSONA + " ORDER BY FECHA_R";
                //res = db.getTable(sql);
                //if (res.Next())
                //    sesion.vdata["Sede"] = res.Get("CVE_SEDE");
                //else
                //    sesion.vdata["Sede"] = "UAN";
            }

            model.IDSIU      = sesion.vdata["IDSIU"];
            model.Sede       = sesion.vdata["Sede"];
            model.ID_PERSONA = sesion.vdata["ID_PERSONA"];

            model.GetDatos();
        }
        public ActionResult Contratos()
        {
            if ((sesion = SessionDB.start(Request, Response, false, db)) == null)
            {
                return(Content("-1"));
            }

            try
            {
                Main view = new Main();
                ViewBag.MainUser = this.CreateMenuInfoUser(sesion);

                Scripts.SCRIPTS = new string[]
                {
                    "js/Pagos/EstadodeCuentaWeb/Contratos.js",
                };

                ViewBag.Scripts = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion);

                EstadodeCuentaWebModel model = new EstadodeCuentaWebModel();
                this.setDatosProfesor(sesion, model);

                // Datos persona
                model.GetDatos();
                ViewBag.Profesor = model.Profesor;

                // Datos fiscales
                model.GetDatosFiscales();

                if (model.Email_Sociedad == "")
                {
                    ViewBag.Email_Sociedad = "*****@*****.**";
                }
                else
                {
                    ViewBag.Email_Sociedad = model.Email_Sociedad;
                }

                /*if (sesion.tipouser == 'U')
                 *  ViewBag.SEDES = view.createSelectSedes("Sedes", sesion);
                 * else*/
                ViewBag.SEDES = view.createSelectSedesWeb("Sedes", sesion, model.ID_PERSONA);

                sesion.saveSession();

                ViewBag.Table_Contratos = model.GetContratos(Request);

                Log.write(this, "Start", LOG.CONSULTA, "Ingresa Pantalla Estado de cuenta Web", sesion);
            }
            catch (Exception e)
            {
                ViewBag.Notification = Notification.Error(e.Message);
                Log.write(this, "Start", LOG.ERROR, "Ingresa Pantalla Estado de cuenta Web" + e.Message, sesion);  //MODIFICAR LA REFERENCIA DE LA PAGINA A INGRESAR
            }
            return(View(Factory.View.Access + "Pagos/EstadodeCuentaWeb/Contratos.cshtml"));
        }
        public ActionResult ConstanciasRetencion()
        {
            if ((sesion = SessionDB.start(Request, Response, false, db)) == null)
            {
                return(Content("-1"));
            }

            try
            {
                Main view = new Main();
                ViewBag.MainUser = this.CreateMenuInfoUser(sesion);
                Scripts.SCRIPTS  = new string[]
                {
                    "js/Pagos/EstadodeCuentaWeb/ECW_RetencionesMensuales.js"
                };

                ViewBag.Scripts = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion);

                EstadodeCuentaWebModel model = new EstadodeCuentaWebModel();

                this.setDatosProfesor(sesion, model);

                // Datos persona
                model.GetDatos();
                ViewBag.Profesor = model.Profesor;

                /* if (sesion.tipouser == 'U')
                 *   ViewBag.SEDES = view.createSelectSedes("Sedes", sesion);
                 * else*/
                ViewBag.SEDES = view.createSelectSedesWeb("Sedes", sesion, model.ID_PERSONA);

                sesion.vdata["CVE_TIPOFACTURA"] = model.CveTipoFactura;
                sesion.saveSession();

                ViewBag.ConstanciasRetencionMensual = model.ConstanciasRetencionMensual(Request);

                Log.write(this, "Start", LOG.CONSULTA, "Ingresa Pantalla Estado de cuenta Web", sesion);
            }
            catch (Exception e)
            {
                ViewBag.Notification = Notification.Error(e.Message);
                Log.write(this, "Start", LOG.ERROR, "Ingresa Pantalla Estado de cuenta Web" + e.Message, sesion);  //MODIFICAR LA REFERENCIA DE LA PAGINA A INGRESAR
            }
            return(View(Factory.View.Access + "Pagos/EstadodeCuentaWeb/ConstanciasRetencion.cshtml"));
        }
        public ActionResult Perfil2_(EstadodeCuentaWebModel model)
        {
            if ((sesion = SessionDB.start(Request, Response, false, db, SESSION_BEHAVIOR.AJAX)) == null)
            {
                return(Content("-1"));
            }

            this.setDatosProfesor(sesion, model);

            sesion.vdata["Sede"] = Request.Params["filter_Sede"];
            model.Sede           = sesion.vdata["Sede"];

            model.GetDatos();
            model.GetDatosFiscales();

            sesion.vdata["CVE_TIPOFACTURA"] = model.CveTipoFactura;
            sesion.saveSession();

            return(Json(new
            {
                Profesor = model.Profesor,
                NoCuenta = model.NoCuenta,
                Banco = model.Banco,
                RFC = model.RFC,
                Direccion = model.Direccion,
                Fis_Sede = model.Sede,
                Fis_RecibiDe = model.Fis_Recibide,
                Fis_RFC = model.Fis_RFC,
                Fis_Domicilio = model.Fis_Domicilio,
                Fis_Concepto = model.Fis_Concepto,
                IDSIU = model.IDSIU,
                pensiones = model.GetPensiones(),
                CuentaClabe = model.CuentaClabe,
                Email_Sociedad = model.Email_Sociedad,
            }));
        }
        public ActionResult Home()
        {
            if ((sesion = SessionDB.start(Request, Response, false, db)) == null)
            {
                return(Content("-1"));
            }
            try
            {
                Main view = new Main();
                EstadodeCuentaWebModel model = new EstadodeCuentaWebModel();

                Scripts.SCRIPTS = new string[]
                {
                    "js/Pagos/EstadodeCuentaWeb/ECW_Contratos.js"
                };

                ViewBag.Scripts = Scripts.addScript() + Scripts.setPrivileges(Privileges, sesion);

                sesion.vdata["HmeAclzn"] = "No";
                this.setDatosProfesor(sesion, model);

                // Datos persona
                model.GetDatos();
                sesion.vdata["ID_PERSONA"] = model.ID_PERSONA;
                ViewBag.Profesor           = model.Profesor;
                ViewBag.IDSIU       = model.IDSIU;
                ViewBag.NoCuenta    = model.NoCuenta;
                ViewBag.CuentaClabe = model.CuentaClabe;
                ViewBag.Banco       = model.Banco;
                ViewBag.RFC         = model.RFC;

                // Datos fiscales
                model.GetDatosFiscales();
                ViewBag.Fis_Sede      = model.Sede;
                ViewBag.Fis_RecibiDe  = model.Fis_Recibide;
                ViewBag.Fis_RFC       = model.Fis_RFC;
                ViewBag.Fis_Domicilio = model.Fis_Domicilio;
                ViewBag.Fis_Concepto  = model.Fis_Concepto;

                ViewBag.Email_Sociedad = model.Email_Sociedad;

                ViewBag.SEDES = view.createSelectSedesWeb("Sedes", sesion, model.ID_PERSONA);

                sesion.vdata["CVE_TIPOFACTURA"] = model.CveTipoFactura;
                sesion.saveSession();

                //Intercom
                ViewBag.User     = sesion.nickName.ToString();
                ViewBag.Email    = sesion.nickName.ToString();
                ViewBag.FechaReg = DateTime.Today;

                //cuenta
                if (!string.IsNullOrWhiteSpace(model.NoCuenta))
                {
                    if (model.VerificarCuenta())
                    {
                        ViewBag.casilla_valida     = "<input type=\"checkbox\" id=\"valida_check\" checked disabled/>";
                        ViewBag.boton_validacuenta = "<button type = 'button' id = \"btn_valida\" class='btn btn-sm btn-success' onclick=\"validaCuenta();\" disabled>Verificado</button>";
                    }
                    else
                    {
                        ViewBag.casilla_valida     = "<input type=\"checkbox\" id=\"valida_check\"/>";
                        ViewBag.boton_validacuenta = "<button type = 'button' id = \"btn_valida\" class='btn btn-sm btn-success' onclick=\"validaCuenta();\">Verificar</button>";
                    }
                }
                else
                {
                    ViewBag.casilla_valida     = "<input type=\"checkbox\" id=\"valida_check\" disabled/>";
                    ViewBag.boton_validacuenta = "<button type = 'button' id = \"btn_valida\" class='btn btn-sm btn-success' onclick=\"validaCuenta();\" disabled>Verificar</button>";

                    // limpiar validacuenta** y poner en 0
                    model.validaCuenta_2();
                }

                this.getPagosDashboardPagos(model);

                Log.write(this, "Start", LOG.CONSULTA, "Ingresa Pantalla Estado de cuenta Web", sesion);
            }
            catch (Exception e)
            {
                ViewBag.Notification = Notification.Error(e.Message);
                Log.write(this, "Start", LOG.ERROR, "Ingresa Pantalla Estado de cuenta Web" + e.Message, sesion);  //MODIFICAR LA REFERENCIA DE LA PAGINA A INGRESAR
            }
            return(View(Factory.View.Access + "Pagos/EstadodeCuentaWeb/Home.cshtml"));
        }