Exemple #1
0
        public Req_CmpModel BuscarID_RC(int id_rc)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "select * from requisicao_de_compra where id_rc = @id_rc";
            comando.Parameters.AddWithValue("@id_rc", id_rc);

            MySqlDataReader dr = ConnectBD.Select(comando);
            Req_CmpModel    RC = new Req_CmpModel();

            if (dr.HasRows)
            {
                dr.Read();
                RC.ID        = (int)dr["id_rc"];
                RC.Descricao = (string)dr["descricao_rc"];
                RC.Data      = (DateTime)dr["data_rc"];
            }
            else
            {
                RC = null;
            }

            return(RC);
        }
Exemple #2
0
        public IList <Ord_ManModel> BuscaPorDescricao_Om(string Descricao)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "select * from ordem_de_manutencao where descricao_om like @descricao";
            comando.Parameters.AddWithValue("@descricao", "%" + Descricao + "%");
            MySqlDataReader      dr        = ConnectBD.Select(comando);
            IList <Ord_ManModel> Lista_Oms = new List <Ord_ManModel>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Ord_ManModel Ord_Om = new Ord_ManModel();
                    Ord_Om.ID        = (int)dr["id_om"];
                    Ord_Om.Descricao = (string)dr["descricao_om"];
                    Ord_Om.Data      = (DateTime)dr["data_om"];
                    Lista_Oms.Add(Ord_Om);
                }
            }
            else
            {
                Lista_Oms = null;
            }
            return(Lista_Oms);
        }
Exemple #3
0
        public List <Ord_ManModel> Listagem_Om()
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "select id_om AS Número, descricao_om AS Descrição, data_om AS Data, CONCAT ('Faltam ', DATEDIFF(data_om, CURDATE()), ' dias. ') As 'Dias' from ordem_de_manutencao";
            MySqlDataReader     dr        = ConnectBD.Select(comando);
            List <Ord_ManModel> Lista_Oms = new List <Ord_ManModel>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Ord_ManModel Ord_Om = new Ord_ManModel();
                    Ord_Om.ID        = (int)dr["id_om"];
                    Ord_Om.Descricao = (string)dr["descricao_om"];
                    Ord_Om.Data      = (DateTime)dr["data_om"];
                    Lista_Oms.Add(Ord_Om);
                }
            }
            else
            {
                Lista_Oms = null;
            }
            return(Lista_Oms);
        }
Exemple #4
0
        public IList <Req_CmpModel> BuscaPorDescricao_Rc(string Descricao)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "select * from requisicao_de_compra where descricao_rc like @descricao";
            comando.Parameters.AddWithValue("@descricao", "%" + Descricao + "%");
            MySqlDataReader      dr        = ConnectBD.Select(comando);
            IList <Req_CmpModel> Lista_RCs = new List <Req_CmpModel>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Req_CmpModel Req_CP = new Req_CmpModel();
                    Req_CP.ID        = (int)dr["id_rc"];
                    Req_CP.Descricao = (string)dr["descricao_rc"];
                    Req_CP.Data      = (DateTime)dr["data_rc"];
                    Lista_RCs.Add(Req_CP);
                }
            }
            else
            {
                Lista_RCs = null;
            }
            return(Lista_RCs);
        }
Exemple #5
0
        public Ped_CmpModel BuscarID_PC(int id_pc)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "select * from pedido_de_compra where id_pc = @id_pc";
            comando.Parameters.AddWithValue("@id_pc", id_pc);

            MySqlDataReader dr = ConnectBD.Select(comando);
            Ped_CmpModel    PC = new Ped_CmpModel();

            if (dr.HasRows)
            {
                dr.Read();
                PC.ID        = (int)dr["id_pc"];
                PC.Descricao = (string)dr["descricao_pc"];
                PC.Data      = (DateTime)dr["data_pc"];
            }
            else
            {
                PC = null;
            }

            return(PC);
        }
Exemple #6
0
        public UsuarioModel Usuario_Login(string nome, string senha)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "select id_user, nome_user, funcao_user from usuarios where nome_user = @nome_user and senha_user = @senha_user";
            comando.Parameters.AddWithValue("@nome_user", nome);
            comando.Parameters.AddWithValue("@senha_user", senha);
            MySqlDataReader dr   = ConnectBD.Select(comando);
            UsuarioModel    User = new UsuarioModel();

            if (dr.HasRows)
            {
                dr.Read();
                User.Id_user     = (int)dr["id_user"];
                User.Nome_user   = (string)dr["nome_user"];
                User.Funcao_user = (string)dr["funcao_user"];

                return(User);
            }
            else
            {
                return(null);
            }
        }
Exemple #7
0
        public void Delete(UsuarioModel User)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "delete from bd_valelembrar.usuarios where nome_user = @nome_del_user";
            comando.Parameters.AddWithValue("@nome_del_user", User.Nome_user);
            ConnectBD.CRUD(comando);
        }
Exemple #8
0
        public void Delete_PC(Ped_CmpModel PC)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "delete from bd_valelembrar.pedido_de_compra where id_pc = @id_del_pc";
            comando.Parameters.AddWithValue("@id_del_pc", PC.ID);
            ConnectBD.CRUD(comando);
        }
Exemple #9
0
        public void Delete_RC(Req_CmpModel RC)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "delete from bd_valelembrar.requisicao_de_compra where id_rc = @id_del_rc";
            comando.Parameters.AddWithValue("@id_del_rc", RC.ID);
            ConnectBD.CRUD(comando);
        }
Exemple #10
0
        public void Delete_OM(Ord_ManModel OM)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "delete from ordem_de_manutencao where id_om = @id_del_om";
            comando.Parameters.AddWithValue("@id_del_om", OM.ID);
            ConnectBD.CRUD(comando);
        }
Exemple #11
0
        public void Insert(UsuarioModel User)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "insert into usuarios (nome_user,senha_user,funcao_user) values (@add_user,@add_senha,@funcao_user)";
            comando.Parameters.AddWithValue("@add_user", User.Nome_user);
            comando.Parameters.AddWithValue("@add_senha", User.Senha_user);
            comando.Parameters.AddWithValue("@funcao_user", User.Funcao_user);
            ConnectBD.CRUD(comando);
        }
Exemple #12
0
        public void Update_OM(Ord_ManModel OM, int Om_set)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "update ordem_de_manutencao set id_om =" + Om_set + ", descricao_om = @descricao_om, data_om = @data_om, status_om = @status_om where id_om = @id_om";
            comando.Parameters.AddWithValue("@id_om", OM.ID);
            comando.Parameters.AddWithValue("@descricao_om", OM.Descricao);
            comando.Parameters.AddWithValue("@data_om", OM.Data);
            comando.Parameters.AddWithValue("@status_om", OM.Status);
            ConnectBD.CRUD(comando);
        }
Exemple #13
0
        public void Insert_OM(Ord_ManModel OM)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "insert into ordem_de_manutencao (id_om, descricao_om, data_om, status_om) values (@id_om, @descricao_om, @data_om,@status_om)";
            comando.Parameters.AddWithValue("@id_om", OM.ID);
            comando.Parameters.AddWithValue("@descricao_om", OM.Descricao);
            comando.Parameters.AddWithValue("@data_om", OM.Data);
            comando.Parameters.AddWithValue("@status_om", OM.Status);
            ConnectBD.CRUD(comando);
        }
Exemple #14
0
        public void Insert_PC(Ped_CmpModel PC)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "insert into pedido_de_compra (id_pc, descricao_pc, data_pc,status_pc) values (@id_pc, @descricao_pc, @data_pc,@status_pc)";
            comando.Parameters.AddWithValue("@id_pc", PC.ID);
            comando.Parameters.AddWithValue("@descricao_pc", PC.Descricao);
            comando.Parameters.AddWithValue("@data_pc", PC.Data);
            comando.Parameters.AddWithValue("@status_pc", PC.Status);
            ConnectBD.CRUD(comando);
        }
Exemple #15
0
        public void Update_PC(Ped_CmpModel PC, int Pc_Id2)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "update pedido_de_compra set id_pc = " + Pc_Id2 + ", descricao_pc = @descricao_pc, data_pc = @data_pc, status_pc = @status_pc where id_pc = @id_pc";
            comando.Parameters.AddWithValue("@id_pc", PC.ID);
            comando.Parameters.AddWithValue("@descricao_pc", PC.Descricao);
            comando.Parameters.AddWithValue("@data_pc", PC.Data);
            comando.Parameters.AddWithValue("@status_pc", PC.Status);
            ConnectBD.CRUD(comando);
        }
Exemple #16
0
        public void Update_RC(Req_CmpModel RC, int RC_ID2)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "update requisicao_de_compra set id_rc  = " + RC_ID2 + ", descricao_rc = @descricao_rc, data_rc = @data_rc, status_rc = @status_rc where id_rc = @id_rc";
            comando.Parameters.AddWithValue("@id_rc", RC.ID);
            comando.Parameters.AddWithValue("@descricao_rc", RC.Descricao);
            comando.Parameters.AddWithValue("@data_rc", RC.Data);
            comando.Parameters.AddWithValue("@status_rc", RC.Status);
            ConnectBD.CRUD(comando);
        }
