Ejemplo n.º 1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            Profesion prof = new Profesion();

            prof.nombreProfesion = txtProfesion.Text.Trim();
            prof.id = int.Parse(grdProfesiones.CurrentRow.Cells["id_Profesiones"].Value.ToString());
            string msjAlert = "Desea eliminar la Profesion: \n " + prof.nombreProfesion;

            MessageBoxButtons buttons = MessageBoxButtons.YesNo;

            MessageBox.Show(msjAlert, "Error", buttons);


            bool resultado = AD_Profesiones.EliminarProfesion(prof);

            if (resultado)
            {
                MessageBox.Show("Cliente Eliminado exitosamente");
                LimpiarCampos();
                CargarGrilla();
                btnGuardar.Enabled    = true;
                btnEliminar.Enabled   = false;
                btnActualizar.Enabled = false;
            }
            else
            {
                MessageBox.Show("Error al actualizar Cliente");
            }
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutProfesion(string id, Profesion profesion)
        {
            if (id != profesion.ProfCodigo)
            {
                return(BadRequest());
            }

            _context.Entry(profesion).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfesionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 3
0
        public bool Delete(Profesion profesion)
        {
            bool respuesta = false;

            try
            {
                var connection = new SqlConnection(connection_string);
                connection.Open();

                var query = new SqlCommand("DELETE FROM profesiones WHERE id = @p0", connection);
                query.Parameters.AddWithValue("@p0", profesion.id);
                query.ExecuteNonQuery();

                connection.Close();
                connection.Dispose();

                respuesta = true;
            }
            catch
            {
                throw;
            }

            return(respuesta);
        }
Ejemplo n.º 4
0
        //
        // GET: /Profesion/Edit/5

        public ActionResult Edit(int id)
        {
            Profesion profesion = db.Profesion.Find(id);

            profesion.Nombre = utils.ToTitle(profesion.Nombre);
            return(View(profesion));
        }
Ejemplo n.º 5
0
        protected async override Task OnAppearingAnimationEnd()
        {
            var translateLength = 400u;

            await Task.WhenAll(
                Nombre.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                Apellido.FadeTo(1));

            await Task.WhenAll(
                UsernameEntry.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                UsernameEntry.FadeTo(1),
                Profesion.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                Profesion.FadeTo(1),

                (new Func <Task>(async() =>
            {
                await Task.Delay(200);
                await Task.WhenAll(
                    PasswordEntry.TranslateTo(0, 0, easing: Easing.SpringOut, length: translateLength),
                    PasswordEntry.FadeTo(1));
            }))());


            await Task.WhenAll(
                LoginButton.ScaleTo(1),
                LoginButton.FadeTo(1));
        }
Ejemplo n.º 6
0
 private void ListadoProfesiones()
 {
     cbProfesion.DataSource    = Profesion.ListarProfesiones();
     cbProfesion.DisplayMember = "NOMBRE_PROFESION";
     cbProfesion.ValueMember   = "ID_PROFESION";
     cbProfesion.SelectedIndex = -1;
 }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Usuario user = new Usuario();

            user.Nombre = "Alexis Aravena";

            Profesion prof = new Profesion();

            prof.NombreProfesion = "Ingenieria en Informatica";

            Colegio col = new Colegio();

            col.Nombre     = "Duoc UC";
            col.AnnoInicio = 1950;

            prof.Colegio     = col;
            user.MiProfesion = prof;


            Console.WriteLine("Avance del codigo version 1.2.3");
            Console.WriteLine("Nombre:{0}    Profesión{1}   Colegio:{2}", user.Nombre, user.MiProfesion.NombreProfesion, user.MiProfesion.Colegio.Nombre);



            Console.ReadKey();
        }
