Exemple #1
0
 private void cbMusculos_Click(object sender, EventArgs e)
 {
     cbMusculos.DataSource    = Musculos.obtenerMusculos().Tables[0];
     cbMusculos.DisplayMember = "musculo";
     cbMusculos.ValueMember   = "musculo";
     cbMusculos.SelectedIndex = 0;
 }
Exemple #2
0
        public ActionResult Post(bool IsNew, MusculosModel varMusculos)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IMusculosApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result       = "";
                var MusculosInfo = new Musculos
                {
                    Folio         = varMusculos.Folio
                    , Descripcion = varMusculos.Descripcion
                };

                result = !IsNew?
                         _IMusculosApiConsumer.Update(MusculosInfo, null, null).Resource.ToString() :
                             _IMusculosApiConsumer.Insert(MusculosInfo, null, null).Resource.ToString();

                Session["KeyValueInserted"] = result;
                return(Json(result, JsonRequestBehavior.AllowGet));
                //}
                //return Json(false, JsonRequestBehavior.AllowGet);
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
        public HttpResponseMessage Post(Musculos varMusculos)
        {
            if (ModelState.IsValid)
            {
                var data = "-1";
                try
                {
                    data = Convert.ToString(this.service.Insert(varMusculos));
                    var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_InsMusculos", new JavaScriptSerializer().Serialize(varMusculos), true);
                    serviceBitacora.Insert(bitacora);
                }
                catch (ServiceException ex)
                {
                    var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_InsMusculos", new JavaScriptSerializer().Serialize(varMusculos), 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_InsMusculos", new JavaScriptSerializer().Serialize(varMusculos), false, errors.ToString());
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, errors));
            }
        }
        public HttpResponseMessage Delete(int id)
        {
            Musculos varMusculos = this.service.GetByKey(id, false);
            bool     result      = false;

            if (varMusculos == 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_DelMusculos", new JavaScriptSerializer().Serialize(varMusculos), result);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, id, BitacoraHelper.TypeSql.DELETE, "sp_DelMusculos", new JavaScriptSerializer().Serialize(varMusculos), 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)
        {
            Musculos entity = this.service.ListaSelAll(1, 1, "Musculos.Folio='" + id.ToString() + "'", "").Musculoss.First();
            Musculos result = new Musculos();

            result.Folio       = entity.Folio;
            result.Descripcion = entity.Descripcion;

            return(Request.CreateResponse(HttpStatusCode.OK, result, Configuration.Formatters.JsonFormatter));
        }
        public HttpResponseMessage PutTunnel(Musculos 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(Musculos varMusculos_Datos_Generales)
        {
            var data = "-1";

            try
            {
                data = Convert.ToString(this.service.Update_Datos_Generales(varMusculos_Datos_Generales));
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varMusculos_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdMusculos", new JavaScriptSerializer().Serialize(varMusculos_Datos_Generales), true);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, varMusculos_Datos_Generales.Folio, BitacoraHelper.TypeSql.UPDATE, "sp_UpdMusculos", new JavaScriptSerializer().Serialize(varMusculos_Datos_Generales), false, ex.Message);
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter));
        }
Exemple #8
0
        public CrearRutina()
        {
            InitializeComponent();
            #region DataSet Ejercicios
            actualizarCheckedListEjercicios();
            #endregion

            #region DataSet Dias
            clbDias.DataSource    = Dias.obtenerDias().Tables[0];
            clbDias.DisplayMember = "dia";
            clbDias.ValueMember   = "dia";
            #endregion

            #region DataSet Musculos
            clbMusculos.DataSource    = Musculos.obtenerMusculos().Tables[0];
            clbMusculos.DisplayMember = "musculo";
            clbMusculos.ValueMember   = "musculo";
            #endregion
        }
        public HttpResponseMessage MusculosGenerateID()
        {
            Musculos varMusculos = new Musculos();
            var      data        = "-1";

            try
            {
                data = Convert.ToString(this.service.Insert(varMusculos));
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, Convert.ToInt32(data), BitacoraHelper.TypeSql.INSERT, "sp_MusculosGenerateID", new JavaScriptSerializer().Serialize(varMusculos), true);
                serviceBitacora.Insert(bitacora);
            }
            catch (ServiceException ex)
            {
                var bitacora = BitacoraHelper.GetBitacora(Request, object_id, 0, BitacoraHelper.TypeSql.INSERT, "sp_MusculosGenerateID", new JavaScriptSerializer().Serialize(varMusculos), true);
                serviceBitacora.Insert(bitacora);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, data, Configuration.Formatters.JsonFormatter));
        }
Exemple #10
0
        public ActionResult Delete(int id)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IMusculosApiConsumer.SetAuthHeader(_tokenManager.Token);

                Musculos varMusculos = null;
                if (id.ToString() != "0")
                {
                    string where = "";
                }
                var result = _IMusculosApiConsumer.Delete(id, null, null).Resource;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }