Esempio n. 1
0
        private void ExecuteCommandAddAction(object param)
        {
            var acoes = new mAcoes();

            try
            {
                List <string> lista = new mDataValidarAcao().Validate(SelectedTipoAlvo, NumeroAlvo, ComplementoAlvo);

                acoes.TipoOrigem        = Doc.Tipo;
                acoes.NumeroOrigem      = Doc.Numero;
                acoes.ComplementoOrigem = Doc.Complemento;
                acoes.DataOrigem        = Doc.Data;
                acoes.Acao            = SelectedAcao;
                acoes.TipoAlvo        = lista[0];
                acoes.NumeroAlvo      = Convert.ToInt32(lista[1]);
                acoes.ComplementoAlvo = lista[2];
                acoes.DataAlvo        = Convert.ToDateTime(lista[3]);
                acoes.Incluido        = DateTime.Now;

                ListAcoes.Add(acoes);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                SelectedAcao     = "0";
                SelectedTipoAlvo = "...";
                NumeroAlvo       = 0;
                ComplementoAlvo  = string.Empty;
            }
        }
Esempio n. 2
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. 3
0
 private void ExecuteCommandRemoveAction(object param)
 {
     if (MessageBox.Show("Excluir Ação?", "Sim.Apps.Alerta!", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
     {
         try
         {
             ListAcoes.RemoveAt(SelectedIndex);
         }
         catch (Exception ex) { MessageBox.Show(ex.Message); }
     }
 }
Esempio n. 4
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. 5
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);
            }
        }