public ActionResult Delete(ContratosWebPreviewModel model) { if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } model.sesion = sesion; if (!sesion.permisos.havePermission(Privileges[0].Permiso)) { return(Json(new { msg = Notification.notAccess() })); } try { if (model.Delete()) { Log.write(this, "Delete", LOG.BORRADO, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Succes("Contrato ELIMINADO con exito: " + model.Contrato) })); } else { Log.write(this, "Delete", LOG.ERROR, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Error(" Error al Eliminar: " + model.Contrato) })); } } catch (Exception e) { return(Json(new { msg = Notification.Error(e.Message) })); } }
public ActionResult Add(ContratosWebPreviewModel model) { if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } model.sesion = sesion; if (!sesion.permisos.havePermission(Privileges[0].Permiso)) { return(Json(new { msg = Notification.notAccess() })); } try { if (model.Add()) { Log.write(this, "Add", LOG.REGISTRO, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Succes("Contrato agregado con exito: " + model.Contrato) })); } else { Log.write(this, "Add", LOG.ERROR, "SQL:" + model.sql, sesion); return(Json(new { msg = Notification.Error(" Error al agregar: " + model.Contrato) })); } } catch (Exception e) { return(Json(new { msg = Factory.Notification.Error(e.Message) })); } }
public ActionResult Edit(ContratosWebPreviewModel model) { if (model.Edit()) { return(Json(new JavaScriptSerializer().Serialize(model))); } return(View()); }
public ActionResult getHTML(ContratosWebPreviewModel model) { if (sesion == null) { sesion = SessionDB.start(Request, Response, false, db); } model.Edit(); sesion.vdata["html"] = model.Formato; sesion.saveSession(); return(Json(new { msg = Notification.Succes("Contrato Generado con exito: ") })); }