Beispiel #1
0
    public static string EditarTiempoEntrega(Dictionary <string, object> pTiempoEntrega)
    {
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();

        CTiempoEntrega TiempoEntrega = new CTiempoEntrega();

        TiempoEntrega.IdTiempoEntrega = Convert.ToInt32(pTiempoEntrega["IdTiempoEntrega"]);;
        TiempoEntrega.TiempoEntrega   = Convert.ToString(pTiempoEntrega["TiempoEntrega"]);

        string validacion = ValidarTiempoEntrega(TiempoEntrega, ConexionBaseDatos);

        JObject oRespuesta = new JObject();

        if (validacion == "")
        {
            TiempoEntrega.Editar(ConexionBaseDatos);
            oRespuesta.Add(new JProperty("Error", 0));
            ConexionBaseDatos.CerrarBaseDatosSqlServer();
        }
        else
        {
            oRespuesta.Add(new JProperty("Error", 1));
            oRespuesta.Add(new JProperty("Descripcion", validacion));
        }
        return(oRespuesta.ToString());
    }
Beispiel #2
0
    public static string ObtenerFormaEditarTiempoEntrega(int IdTiempoEntrega)
    {
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        JObject   oRespuesta        = new JObject();
        JObject   oPermisos         = new JObject();
        CUsuario  Usuario           = new CUsuario();

        oPermisos.Add("puedeEditarTiempoEntrega", puedeEditarTiempoEntrega);

        if (respuesta == "Conexion Establecida")
        {
            JObject        Modelo        = new JObject();
            CTiempoEntrega TiempoEntrega = new CTiempoEntrega();
            TiempoEntrega.LlenaObjeto(IdTiempoEntrega, ConexionBaseDatos);
            Modelo.Add(new JProperty("IdTiempoEntrega", TiempoEntrega.IdTiempoEntrega));
            Modelo.Add(new JProperty("TiempoEntrega", TiempoEntrega.TiempoEntrega));
            Modelo.Add(new JProperty("Permisos", oPermisos));
            oRespuesta.Add(new JProperty("Error", 0));
            oRespuesta.Add(new JProperty("Modelo", Modelo));
            ConexionBaseDatos.CerrarBaseDatosSqlServer();
        }
        else
        {
            oRespuesta.Add(new JProperty("Error", 1));
            oRespuesta.Add(new JProperty("Descripcion", "No hay conexion a Base de Datos"));
        }
        return(oRespuesta.ToString());
    }
Beispiel #3
0
    public static string AgregarTiempoEntrega(Dictionary <string, object> pTiempoEntrega)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();

        //¿La conexion se establecio?
        if (respuesta == "Conexion Establecida")
        {
            CTiempoEntrega TiempoEntrega = new CTiempoEntrega();
            TiempoEntrega.TiempoEntrega = Convert.ToString(pTiempoEntrega["TiempoEntrega"]);

            string validacion = ValidarTiempoEntrega(TiempoEntrega, ConexionBaseDatos);

            JObject oRespuesta = new JObject();
            if (validacion == "")
            {
                TiempoEntrega.Agregar(ConexionBaseDatos);
                oRespuesta.Add(new JProperty("Error", 0));
                ConexionBaseDatos.CerrarBaseDatosSqlServer();
            }
            else
            {
                oRespuesta.Add(new JProperty("Error", 1));
                oRespuesta.Add(new JProperty("Descripcion", validacion));
            }
            ConexionBaseDatos.CerrarBaseDatosSqlServer();
            return(oRespuesta.ToString());
        }
        else
        {
            return("1|" + respuesta);
        }
    }
    public static JArray ObtenerJsonTiempoEntrega(int pIdTiempoEntrega, CConexion pConexion)
    {
        CTiempoEntrega TiempoEntrega   = new CTiempoEntrega();
        JArray         JTiemposEntrega = new JArray();

        Dictionary <string, object> Parametros = new Dictionary <string, object>();

        Parametros.Add("Baja", 0);
        foreach (CTiempoEntrega oTiempoEntrega in TiempoEntrega.LlenaObjetosFiltros(Parametros, pConexion))
        {
            JObject JTiempoEntrega = new JObject();
            JTiempoEntrega.Add("Valor", oTiempoEntrega.IdTiempoEntrega);
            JTiempoEntrega.Add("Descripcion", oTiempoEntrega.TiempoEntrega);
            if (oTiempoEntrega.IdTiempoEntrega == pIdTiempoEntrega)
            {
                JTiempoEntrega.Add(new JProperty("Selected", 1));
            }
            else
            {
                JTiempoEntrega.Add(new JProperty("Selected", 0));
            }
            JTiemposEntrega.Add(JTiempoEntrega);
        }
        return(JTiemposEntrega);
    }
Beispiel #5
0
    //Validaciones
    private static string ValidarTiempoEntrega(CTiempoEntrega pTiempoEntrega, CConexion pConexion)
    {
        string errores = "";

        if (pTiempoEntrega.TiempoEntrega == "")
        {
            errores = errores + "<span>*</span> El campo tiempo de entrega esta vacío, favor de capturarlo.<br />";
        }

        if (errores != "")
        {
            errores = "<p>Favor de completar los siguientes requisitos:</p>" + errores;
        }

        return(errores);
    }
Beispiel #6
0
    public static string CambiarEstatus(int pIdTiempoEntrega, bool pBaja)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();

        //¿La conexion se establecio?
        if (respuesta == "Conexion Establecida")
        {
            CTiempoEntrega TiempoEntrega = new CTiempoEntrega();
            TiempoEntrega.IdTiempoEntrega = pIdTiempoEntrega;
            TiempoEntrega.Baja            = pBaja;
            TiempoEntrega.Eliminar(ConexionBaseDatos);
            respuesta = "0|TiempoEntregaEliminado";
        }

        //Cerrar Conexion
        ConexionBaseDatos.CerrarBaseDatosSqlServer();
        return(respuesta);
    }