Exemplo n.º 1
0
        private bool ExisteEnLaBaseDeDatos()
        {
            RepositorioBase <Productores> repositorio = new RepositorioBase <Productores>();
            Productores Productores = repositorio.Buscar(ProductorIdTxt.Text.ToInt());

            repositorio.Dispose();
            return(!Productores.EsNulo() && PerteneceALaEmpresa(Productores.EmpresaId));
        }
Exemplo n.º 2
0
        private bool BuscarProductores()
        {
            RepositorioBase <Productores> repositorio = new RepositorioBase <Productores>();
            Productores productores = repositorio.Buscar(ProductorIdTextBox.Text.ToInt());

            if (!productores.EsNulo())
            {
                NombreProductorTextBox.Text = productores.Nombre;
            }
            else
            {
                NombreProductorTextBox.Text = string.Empty;
                Utils.ToastSweet(this, IconType.info, TiposMensajes.RegistroNoEncontrado);
            }

            return(!productores.EsNulo());
        }
Exemplo n.º 3
0
        public bool PerteneceALaEmpresa(int id)
        {
            RepositorioBase <Productores> repositorio = new RepositorioBase <Productores>();
            Productores productor = repositorio.Buscar(id);

            if (productor.EsNulo())
            {
                return(false);
            }
            return(productor.EmpresaId == Empresa.EmpresaID);
        }
Exemplo n.º 4
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            RepositorioBase <Productores> repositorio = new RepositorioBase <Productores>();
            int Id = ProductorIdTxt.Text.ToInt();

            if (Id != 0)
            {
                Productores Productores = repositorio.Buscar(Id);
                if (!Productores.EsNulo() && PerteneceALaEmpresa(Productores.ProductorId))
                {
                    Limpiar();
                    LlenarCampos(Productores);
                }
                else
                {
                    Utils.ToastSweet(this, IconType.info, TiposMensajes.RegistroNoEncontrado);
                }
            }
            else
            {
                Utils.ToastSweet(this, IconType.info, TiposMensajes.RegistroNoEncontrado);
            }
            repositorio.Dispose();
        }