private void cargarDuenos()
        {
            try
            {
                SqlConnection conx  = new SqlConnection(ConfigurationManager.ConnectionStrings["cadenaConexion"].ConnectionString);
                string        query = "SELECT * FROM Duenno join Finca on Duenno.Id_Finca = Finca.Id_Finca;";

                conx.Open();

                SqlCommand    comando = new SqlCommand(query, conx);
                SqlDataReader dr      = comando.ExecuteReader();

                if (dr.HasRows == true)
                {
                    while (dr.Read())
                    {
                        Finca finca = new Finca(dr.GetInt32(7), dr.GetString(8), dr.GetInt32(9), dr.GetString(10), dr.GetInt32(11));
                        Dueno dueno = new Dueno(dr.GetInt32(0), dr.GetString(1), dr.GetString(2), dr.GetString(3), dr.GetString(4), dr.GetInt32(5), finca);
                        duenos.Add(dueno);
                    }
                }

                conx.Close();
            }
            catch (SqlException x)
            {
                MessageBox.Show("Error! al cargar datos");
            }
        }
Ejemplo n.º 2
0
        public static void DuenoMascota()
        {
            //Persona
            Dueno  dueno;
            String Nombre;
            String Direccion;
            String Telefono;

            Console.WriteLine("Digite el nombre del dueno:");
            Nombre = Console.ReadLine();
            Console.WriteLine("Digite la direccion:");
            Direccion = Console.ReadLine();
            Console.WriteLine("Digite su numero de telefono:");
            Telefono = Console.ReadLine();

            dueno = new Dueno(Nombre, Direccion, Telefono);



            //Mascota
            Mascota mascota;
            String  Nombre2;
            String  Raza;

            Console.WriteLine("Digite el nombre de la Mascota:");
            Nombre2 = Console.ReadLine();
            Console.WriteLine("Digite la Raza:");
            Raza = Console.ReadLine();

            mascota = new Mascota(Nombre2, Raza, Nombre, Direccion, Telefono);

            Console.WriteLine(dueno.ToString());
            Console.WriteLine(mascota.ToString());
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Dueno dueno = db.Duenoes.Find(id);

            db.Duenoes.Remove(dueno);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Id,Nombre,Apellido")] Dueno dueno)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dueno).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dueno));
 }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "Id,Nombre,Apellido")] Dueno dueno)
        {
            if (ModelState.IsValid)
            {
                db.Duenoes.Add(dueno);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dueno));
        }
Ejemplo n.º 6
0
        // GET: Duenoes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Dueno dueno = db.Duenoes.Find(id);

            if (dueno == null)
            {
                return(HttpNotFound());
            }
            return(View(dueno));
        }
Ejemplo n.º 7
0
        public static void Dueno_Mascota()
        {
            Dueno  dueno;
            String Nombre;
            String Direccion;
            String Telefono;



            Console.WriteLine("Digite el nombre del dueno:");
            Nombre = Console.ReadLine();
            Console.WriteLine("Digite la direccion:");
            Direccion = Console.ReadLine();
            Console.WriteLine("Digite su numero de telefono:");
            Telefono = Console.ReadLine();


            dueno = new Dueno(Nombre, Direccion, Telefono);


            Console.WriteLine(dueno.ToString());
        }
Ejemplo n.º 8
0
 public Mascota(String NombreMascota, String Raza2, String NombreD, String DireccionD, String TelefonoD)
 {
     Nombre = NombreMascota;
     Raza   = Raza2;
     Jefe   = new Dueno(NombreD, DireccionD, TelefonoD);
 }
Ejemplo n.º 9
0
 public Mascota(String NombreMascota, String rRaza, String NombreDueno, String DireccionD, String TelefonoD)
 {
     Nombre = NombreMascota;
     Raza   = rRaza;
     Jefe   = new Dueno(NombreDueno, DireccionD, TelefonoD);
 }
