示例#1
0
        /******************************************************************** DETALHES DO LOTE ********************************************************************/
        public List <Ingrediente> DetalhesLote(String ID)
        {
            //SqlConnection Conexao = new SqlConnection(ConfigurationManager.ConnectionStrings["BancoEstoque"].ConnectionString);
            SqlConnection Conexao = new SqlConnection("Server = DESKTOP-PHTQI5U\\SQLEXPRESS; Database = DRLTCC; Trusted_Connection = True;");

            Conexao.Open();

            SqlCommand Comando = new SqlCommand();

            Comando.Connection = Conexao;

            Comando.CommandText = "SELECT * FROM Ingrediente WHERE FK_CodigoLote = @FK_CodigoLote;";
            Comando.Parameters.AddWithValue("@FK_CodigoLote", ID);

            SqlDataReader      Leitor       = Comando.ExecuteReader();
            List <Ingrediente> DetalhesLote = new List <Ingrediente>();

            while (Leitor.Read())
            {
                Ingrediente I = new Ingrediente();
                I.CodigoIngrediente = Convert.ToInt32(Leitor["CodigoIngrediente"].ToString());
                I.NomeIngrediente   = Leitor["NomeIngrediente"].ToString();
                I.UnidadeMedida     = Leitor["UnidadeMedida"].ToString();
                I.QtdIngrediente    = Convert.ToInt32(Leitor["QtdIngrediente"].ToString());

                DetalhesLote.Add(I);
            }
            Conexao.Close();
            return(DetalhesLote);
        }
示例#2
0
        /******************************************************************** LISTAR INGREDIENTE - ALTERAR INGREDIENTE F ********************************************************************/
        public List <Ingrediente> IngredienteF()
        {
            //SqlConnection Conexao = new SqlConnection(ConfigurationManager.ConnectionStrings["BancoEstoque"].ConnectionString);
            SqlConnection Conexao = new SqlConnection("Server = DESKTOP-PHTQI5U\\SQLEXPRESS; Database = DRLTCC; Trusted_Connection = True;");

            Conexao.Open();
            SqlCommand Comando = new SqlCommand();

            Comando.Connection = Conexao;

            Comando.CommandText = "SELECT CodigoIngrediente, NomeIngrediente FROM Ingrediente;";

            SqlDataReader Leitor = Comando.ExecuteReader();

            while (Leitor.Read())
            {
                Ingrediente I = new Ingrediente();
                I.CodigoIngrediente = Convert.ToInt32(Leitor["CodigoIngrediente"].ToString());
                I.NomeIngrediente   = Leitor["NomeIngrediente"].ToString();

                Ingredientes.Add(I);
            }
            Conexao.Close();

            return(Ingredientes);
        }
示例#3
0
        /******************************************************************** LISTAR INGREDIENTE RETIRADO ********************************************************************/
        public List <Ingrediente> ListaIngredientesRetirados()
        {
            //SqlConnection Conexao = new SqlConnection(ConfigurationManager.ConnectionStrings["BancoEstoque"].ConnectionString);
            SqlConnection Conexao = new SqlConnection("Server = DESKTOP-PHTQI5U\\SQLEXPRESS; Database = DRLTCC; Trusted_Connection = True;");

            Conexao.Open();
            SqlCommand Comando = new SqlCommand();

            Comando.Connection  = Conexao;
            Comando.CommandText = "SELECT I.NomeIngrediente,I.FK_CodigoLote,L.NomeLote,IR.*, I.UnidadeMedida FROM IngredienteRetirado IR JOIN Ingrediente I ON CodigoIngrediente = FK_CodigoIngrediente JOIN Lote L ON CodigoLote = FK_CodigoLote;";

            SqlDataReader      Leitor    = Comando.ExecuteReader();
            List <Ingrediente> Retirados = new List <Ingrediente>();

            while (Leitor.Read())
            {
                Ingrediente I = new Ingrediente();
                I.CodigoIngrediente = Convert.ToInt32(Leitor["FK_CodigoIngrediente"].ToString());
                I.NomeIngrediente   = Leitor["NomeIngrediente"].ToString();
                I.FK_NIFUsuario     = Convert.ToInt32(Leitor["FK_NIFUsuario"].ToString());
                I.QtdIngrediente    = Convert.ToInt32(Leitor["QtdRetirado"].ToString());
                I.DataRetirada      = Convert.ToDateTime(Leitor["DataRetirado"].ToString());
                I.UnidadeMedida     = Leitor["UnidadeMedida"].ToString();
                I.FK_CodigoLote     = Convert.ToInt32(Leitor["FK_CodigoLote"].ToString());
                I.NomeLote          = Leitor["NomeLote"].ToString();
                Retirados.Add(I);
            }
            return(Retirados);
        }
示例#4
0
        /******************************************************************** LISTAR INGREDIENTE ********************************************************************/
        public List <Ingrediente> ListarIngredientes()
        {
            //SqlConnection Conexao = new SqlConnection(ConfigurationManager.ConnectionStrings["BancoEstoque"].ConnectionString);
            SqlConnection Conexao = new SqlConnection("Server = DESKTOP-PHTQI5U\\SQLEXPRESS; Database = DRLTCC; Trusted_Connection = True;");

            Conexao.Open();
            SqlCommand Comando = new SqlCommand();

            Comando.Connection = Conexao;

            Comando.CommandText = "SELECT I.*, L.CodigoLote, L.NomeLote FROM Ingrediente I JOIN Lote L ON CodigoLote = FK_CodigoLote;";

            SqlDataReader Leitor = Comando.ExecuteReader();



            while (Leitor.Read())
            {
                Ingrediente I = new Ingrediente();
                I.FK_CodigoLote     = Convert.ToInt32(Leitor["FK_CodigoLote"].ToString());
                I.NomeLote          = Leitor["NomeLote"].ToString();
                I.CodigoIngrediente = Convert.ToInt32(Leitor["CodigoIngrediente"].ToString());
                I.NomeIngrediente   = Leitor["NomeIngrediente"].ToString();
                I.QtdIngrediente    = Convert.ToInt32(Leitor["QtdIngrediente"].ToString());
                I.UnidadeMedida     = Leitor["UnidadeMedida"].ToString();
                I.NivelRisco        = Convert.ToInt32(Leitor["NivelRisco"].ToString());
                I.FK_CodigoLote     = Convert.ToInt32(Leitor["FK_CodigoLote"].ToString());


                Ingredientes.Add(I);
            }
            Conexao.Close();

            teste = Ingredientes.Count();
            return(Ingredientes);
        }