예제 #1
0
        public ActionResult Cobranza(ListaCobranza modelo)
        {
            ViewBag.cedula  = modelo.StrDocumento;
            ViewBag.nombre  = modelo.StrNombre;
            ViewBag.saldo   = modelo.CurSaldo;
            ViewBag.campana = modelo.StrCampaña;
            ViewBag.puntos  = modelo.NumPuntos;

            var usuario = Session["Usuario"].ToString();

            modelo.StrEmail = usuario;

            var vc = new Clases.VisitasDao();

            var res = vc.AddCobranza(modelo, out _strMensaje);

            if (res)
            {
                ViewBag.mensaje = _strMensaje;
                //return RedirectToAction("Index", "Visitas");
            }
            else
            {
                ViewBag.Error = _strMensaje;
            }

            return(View());
        }
예제 #2
0
        public bool AddCobranza(ListaCobranza modelo, out string strMensaje)
        {
            try
            {
                var parametros = new List <SqlParameter>()
                {
                    new SqlParameter("@strEmail", modelo.StrEmail),
                    new SqlParameter("@idTipoVisita", TpVisitas.Cobranza),
                    new SqlParameter("@strDocumento", modelo.StrDocumento),
                    new SqlParameter("@strNombre", modelo.StrNombre),
                    new SqlParameter("@strObservacion", modelo.StrObservacion)
                };

                var mensaje = new SqlParameter("@strMensaje", SqlDbType.VarChar, 100)
                {
                    Direction = ParameterDirection.Output
                };
                var respuesta = new SqlParameter("@logRespuesta", SqlDbType.Bit)
                {
                    Direction = ParameterDirection.Output
                };
                var id = new SqlParameter("@numCodigo", SqlDbType.BigInt)
                {
                    Direction = ParameterDirection.Output
                };

                parametros.Add(mensaje);
                parametros.Add(respuesta);
                parametros.Add(id);

                var res = _datahelper.EjecutarSp <bool>("sp_vtAddVisitasMobil", parametros);

                if (res)
                {
                    strMensaje = mensaje.Value.ToString();
                    return(Convert.ToBoolean(respuesta.Value));
                }
                else
                {
                    strMensaje = "No hay conexion con el servidor";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strMensaje = ex.Message;
                return(false);
            }
        }