Exemplo n.º 1
0
        private void btnVender_Click(object sender, EventArgs e)
        {
            try
            {
                VendaDTO dto = new VendaDTO();
                dto.IdUsuario  = UserSession.UsuarioLogado.Id;
                dto.Data       = mkbDataCompra.Text;
                dto.FormaPagto = Convert.ToString(cboTipoPag.SelectedItem);

                VendaBusiness buss = new VendaBusiness();
                buss.Salvar(dto, carrinhoAdd.ToList());

                string msg = "Venda efetuada com sucesso!";

                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void btnCalcular_Click(object sender, EventArgs e)
        {
            try
            {
                FolhaPagto pagto = new FolhaPagto();
                pagto.Salario    = Convert.ToDecimal(txtSalario.Text);
                pagto.Faltas     = Convert.ToInt32(nudFaltas.Value);
                pagto.HoraExtra  = Convert.ToDateTime(mkbHE.Text);
                pagto.Atrasos    = Convert.ToDateTime(mkbAtraso.Text);
                pagto.Domingos   = Convert.ToInt32(nudDom.Value);
                pagto.Percentual = Convert.ToInt32(txtPercent.Text);

                txtINSS.Text       = pagto.CalcularINSS().ToString("F2");
                txtIR.Text         = pagto.CalcularIR().ToString("F2");
                txtFGTS.Text       = pagto.CalcularFGTS().ToString("F2");
                TxtSalFam.Text     = pagto.VerificarSalarioFamilia().ToString("F2");
                txtValTrans.Text   = pagto.CalcularValeTransporte().ToString("F2");
                txtSalLiquido.Text = pagto.CalcularSalarioLiquido().ToString("F2");
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 3
0
        void GerarCredenciais()
        {
            try
            {
                string          nome = cboFuncionario.Text;
                ViewFuncionario dto  = cboFuncionario.SelectedItem as ViewFuncionario;

                mkbCPF.Text     = dto.Cpf;
                txtSalario.Text = dto.Salario.ToString();
                txtDepto.Text   = dto.Depto.ToString();

                if (dto.Imagem == string.Empty)
                {
                    pbxImgFuncionario.Image = null;
                }
                else
                {
                    pbxImgFuncionario.Image = ImagemPlugIn.ConverterParaImagem(dto.Imagem);
                }
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
        private void btnAlterar_Click(object sender, EventArgs e)
        {
            try
            {
                if (funcionario == null)
                {
                    string msg = "Selecione um registro para Altera-lo.";

                    frmAlert tela = new frmAlert();
                    tela.LoadScreen(msg);
                    tela.ShowDialog();
                }
                else
                {
                    frmAlterarFuncionarios screen = new frmAlterarFuncionarios();
                    screen.LoadScreen(funcionario);
                    screen.ShowDialog();

                    CarregarGrid();
                }
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 5
0
        private void btnCadatrar_Click(object sender, EventArgs e)
        {
            try
            {
                ProdutoDTO dto = new ProdutoDTO();
                dto.Nome      = txtNome.Text;
                dto.Marca     = txtMarca.Text;
                dto.Descricao = txtDesc.Text;
                dto.Preco     = nudPreco.Value;

                ProdutoBusiness business = new ProdutoBusiness();
                int             pk       = business.Salvar(dto);

                EstoqueDTO estoque = new EstoqueDTO();
                estoque.Produto       = txtNome.Text;
                estoque.ItemProdutoId = pk;
                estoque.QtdEstocado   = 0;

                EstoqueBusiness buss = new EstoqueBusiness();
                buss.Salvar(estoque);

                frmMessage tela = new frmMessage();
                tela.LoadScreen("Produto registrado com sucesso.");
                tela.ShowDialog();
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                ItemDTO dto = cboProduto.SelectedItem as ItemDTO;

                int quantidade = Convert.ToInt32(nudQtd.Value);

                for (int i = 0; i < quantidade; i++)
                {
                    itemAdd.Add(dto);
                }

                CarregarGrid();

                valor.Add(dto.Preco * quantidade);
                nudValor.Value = Convert.ToDecimal(valor.Sum());
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 7
0
        public void Cadastro()
        {
            try
            {
                //Vai intanciar o DTO e dps joga um valor nesse DTO
                classes.Classes.Cliente.DeptoDTO dto = new classes.Classes.Cliente.DeptoDTO();
                dto.Nome      = txtDepto.Text;
                dto.Descricao = txtDecricao.Text;

                //Chama a função de salvar de business que em sua vez grava essas açoes no DTO
                classes.Classes.Cliente.DeptoBusiness business = new classes.Classes.Cliente.DeptoBusiness();
                business.Salvar(dto);

                //Exibe de uma msg de suceso
                string msg = "Departamento cadastrado.";

                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 8
0
        private void btnCadastrar_Click(object sender, EventArgs e)
        {
            try
            {
                FornecedorDTO fornecedor = cboFornecedor.SelectedItem as FornecedorDTO;

                ItemDTO dto = new ItemDTO();
                dto.Nome         = txtNome.Text;
                dto.FornecedorId = fornecedor.Id;
                dto.Descricao    = txtDescricao.Text;
                dto.Preco        = Convert.ToDecimal(nudPreco.Value);

                ItemBusiness buss = new ItemBusiness();
                int          pk   = buss.Salvar(dto);

                EstoqueDTO estoque = new EstoqueDTO();
                estoque.Produto       = txtNome.Text;
                estoque.ItemProdutoId = pk;
                estoque.QtdEstocado   = 0;

                EstoqueBusiness business = new EstoqueBusiness();
                business.Salvar(estoque);

                frmMessage tela = new frmMessage();
                tela.LoadScreen("Produto cadastrado com sucesso.");
                tela.ShowDialog();
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 9
0
        void CarregarTxt()
        {
            try
            {
                ItemView item = cboItem.SelectedItem as ItemView;

                if (item.Nome != null)
                {
                    txtItem.Text = item.Nome;

                    txtValorTotal.Text = Convert.ToString(item.Preco);
                    txtFornecedor.Text = item.Fornecedor;
                }
                else
                {
                    txtItem.Text = "NULL";
                }
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
        void CarregarCombos()
        {
            try
            {
                CargoBusiness   buss  = new CargoBusiness();
                List <CargoDTO> lista = buss.Listar();

                cboDepto.ValueMember   = nameof(CargoDTO.Id);
                cboDepto.DisplayMember = nameof(CargoDTO.Nome);
                cboDepto.DataSource    = lista;

                EstadoBusiness   bess = new EstadoBusiness();
                List <EstadoDTO> li   = bess.Listar();

                cboEstado.ValueMember   = nameof(EstadoDTO.IdEstado);
                cboEstado.DisplayMember = nameof(EstadoDTO.Estado);
                cboEstado.DataSource    = li;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 11
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                ItemView dto = cboItem.SelectedItem as ItemView;

                int quantidade = Convert.ToInt32(nudQtd.Value);

                for (int i = 0; i < quantidade; i++)
                {
                    carrinhoAdd.Add(dto);
                }

                CarregarGrid();

                valor.Add(dto.Preco * quantidade);
                txtValorTotal.Text = Convert.ToString(valor.Sum());
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 12
0
        void GerarCredenciais()
        {
            try
            {
                string          nome = cboFuncionario.Text;
                FuncionarioView dto  = cboFuncionario.SelectedItem as FuncionarioView;

                mkbCPF.Text     = dto.Cpf;
                txtSalario.Text = dto.Salario.ToString();
                txtDepto.Text   = dto.Depto.ToString();

                if (dto.Imagem == string.Empty)
                {
                    pbxImgFuncionario.Image = null;
                }
                else
                {
                    pbxImgFuncionario.Image = ImagemPlugIn.ConverterParaImagem(dto.Imagem);
                }
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 13
0
        public void LoadScreen(FuncionarioView dto)
        {
            try
            {
                this.dto              = dto;
                txtCidade.Text        = dto.Cidade;
                txtEmail.Text         = dto.Email;
                txtNome.Text          = dto.Nome;
                nudSalario.Value      = dto.Salario;
                mkbCEP.Text           = dto.Cep;
                txtEndereco.Text      = dto.Rua;
                txtNum.Text           = dto.Numero.ToString();
                mkbCPF.Text           = dto.Cpf;
                mkbRG.Text            = dto.Rg;
                mkbTelefone.Text      = dto.Telefone;
                cboDepto.SelectedItem = dto.Depto;
                cboUF.Text            = dto.Estado;
                txtComplemento.Text   = dto.Complemento;

                pbxFoto.Image = ImagemPlugIn.ConverterParaImagem(dto.Imagem);
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 14
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                GastosDTO dto = new GastosDTO();
                dto.Nome      = txtNome.Text;
                dto.Descricao = txtDescricao.Text;
                dto.Data      = mkbData.Text;
                dto.Valor     = nudValor.Value;

                GastosBusiness buss = new GastosBusiness();
                buss.Salvar(dto);

                string msg = "Gasto salvo com sucesso!";

                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 15
0
        private void Tutorial_Load(object sender, EventArgs e)
        {
            int height = pnlTV.Height;
            int width = pnlTV.Width;
            try
            {
                video = new Video(System.IO.Path.Combine(Application.StartupPath, "RaagaHacker.avi"), false);
                video.Owner = pnlTV;
                pnlTV.Width = width;
                pnlTV.Height = height;
                video.Play();
            }
            catch (Exception ex)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "Tutorial_Load: Uanble to play video ";
                frm.ErrorMessage = ex.Message;
                frm.StrackTrace = ex.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
            finally
            {

                if (video != null)
                {
                    video.Dispose();
                    video = null;
                }

            }
        }
Exemplo n.º 16
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                FuncionarioDTO funcionario = cboFuncionario.SelectedItem as FuncionarioDTO;

                FolhaPagamentoDTO dto = new FolhaPagamentoDTO();
                dto.HorasExtras  = mkbHE.Text;
                dto.Faltas       = Convert.ToInt32(nudFaltas.Value);
                dto.SalBruto     = Convert.ToDecimal(txtSalario.Text);
                dto.ImpostoRenda = Convert.ToDecimal(txtIR.Text);
                dto.Fgts         = Convert.ToDecimal(txtFGTS.Text);
                dto.VLTars       = Convert.ToDecimal(txtValTrans.Text);
                dto.IdFuncio     = funcionario.Id;
                dto.SalLiq       = Convert.ToDecimal(txtSalLiquido.Text);
                dto.Inss         = Convert.ToDecimal(txtINSS.Text);
                dto.SalFamilia   = Convert.ToDecimal(TxtSalFam.Text);
                dto.Data         = mkbData.Text;

                FolhaPagamentoBusiness buss = new FolhaPagamentoBusiness();
                buss.Salvar(dto);

                frmMessage tela = new frmMessage();
                tela.LoadScreen("Pagamento registrado com sucesso!");
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 17
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                GastosADTO dto = new GastosADTO();
                dto.Nome      = txtNome.Text;
                dto.Descricao = txtDescricao.Text;
                dto.Data      = mktData.Text;
                dto.Valor     = nudValor.Value;

                GastosABusiness buss = new GastosABusiness();
                buss.Salvar(dto);

                string     msg  = "Gasto adicionado com sucesso.";
                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                DeptoDTO  depto  = cboDepto.SelectedItem as DeptoDTO;
                EstadoDTO estado = cboUF.SelectedItem as EstadoDTO;

                FuncionarioDTO dto = new FuncionarioDTO();
                dto.Nome        = txtNome.Text;
                dto.Rg          = mkbRG.Text;
                dto.Salario     = nudSalario.Value;
                dto.Cpf         = mkbCPF.Text;
                dto.Telefone    = mkbTelefone.Text;
                dto.Email       = txtEmail.Text;
                dto.IdDepto     = depto.Id;
                dto.Cidade      = txtCidade.Text;
                dto.IdEstado    = estado.Id;
                dto.Cep         = mkbCEP.Text;
                dto.Rua         = txtEndereco.Text;
                dto.Complemento = txtComplemento.Text;
                dto.Numero      = txtNum.Text;

                dto.Imagem = ImagemPlugIn.ConverterParaString(pbxFoto.Image);

                FuncionarioBusiness buss = new FuncionarioBusiness();
                buss.Salvar(dto);

                frmMessage tela = new frmMessage();
                tela.LoadScreen("Funcionário cadastrado com sucesso!");
                tela.ShowDialog();
            }
            catch (MySqlException mex)
            {
                if (mex.Number == 1062)
                {
                    string msg = "Funcionario já está cadastrado. Verifique se o CPF está corretamente preenchido ou se ele já esta no sistema.";

                    frmAlert tela = new frmAlert();
                    tela.LoadScreen(msg);
                    tela.ShowDialog();
                }
            }
            catch (ValidacaoException vex)
            {
                string msg = vex.Message;

                frmAlert tela = new frmAlert();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 19
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                EstadoDTO estado = cboEstado.SelectedItem as EstadoDTO;

                FornecedoresDTO dto = new FornecedoresDTO();

                dto.Nome = txtNome.Text;
                dto.Email = txtEmail.Text;
                dto.CNPJ = txtCnpj.Text;
                dto.Cidade = txtCidade.Text;
                dto.CEP = mkbCep.Text;
                dto.Telefone = txtTelefone.Text;
                dto.IdEstado = estado.Id;
                dto.Rua = txtRua.Text;
                dto.Numero = txtNumero.Text;

                FornecedoresBusiness business = new FornecedoresBusiness();
                business.Salvar(dto);

                string msg = "Fornecedor cadastrado com sucesso!";

                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (ValidacaoException vex)
            {
                string msg = vex.Message;

                frmAlert tela = new frmAlert();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (MySqlException mex)
            {
                if (mex.Number == 1062)
                {
                    string msg = "Esse fornecedor já está cadastrado. " +
                        "Verifique se o CNPJ está corretamente preenchido ou se ele já está cadastrado no sistema.";

                    frmAlert tela = new frmAlert();
                    tela.LoadScreen(msg);
                    tela.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 20
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                DeptoDTO  depto  = cboDepto.SelectedItem as DeptoDTO;
                EstadoDTO estado = cboUF.SelectedItem as EstadoDTO;

                int funcio = this.dto.Id;

                FuncionarioDTO dto = new FuncionarioDTO();
                dto.Id = funcio;

                dto.Nome        = txtNome.Text;
                dto.Rg          = mkbRG.Text;
                dto.Salario     = nudSalario.Value;
                dto.Cpf         = mkbCPF.Text;
                dto.Telefone    = mkbTelefone.Text;
                dto.Email       = txtEmail.Text;
                dto.IdDepto     = depto.Id;
                dto.Cidade      = txtCidade.Text;
                dto.IdEstado    = estado.Id;
                dto.Cep         = mkbCEP.Text;
                dto.Rua         = txtEndereco.Text;
                dto.Numero      = txtNum.Text;
                dto.Imagem      = ImagemPlugIn.ConverterParaString(pbxFoto.Image);
                dto.Complemento = txtComplemento.Text;

                FuncionarioBusiness buss = new FuncionarioBusiness();
                buss.Alterar(dto);

                string msg = "Funcionário alterado com sucesso!";

                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();

                this.Close();
            }
            catch (ValidacaoException vex)
            {
                string msg = vex.Message;

                frmAlert tela = new frmAlert();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 21
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     try
     {
         CarregarGrid();
     }
     catch (Exception)
     {
         frmException tela = new frmException();
         tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
         tela.ShowDialog();
     }
 }
Exemplo n.º 22
0
        private void btnProcurar_Click(object sender, EventArgs e)
        {
            try
            {
                CarregarGrid();
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 23
0
        void Autocarregar()
        {
            try
            {
                FornecedorBusiness    buss  = new FornecedorBusiness();
                List <FornecedorView> lista = buss.ListarPraGrid();

                dgvFornecedor.DataSource = lista;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 24
0
        void AutoCarregar()
        {
            try
            {
                ItemBusiness    buss  = new ItemBusiness();
                List <ItemView> lista = buss.Listar();

                dgvProduto.DataSource = lista;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 25
0
        private void btnAlterar_Click(object sender, EventArgs e)
        {
            try
            {
                EstadoDTO dto = cboUF.SelectedItem as EstadoDTO;

                ClienteDTO dta = new ClienteDTO();
                dta.id = this.cliente.id;

                dta.Nome           = txtNome.Text;
                dta.Email          = txtEmail.Text;
                dta.DataNascimento = mkbNascimento.Text;
                dta.Rg             = mkbRG.Text;
                dta.Cpf            = mkbCPF.Text;
                dta.Telefone       = mkbTelefone.Text;
                dta.Cidade         = txtCidade.Text;
                dta.DataCadastro   = mkbCadastro.Text;
                dta.Cep            = txtCEP.Text;
                dta.Rua            = txtRua.Text;
                dta.Numero         = txtNumero.Text;
                dta.EstadoId       = Convert.ToInt32(dto.Id);
                dta.Complemento    = txtComplemento.Text;

                ClienteBusiness business = new ClienteBusiness();
                business.Alterar(dta);

                string msg = "Cliente Cadastrado com sucesso";

                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (ValidacaoException vex)
            {
                frmAlert tela = new frmAlert();
                tela.LoadScreen(vex.Message);
                tela.ShowDialog();
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 26
0
        void AutoCarregar()
        {
            try
            {
                VendaBusiness            buss  = new VendaBusiness();
                List <ProdutoVendasView> lista = buss.Listar();

                dgvProduto.AutoGenerateColumns = false;
                dgvProduto.DataSource          = lista;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 27
0
        public void AutoCarregar()
        {
            try
            {
                CargoBusiness   buss = new CargoBusiness();
                List <CargoDTO> dto  = buss.Listar();

                dgvDepto.AutoGenerateColumns = false;
                dgvDepto.DataSource          = dto;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 28
0
        void AutoCarregarGrid()
        {
            try
            {
                EstoqueBusiness   buss = new EstoqueBusiness();
                List <EstoqueDTO> list = buss.Listar();

                dgvEstoque.AutoGenerateColumns = false;
                dgvEstoque.DataSource          = list;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 29
0
        void AutoCarregar()
        {
            try
            {
                GastosABusiness   buss  = new GastosABusiness();
                List <GastosADTO> lista = buss.Listar();

                dgvGastos.AutoGenerateColumns = false;
                dgvGastos.DataSource          = lista;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 30
0
        void AutoCarregar()
        {
            try
            {
                CompraBusiness         bus = new CompraBusiness();
                List <ItemComprasView> dto = bus.Listar();

                dgvCompra.AutoGenerateColumns = false;
                dgvCompra.DataSource          = dto;
            }
            catch (Exception)
            {
                frmException tela = new frmException();
                tela.LoadScreen("Ocorreu um erro.\nConsulte o administrador do sistema.");
                tela.ShowDialog();
            }
        }
Exemplo n.º 31
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                EstadoDTO estado = cboEstado.SelectedItem as EstadoDTO;

                FornecedoresDTO dto = new FornecedoresDTO();
                dto.Id = this.fornecedor.Id;

                dto.Nome     = txtNome.Text;
                dto.Email    = txtEmail.Text;
                dto.CNPJ     = txtCnpj.Text;
                dto.Cidade   = txtCidade.Text;
                dto.CEP      = mkbCep.Text;
                dto.Telefone = txtTelefone.Text;
                dto.IdEstado = estado.Id;
                dto.Rua      = txtRua.Text;
                dto.Numero   = txtNumero.Text;

                FornecedoresBusiness business = new FornecedoresBusiness();
                business.Alterar(dto);

                string msg = "Fornecedor alterado com sucesso!";

                frmMessage tela = new frmMessage();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (ValidacaoException vex)
            {
                string msg = vex.Message;

                frmAlert tela = new frmAlert();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
            catch (Exception ex)
            {
                string msg = "Ocorreu um erro: " + ex.Message;

                frmException tela = new frmException();
                tela.LoadScreen(msg);
                tela.ShowDialog();
            }
        }
Exemplo n.º 32
0
        public static void Encode(string WavFile, SongInfo songInfo, out string Mp3File)
        {
            Mp3File = "";
            ProcessStartInfo pi = new ProcessStartInfo();
            Process p = new Process();
            try
            {
                //
                //Ensure WAV file exists
                if (File.Exists(WavFile) == false)
                {
                    MessageBox.Show(null,
                        "WAV file is not valid. MP3 Conversion Fails...",
                        "MP3 Conversion Problem",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Stop);
                    return;
                }

                //
                //Ensure LAME exists(Same as this app.)
                if (File.Exists(Path.Combine(Application.StartupPath, "lame.exe")) == false)
                {
                    MessageBox.Show(null,
                        "LAME engine not found. MP3 Conversion Fails...",
                        "MP3 Conversion Problem",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Stop);

                    return;
                }

                //
                //Extract the mp3 file name from wav file
                FileInfo fiWav = new FileInfo(WavFile);
                Mp3File =
                    Path.GetDirectoryName(WavFile) + "\\" +
                    fiWav.Name.TrimEnd(fiWav.Extension.ToCharArray()) +
                    ".mp3";

                //
                //Check the passed songinfo structure and if valid embed ID3 header
                //information to the generated MP3 file
                string id3TagOptions = "";

                if (songInfo != null)
                {
                    //Construct the ID3 tag options as Lame wants

                    //Write actual ID3 header only if asked so.
                    if (Globals.GetInstance().AutomaticID3TagsInsertion == true)
                    {
                        //Title
                        if (songInfo.SongTitle != null)
                        {
                            if (songInfo.SongTitle.Trim().Length > 0)
                            {
                                id3TagOptions += " --tt " +  "\"" + (songInfo.SongTitle.Trim()) + "\"";
                            }
                        }

                        //Artist
                        if (songInfo.Artist != null)
                        {
                            if (songInfo.Artist.Trim().Length > 0)
                            {
                                id3TagOptions += " --ta " + "\"" + (songInfo.Artist.Trim()) + "\"";
                            }
                        }

                        //Album
                        if (songInfo.Album != null)
                        {
                            if (songInfo.Album.Trim().Length > 0)
                            {
                                id3TagOptions += " --tl " + "\"" + (songInfo.Album.Trim()) + "\"";
                            }
                        }
                    }

                    //Watermark "RaagaHacker" in recorded songs
                    //We can use "comment" tag header for the same
                    //
                    //Probably when we will show the song browser, we can have a filter
                    //that will show only those songs recorded by RaagaHacker !
                    id3TagOptions += " --tc " + "RaagaHacker";

                }

                //
                //Start the LAME engine

                //
                //Prepare the commandline arguments
                string arguments = "";

                //Noise shaping & psycho acoustic algorithms:
                //    -q <arg>        <arg> = 0...9.  Default  -q 5
                //        -q 0:  Highest quality, very slow
                //        -q 9:  Poor quality, but fast
                //    -h              Same as -q 2.   Recommended.
                arguments += " -h ";

                //
                //To be in safe-side mark this recorded songs as non-original
                arguments += " -o ";

                //embed ID3 tags
                if (id3TagOptions.Trim().Length > 0)
                {
                    arguments += id3TagOptions.Trim();
                }

                pi.Arguments = arguments.Trim() + " " + "\"" + WavFile + "\"" + " " + "\"" + Mp3File + "\"";
                pi.FileName = "\"" + Application.StartupPath + "\\" + "lame.exe" + "\"";
                pi.WindowStyle = ProcessWindowStyle.Hidden;
                p.StartInfo = pi;

                p.Start();

                //Wait until it finishes
                p.WaitForExit();

            }
            catch (Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "MP3 Encoding Problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
            finally
            {
                if (p != null)
                {
                    pi = null;
                    p.Dispose();
                    p = null;
                }
            }
        }
Exemplo n.º 33
0
        /// <summary>
        /// This function uses LAME engine to encode a given WAV file(sppecified by the 
        /// first parameter : WavFile) to a MP3 file(specified by the second parameter)
        /// </summary>
        /// <param name="WavFile">Fullpath of the WAV file</param>
        /// <param name="Mp3File">Fullpath of the MP3 file to be created</param>
        public static void Encode(string WavFile,out string Mp3File)
        {
            Mp3File = "";
            ProcessStartInfo pi = new ProcessStartInfo();
            Process p = new Process();
            try
            {
                //
                //Ensure WAV file exists
                if (File.Exists(WavFile) ==  false)
                {
                    MessageBox.Show(null,
                        "WAV file is not valid. MP3 Conversion Fails...",
                        "MP3 Conversion Problem",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Stop);
                    return;
                }

                //
                //Ensure LAME exists(Same as this app.)
                if (File.Exists(Path.Combine(Application.StartupPath,"lame.exe")) == false)
                {
                    MessageBox.Show(null,
                        "LAME engine not found. MP3 Conversion Fails...",
                        "MP3 Conversion Problem",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Stop);

                    return;
                }

                //
                //Extract the mp3 file name from wav file
                FileInfo fiWav = new FileInfo(WavFile);
                Mp3File =
                    Path.GetDirectoryName(WavFile) + "\\" +
                    fiWav.Name.TrimEnd(fiWav.Extension.ToCharArray()) +
                    ".mp3";

                //
                //Start the LAME engine
                pi.Arguments = "-h " + "\"" + WavFile + "\"" + " " + "\"" + Mp3File + "\"";
                pi.FileName = "\"" + Application.StartupPath + "\\" + "lame.exe" + "\"";
                pi.WindowStyle = ProcessWindowStyle.Hidden;
                p.StartInfo = pi;

                p.Start();

                //Wait until it finishes
                p.WaitForExit();

            }
            catch(Exception _e)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "MP3 Encoding Problem ";
                frm.ErrorMessage = _e.Message;
                frm.StrackTrace = _e.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
            finally
            {
                if (p != null)
                {
                    pi = null;
                    p.Dispose();
                    p = null;
                }
            }
        }
Exemplo n.º 34
0
        private void UpdatePlaylist(PlaylistManager playListManager)
        {
            try
            {
                //
                //This is the code which glues the PlaylistManager with UI
                //

                //Double check
                if (playListManager != null)
                {
                    foreach (Movie movie in playListManager.Movies)
                    {
                        //Create & add the movie node
                        TreeNode tnMovie = new TreeNode(movie.MovieName);

                        //Add the songs under movie
                        TreeNode tnMovieSong = null;
                        foreach (string key in movie.SongCollection)
                        {
                            //Create each song node
                            tnMovieSong = new TreeNode(movie.SongCollection[key]);

                            //Place the song id in associated Tag field
                            tnMovieSong.Tag = key;

                            //Add this to movie node
                            tnMovie.Nodes.Add(tnMovieSong);
                        }

                        //Add this to the root node
                        tvPlaylists.Nodes[0].Nodes.Add(tnMovie);

                    }

                }

            }
            catch(Exception ex)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "frmPlaylists::UpdatePlaylist - Error while updating the playlist ";
                frm.ErrorMessage = ex.Message;
                frm.StrackTrace = ex.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }