public ActionResult Post(bool IsNew, MS_Roles_de_Usuario_NotificacionModel varMS_Roles_de_Usuario_Notificacion) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IMS_Roles_de_Usuario_NotificacionApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var MS_Roles_de_Usuario_NotificacionInfo = new MS_Roles_de_Usuario_Notificacion { Folio = varMS_Roles_de_Usuario_Notificacion.Folio , Nombre_del_Campo = varMS_Roles_de_Usuario_Notificacion.Nombre_del_Campo }; result = !IsNew? _IMS_Roles_de_Usuario_NotificacionApiConsumer.Update(MS_Roles_de_Usuario_NotificacionInfo, null, null).Resource.ToString() : _IMS_Roles_de_Usuario_NotificacionApiConsumer.Insert(MS_Roles_de_Usuario_NotificacionInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public HttpResponseMessage Post(MS_Roles_de_Usuario_Notificacion varMS_Roles_de_Usuario_Notificacion) { if (ModelState.IsValid) { var data = "-1"; try { data = Convert.ToString(this.service.Insert(varMS_Roles_de_Usuario_Notificacion)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsMS_Roles_de_Usuario_Notificacion", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsMS_Roles_de_Usuario_Notificacion", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); } else { var errors = ModelState.SelectMany(m => m.Value.Errors.Select(err => err.ErrorMessage != string.Empty ? err.ErrorMessage : err.Exception.Message).ToList()).ToList(); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsMS_Roles_de_Usuario_Notificacion", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion), false, errors.ToString()); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.BadRequest, errors)); } }
public HttpResponseMessage Delete(int id) { MS_Roles_de_Usuario_Notificacion varMS_Roles_de_Usuario_Notificacion = this.service.GetByKey(id, false); bool result = false; if (varMS_Roles_de_Usuario_Notificacion == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } try { result = this.service.Delete(id);//, globalData, dataReference); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelMS_Roles_de_Usuario_Notificacion", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion), result); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelMS_Roles_de_Usuario_Notificacion", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion), result, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public HttpResponseMessage Get_Datos_Generales(int id) { MS_Roles_de_Usuario_Notificacion entity = this.service.ListaSelAll(1, 1, "MS_Roles_de_Usuario_Notificacion.Folio='" + id.ToString() + "'", "").MS_Roles_de_Usuario_Notificacions.First(); MS_Roles_de_Usuario_Notificacion result = new MS_Roles_de_Usuario_Notificacion(); result.Folio = entity.Folio; result.Nombre_del_Campo = entity.Nombre_del_Campo; result.Nombre_del_Campo_Nombre_del_campo_en_MS = entity.Nombre_del_Campo_Nombre_del_campo_en_MS; return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage PutTunnel(MS_Roles_de_Usuario_Notificacion emp, string user, string password) { var client = new System.Net.WebClient(); client.Headers = TokenManager.GetAuthenticationHeader(user, password); client.Headers["Content-Type"] = "application/json"; var dataString = new JavaScriptSerializer().Serialize(emp); var result = client.UploadString(new Uri(baseApi + ApiControllerUrl + "/Put?Id=" + emp.Folio), "PUT" , dataString); return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Put_Datos_Generales(MS_Roles_de_Usuario_Notificacion varMS_Roles_de_Usuario_Notificacion_Datos_Generales) { var data = "-1"; try { data = Convert.ToString(this.service.Update_Datos_Generales(varMS_Roles_de_Usuario_Notificacion_Datos_Generales)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varMS_Roles_de_Usuario_Notificacion_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdMS_Roles_de_Usuario_Notificacion", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion_Datos_Generales), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varMS_Roles_de_Usuario_Notificacion_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdMS_Roles_de_Usuario_Notificacion", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion_Datos_Generales), false, ex.Message); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage MS_Roles_de_Usuario_NotificacionGenerateID() { MS_Roles_de_Usuario_Notificacion varMS_Roles_de_Usuario_Notificacion = new MS_Roles_de_Usuario_Notificacion(); var data = "-1"; try { data = Convert.ToString(this.service.Insert(varMS_Roles_de_Usuario_Notificacion)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_MS_Roles_de_Usuario_NotificacionGenerateID", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_MS_Roles_de_Usuario_NotificacionGenerateID", new JavaScriptSerializer().Serialize(varMS_Roles_de_Usuario_Notificacion), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }
public ActionResult Delete(int id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IMS_Roles_de_Usuario_NotificacionApiConsumer.SetAuthHeader(_tokenManager.Token); MS_Roles_de_Usuario_Notificacion varMS_Roles_de_Usuario_Notificacion = null; if (id.ToString() != "0") { string where = ""; } var result = _IMS_Roles_de_Usuario_NotificacionApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }