public static Result getListaOpcionesMaestroAnexos(int maestroAnexoId, int registroPartida, int totalAExtraer, int usuarioId) { Result r = ValidateSession.validarSession(usuarioId, HttpContext.Current.Session["usuarioId"]); if (r.error != "") { return(r); } int totalRegistros = 0; List <OpcionesMaestroAnexosViewModel> lst = new List <OpcionesMaestroAnexosViewModel>(); try { OpcionesMaestroAnexosController omac = new OpcionesMaestroAnexosController(); lst = omac.getListaOpcionesMaestroAnexosPorMaestroAnexoId(maestroAnexoId); totalRegistros = lst.Count(); totalAExtraer = (lst.Count() - registroPartida) < totalAExtraer ? (lst.Count() - registroPartida) : totalAExtraer; } catch (Exception e) { return(new Result() { error = e.Message, id = 0, tipoAlerta = "warning" }); } return(new Result() { error = "", getCadena = new JavaScriptSerializer().Serialize(lst.GetRange(registroPartida, totalAExtraer)), totalRegistros = totalRegistros }); }
public static Result guardar(int id, int maestroAnexosId, int usuarioId, string nombreOpcion) { Result r = ValidateSession.validarSession(usuarioId, HttpContext.Current.Session["usuarioId"]); if (r.error != "") { return(r); } OpcionesMaestroAnexos objEntity = new OpcionesMaestroAnexos(); objEntity.id = id; objEntity.maestroAnexosId = maestroAnexosId; objEntity.usuarioId = usuarioId; objEntity.nombreOpcion = nombreOpcion; try { OpcionesMaestroAnexosController omac = new OpcionesMaestroAnexosController(); return(omac.guardarOpcionesMaestroAnexos(objEntity)); } catch (Exception ex) { return(new Result() { error = ex.Message, id = 0, tipoAlerta = "warning" }); } }
protected void Page_Load(object sender, EventArgs e) { int maestroAnexoId = 0; if (!IsPostBack) { string tabla = Request.QueryString["tabla"]; hRegistro.Value = Request.QueryString["registroId"]; OpcionesMaestroAnexosController omc = new OpcionesMaestroAnexosController(); List <OpcionesMaestroAnexosViewModel> lstOMA = omc.getListaOpcionesMaestroAnexosPorMaestroNombreTabla(tabla); foreach (OpcionesMaestroAnexosViewModel omavm in lstOMA) { maestroAnexoId = omavm.maestroAnexosId; cmbTipoAnexo.Items.Add(new ListItem() { Text = omavm.nombreOpcion, Value = omavm.id.ToString() }); } try { hConsecutivo.Value = ConsecutivosTemporalesController.getConsecutivo(maestroAnexoId); Button1.Enabled = true; } catch (Exception) { Button1.Enabled = false; } } }
public static Result eliminar(int id, int usuarioId) { Result r = ValidateSession.validarSession(usuarioId, HttpContext.Current.Session["usuarioId"]); if (r.error != "") { return(r); } try { OpcionesMaestroAnexosController omac = new OpcionesMaestroAnexosController(); return(omac.eliminarOpcionesMaestroAnexos(id, usuarioId)); } catch (Exception ex) { return(new Result() { error = ex.Message, id = 0, tipoAlerta = "warning" }); } }