Exemplo n.º 1
0
        protected void FillTreatmentList()
        {
            // Create a table to store data for the DropDownList control.
            DataTable dt = new DataTable();

            // Define the columns of the table.
            dt.Columns.Add(new DataColumn("TextField", typeof(String)));
            dt.Columns.Add(new DataColumn("ValueField", typeof(String)));

            IRepoEvento       repo  = new RepoEvento();
            List <TipoEvento> tipos = repo.getTipoEventosPorTipo("COMPRAVENTA");

            // Populate the table with sample values.
            dt.Rows.Add(CreateRow("", "", dt));

            foreach (TipoEvento tipo in tipos)
            {
                dt.Rows.Add(CreateRow(tipo.Nombre, tipo.Nombre, dt));
            }

            // Create a DataView from the DataTable to act as the data source
            // for the DropDownList control.

            listOperacion.DataSource     = new DataView(dt);
            listOperacion.DataTextField  = "TextField";
            listOperacion.DataValueField = "ValueField";

            // Bind the data to the control.
            listOperacion.DataBind();

            // Set the default selected item, if desired.
            listOperacion.SelectedIndex = 0;
        }
Exemplo n.º 2
0
        protected void RealizarTransaccion(object sender, EventArgs e)
        {
            IRepoEvento repo   = new RepoEvento();
            Animal      animal = new Animal();
            Evento      evento = new Evento();

            try
            {
                evento.idAnimal      = Convert.ToInt32(listAnimales.SelectedItem.Value);
                evento.DicoseOrg     = Convert.ToInt64(listEstablecimientos.SelectedItem.Value);
                evento.DicoseDest    = Convert.ToInt64(listEstablecimientosDestino.SelectedItem.Value);
                evento.Fecha         = Calendar2.SelectedDate;
                evento.Observaciones = txtObs.Text;

                String option = listOperacion.SelectedItem.Value;
                if (option.Equals("COMPRA"))
                {
                    evento.Nombre = "COMPRA";
                    evento.Tipo   = evento.Nombre;
                }
                else
                {
                    evento.Nombre = "VENTA";
                    evento.Tipo   = evento.Nombre;
                }
                repo.AddTransaction(evento);
                // Aca deberiamos mostrar algun cuadro de dialogo confirmando la creacion del animal.
                navegarHome();
            }
            catch (Exception)
            {
                Session.Add("error", "No fue posible agregar el animal");
                Response.Redirect("ErrorPages/Error.aspx");
            }
        }
Exemplo n.º 3
0
        protected void AltaTratamiento(object sender, EventArgs e)
        {
            IRepoEvento repo   = new RepoEvento();
            Animal      animal = new Animal();
            Evento      evento = new Evento();


            try
            {
                evento.idAnimal  = Convert.ToInt32(listAnimales.SelectedItem.Value);
                evento.DicoseOrg = Convert.ToInt64(listEstablecimientos.SelectedItem.Value);

                String option = listTratamiento.SelectedItem.Value;
                if (option.Equals("MUERTE"))
                {
                    evento.Fecha         = Calendar1.SelectedDate;
                    evento.Nombre        = "Muerte";
                    evento.Tipo          = evento.Nombre;
                    evento.Observaciones = "";
                }
                else if (option.Equals("PESAJE"))
                {
                    evento.Fecha         = Calendar2.SelectedDate;
                    evento.Nombre        = "Pesaje";
                    evento.Tipo          = evento.Nombre;
                    evento.Observaciones = txtKilos.Text;
                }
                else if (option.Equals("VACUNAS"))
                {
                    evento.Fecha         = DateTime.Now;
                    evento.Nombre        = txtNombreVacuna.Text;
                    evento.Tipo          = "VACUNAS";
                    evento.Observaciones = txtDosisVacuna.Text;
                }
                else if (option.Equals("TRATAMIENTO"))
                {
                    evento.Fecha         = DateTime.Now;
                    evento.Nombre        = txtNomTratamiento.Text;
                    evento.Tipo          = "TRATAMIENTO";
                    evento.Observaciones = txtAplicacionTratamiento.Text;
                }
                else if (option.Equals("PRENIA"))
                {
                    evento.Fecha         = Calendar3.SelectedDate;
                    evento.Nombre        = "PRENIA";
                    evento.Tipo          = "PRENIA";
                    evento.Observaciones = txtPrenia.Text;
                }
                else
                {
                    evento.Fecha         = Calendar4.SelectedDate;
                    evento.Nombre        = "NACIMIENTOS";
                    evento.Tipo          = "NACIMIENTOS";
                    evento.Observaciones = txtParto.Text;
                }


                repo.Add(evento);

                // Aca deberiamos mostrar algun cuadro de dialogo confirmando la creacion del animal.
                navegarHome();
            }
            catch (Exception)
            {
                Session.Add("error", "No fue posible agregar el animal");
                Response.Redirect("ErrorPages/Error.aspx");
            }
        }