// GET: CatalogoDeDeducciones/Edit/5 public JsonResult Edit(int?ID) { db.Configuration.ProxyCreationEnabled = false; tbCatalogoDeDeducciones tbCatalogoDeDeduccionesJSON = db.tbCatalogoDeDeducciones.Find(ID); return(Json(tbCatalogoDeDeduccionesJSON, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteConfirmed(int id) { tbCatalogoDeDeducciones tbCatalogoDeDeducciones = db.tbCatalogoDeDeducciones.Find(id); db.tbCatalogoDeDeducciones.Remove(tbCatalogoDeDeducciones); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "cde_DescripcionDeduccion,tde_IdTipoDedu,cde_PorcentajeColaborador,cde_PorcentajeEmpresa,cde_UsuarioCrea,cde_FechaCrea")] tbCatalogoDeDeducciones tbCatalogoDeDeducciones) { //LLENAR LA DATA DE AUDITORIA, DE NO HACERLO EL MODELO NO SERÍA VÁLIDO Y SIEMPRE CAERÍA EN EL CATCH tbCatalogoDeDeducciones.cde_UsuarioCrea = Function.GetUser(); tbCatalogoDeDeducciones.cde_FechaCrea = Function.DatetimeNow(); //VARIABLE PARA ALMACENAR EL RESULTADO DEL PROCESO Y ENVIARLO AL LADO DEL CLIENTE string response = String.Empty; IEnumerable <object> listCatalogoDeDeducciones = null; string MensajeError = ""; //VALIDAR SI EL MODELO ES VÁLIDO if (ModelState.IsValid) { try { //EJECUTAR PROCEDIMIENTO ALMACENADO listCatalogoDeDeducciones = db.UDP_Plani_tbCatalogoDeDeducciones_Insert(tbCatalogoDeDeducciones.cde_DescripcionDeduccion, tbCatalogoDeDeducciones.tde_IdTipoDedu, tbCatalogoDeDeducciones.cde_PorcentajeColaborador, tbCatalogoDeDeducciones.cde_PorcentajeEmpresa, tbCatalogoDeDeducciones.cde_UsuarioCrea, tbCatalogoDeDeducciones.cde_FechaCrea); //RECORRER EL TIPO COMPLEJO DEL PROCEDIMIENTO ALMACENADO PARA EVALUAR EL RESULTADO DEL SP foreach (UDP_Plani_tbCatalogoDeDeducciones_Insert_Result Resultado in listCatalogoDeDeducciones) { MensajeError = Resultado.MensajeError; } if (MensajeError.StartsWith("-1")) { //EN CASO DE OCURRIR UN ERROR, IGUALAMOS LA VARIABLE "RESPONSE" A ERROR PARA VALIDARLO EN EL CLIENTE ModelState.AddModelError("", "No se pudo ingresar el registro, contacte al administrador"); response = "error"; } }catch (Exception Ex) { //EN CASO DE CAER EN EL CATCH, IGUALAMOS LA VARIABLE "RESPONSE" A ERROR PARA VALIDARLO EN EL CLIENTE response = Ex.Message.ToString(); } //SI LA EJECUCIÓN LLEGA A ESTE PUNTO SIGNIFICA QUE NO OCURRIÓ NINGÚN ERROR Y EL PROCESO FUE EXITOSO //IGUALAMOS LA VARIABLE "RESPONSE" A "BIEN" PARA VALIDARLO EN EL CLIENTE response = "bien"; } else { //SI EL MODELO NO ES VÁLIDO, IGUALAMOS LA VARIABLE "RESPONSE" A ERROR PARA VALIDARLO EN EL CLIENTE response = "error"; } //RETORNAMOS LA VARIABLE RESPONSE AL CLIENTE PARA EVALUARLA ViewBag.cde_UsuarioCrea = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbCatalogoDeDeducciones.cde_UsuarioCrea); ViewBag.cde_UsuarioModifica = new SelectList(db.tbUsuario, "usu_Id", "usu_NombreUsuario", tbCatalogoDeDeducciones.cde_UsuarioModifica); ViewBag.tde_IdTipoDedu = new SelectList(db.tbTipoDeduccion, "tde_IdTipoDedu", "tde_Descripcion", tbCatalogoDeDeducciones.tde_IdTipoDedu); object json = new { response = response, data = GetData() }; return(Json(json, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit([Bind(Include = "cde_IdDeducciones,cde_DescripcionDeduccion,tde_IdTipoDedu,cde_PorcentajeColaborador,cde_PorcentajeEmpresa,cde_UsuarioCrea,cde_FechaCrea,cde_UsuarioModifica,cde_FechaModifica")] tbCatalogoDeDeducciones tbCatalogoDeDeducciones) { if (ModelState.IsValid) { db.Entry(tbCatalogoDeDeducciones).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.tde_IdTipoDedu = new SelectList(db.tbTipoDeduccion, "tde_IdTipoDedu", "tde_Descripcion", tbCatalogoDeDeducciones.tde_IdTipoDedu); return(View(tbCatalogoDeDeducciones)); }
public ActionResult Edit([Bind(Include = "cde_IdDeducciones,cde_DescripcionDeduccion,tde_IdTipoDedu,cde_PorcentajeColaborador,cde_PorcentajeEmpresa,cde_UsuarioCrea,cde_FechaCrea")] tbCatalogoDeDeducciones tbCatalogoDeDeducciones) { //DATA DE AUDIOTIRIA DE CREACIÓN, PUESTA UNICAMENTE PARA QUE NO CAIGA EN EL CATCH //EN EL PROCEDIMIENTO ALMACENADO, ESTOS DOS CAMPOS NO SE DEBEN MODIFICAR tbCatalogoDeDeducciones.cde_UsuarioCrea = Function.GetUser(); tbCatalogoDeDeducciones.cde_FechaCrea = Function.DatetimeNow(); //LLENAR DATA DE AUDITORIA tbCatalogoDeDeducciones.cde_UsuarioModifica = Function.GetUser(); tbCatalogoDeDeducciones.cde_FechaModifica = Function.DatetimeNow(); //VARIABLE DONDE SE ALMACENARA EL RESULTADO DEL PROCESO string response = "bien"; IEnumerable <object> listCatalogoDeDeducciones = null; string MensajeError = ""; //VALIDAR SI EL MODELO ES VÁLIDO try { //EJECUTAR PROCEDIMIENTO ALMACENADO listCatalogoDeDeducciones = db.UDP_Plani_tbCatalogoDeDeducciones_Update(tbCatalogoDeDeducciones.cde_IdDeducciones, tbCatalogoDeDeducciones.cde_DescripcionDeduccion, tbCatalogoDeDeducciones.tde_IdTipoDedu, tbCatalogoDeDeducciones.cde_PorcentajeColaborador, tbCatalogoDeDeducciones.cde_PorcentajeEmpresa, tbCatalogoDeDeducciones.cde_UsuarioModifica, tbCatalogoDeDeducciones.cde_FechaModifica); //RECORRER EL TIPO COMPLEJO DEL PROCEDIMIENTO ALMACENADO PARA EVALUAR EL RESULTADO DEL SP foreach (UDP_Plani_tbCatalogoDeDeducciones_Update_Result Resultado in listCatalogoDeDeducciones) { MensajeError = Resultado.MensajeError; } if (MensajeError.StartsWith("-1")) { //EN CASO DE OCURRIR UN ERROR, IGUALAMOS LA VARIABLE "RESPONSE" A ERROR PARA VALIDARLO EN EL CLIENTE ModelState.AddModelError("", "No se pudo ingresar el registro, contacte al administrador"); response = "error"; } } catch (Exception Ex) { //EN CASO DE CAER EN EL CATCH, IGUALAMOS LA VARIABLE "RESPONSE" A ERROR PARA VALIDARLO EN EL CLIENTE response = Ex.Message.ToString(); } //SI LA EJECUCIÓN LLEGA A ESTE PUNTO SIGNIFICA QUE NO OCURRIÓ NINGÚN ERROR Y EL PROCESO FUE EXITOSO //IGUALAMOS LA VARIABLE "RESPONSE" A "BIEN" PARA VALIDARLO EN EL CLIENTE ViewBag.tde_IdTipoDedu = new SelectList(db.tbTipoDeduccion, "tde_IdTipoDedu", "tde_Descripcion", tbCatalogoDeDeducciones.tde_IdTipoDedu); //RETORNAR MENSAJE AL LADO DEL CLIENTE return(Json(response, JsonRequestBehavior.AllowGet)); }
// GET: CatalogoDeDeducciones/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbCatalogoDeDeducciones tbCatalogoDeDeducciones = db.tbCatalogoDeDeducciones.Find(id); if (tbCatalogoDeDeducciones == null) { return(HttpNotFound()); } return(View(tbCatalogoDeDeducciones)); }
// GET: CatalogoDeDeducciones/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbCatalogoDeDeducciones tbCatalogoDeDeducciones = db.tbCatalogoDeDeducciones.Find(id); if (tbCatalogoDeDeducciones == null) { return(HttpNotFound()); } ViewBag.tde_IdTipoDedu = new SelectList(db.tbTipoDeduccion, "tde_IdTipoDedu", "tde_Descripcion", tbCatalogoDeDeducciones.tde_IdTipoDedu); return(View(tbCatalogoDeDeducciones)); }