Ejemplo n.º 1
0
 private void btn_add_pc_Click(object sender, EventArgs e)
 {
     try
     {
         Ped_CmpModel PC_Model = new Ped_CmpModel();
         Ped_CmpBO    PC_BO    = new Ped_CmpBO();
         PC_Model.ID        = int.Parse(txt_id_pc.Text);
         PC_Model.Descricao = txt_descricao_pc.Text;
         PC_Model.Data      = DateTime.Parse(txt_data_pc.Text);
         if (btn_statusnovo_pc.Checked)
         {
             PC_Model.Status = btn_statusnovo_pc.Text;
         }
         if (btn_statusandamento_pc.Checked)
         {
             PC_Model.Status = btn_statusandamento_pc.Text;
         }
         if (btn_statusatrasada_pc.Checked)
         {
             PC_Model.Status = btn_statusatrasada_pc.Text;
         }
         if (btn_statusconcluida_pc.Checked)
         {
             PC_Model.Status = btn_statusconcluida_pc.Text;
         }
         PC_BO.BO_Add_PC(PC_Model);
         MessageBox.Show("Adicionado com Sucesso O PC nº =  " + PC_Model.ID);
     }
     catch (Exception)
     {
         MessageBox.Show("Número do PC Inválido ou Já Cadastrado !! ");
     }
 }
Ejemplo n.º 2
0
 private void btn_alter_pc_Click(object sender, EventArgs e)
 {
     try
     {
         Ped_CmpModel Ped_Model = new Ped_CmpModel();
         Ped_CmpBO    PC_BO     = new Ped_CmpBO();
         Ped_Model.ID        = int.Parse(txt_id_pc.Text);
         Ped_Model.Descricao = txt_descricao_pc.Text;
         Ped_Model.Data      = DateTime.Parse(txt_data_pc.Text);
         if (btn_statusnovo_pc.Checked)
         {
             Ped_Model.Status = btn_statusnovo_pc.Text;
         }
         if (btn_statusandamento_pc.Checked)
         {
             Ped_Model.Status = btn_statusandamento_pc.Text;
         }
         if (btn_statusatrasada_pc.Checked)
         {
             Ped_Model.Status = btn_statusatrasada_pc.Text;
         }
         if (btn_statusconcluida_pc.Checked)
         {
             Ped_Model.Status = btn_statusconcluida_pc.Text;
         }
         PC_BO.BO_Update_PC(Ped_Model, int.Parse(txt_id2_pc.Text));
         MessageBox.Show("Alterada o PC de nº = " + Ped_Model.ID);
     }
     catch (Exception)
     {
         MessageBox.Show("Número do PC Inválido ou Inexistente!! ");
     }
 }
Ejemplo n.º 3
0
        public IList <Ped_CmpModel> BuscaPorDescricao_Pc(string Descricao)
        {
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "select * from pedido_de_compra where descricao_pc like @descricao";
            comando.Parameters.AddWithValue("@descricao", "%" + Descricao + "%");
            MySqlDataReader      dr        = ConnectBD.Select(comando);
            IList <Ped_CmpModel> Lista_PCs = new List <Ped_CmpModel>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Ped_CmpModel Ped_CP = new Ped_CmpModel();
                    Ped_CP.ID        = (int)dr["id_pc"];
                    Ped_CP.Descricao = (string)dr["descricao_pc"];
                    Ped_CP.Data      = (DateTime)dr["data_pc"];
                    Lista_PCs.Add(Ped_CP);
                }
            }
            else
            {
                Lista_PCs = null;
            }
            return(Lista_PCs);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
 public void BO_Delete_PC(Ped_CmpModel PC)
 {
     if (PC != null)
     {
         Ped_CmpDAO PCDAO = new Ped_CmpDAO();
         PCDAO.Delete_PC(PC);
     }
 }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
 public void BO_Add_PC(Ped_CmpModel PC)
 {
     if (PC != null)
     {
         Ped_CmpDAO PCDAO = new Ped_CmpDAO();
         if (PC.ID != 0)
         {
             PCDAO.Insert_PC(PC);
         }
     }
 }
Ejemplo n.º 8
0
 public void BO_Update_PC(Ped_CmpModel PC, int Pc_Id)
 {
     if (PC != null)
     {
         Ped_CmpDAO PCDAO = new Ped_CmpDAO();
         if (PC.ID != 0)
         {
             PCDAO.Update_PC(PC, Pc_Id);
         }
     }
 }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        private void btn_del_pc_Click(object sender, EventArgs e)
        {
            string message = "Tem certeza que deseja excluir o PC?";
            string caption = "Atenção para exclusão!";

            try
            {
                Ped_CmpModel Ped_Model = new Ped_CmpModel();
                Ped_CmpBO    PC_BO     = new Ped_CmpBO();
                Ped_Model.ID = int.Parse(txt_id_cancel_pc.Text);
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult      result;
                result = MessageBox.Show(message, caption, buttons);
                if (result == DialogResult.Yes)
                {
                    PC_BO.BO_Delete_PC(Ped_Model);
                    MessageBox.Show("Excluído com Sucesso o PC nº =  " + Ped_Model.ID);
                }
            }
            catch (Exception erro)
            {
                MessageBox.Show("Verifique o número do PC!! ", erro.Message);
            }
        }