Project in Visual Studio gives me error

0

Goodnight, I would like to know what is wrong with the NotImplementedException error  I have my form and when I press the check button, there is no problem, when I enter the provider code, I get the problem, this is the code of the consult button.

namespace FacturacionCompras
{
    public partial class Formulario_web11 : System.Web.UI.Page
    {


        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnConsultar_Click(object sender, EventArgs e)
        {
            if (TextPROVEEDOR.Text == "")
            {
                lblMensaje.Text = "Debe de ingresar un cod de proveedor";
                TextPROVEEDOR.Focus();
                return;
            }
            if (!CADFacturacion.CADProveedor.ExisteProveedor(TextPROVEEDOR.Text))
            {
                lblMensaje.Text = "Proveedor no existe";
                TextPROVEEDOR.Focus();
                return;
            }
            CADFacturacion.DSFacturacion.PROVEEDORDataTable miProveedor = CADFacturacion.CADProveedor.GetProveedor(TextPROVEEDOR.Text);
            foreach (DataRow row in miProveedor.Rows)
            {
                TextNOMBRE.Text = row["NOM PROV"].ToString();
                TextDIRECCION.Text = row["Direccion"].ToString();
                TextPAIS.Text = row["pais"].ToString();
                CalFecha.SelectedDate = Convert.ToDateTime(row["Fecha"]);
            }

            lblMensaje.Text = "Proveedor Consultado";
        }
    }

}
    
asked by BernalHD 21.11.2018 в 05:15
source

3 answers

0

You should put more information, such as the definition of each method, however here goes my bet.

As you say, if you click without entering anything it works, this is because it enters the first part of the condition.

if (TextPROVEEDOR.Text == "")
{
   lblMensaje.Text = "Debe de ingresar un cod de proveedor";
   TextPROVEEDOR.Focus();
   return;
}

That is, you show an error and exit the method.

However, if that condition is not met, you pass to the next one, this is one of the possible cases where it may fail:

CADFacturacion.CADProveedor.ExisteProveedor(TextPROVEEDOR.Text)

If the error is shown that the provider does not exist then that method works correctly and therefore the one that is not implemented is:

CADFacturacion.CADProveedor.GetProveedor(TextPROVEEDOR.Text);

Check or teach the definition of both if you want to be more precise. Greetings.

    
answered by 21.11.2018 / 11:27
source
0
using System;

namespace CADFacturacion
{
    internal class CADProveedor
    {
        internal static DSFacturacion.PROVEEDORDataTable GetProveedor(string text)
        {
            throw new NotImplementedException();
        }

        internal static bool ExisteProveedor(string text)
        {
            throw new NotImplementedException();
        }
    }
}
    
answered by 22.11.2018 в 01:20
0

This is the other code, I think the error is in that namespace.

 using CADFacturacion;
    using CADFacturacion.DSFacturacionTableAdapters;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace CADProveedor

    {
        public class CADProveedor
        {
            private static PROVEEDORTableAdapter adapter = new PROVEEDORTableAdapter();
            public static DSFacturacion.PROVEEDORDataTable GetProveedor(string COD_PROV)
            {
                return adapter.GetProveedor(COD_PROV);
            }
            public static bool ExisteProveedor(string COD_PROV)
            {
                return adapter.ExisteProveedor(COD_PROV) == 1;
            }
        }
    }
    
answered by 22.11.2018 в 05:37