Exemplo n.º 1
0
        public JsonResult GetAsegurado(string rfc, string razonSocial)
        {
            string id = string.Empty, mensaje = string.Empty;

            Regex regex = new Regex(@"^([A-ZÑ\x26]{3,4}([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[A-Z|\d]{3})$");
            Match match = regex.Match(rfc.ToUpper());

            if (!match.Success)
            {
                mensaje = MessagesValidation.Error(Messages.dataFormat_Error).ToString();
            }

            if (string.IsNullOrEmpty(mensaje))
            {
                Asegurado a = _AseguradoService.FindwsAseguradobyRFC(rfc, Helper.GetUserData().UserId);
                if (a == null)
                {
                    id = "0";
                }
                else
                {
                    id = a.AseguradoID.ToString();
                }
            }

            Session["AseguradoID"] = id;

            return(this.Json(new { id = id, error = mensaje }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult LogSISE()
        {
            if (Session["cotizacionID"] != null)
            {
                int cotizacionID = (int)Session["cotizacionID"];
                ViewBag.UbicacionList        = _AseguradoService.FindCatalogoUbicaciones(cotizacionID);
                ViewBag.TipoBeneficiarioList = _CatalogoService.AllTableData((int)enumTable.TipoBeneficiario);
                ViewBag.BeneficiariosNumber  = _AseguradoService.GetNumberBenefbyCotizacion(cotizacionID);
                ViewBag.RFC = _CotizacionService.FindRFCCotizacionbyID(cotizacionID);

                Cotizacion cot = _CotizacionService.FindCotizacionLogbyID(cotizacionID);
                if (cot.bk_te_CotizacionLog.ToList().Exists(x => x.isOK.Value))
                {
                    ViewBag.isEnable = false;
                }
                else
                {
                    ViewBag.isEnable = true;
                }


                ViewBag.ListaAseguradoDiferencias = _AseguradoService.GetDiferenciaAsegurado(cot.AseguradoID);
                ViewBag.ErrorNroBeneficiarios     = MessagesValidation.Error(cot.ErrorMaxBeneficiario());
                return(View(cot));
            }
            return(View());
        }
Exemplo n.º 3
0
        public JsonResult ProcessSendSISE()
        {
            string mensaje = MessagesValidation.Error(Resources.Messages.sesion_error).ToString();

            if (Session["cotizacionID"] != null)
            {
                mensaje = _ProcessService.ProcessSISE((int)Session["cotizacionID"], Helper.GetUserData().UserId);
                mensaje = MessagesValidation.Successful(mensaje).ToString();
            }

            return(this.Json(mensaje, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public JsonResult GetListAsegurados(string rfc, string razonSocial, string nombre, string apellido1, string apellido2)
        {
            string mensaje = string.Empty;
            string datos   = string.Empty;

            if (string.IsNullOrEmpty(rfc) && string.IsNullOrEmpty(razonSocial) && string.IsNullOrEmpty(nombre) && string.IsNullOrEmpty(apellido1) && string.IsNullOrEmpty(apellido2))
            {
                mensaje = Resources.Messages.EmptyFilter_error;
            }

            if (string.IsNullOrEmpty(mensaje))
            {
                //old
                //List<Asegurado> cot = _AseguradoService.FindAseguradobyFiltro(rfc, razonSocial, nombre, apellido1, apellido2);
                //datos = Render.RenderRazorViewToString(this, "Templates/ListaAsegurados", _AseguradoService.FindAseguradobyFiltro(rfc, razonSocial, nombre, apellido1, apellido2));

                //200928 - rbaeza - test
                var datosAseguradoWS            = WsConsultaPersona.datosAseguradoWS(rfc);
                List <Asegurado> datosAsegurado = new List <Asegurado>();
                //Comparación de datos provenientes del servicio vs los datos de la BD
                if (datosAseguradoWS.PerCod > 0)
                {
                    datosAsegurado.Add(new Asegurado
                    {
                        Nombres       = datosAseguradoWS.Asegurado[0].AseNom.ToString(),
                        Apellido1     = datosAseguradoWS.Asegurado[0].AseNomEx.ToString(),
                        Apellido2     = datosAseguradoWS.Asegurado[0].AseNomEx2.ToString(),
                        AseguradoID   = datosAseguradoWS.Asegurado[0].AseCod,                     //Revisar a qué se refiere el campo AseCod
                        CURP          = "",                                                       //Pendiente por revisar ya que no hay un campo explícito para el CURP en la respuesta del ws
                        TipoPersonaID = Int32.Parse(datosAseguradoWS.PerTipPer.ToString()),       //Revisar a qué se refiere el campo PerTipPer
                        CodigoPostal  = datosAseguradoWS.Direccion[0].PerLocaliMex[0].ToString(), //revisar si el código postal siempre viene separado por coma al final del campo PerLocaliMex
                        Cod_colonia   = datosAseguradoWS.Direccion[0].PerDomici[0].ToString(),
                        RFC           = datosAseguradoWS.RFC.ToString(),
                        RazonSocial   = datosAseguradoWS.PerNom.ToString() //,
                                                                           //SIC = //Revisar qué es?
                    }
                                       );
                }
                else
                {
                    //Busca datos en BD
                    datosAsegurado = _AseguradoService.FindAseguradobyFiltro(rfc, razonSocial, nombre, apellido1, apellido2);
                }

                datos = Render.RenderRazorViewToString(this, "Templates/ListaAsegurados", datosAsegurado);
            }
            else
            {
                mensaje = MessagesValidation.Error(mensaje).ToString();
            }

            return(this.Json(new { datos = datos, mensaje = mensaje }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public JsonResult AddAccion(int rolID, int accionID)
        {
            int    codigoMensaje = 0;
            string mensaje       = string.Empty;

            codigoMensaje = _AccountService.AddAccionbyRolID(rolID, accionID);

            if (codigoMensaje == 0)
            {
                mensaje = MessagesValidation.Error(Messages.EmptyData_error).ToString();
            }

            return(this.Json(new { mensaje = mensaje, codigo = codigoMensaje }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public JsonResult SavePagador(int cod_conducto, string cod_banco, int ind_conducto, string rfc, string nroTarjeta, string nombre)
        {
            CotizacionPagador cotizacionPagador = new CotizacionPagador();

            cotizacionPagador.CotizacionID     = (int)Session["cotizacionID"];
            cotizacionPagador.COD_CONDUCTO     = cod_conducto.ToString();
            cotizacionPagador.COD_BANCO_EMI    = cod_banco;
            cotizacionPagador.SISEind_conducto = ind_conducto;
            cotizacionPagador.RFC        = rfc;
            cotizacionPagador.NroTarjeta = nroTarjeta;
            cotizacionPagador.nombre     = nombre;

            _CotizacionService.SaveCotizacionPagador(cotizacionPagador);

            return(this.Json(new { datos = cotizacionPagador, mensaje = MessagesValidation.Successful(Resources.Messages.successful_general).ToString() }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 7
0
        public ActionResult Index(string id, string rfc)
        {
            ViewBag.SICDivisionList = _CatalogoService.AllSICDivisiones();

            if (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(rfc))
            {
                id = Session["AseguradoID"].ToString();
            }

            int i;

            if (int.TryParse(id, out i))
            {
                Asegurado asegurado;

                if (i == 0 && rfc == null)
                {
                    return(RedirectToAction("List"));
                }

                if (i == 0 && (rfc.Length == 13 || rfc.Length == 12))
                {
                    asegurado = new Asegurado(rfc.ToUpper());
                }
                else
                {
                    asegurado = _AseguradoService.FindAseguradobyID(i);
                    Session["AseguradoID"] = i;
                }

                if (asegurado == null)
                {
                    return(View());
                }

                asegurado.TipoPersonaList  = new SelectList(_CatalogoService.AllTipoPersonas(), "TipoPersonaID", "Descripcion");
                asegurado.GeneroList       = new SelectList(_CatalogoService.AllGeneros(), "GeneroID", "nombre");
                asegurado.EstadoCivilList  = new SelectList(_CatalogoService.AllEstadoCiviles(), "EstadoCivilID", "Descripcion");
                asegurado.TipoTelefonoList = new SelectList(_CatalogoService.AllTipoTelefonos(), "TipoTelefonoID", "Descripcion");
                ViewBag.OFAC = MessagesValidation.Error(asegurado.ErrorOFAC());

                return(View(asegurado));
            }

            return(View());
        }
Exemplo n.º 8
0
        public ActionResult Index(Asegurado asegurado, string colonia)
        {
            asegurado.TipoPersonaList  = new SelectList(_CatalogoService.AllTipoPersonas(), "TipoPersonaID", "Descripcion");
            asegurado.GeneroList       = new SelectList(_CatalogoService.AllGeneros(), "GeneroID", "nombre");
            asegurado.EstadoCivilList  = new SelectList(_CatalogoService.AllEstadoCiviles(), "EstadoCivilID", "Descripcion");
            asegurado.TipoTelefonoList = new SelectList(_CatalogoService.AllTipoTelefonos(), "TipoTelefonoID", "Descripcion");
            ViewBag.SICDivisionList    = _CatalogoService.AllSICDivisiones();
            ViewBag.OFAC = MessagesValidation.Error(asegurado.ErrorOFAC());

            int coloniaID;

            if (!Int32.TryParse(colonia, out coloniaID))
            {
                ModelState.Remove("ColoniaID");
                ModelState.AddModelError("ColoniaID", "La Colonia es requerida");
            }

            int ofac = _AseguradoService.BuscarOFAC(asegurado);

            if (ofac == 1)
            {
                ModelState.Remove("AseguradoID");
                ModelState.AddModelError("AseguradoID", "OFAC!!!");
            }
            if (ofac == -1)
            {
                ModelState.Remove("AseguradoID");
                ModelState.AddModelError("AseguradoID", "ERROR OFAC!!!");
            }



            if (ModelState.IsValid)
            {
                asegurado.usuarioid = Helper.GetUserData().UserId;
                asegurado.ColoniaID = coloniaID;
                _AseguradoService.SavewsAsegurado(asegurado);
                Session["AseguradoID"] = asegurado.AseguradoID;

                ViewBag.Mensaje = Resources.Messages.successful_general;
            }

            return(View(asegurado));
        }
Exemplo n.º 9
0
        public JsonResult SaveBeneficiarios(string[] datos, int ubicacionID)
        {
            Persona persona  = new Persona();
            string  mensaje  = persona.VectorValidation(datos);
            int     nroBenef = 0;

            if (String.IsNullOrEmpty(mensaje))
            {
                _AseguradoService.SavePersona(persona.PersonaToXML(datos), (int)Session["cotizacionID"], ubicacionID);
                mensaje  = MessagesValidation.Successful(Resources.Messages.successful_general).ToString();
                nroBenef = _AseguradoService.GetNumberBenefbyCotizacion((int)Session["cotizacionID"]);
            }
            else
            {
                mensaje = MessagesValidation.Error(mensaje).ToString();
            }

            return(this.Json(new { Mensaje = mensaje, NroBenef = nroBenef }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 10
0
        public JsonResult DeleteAccion(int rolID, string[] valores)
        {
            Accion accion        = new Accion();
            string mensaje       = accion.VectorValidation(valores);
            int    codigoMensaje = 0;

            if (string.IsNullOrEmpty(mensaje))
            {
                _AccountService.DeleteAccionbyRolID(rolID, accion.VectorToXML(valores).InnerXml);
                codigoMensaje = 1;
                //mensaje = MessagesValidation.Successful(Resources.Messages.successful_general).ToString();
            }
            else
            {
                mensaje = MessagesValidation.Error(mensaje).ToString();
            }

            return(this.Json(new { mensaje = mensaje, codigo = codigoMensaje }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 11
0
        public JsonResult GetListCotizaciones(string vigenciaInicio, string vigenciaFin, string rfc)
        {
            string              mensaje = string.Empty;
            string              datos = string.Empty;
            DateTime            inicio, fin;
            Nullable <DateTime> param1 = null, param2 = null;

            if (!string.IsNullOrEmpty(vigenciaInicio))
            {
                if (!DateTime.TryParseExact(vigenciaInicio, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out inicio))
                {
                    mensaje = "- Vigencia Inicio -> " + Resources.Messages.date_error;
                }
                else
                {
                    param1 = inicio;
                }
            }

            if (!string.IsNullOrEmpty(vigenciaFin))
            {
                if (!DateTime.TryParseExact(vigenciaFin, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out fin))
                {
                    mensaje = mensaje + " - Vigencia Fin -> " + Resources.Messages.date_error;
                }
                else
                {
                    param2 = fin;
                }
            }

            if (string.IsNullOrEmpty(mensaje))
            {
                //List<Cotizacion> cot = _CotizacionService.FindCotizacionesbyFiltro(param1, param2, rfc, Helper.GetUserData().UserId);
                datos = Render.RenderRazorViewToString(this, "Templates/ListaCotizaciones", _CotizacionService.FindCotizacionesbyFiltro(param1, param2, rfc, Helper.GetUserData().UserId, null, null));
            }
            else
            {
                mensaje = MessagesValidation.Error(mensaje).ToString();
            }

            return(this.Json(new { datos = datos, mensaje = mensaje }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 12
0
 public virtual void Clear()
 {
     MessagesValidation.Clear();
     ValidationVisible = false;
 }