예제 #1
0
    public static string EditarCuentaContable(Dictionary <string, object> pCuentaContable)
    {
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();
        CUsuario  Usuario           = new CUsuario();

        Usuario.LlenaObjeto(Convert.ToInt32(HttpContext.Current.Session["IdUsuario"]), ConexionBaseDatos);
        CCuentaContable CuentaContable = new CCuentaContable();

        CuentaContable.LlenaObjeto(Convert.ToInt32(pCuentaContable["IdCuentaContable"]), ConexionBaseDatos);
        CuentaContable.IdCuentaContable = Convert.ToInt32(pCuentaContable["IdCuentaContable"]);
        CuentaContable.CuentaContable   = Convert.ToString(pCuentaContable["CuentaContable"]);
        CuentaContable.IdSucursal       = Convert.ToInt32(pCuentaContable["IdSucursal"]);
        CuentaContable.IdDivision       = Convert.ToInt32(pCuentaContable["IdDivision"]);
        CuentaContable.IdTipoCompra     = Convert.ToInt32(pCuentaContable["IdTipoCompra"]);
        CuentaContable.Descripcion      = Convert.ToString(pCuentaContable["Descripcion"]);

        string validacion = ValidarCuentaContable(CuentaContable, ConexionBaseDatos);

        JObject oRespuesta = new JObject();

        if (validacion == "")
        {
            CuentaContable.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());
    }
예제 #2
0
    public static string AgregarCuentaContableComplementos(Dictionary <string, object> pCuentaContable)
    {
        //Abrir Conexion
        CConexion ConexionBaseDatos = new CConexion();
        string    respuesta         = ConexionBaseDatos.ConectarBaseDatosSqlServer();

        //¿La conexion se establecio?
        if (respuesta == "Conexion Establecida")
        {
            CUsuario Usuario = new CUsuario();
            Usuario.LlenaObjeto(Convert.ToInt32(HttpContext.Current.Session["IdUsuario"]), ConexionBaseDatos);

            CCuentaContable             CuentaContable = new CCuentaContable();
            Dictionary <string, object> Parametros     = new Dictionary <string, object>();
            Parametros.Add("IdTipoCuentaContable", Convert.ToInt32(pCuentaContable["IdTipoCuentaContable"]));
            CuentaContable.LlenaObjetoFiltros(Parametros, ConexionBaseDatos);

            JObject oRespuesta = new JObject();
            if (CuentaContable.IdCuentaContable == 0)
            {
                CuentaContable.IdTipoCuentaContable = Convert.ToInt32(pCuentaContable["IdTipoCuentaContable"]);
                CuentaContable.CuentaContable       = pCuentaContable["CuentaClienteComplemento"].ToString();
                CuentaContable.Descripcion          = pCuentaContable["DescripcionCuentaClienteComplemento"].ToString();
                CuentaContable.Agregar(ConexionBaseDatos);
            }
            else
            {
                CuentaContable.IdTipoCuentaContable = Convert.ToInt32(pCuentaContable["IdTipoCuentaContable"]);
                CuentaContable.CuentaContable       = pCuentaContable["CuentaClienteComplemento"].ToString();
                CuentaContable.Descripcion          = pCuentaContable["DescripcionCuentaClienteComplemento"].ToString();
                CuentaContable.Editar(ConexionBaseDatos);
            }

            oRespuesta.Add(new JProperty("Error", 0));
            ConexionBaseDatos.CerrarBaseDatosSqlServer();
            return(oRespuesta.ToString());
        }
        else
        {
            return("1|" + respuesta);
        }
    }