Exemple #17
0
        public void Insert_RC(Req_CmpModel RC)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "insert into requisicao_de_compra (id_rc, descricao_rc, data_rc,status_rc) values (@id_rc, @descricao_rc, @data_rc,@status_rc)";
            comando.Parameters.AddWithValue("@id_rc", RC.ID);
            comando.Parameters.AddWithValue("@descricao_rc", RC.Descricao);
            comando.Parameters.AddWithValue("@data_rc", RC.Data);
            comando.Parameters.AddWithValue("@status_rc", RC.Status);
            ConnectBD.CRUD(comando);
        }
Exemple #18
0
        public int Lembrar_RC()
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "select count(*) as 'Resultado' from requisicao_de_compra where data_rc = CURDATE()";
            MySqlDataReader Data_Reader = ConnectBD.Select(comando);

            if (Data_Reader.HasRows)
            {
                Data_Reader.Read();
                return(int.Parse(Data_Reader.GetString(0)));
            }
            return(0);
        }
Exemple #19
0
        public int Lembrar_Om()
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "select count(*) as 'Resultado' from ordem_de_manutencao where data_om = CURDATE()";
            MySqlDataReader Data_Reader = ConnectBD.Select(comando);

            if (Data_Reader.HasRows)
            {
                Data_Reader.Read();
                return(Data_Reader.GetInt32(0));
            }
            return(0);
        }
Exemple #20
0
        public DataTable Om_List(string pesquisa)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "select id_om as Numero,descricao_om as Descrição ,status_om As Status, data_om as Data , concat ('Faltam ',DATEDIFF(data_om,CURDATE()), ' dias. ') As 'Dias'  from ordem_de_manutencao where concat (id_om,descricao_om,data_om,status_om) like '%" + pesquisa + "%'";
            MySqlDataReader Data_Reader = ConnectBD.Select(comando);
            DataTable       dtLista     = new DataTable();

            if (Data_Reader.HasRows)
            {
                MySqlDataAdapter Data_Adapter = ConnectBD.Fill(comando);
                Data_Adapter.Fill(dtLista);
                return(dtLista);
            }
            else
            {
                return(null);
            }
        }
Exemple #21
0
        public DataTable RC_List(string pesquisa)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "select id_rc as Numero,descricao_rc as Descrição ,status_rc as Status,data_rc as Data ,CONCAT ('Faltam ',DATEDIFF(data_rc,CURDATE()), ' dias. ') As 'Dias'  from requisicao_de_compra where concat(id_rc,descricao_rc,data_rc,status_rc) like '%" + pesquisa + "%'";
            MySqlDataReader Data_Reader = ConnectBD.Select(comando);
            DataTable       dtLista     = new DataTable();

            if (Data_Reader.HasRows)
            {
                MySqlDataAdapter Data_Adapter = ConnectBD.Fill(comando);
                Data_Adapter.Fill(dtLista);
                return(dtLista);
            }
            else
            {
                return(null);
            }
        }
Exemple #22
0
        public DataTable UserList(string pesquisa)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "select nome_user as Nome, funcao_user as Função from usuarios WHERE CONCAT(nome_user,funcao_user) like '%" + pesquisa + "%'";
            MySqlDataReader Data_Reader = ConnectBD.Select(comando);
            DataTable       dtLista     = new DataTable();

            if (Data_Reader.HasRows)
            {
                MySqlDataAdapter Data_Adapter = ConnectBD.Fill(comando);
                Data_Adapter.Fill(dtLista);
                return(dtLista);
            }
            else
            {
                return(null);
            }
        }
Exemple #23
0
        public Ord_ManModel BuscarID_OM(int id_om)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "select * from ordem_de_manutencao where id_om = @id_om";
            comando.Parameters.AddWithValue("@id_om", id_om);
            MySqlDataReader dr = ConnectBD.Select(comando);
            Ord_ManModel    OM = new Ord_ManModel();

            if (dr.HasRows)
            {
                dr.Read();
                OM.ID        = (int)dr["id_om"];
                OM.Descricao = (string)dr["descricao_om"];
                OM.Data      = (DateTime)dr["data_om"];
            }
            else
            {
                OM = null;
            }
            return(OM);
        }
Exemple #24
0
        public UsuarioModel FindUser(string nome)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "select nome_user as Nome, funcao_user as 'Tipo de Usuário' from bd_valelembrar.usuarios where nome_user = @nome_user";
            comando.Parameters.AddWithValue("@nome_user", nome);
            MySqlDataReader dr   = ConnectBD.Select(comando);
            UsuarioModel    User = new UsuarioModel();

            if (dr.HasRows)
            {
                dr.Read();
                User.Id_user     = (int)dr["id_user"];
                User.Nome_user   = (string)dr["nome_user"];
                User.Funcao_user = (string)dr["funcao_user"];
            }
            else
            {
                User = null;
            }

            return(User);
        }