Esempio n. 1
0
        private void ExecuteCommandSave(object param)
        {
            Doc.Link = mLink.Create(Doc.Tipo, Doc.Data.Year.ToString(), Doc.Numero);
            ObservableCollectionToList(ListAcoes);
            //MessageBox.Show(Doc.ToString());
            if (new mDataInsert().Insert(Doc))
            {
                MessageBox.Show("Documento Incluido com sucesso!", "Sim.Apps.Info!");


                string filedestino = Common.Helpers.XmlFile.Listar("sim.apps", "App", "PDF", "Legislacao")[0];

                string fileorigem = Common.Helpers.Folders.SystemDesktop
                                    + @"\" + Common.Helpers.Folders.SimPDF
                                    + @"\" + PdfPath;

                if (Doc.Tipo == "LEI")
                {
                    filedestino += @"\leis\" + Doc.Data.Year + @"\" + Doc.Numero + ".pdf";
                }

                if (Doc.Tipo == "LEI COMPLEMENTAR")
                {
                    filedestino += @"\leis_complementares\" + Doc.Data.Year + @"\" + Doc.Numero + ".pdf";
                }

                if (Doc.Tipo == "DECRETO")
                {
                    filedestino += @"\decretos\" + Doc.Data.Year + @"\" + Doc.Numero + ".pdf";
                }

                try
                {
                    System.IO.File.Copy(fileorigem, filedestino, true);
                    System.IO.File.Delete(fileorigem);
                }
                catch { }

                ContentPdfView.Content = null;
                BoxGroups    = Visibility.Collapsed;
                ViewStartPDF = Visibility.Visible;
                ViewGroupPDF = Visibility.Collapsed;
                ListAcoes.Clear();
                Doc.ResetValues();
                Doc.Situacao   = "1";
                SelectedAutor  = "0";
                SelectedOrigem = "0";

                PdfPath = string.Empty;
                PDFs    = Common.Helpers.Files.ListFiles(string.Format(@"{0}\{1}", Common.Helpers.Folders.SystemDesktop, Common.Helpers.Folders.SimPDF), "*.pdf");
            }
            else
            {
                MessageBox.Show(string.Format("Documento já cadastrado [{0} {1}]!", Doc.Tipo, Doc.Numero), "Sim.Apps.Info!");
            }
        }
Esempio n. 2
0
 private void ExecuteCommandCancel(object param)
 {
     BoxGroups              = Visibility.Collapsed;
     ViewStartPDF           = Visibility.Visible;
     ViewGroupPDF           = Visibility.Collapsed;
     ContentPdfView.Content = null;
     ListAcoes.Clear();
     Doc.ResetValues();
     Doc.Situacao     = "1";
     SelectedAutor    = "0";
     SelectedOrigem   = "0";
     SelectedAcao     = "0";
     SelectedTipoAlvo = "...";
     NumeroAlvo       = 0;
     ComplementoAlvo  = "";
 }
Esempio n. 3
0
        //list<t> to observablecollection<t>
        private void ListToObservableCollection(List <mAcoes> listaAcoes)
        {
            ListAcoes.Clear();
            foreach (mAcoes Ac in listaAcoes)
            {
                var nAc = new mAcoes();

                nAc.Indice            = Ac.Indice;
                nAc.TipoOrigem        = Ac.TipoOrigem;
                nAc.NumeroOrigem      = Ac.NumeroOrigem;
                nAc.ComplementoOrigem = Ac.ComplementoOrigem;
                nAc.DataOrigem        = Ac.DataOrigem;
                nAc.Acao            = Ac.Acao;
                nAc.TipoAlvo        = Ac.TipoAlvo;
                nAc.NumeroAlvo      = Ac.NumeroAlvo;
                nAc.ComplementoAlvo = Ac.ComplementoAlvo;
                nAc.DataAlvo        = Ac.DataAlvo;
                nAc.Incluido        = Ac.Incluido;

                ListAcoes.Add(nAc);
            }
        }