public void VendedorSelecionado()
        {
            DataTable dt = new DataTable();

            dt                 = BusinesConfig.PathImage();
            txtNome.Text       = dgvVendedores.CurrentRow.Cells["nome"].Value.ToString();
            txtSobreNome.Text  = dgvVendedores.CurrentRow.Cells["sobre_nome"].Value.ToString();
            txtEmail.Text      = dgvVendedores.CurrentRow.Cells["email"].Value.ToString();
            txtLogin.Text      = dgvVendedores.CurrentRow.Cells["login"].Value.ToString();
            txtSenha.Text      = dgvVendedores.CurrentRow.Cells["senha"].Value.ToString();
            txtTelefone.Text   = dgvVendedores.CurrentRow.Cells["telefone"].Value.ToString();
            txtIdVendedor.Text = dgvVendedores.CurrentRow.Cells["id_vendedor"].Value.ToString();
            DataTable dtPath = new DataTable();

            dtPath = BusinesConfig.PathImage();
            image  = dgvVendedores.CurrentRow.Cells["foto"].Value.ToString();
            if (string.IsNullOrEmpty(image))
            {
                image = "default.png";
            }
            if (!File.Exists(dtPath.Rows[0]["image_path"].ToString() + image))
            {
                image = "default.png";
            }
            string url = dtPath.Rows[0]["image_path"].ToString() + image;

            fotoVendedor.Load(url);
            fotoVendedor.Load();
        }
        public void ProdutoSelecionado()
        {
            txtCodigo.Text     = dgvProdutos.CurrentRow.Cells["codigo"].Value.ToString();
            txtEAN.Text        = dgvProdutos.CurrentRow.Cells["ean"].Value.ToString();
            txtDescricao.Text  = dgvProdutos.CurrentRow.Cells["descricao"].Value.ToString();
            txtEmbalagem.Text  = dgvProdutos.CurrentRow.Cells["embalagem"].Value.ToString();
            txtEstoque.Text    = dgvProdutos.CurrentRow.Cells["estoque"].Value.ToString();
            txtIdProduto.Text  = dgvProdutos.CurrentRow.Cells["id_produto"].Value.ToString();
            txtPrecoCusto.Text = dgvProdutos.CurrentRow.Cells["preco"].Value.ToString();
            txtPrecoVenda.Text = dgvProdutos.CurrentRow.Cells["preco_promocional"].Value.ToString();
            cbCategoria.Text   = dgvProdutos.CurrentRow.Cells["nome_categoria"].Value.ToString();
            DataTable dtPath = new DataTable();

            dtPath = BusinesConfig.PathImage();
            image  = dgvProdutos.CurrentRow.Cells["image"].Value.ToString();
            if (string.IsNullOrEmpty(image))
            {
                image = "default.png";
            }
            if (!File.Exists(dtPath.Rows[0]["image_path"].ToString() + image))
            {
                image = "default.png";
            }
            string url = dtPath.Rows[0]["image_path"].ToString() + image;

            fotoProduto.Load(url);
            fotoProduto.Load();
        }
Beispiel #3
0
        //definindo imagem do produto
        private void fotoVendedor_Click(object sender, EventArgs e)
        {
            DataTable dtPath = new DataTable();

            dtPath = BusinesConfig.PathImage();
            MessageBox.Show(dtPath.Rows[0]["image_path"].ToString());

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.CheckFileExists = false;
            openFileDialog.AddExtension    = true;
            openFileDialog.Multiselect     = false;
            openFileDialog.Filter          = "JPG files (*.jpg)|*.jpg";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this.fotoVendedor.SizeMode = PictureBoxSizeMode.StretchImage;
                this.fotoVendedor.Image    = Image.FromFile(openFileDialog.FileName);
                foreach (string fileName in openFileDialog.FileNames)
                {
                    if (System.IO.File.Exists(dtPath.Rows[0]["image_path"].ToString() + Path.GetFileName(fileName)))
                    {
                        MessageBox.Show("Já existe uma imagem com esse nome na pasta, Atualizar?");
                        //File.Replace(fileName, @"C:\Users\ArteGift\Documents\img\" + Path.GetFileName(fileName), "copy");
                    }
                    else
                    {
                        File.Copy(fileName, dtPath.Rows[0]["image_path"].ToString() + Path.GetFileName(fileName));
                    }
                }
                string fileNames = openFileDialog.FileName;
                image = Path.GetFileName(fileNames);
            }
        }
