public ActionResult Edit(int id) { var colBLL = new ColaboradorBLL(); tblColaboradore objCol = colBLL.RetrieveColaboradorByID(id); return(View(objCol)); }
public bool Update(tblColaboradore t) { bool Result = false; using (var r = new Repository <tblColaboradore>()) { tblColaboradore ba = r.Retrieve(p => p.nombreColaborador == t.nombreColaborador && p.telefonoColaborador == t.telefonoColaborador && p.correoColaborador == t.correoColaborador && p.horarioInicio == t.horarioInicio && p.horaFin == t.horaFin && p.contraseniaColaborador == t.contraseniaColaborador && p.idColaborador != t.idColaborador); if (ba == null) { Result = r.Update(t); } else { throw (new Exception("No se pudo actualizar el colaborador seleccionada.")); } } return(Result); }
public tblColaboradore Create(tblColaboradore t) { tblColaboradore Result = null; using (var r = new Repository <tblColaboradore>()) { tblColaboradore ba = r.Retrieve(p => p.nombreColaborador == t.nombreColaborador && p.telefonoColaborador == t.telefonoColaborador && p.correoColaborador == t.correoColaborador && p.horarioInicio == t.horarioInicio && p.horaFin == t.horaFin && p.contraseniaColaborador == t.contraseniaColaborador && p.idColaborador != t.idColaborador); if (ba == null) { Result = r.Create(t); } else { throw (new Exception("El colaborador ya existe.")); } } return(Result); }
public tblColaboradore RetrieveColaboradorByID(int id) { tblColaboradore Result = null; using (var r = new Repository <tblColaboradore>()) { Result = r.Retrieve(p => p.idColaborador == id); } return(Result); }
public tblColaboradore ValidarUsuarioContrasenia(string user, string pass) { tblColaboradore Result = null; using (var r = new Repository <tblColaboradore>()) { Result = r.Retrieve(p => p.correoColaborador == user && p.contraseniaColaborador == pass); } return(Result); }
public bool Delete(int id) { bool Result = false; tblColaboradore obj = RetrieveColaboradorByID(id); if (obj != null) { using (var r = new Repository <tblColaboradore>()) { Result = r.Delete(obj); } } else { throw (new Exception("El colaborador seleccionado no se pudo eliminar.")); } return(Result); }
public JsonResult ValidarUsuario(string correo_p, string password_p) { var ocBLL = new ColaboradorBLL(); tblColaboradore objColaborador = ocBLL.ValidarUsuarioContrasenia(correo_p, password_p); wmJsonResult objJson = new wmJsonResult(); if (objColaborador != null) { objJson.bandera = true; objJson.mensaje = objColaborador.nombreColaborador; } else { objJson.bandera = false; objJson.mensaje = "No se encontró usuario"; } return(Json(objJson, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(tblColaboradore colaborador) { var colBLL = new ColaboradorBLL(); ActionResult Result = null; try { if (ModelState.IsValid) { colBLL.Update(colaborador); Result = RedirectToAction("Index"); } } catch { return(View()); } return(Result); }
public ActionResult Create(tblColaboradore colaborador) { var colBLL = new ColaboradorBLL(); ActionResult Result = null; try { if (ModelState.IsValid) { colBLL.Create(colaborador); Result = RedirectToAction("Index"); } else { Result = RedirectToAction("Index"); } } catch { Result = RedirectToAction("Index"); } return(Result); }
public ActionResult CreateHorarios(int id) { var colBLL = new ColaboradorBLL(); tblColaboradore objColaborador = colBLL.RetrieveColaboradorByID(id); var diasBLL = new DiaBLL(); List <tblDia> listaDias = diasBLL.RetrieveAll(); var mesBLL = new MesBLL(); List <tblMe> listaSemanas = mesBLL.RetrieveAll(); var anioBLL = new AnioBLL(); List <tblAnio> listaAnios = anioBLL.RetrieveAll(); ViewBag.idColaborador = objColaborador.idColaborador; ViewBag.NombreColaborador = objColaborador.nombreColaborador; ViewBag.HoraInicial = objColaborador.horarioInicio.ToShortTimeString(); ViewBag.HoraFinal = objColaborador.horaFin.ToShortTimeString(); ViewBag.idDias = new SelectList(listaDias, "idDias", "dia"); ViewBag.idMes = new SelectList(listaSemanas, "idMes", "Mes"); ViewBag.idAnio = new SelectList(listaAnios, "idAnio", "anio"); return(View()); }
public JsonResult DeleteColaborador(int id) { var colBLL = new ColaboradorBLL(); wmJsonResult objJson = new wmJsonResult(); try { tblColaboradore colaborador = colBLL.RetrieveColaboradorByID(id); if (colaborador != null) { var eveBLL = new EventoBLL(); List <tblEvento> listaEventos = eveBLL.RetrieveEventosColaboradorByID(id); if (listaEventos.Count() >= 0) { //significa que tiene eventos.... } var areaBLL = new AreasBLL(); List <tblArea> listaArea = areaBLL.RetrieveAreasColaboradorByID(id); if (listaArea.Count() >= 0) { //significa que tiene areas asignadas.... } var citBLL = new CitaBLL(); List <tblCita> listaCitas = citBLL.RetrieveCitasColaboradorByID(id); if (listaCitas.Count() >= 0) { //significa que tiene areas asignadas.... } bool banderita = colBLL.Delete(id); if (banderita == true) { objJson.bandera = true; objJson.mensaje = "El colaborador se eliminó correctamente"; } else { objJson.bandera = false; objJson.mensaje = "El colaborador NO se eliminó correctamente"; } } else { objJson.bandera = false; objJson.mensaje = "El colaborador no se encontró"; } } catch { objJson.bandera = false; objJson.mensaje = "Ocurrio una excepcion al eliminar el registro"; } return(Json(objJson, JsonRequestBehavior.AllowGet)); }