public ActionResult DeleteConfirmed(int id)
 {
     AreaTrabajo areatrabajo = db.AreaTrabajo.Find(id);
     db.AreaTrabajo.Remove(areatrabajo);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RPPMain.Main main = new RPPMain.Main();
            AreaTrabajo  area = main.AreasTrabajo[1];

            String descrpcionArea = area.Descripcion;
        }
 public ActionResult Edit([Bind(Include="Id,Nombre")] AreaTrabajo areatrabajo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(areatrabajo).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(areatrabajo);
 }
        public ActionResult Create([Bind(Include="Id,Nombre")] AreaTrabajo areatrabajo)
        {
            if (ModelState.IsValid)
            {
                db.AreaTrabajo.Add(areatrabajo);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(areatrabajo);
        }
 // GET: /AreaTrabajo/Delete/5
 public ActionResult Delete(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     AreaTrabajo areatrabajo = db.AreaTrabajo.Find(id);
     if (areatrabajo == null)
     {
         return HttpNotFound();
     }
     return View(areatrabajo);
 }
示例#6
0
        protected void gvAreasTrabajo_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            AreaTrabajo at = new AreaTrabajo();

            Label   txId     = (Label)gvAreasTrabajo.Rows[e.RowIndex].FindControl("lbEditClave");
            TextBox txNombre = (TextBox)gvAreasTrabajo.Rows[e.RowIndex].FindControl("txEditNombre");

            String Resultado = at.Actualizar(int.Parse(txId.Text), txNombre.Text.ToUpper(), "");

            gvAreasTrabajo.EditIndex  = -1;
            gvAreasTrabajo.DataSource = main.AreasTrabajo.Catalogo();
            gvAreasTrabajo.DataBind();
            if (Resultado.Equals("OK"))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Datos actualizados Correctamente')", true);
            }
        }
示例#7
0
        protected void gvAreasTrabajo_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("AGREGAR"))
            {
                AreaTrabajo at = new AreaTrabajo();

                TextBox txtNombreArea = (TextBox)gvAreasTrabajo.FooterRow.FindControl("txNombreArea");

                String Resultado = at.GuardarNuevo(txtNombreArea.Text.ToUpper(), "");

                gvAreasTrabajo.DataSource = main.AreasTrabajo.Catalogo();
                gvAreasTrabajo.DataBind();
                if (Resultado.Equals("OK"))
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Datos agregados Correctamente')", true);
                }
            }
        }