Beispiel #4
0
        private List <DadosExcel> GetEmployeeDetails()
        {
            DataTable dt = new DataTable();

            dt = BusinesConfig.PathImage();
            string imagePath = dt.Rows[0]["image_path"].ToString();

            DataTable dtR = new DataTable();

            dtR = BPedidosCompra.PedidoCompra_DadosExcel(Convert.ToInt32(lblPedido.Text));

            //Instantiate employee list
            List <DadosExcel> employeeList = new List <DadosExcel>();

            //Set the details of employee and into employee list

            for (int i = 0; i < dtR.Rows.Count; i++)
            {
                //Percorrer as imagens dentro da pasta
                byte[]     image = File.ReadAllBytes(imagePath.ToString() + dtR.Rows[i]["image"].ToString());
                DadosExcel emp   = new DadosExcel();
                emp.Foto         = image;
                emp.Codigo       = dtR.Rows[i]["codigo"].ToString();
                emp.Descricao    = dtR.Rows[i]["descricao"].ToString();
                emp.QtdCaixa     = Convert.ToInt32(dtR.Rows[i]["qtd_embalagem"].ToString());
                emp.ValorUnidade = Convert.ToDecimal(dtR.Rows[i]["preco_unidade"].ToString());
                emp.Quantidade   = Convert.ToInt32(dtR.Rows[i]["quantidade"].ToString());
                emp.Total        = Convert.ToDecimal(dtR.Rows[i]["Total"].ToString());
                emp.MetroCubico  = Convert.ToDecimal(dtR.Rows[i]["metro_cubico"].ToString());
                emp.TotalCBM     = Convert.ToDecimal(dtR.Rows[i]["TotalCBM"].ToString());
                emp.MinimoVenda  = Convert.ToInt32(dtR.Rows[i]["embalagem"].ToString());
                emp.CodBarra     = dtR.Rows[i]["ean"].ToString();
                emp.Medida       = dtR.Rows[i]["medida"].ToString();
                emp.ObsItem      = dtR.Rows[i]["obs_item"].ToString();
                employeeList.Add(emp);
            }

            //DadosExcel emp = new DadosExcel();
            //emp.Foto = image;
            //emp.Codigo = dtR.Rows[0]["codigo"].ToString();
            //emp.Descricao = dtR.Rows[0]["descricao"].ToString();
            //emp.QtdCaixa = Convert.ToInt32(dtR.Rows[0]["qtd_embalagem"].ToString());
            //emp.ValorUnidade = Convert.ToDecimal(dtR.Rows[0]["preco_unidade"].ToString());
            //emp.Obs = dtR.Rows[0]["observacao"].ToString();
            //employeeList.Add(emp);

            //Return the employee list
            return(employeeList);
        }
Beispiel #5
0
        private void SettingGeral_Load(object sender, EventArgs e)
        {
            lblUser.Text = "Olá, " + UserLoginCache.Nome + " " + UserLoginCache.SobreNome;
            DataTable dt = new DataTable();

            dt = BusinesConfig.PathImage();
            if (dt.Rows.Count != 0)
            {
                string imagePath = dt.Rows[0]["image_path"].ToString();
                lblFolderPath.Visible = true;
                lblFolderPath.Text    = "      Suas imagens estão sendo gravadas no caminho: " + imagePath;
            }
            else
            {
                msgAlert("Defina uma pasta para guardar as imagens dos produtos, vendedores...");
            }
        }
Beispiel #6
0
 public void UploadImagePath()
 {
     try
     {
         DataTable dt = new DataTable();
         dt = BusinesConfig.PathImage();
         string rpta = "";
         if (!string.IsNullOrEmpty(txtPathImage.Text))
         {
             rpta = BusinesConfig.CadastroPathImage(txtPathImage.Text);
             lblFolderPath.Visible = false;
             lblAlert.Visible      = false;
             msgSuccess("Ok, gravei sua pasta de imagens com sucesso! Apartir de agora essa é sua pasta de imagens!");
         }
     }
     catch (Exception ex)
     {
         msgSuccess(ex.Message + ex.StackTrace);
     }
 }
        private void imageProduto_Click(object sender, EventArgs e)
        {
            DataTable dtPath = new DataTable();

            dtPath = BusinesConfig.PathImage();

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.CheckFileExists = false;
            openFileDialog.AddExtension    = true;
            openFileDialog.Multiselect     = false;
            openFileDialog.Filter          = "JPG files (*.jpg)|*.jpg";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                //this.fotoVendedor.SizeMode = PictureBoxSizeMode.Zoom;
                this.fotoProduto.Image = Image.FromFile(openFileDialog.FileName);
                string original = Path.GetFullPath(openFileDialog.FileName);
                string novo     = dtPath.Rows[0]["image_path"].ToString() + Path.GetFileName(openFileDialog.FileName);
                //string original = dtPath.Rows[0]["image_path"].ToString() + Path.GetFileName(openFileDialog.FileName);

                foreach (string fileName in openFileDialog.FileNames)
                {
                    if (File.Exists(dtPath.Rows[0]["image_path"].ToString() + Path.GetFileName(fileName)))
                    {
                        MessageBox.Show("Já existe uma imagem com esse nome na pasta, Atualizar?");
                        //File.Replace(fileName, @"C:\Users\ArteGift\Documents\img\" + Path.GetFileName(fileName), "copy");
                    }
                    else
                    {
                        ResizeImage(original, novo, 300, 200, true);
                        //File.Copy(fileName, dtPath.Rows[0]["image_path"].ToString() + Path.GetFileName(fileName));
                    }
                }
                string fileNames = openFileDialog.FileName;
                image = Path.GetFileName(fileNames);
                MessageBox.Show(image);
            }
        }