Ejemplo n.º 1
0
        public GastosUserControl(string id = null)
        {
            InitializeComponent();

            currentID               = -1;
            currentGastosDao        = new GastosDAO(MainWindow.currentPath);
            tipoComboBox.DataSource = Enum.GetValues(typeof(GastosType));

            maquinarioDao              = new MaquinarioDAO(MainWindow.currentPath);
            unidadeAnimalDao           = new UnidadeAnimalDAO(MainWindow.currentPath);
            combustiveisDao            = new CombustiveisDAO(MainWindow.currentPath);
            pastagemDao                = new PastagemDAO(MainWindow.currentPath);
            gastosDao                  = new GastosDAO(MainWindow.currentPath);
            tipoComboBox.SelectedIndex = -1;

            if (id != null)
            {
                currentID                  = int.Parse(id);
                currentGastos              = currentGastosDao.selectById(currentID);
                nomeTextBox.Text           = currentGastos.nome;
                tipoComboBox.SelectedIndex = (int)currentGastos.idCategoria;
                refreshList();
                if (tipoComboBox.SelectedIndex > 0)
                {
                    referenteComboBox.SelectedIndex = currentGastos.idRef - 1;
                }
                else
                {
                    referenteComboBox.SelectedIndex = -1;
                }
                valorTextBox.Text = currentGastos.valor.ToString();
            }
        }
Ejemplo n.º 2
0
 private void initDaos()
 {
     if (currentPath == null)
     {
         return;
     }
     maquinarioDao    = new MaquinarioDAO(currentPath);
     combustiveisDao  = new CombustiveisDAO(currentPath);
     pastagemDao      = new PastagemDAO(currentPath);
     tipoPastagemDao  = new TipoPastagemDAO(currentPath);
     gastosDao        = new GastosDAO(currentPath);
     unidadeAnimalDao = new UnidadeAnimalDAO(currentPath);
 }
Ejemplo n.º 3
0
 public CombustivelUserControl(string id = null)
 {
     InitializeComponent();
     currentID             = -1;
     currentCombustivelDao = new CombustiveisDAO(MainWindow.currentPath);
     if (id != null)
     {
         currentID             = int.Parse(id);
         currentCombustivel    = currentCombustivelDao.selectById(currentID);
         nomeTextBox.Text      = currentCombustivel.nome;
         descricaoTextBox.Text = currentCombustivel.descricao;
     }
 }
Ejemplo n.º 4
0
        private static void Main(string[] args)
        {
            var              path             = @"D:\hue.cdp";
            CombustiveisDAO  combustiveisDao  = new CombustiveisDAO(path);
            MaquinarioDAO    maquinarioDao    = new DataPersistent.MaquinarioDAO(path);
            PastagemDAO      pastagemDao      = new DataPersistent.PastagemDAO(path);
            TipoPastagemDAO  tipoPastagemDao  = new DataPersistent.TipoPastagemDAO(path);
            GastosDAO        gastosDao        = new DataPersistent.GastosDAO(path);
            UnidadeAnimalDAO unidadeAnimalDao = new DataPersistent.UnidadeAnimalDAO(path);


            var a = new HTMLBuilder();

            a.addButton("Maquinarios");
            a.addButton("Pastagem");
            a.addButton("Gastos");
            a.addButton("Unidade Animal");

            a.initDiv("Maquinarios");
            a.addMaquinariosTable(maquinarioDao.selectEverything());
            a.endDiv();


            a.initDiv("Pastagem");
            a.addPastagemTable(pastagemDao.selectEverything());
            a.endDiv();


            a.initDiv("Gastos");
            a.addGastosTable(gastosDao.selectEverything());
            a.endDiv();


            a.initDiv("Unidade Animal");
            a.addUnidadeAnimalTable(unidadeAnimalDao.selectEverything());
            a.endDiv();


            using (StreamWriter writer =
                       new StreamWriter(@"D:Relato.html"))
            {
                writer.WriteLine(a.toHTML());
            }



            Console.ReadLine();
        }
Ejemplo n.º 5
0
        public MaquinarioUserControl(string id = null)
        {
            InitializeComponent();
            currentID            = -1;
            maquinarioDao        = new MaquinarioDAO(MainWindow.currentPath);
            combustiveisDao      = new CombustiveisDAO(MainWindow.currentPath);
            comboBox1.DataSource = combustiveisDao.selectIdAndString().Values.ToArray();

            if (id != null)
            {
                currentID               = int.Parse(id);
                currentMaquinario       = maquinarioDao.selectById(int.Parse(id));
                textBox1.Text           = currentMaquinario.nome;
                textBox2.Text           = currentMaquinario.descricao;
                comboBox1.SelectedIndex = currentMaquinario.combustivel_id - 1;
            }
        }
        void gerador()
        {
            a.clear();

            var              path             = MainWindow.currentPath;
            CombustiveisDAO  combustiveisDao  = new CombustiveisDAO(path);
            MaquinarioDAO    maquinarioDao    = new DataPersistent.MaquinarioDAO(path);
            PastagemDAO      pastagemDao      = new DataPersistent.PastagemDAO(path);
            TipoPastagemDAO  tipoPastagemDao  = new DataPersistent.TipoPastagemDAO(path);
            GastosDAO        gastosDao        = new DataPersistent.GastosDAO(path);
            UnidadeAnimalDAO unidadeAnimalDao = new DataPersistent.UnidadeAnimalDAO(path);
            Misc             miscDao          = new Misc(path);



            a.initDiv("", "division");

            if (maquinariosCheckBox.Checked)
            {
                a.addButton("Maquinarios");
            }
            if (pastagemCheckBox.Checked)
            {
                a.addButton("Pastagem");
            }
            if (gastoCheckBox.Checked)
            {
                a.addButton("Gastos");
            }
            if (UAcheckBox.Checked)
            {
                a.addButton("Unidade Animal");
            }


            a.endDiv();

            if (maquinariosCheckBox.Checked)
            {
                a.initDiv("Maquinarios", "separator");
                a.addMaquinariosTable(maquinarioDao.selectEverything());
                a.endDiv();
            }


            if (pastagemCheckBox.Checked)
            {
                a.initDiv("Pastagem", "separator");
                a.addPastagemTable(pastagemDao.selectEverything());
                a.endDiv();
            }


            if (gastoCheckBox.Checked)
            {
                a.initDiv("Gastos", "separator");
                a.addGastosTable(gastosDao.selectEverything());
                a.endDiv();
            }


            if (UAcheckBox.Checked)
            {
                a.initDiv("Unidade Animal", "Separator");
                a.addUnidadeAnimalTable(unidadeAnimalDao.selectEverything());
                a.endDiv();
            }


            a.css();
        }