Ejemplo n.º 10
0
        public Registro_mascota(Mascota mascota, bool isEdit)
        {
            InitializeComponent();

            pkrRazaMascota.IsEnabled  = false;
            pkrColorMascota.IsEnabled = false;

            if (isEdit)
            {
                mascotaG                     = mascota;
                isEditG                      = isEdit;
                txtCodigo.Text               = mascota.codigo;
                txtNombre.Text               = mascota.nombre;
                txtedadMascota.Text          = mascota.edad.ToString();
                pkrSexoMascota.SelectedIndex = mascota.sexo == "M" ? 0 : 1;
                sexoMascotaC                 = pkrTipoMascota.SelectedIndex == 0 ? (char)77 : (char)72;
                chkTermino.IsChecked         = true;
                //txtedadMascota.Text = mascota.edad.ToString();
            }

            if (!CrossConnectivity.Current.IsConnected)
            {
                DisplayAlert("Error", "No estás conectado a internet", "Ok");
                return;
            }

            DataTable tipoMascota = new DataTable();

            DependencyService.Get <IWebService>().getMascotaTipo_Busca();
            tipoMascota = DependencyService.Get <IWebService>().MascotaTipo_Busca;

            //get client data by memberId
            try
            {
                DependencyService.Get <IWebService>().getCliente_Busca(Preferences.Get("idMiembro", 0), -1);
                dtDueno = DependencyService.Get <IWebService>().Cliente_Busca;
                Console.WriteLine("Get idMiembro" + Preferences.Get("idMiembro", 0));
                Console.WriteLine("Rows: " + dtDueno.Rows.Count);
                foreach (DataRow dr in dtDueno.Rows)
                {
                    dueno = new Dueno()
                    {
                        nombre     = dr["Name"].ToString(),
                        apellidoP  = dr["LastName"].ToString(),
                        apellidoM  = dr["LastName2"].ToString(),
                        sexo       = dr["Sex"].ToString() == "M" ? 77 : 70,
                        correo     = dr["EMail"].ToString().Replace("\t", "").Trim(),
                        contrasena = Preferences.Get("password", "")
                    };

                    Console.WriteLine("Nombre: " + nombre);
                    Console.WriteLine("Apellido P: " + apellidoP);
                    Console.WriteLine("Apellido M: " + apellidoM);
                    Console.WriteLine("Sexo: " + sexo);
                    Console.WriteLine("correo: " + correo);
                    Console.WriteLine("contrasena: " + contrasena);
                }
            }
            catch (Exception ex) {
                Console.WriteLine("Error linea 68: " + ex);
            }

            pkrTipoMascota.Items.Clear();
            tipoMascotaDic.Clear();
            foreach (DataRow dr in tipoMascota.Rows)
            {
                pkrTipoMascota.Items.Add(dr[2].ToString());
                tipoMascotaDic.Add(dr[2].ToString(), Convert.ToInt32(dr[0]));
            }



            pkrTipoMascota.SelectedIndexChanged += tipoMascotaSeleccionado;

            pkrSexoMascota.SelectedIndexChanged += (object sender, EventArgs eventArgs) =>
            {
                int sexoSelected = pkrSexoMascota.SelectedIndex;
                if (sexoSelected == 0)
                {
                    sexoMascotaC = (char)77;
                }
                else if (sexoSelected == 1)
                {
                    sexoMascotaC = (char)72;
                }
            };

            DataTable paises = new DataTable();

            DependencyService.Get <IWebService>().getPais_Busca();
            paises = DependencyService.Get <IWebService>().Pais_Busca;
            pkrPais.Items.Clear();
            paisDic.Clear();
            foreach (DataRow dr in paises.Rows)
            {
                pkrPais.Items.Add(dr["Name"].ToString());
                paisDic.Add(dr["Name"].ToString(), Convert.ToInt32(dr["IDCountry"]));
                paisDicEdit.Add(Convert.ToInt32(dr["IDCountry"]), dr["Name"].ToString());
            }

            pkrPais.SelectedIndexChanged += PkrPais_SelectedIndexChanged;

            if (isEdit)
            {
                pkrTipoMascota.SelectedItem = mascota.tipo;
                pkrRazaMascota.IsEnabled    = true;
                tipoMascotaSeleccionado(null, null);
                try
                {
                    pkrPais.SelectedItem = paisDicEdit[mascota.idPais];
                    PkrPais_SelectedIndexChanged(null, null);
                }
                catch (Exception) {
                }
            }
        }//Constructor