Beispiel #1
0
        protected void FillAnimalList(string sexo)
        {
            Int64 dicose = Convert.ToInt64(listEstablecimientos.SelectedItem.Value);

            IRepoAnimal   repo     = new RepoAnimal();
            List <Animal> animales = repo.getAllByEst(dicose, sexo);
            // 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)));

            foreach (Animal obj in animales)
            {
                String idAnimal = Convert.ToString(obj.ID);
                // Populate the table with sample values.
                dt.Rows.Add(CreateRow(idAnimal, idAnimal, dt));
            }

            // Create a DataView from the DataTable to act as the data source
            // for the DropDownList control.
            listAnimales.DataSource     = new DataView(dt);
            listAnimales.DataTextField  = "TextField";
            listAnimales.DataValueField = "ValueField";

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

            // Set the default selected item, if desired.
            listAnimales.SelectedIndex = 0;
        }
Beispiel #2
0
        protected void AltaAnimal(object sender, EventArgs e)
        {
            IRepoAnimal repo   = new RepoAnimal();
            Animal      animal = new Animal();

            try
            {
                animal.DICOSE             = Convert.ToInt64(listEstablecimientos.SelectedItem.Value);
                animal.Sexo               = Convert.ToChar(genderList.SelectedItem.Value);
                animal.AnoNacimiento      = Convert.ToInt32(yearList.SelectedItem.Value);
                animal.EstacionNacimiento = Convert.ToChar(stationList.SelectedItem.Value);
                animal.RazaCruza          = txtRaza.Text;

                if (chkRfid.Checked)
                {
                    animal.RFID = Convert.ToInt64(txtRfid.Text);
                }
                else
                {
                    animal.RFID = 0;
                }

                repo.Add(animal);
                // 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");
                throw;
            }
        }
Beispiel #3
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            IRepoAnimal repo = new RepoAnimal();

            try
            {
                DateTime      fecha    = Convert.ToDateTime(calFecha.SelectedDate);
                List <Animal> list     = repo.sinPesar(fecha);
                List <String> sinPesar = new List <String>();
                foreach (var i in list)
                {
                    sinPesar.Add("ID: " + i.ID + " | DICOSE: " + i.DICOSE + " | Sexo: " + i.Sexo +
                                 " | Raza / Cruza: " + i.RazaCruza + " | Año Nacimiento: " + i.AnoNacimiento);
                }
                bullSinPesar.DataSource = sinPesar;
                if (bullSinPesar.DataSource == null)
                {
                    lblError.Visible        = true;
                    bullSinPesar.DataSource = new List <String>();
                }
                else
                {
                    lblError.Visible = false;
                }
                bullSinPesar.DataBind();
            }
            catch
            {
                lblError.Visible = true;
            }
        }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         IRepoAnimal repo = new RepoAnimal();
         ddlAnimal.DataSource = repo.getAll();
         ddlAnimal.DataBind();
     }
 }
Beispiel #5
0
        protected void btnConfirmar_Click(object sender, EventArgs e)
        {
            IRepoAnimal repo = new RepoAnimal();

            try
            {
                Int32 id = Convert.ToInt32(ddlAnimal.SelectedItem.Text);
                bullPesajes.DataSource = repo.Pesajes(id);
                if (bullPesajes.DataSource == null)
                {
                    lblError.Visible       = true;
                    bullPesajes.DataSource = new List <String>();
                }
                else
                {
                    lblError.Visible = false;
                }
                bullPesajes.DataBind();
            }
            catch
            {
                lblError.Visible = true;
            }
        }