Ejemplo n.º 8
0
 //public string List()
 //{
 //    string todos = "";
 //    foreach (Vendedor vendedor in ListaVendedor)
 //    {
 //        todos += vendedor.ToString();
 //    }
 //    return todos;
 //}
 /// <summary>
 /// Muestra los datos de un vendedor
 /// </summary>
 public void Show()
 {
     Console.WriteLine(Cedula.ToString().PadRight(12) + Nombre.PadRight(35) + FechaNacimiento.ToShortDateString().PadLeft(12) +
                       Sexo.ToString().PadRight(12).PadLeft(15) + Telefono.ToString().PadLeft(12).PadRight(15) + Correo.PadRight(40) + Direccion.PadRight(40) +
                       EstadoCivil.ToString().PadRight(12) + IdVendedor.ToString().PadLeft(5) + FechaIngreso.ToShortDateString().PadLeft(12) +
                       Salario.ToString().PadLeft(10) + Profesion.PadLeft(20).PadRight(17) + Calificacion.ToString().PadLeft(5));
 }
        public ActionResult Create(Profesion a)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            try
            {
                using (var db = new ReservacionesEntities())
                {
                    //Auditoria(Cedula, "Usuario", "AGREGO UN USUARIO");
                    db.Profesions.Add(a);
                    var K = db.Usuarios.Single(u => u.Estado == "1");
                    if (K != null)
                    {
                        Auditoria(K.Cedula, "Profesion", "CREO UNA PROFESION");
                    }
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error al agregar una Escuela", ex);
                return(View());
            }
        }
 public ActionResult Edit(Profesion a)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     try
     {
         using (var db = new ReservacionesEntities())
         {
             Escuela al = db.Escuelas.Find(a.Id);
             al.Nombre = a.Nombre;
             var K = db.Usuarios.Single(u => u.Estado == "1");
             if (K != null)
             {
                 Auditoria(K.Cedula, "Escuela", "EDITO UNA PROFESION");
             }
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Error al Editar al Usuario", ex);
         return(View());
     }
 }
Ejemplo n.º 11
0
        public Profesion Get(int id)
        {
            Profesion profesion = null;

            try
            {
                var connection = new SqlConnection(connection_string);
                connection.Open();

                var query = new SqlCommand("SELECT * FROM profesiones WHERE id = @id", connection);
                query.Parameters.AddWithValue("@id", id);

                var dr = query.ExecuteReader();

                dr.Read();

                if (dr.HasRows)
                {
                    profesion        = new Profesion();
                    profesion.id     = Convert.ToInt32(dr["id"]);
                    profesion.nombre = dr["nombre"].ToString();
                }

                dr.Close();

                connection.Close();
                connection.Dispose();
            }
            catch
            {
                throw;
            }

            return(profesion);
        }
Ejemplo n.º 12
0
        public bool Add(Profesion profesion)
        {
            bool respuesta = false;

            try
            {
                var connection = new SqlConnection(connection_string);
                connection.Open();

                var query = new SqlCommand("INSERT INTO profesiones(nombre) VALUES (@p0)", connection);

                query.Parameters.AddWithValue("@p0", profesion.nombre);

                query.ExecuteNonQuery();

                connection.Close();
                connection.Dispose();

                respuesta = true;
            }
            catch
            {
                throw;
            }

            return(respuesta);
        }
Ejemplo n.º 13
0
        protected void btnEditar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text != "")
            {
                int    id     = Convert.ToInt32(hfID.Value);
                string nombre = txtNombre.Text;

                Profesion profesion = new Profesion();
                profesion.id     = id;
                profesion.nombre = nombre;

                if (profesionDatos.Update(profesion))
                {
                    Application["mensaje"] = funcion.mensaje("Registro editado");
                    Response.Redirect("~/Forms/Profesiones/Index.aspx");
                }
                else
                {
                    Application["mensaje"] = funcion.mensaje("Error");
                    Response.Redirect("~/Forms/Profesiones/Editar.aspx?id=" + id);
                }
            }
            else
            {
                Application["mensaje"] = funcion.mensaje("Faltan datos");
                Response.Redirect("~/Forms/Profesiones/Editar.aspx?id=" + Request.QueryString["id"]);
            }
        }
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            if (txtNombre.Text != "")
            {
                string nombre = txtNombre.Text;

                Profesion profesion = new Profesion();
                profesion.nombre = nombre;

                if (profesionDatos.Add(profesion))
                {
                    Application["mensaje"] = funcion.mensaje("Registro agregado");
                    Response.Redirect("~/Forms/Profesiones/Index.aspx");
                }
                else
                {
                    Application["mensaje"] = funcion.mensaje("Error");
                    Response.Redirect("~/Forms/Profesiones/Agregar.aspx");
                }
            }
            else
            {
                Application["mensaje"] = funcion.mensaje("Faltan datos");
                Response.Redirect("~/Forms/Profesiones/Agregar.aspx");
            }
        }
Ejemplo n.º 15
0
        public IHttpActionResult PutProfesion(int id, Profesion profesion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != profesion.Id)
            {
                return(BadRequest());
            }

            db.Entry(profesion).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProfesionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 16
0
 private void ListadoProfesiones()
 {
     dgvProfesiones.AutoGenerateColumns         = false;
     dgvProfesiones.DataSource                  = Profesion.ListarProfesiones();
     dgvProfesiones.Columns[0].DataPropertyName = "ID_PROFESION";
     dgvProfesiones.Columns[1].DataPropertyName = "NOMBRE_PROFESION";
 }
Ejemplo n.º 17
0
        public static bool ActualizarProfesion(Profesion prof)
        {
            string        cadenaConexion = System.Configuration.ConfigurationManager.AppSettings["cadenaTP1"];
            SqlConnection cn             = new SqlConnection(cadenaConexion);
            bool          resultado      = false;

            try
            {
                SqlCommand cmd      = new SqlCommand();
                string     consulta = "UPDATE profesiones SET nombre_profesion = @nombre_profesion WHERE id_profesion = @id_profesion";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@nombre_profesion", prof.nombreProfesion);
                cmd.Parameters.AddWithValue("@id_profesion", prof.id.ToString());

                cmd.CommandType = CommandType.Text;
                cmd.CommandText = consulta;

                cn.Open();
                cmd.Connection = cn;
                cmd.ExecuteNonQuery();
                resultado = true;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cn.Close();
            }

            return(resultado);
        }
Ejemplo n.º 18
0
        public static bool AgregaProfesionABD(Profesion prof)
        {
            string        cadenaConexion = System.Configuration.ConfigurationManager.AppSettings["cadenaTP1"];
            SqlConnection cn             = new SqlConnection(cadenaConexion);
            bool          resultado      = false;

            try
            {
                SqlCommand cmd      = new SqlCommand();
                string     consulta = "INSERT INTO profesiones (nombre_profesion) VALUES (@nombreProfesion)";
                cmd.Parameters.Clear();
                cmd.Parameters.AddWithValue("@nombreProfesion", prof.nombreProfesion);

                cmd.CommandType = CommandType.Text;
                cmd.CommandText = consulta;

                cn.Open();
                cmd.Connection = cn;
                cmd.ExecuteNonQuery();
                resultado = true;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                cn.Close();
            }

            return(resultado);
        }
        private void ChangeProfessions(Profesion profesion, MaterialLabel proffesionLabel, Button proffesionButton)
        {
            ResourceManager rm            = Properties.Resources.ResourceManager;
            Image           proffesionImg = (Image)rm.GetObject(profesion.img);

            proffesionLabel.Text             = profesion.name;
            proffesionButton.BackgroundImage = proffesionImg;
        }
Ejemplo n.º 20
0
        public void ActualizarProfesion(string strID, string strDescripcion)
        {
            Profesion uProfesion = new Profesion();

            uProfesion.ID          = strID;
            uProfesion.Descripcion = strDescripcion;
            ProfesionBusiness.Actualizar(uProfesion);
        }
Ejemplo n.º 21
0
        public ActionResult DeleteConfirmed(int id)
        {
            Profesion profesion = db.Profesion.Find(id);

            db.Profesion.Remove(profesion);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 22
0
 private void Preselec_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     p = (Profesion)preselec.SelectedItem;
     MessageBox.Show($"Profesion id: {p.id}");
     nombreTextBox.Text  = p.nombre;
     diminTextBox.Text   = p.dimin;
     DescripTextBox.Text = p.descipcion;
     save_btn.IsEnabled  = true;
 }
Ejemplo n.º 23
0
 public Profesion GetProfesion(int idProfesion)
 {
     using (DBEntities_TP db = new DBEntities_TP())
     {
         Profesion profesion = new Profesion();
         profesion = db.Profesions.Find(idProfesion);
         return(profesion);
     }
 }
 public ActionResult Edit([Bind(Include = "Id,nombreProfesion,Experiencia,conocimientos")] Profesion profesion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(profesion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(profesion));
 }
Ejemplo n.º 25
0
 public ActionResult Edit([Bind(Include = "idProfesion,descripcion")] Profesion profesion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(profesion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(profesion));
 }
        public ActionResult ConfirmarBorrar(int id)
        {
            Profesion profesion = profesionDatos.Get(id);

            if (profesion == null)
            {
                return(HttpNotFound());
            }
            return(View("Borrar", profesion));
        }
Ejemplo n.º 27
0
 public ActionResult Edit(Profesion profesion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(profesion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Create"));
     }
     return(View(profesion));
 }
Ejemplo n.º 28
0
        public IHttpActionResult GetProfesion(int id)
        {
            Profesion profesion = db.Profesions.Find(id);

            if (profesion == null)
            {
                return(NotFound());
            }

            return(Ok(profesion));
        }
Ejemplo n.º 29
0
        public ActionResult Create([Bind(Include = "idProfesion,descripcion")] Profesion profesion)
        {
            if (ModelState.IsValid)
            {
                db.Profesion.Add(profesion);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(profesion));
        }
Ejemplo n.º 30
0
 public ActionResult Edit([Bind(Include = "ProfesionId,CompanyClientId,Descripcion")] Profesion profesion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(profesion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CompanyClientId = new SelectList(db.CompanyClient, "CompanyClientId", "RazonSocial", profesion.CompanyClientId);
     return(View(profesion));
 }