public JsonResult CheckSegmento(int SucId, string Segmento) { SucursalesSegmento obj = new SucursalesSegmento(); SegmentosRepository SucRep = new SegmentosRepository(); try { if (SucId != -1 || Segmento != string.Empty) { obj.Accion = SucRep.CheckSegmento(SucId, Segmento); if (obj.Accion == -1) { obj.Mensaje = "Se genero un error al verificar la existencia del cubiculo!"; } } else { obj.Accion = -1; obj.Mensaje = "El parametro tiene un valor incorrecto!"; } } catch (Exception ex) { //throw; obj.Accion = -1; obj.Mensaje = ex.Message.ToString(); //return Json(list, JsonRequestBehavior.AllowGet); } return(Json(obj, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveDataSegmentos(SucursalesSegmento segmentos) { try { SegmentosRepository SucSeg = new SegmentosRepository(); if (ModelState.IsValid) { SucSeg.Save(segmentos); //db.Sucursal.Add(sucursal); //db.SaveChanges(); } else { segmentos.Accion = 0; segmentos.Mensaje = "Los datos enviados no son correctos, intente de nuevo!"; } //return Json(horarios, JsonRequestBehavior.AllowGet); } catch (Exception ex) { //throw; segmentos.Accion = 0; segmentos.Mensaje = ex.Message.ToString(); } return(Json(segmentos, JsonRequestBehavior.AllowGet)); }
public JsonResult GetSegmentosBySucursalId(int id) { SegmentosRepository SucSeg = new SegmentosRepository(); try { return(Json(SucSeg.GetSegmentosBySucursal(id), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { //throw; List <SucursalesSegmento> list = new List <SucursalesSegmento>(); SucursalesSegmento obj = new SucursalesSegmento(); obj.Accion = 0; obj.Mensaje = ex.Message.ToString(); list.Add(obj); return(Json(list, JsonRequestBehavior.AllowGet)); } }
public JsonResult deleteSegmento(int SucursalId, string SucSegmentoId) { SucursalesSegmento obj = new SucursalesSegmento(); SegmentosRepository SSRep = new SegmentosRepository(); try { if (SucSegmentoId != "") { obj = SSRep.DelSegmento(SucursalId, SucSegmentoId); } else { obj.Accion = 0; obj.Mensaje = "El parametro tiene un valor incorrecto!"; } } catch (Exception ex) { obj.Accion = 0; obj.Mensaje = ex.Message.ToString(); } return(Json(obj, JsonRequestBehavior.AllowGet)); }