Example #1
0
        private void refreshLote_Click(object sender, RoutedEventArgs e)
        {
            DirectoryInfo diretorio = new DirectoryInfo(@"c:\dados\lotes\");

            FileInfo[] Arquivos = diretorio.GetFiles("*.xml*");

            listviewLotes.Items.Clear();

            foreach (FileInfo fileinfo in Arquivos)
            {
                string nome = fileinfo.FullName;

                XmlTextReader tr = new XmlTextReader(nome);

                LVDataLote row = new LVDataLote();

                while (tr.Read())
                {
                    if (tr.NodeType == XmlNodeType.Element)
                    {
                        if (tr.Name == "codigoLote")
                        {
                            row.Codigo = tr.ReadString();
                        }

                        if (tr.Name == "descricaoLote")
                        {
                            row.Descricao = tr.ReadString();
                        }
                    }
                }
                listviewLotes.Items.Add(row);
                tr.Close();
            }
        }
Example #2
0
 private void excluirLote_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Deseja apagar esse lote?", "Apagar lote", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         LVDataLote s        = (LVDataLote)listviewLotes.SelectedItems[0];
         string     caminho1 = "C:\\dados\\lotes\\" + s.Codigo + ".xml";
         File.Delete(caminho1);
     }
 }
Example #3
0
        private void atualizarDataGridPecasDoLote_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string      caminhoLote = "c:\\dados\\lotes\\" + codigoLote.Text + ".xml";
                XmlDocument doc         = new XmlDocument();
                doc.Load(caminhoLote);

                XmlNodeList listaPeca = doc.GetElementsByTagName("peca");


                var pecasParaLote = new ObservableCollection <LVDataLote>()
                {
                };

                foreach (XmlNode node in listaPeca)
                {
                    XmlElement elementoPeca = (XmlElement)node;

                    string codigoP      = elementoPeca.GetElementsByTagName("codigoP")[0].InnerText;
                    string descricaoP   = elementoPeca.GetElementsByTagName("descricaoP")[0].InnerText;
                    string comprimentoP = elementoPeca.GetElementsByTagName("comprimentoP")[0].InnerText;
                    string larguraP     = elementoPeca.GetElementsByTagName("larguraP")[0].InnerText;
                    string quantidadeP  = elementoPeca.GetElementsByTagName("quantidadeP")[0].InnerText;
                    //      bool rotacionaP = false;
                    string auxiliarRotacionaP = elementoPeca.GetElementsByTagName("rotacionaP")[0].InnerText;

                    LVDataLote pecaParaAddNaLista = new LVDataLote();
                    pecaParaAddNaLista.Codigo      = codigoP;
                    pecaParaAddNaLista.Descricao   = descricaoP;
                    pecaParaAddNaLista.Comprimento = comprimentoP;
                    pecaParaAddNaLista.Largura     = larguraP;
                    pecaParaAddNaLista.Quantidade  = quantidadeP;

                    if (auxiliarRotacionaP.Equals("True"))
                    {
                        pecaParaAddNaLista.Rotacionar = true;
                    }

                    if (auxiliarRotacionaP.Equals("False"))
                    {
                        pecaParaAddNaLista.Rotacionar = false;
                    }

                    pecasParaLote.Add(pecaParaAddNaLista);
                }
                this.datagridLote.ItemsSource = pecasParaLote;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #4
0
        private void editarLote_Click(object sender, RoutedEventArgs e)
        {
            LVDataLote s = (LVDataLote)listviewLotes.SelectedItems[0];

            //     string caminho2 = "C:\\dados\\materiais\\" + s.Codigo + ".xml";
            int    valorLinha  = Convert.ToInt32(s.Codigo);
            string valorLinha2 = Convert.ToString(s.Descricao);

            cadastrarPecasLote janela = new cadastrarPecasLote(valorLinha, valorLinha2);

            janela.Show();
        }
Example #5
0
        private void excluirLinha_Click(object sender, RoutedEventArgs e)
        {
            var pecasParaLote = new List <LVDataLote>
            {
            };

            LVDataLote novaLinha = new LVDataLote();

            novaLinha.Codigo      = "";
            novaLinha.Descricao   = "";
            novaLinha.Comprimento = "";
            novaLinha.Largura     = "";
            novaLinha.Quantidade  = "";
            novaLinha.Rotacionar  = false;

            pecasParaLote.Add(novaLinha);

            datagridLote.ItemsSource = pecasParaLote;
        }