public HttpResponseMessage PostTunnel(Dashboard_Config_Detail 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 + "/Post"), "POST", dataString); return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter)); }
public HttpResponseMessage Put_Datos_Generales(Dashboard_Config_Detail varDashboard_Config_Detail_Datos_Generales) { var data = "-1"; try { data = Convert.ToString(this.service.Update_Datos_Generales(varDashboard_Config_Detail_Datos_Generales)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDashboard_Config_Detail_Datos_Generales.Detail_Id, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDashboard_Config_Detail", new JavaScriptSerializer().Serialize(varDashboard_Config_Detail_Datos_Generales), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varDashboard_Config_Detail_Datos_Generales.Detail_Id, BitacoraHelper.TypeSql.UPDATE, "sp_UpdDashboard_Config_Detail", new JavaScriptSerializer().Serialize(varDashboard_Config_Detail_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 Dashboard_Config_DetailGenerateID() { Dashboard_Config_Detail varDashboard_Config_Detail = new Dashboard_Config_Detail(); var data = "-1"; try { data = Convert.ToString(this.service.Insert(varDashboard_Config_Detail)); var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_Dashboard_Config_DetailGenerateID", new JavaScriptSerializer().Serialize(varDashboard_Config_Detail), true); serviceBitacora.Insert(bitacora); } catch (ServiceException ex) { var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_Dashboard_Config_DetailGenerateID", new JavaScriptSerializer().Serialize(varDashboard_Config_Detail), true); serviceBitacora.Insert(bitacora); return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter)); }
public ActionResult WizardComplete(int idDashboard, int reportId, int row, int column) { if (!_tokenManager.GenerateToken()) { return(null); } _IDashboard_Config_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var resultConfig = _IDashboard_Config_DetailApiConsumer.ListaSelAll(0, 100, "Dashboard_Config_Detail.Dashboard=" + idDashboard + " AND Dashboard_Config_Detail.ConfigRow=" + row + " AND Dashboard_Config_Detail.ConfigColumn=" + column, ""); string result; //Estoy editando if (resultConfig.Success && resultConfig.Resource.RowCount > 0 && resultConfig.Resource.Dashboard_Config_Details.Any()) { var dashboardConfig = resultConfig.Resource.Dashboard_Config_Details.First(); dashboardConfig.Report_Id = reportId; dashboardConfig.Report_Name = reportId.ToString(); result = _IDashboard_Config_DetailApiConsumer.Update(dashboardConfig, null, null).Resource.ToString(); } //Creo nuevo registro else { var Dashboard_Config_DetailInfo = new Dashboard_Config_Detail { Detail_Id = -1, Dashboard = idDashboard, Report_Id = reportId, Report_Name = reportId.ToString(), ConfigRow = (short)row, ConfigColumn = (short)column }; result = _IDashboard_Config_DetailApiConsumer.Insert(Dashboard_Config_DetailInfo, null, null).Resource.ToString(); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Delete(int id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDashboard_Config_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); Dashboard_Config_Detail varDashboard_Config_Detail = null; if (id.ToString() != "0") { string where = ""; } var result = _IDashboard_Config_DetailApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Post(bool IsNew, Dashboard_Config_DetailModel varDashboard_Config_Detail) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDashboard_Config_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Dashboard_Config_DetailInfo = new Dashboard_Config_Detail { Detail_Id = varDashboard_Config_Detail.Detail_Id , Report_Id = varDashboard_Config_Detail.Report_Id , Report_Name = varDashboard_Config_Detail.Report_Name , ConfigRow = varDashboard_Config_Detail.ConfigRow , ConfigColumn = varDashboard_Config_Detail.ConfigColumn }; result = !IsNew? _IDashboard_Config_DetailApiConsumer.Update(Dashboard_Config_DetailInfo, null, null).Resource.ToString() : _IDashboard_Config_DetailApiConsumer.Insert(Dashboard_Config_DetailInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }