private void ObtenerTimers(bool forzarBD) { if (ViewState["lista"] == null || forzarBD) { TimerProcesosBC tp = new TimerProcesosBC(); ViewState["lista"] = tp.ObtenerTodos(); ViewState.Remove("filtrados"); } DataView dw; if (ViewState["filtrados"] == null) { dw = new DataView((DataTable)ViewState["lista"]); } else { dw = new DataView((DataTable)ViewState["filtrados"]); } if (ViewState["sortExpresion"] != null && ViewState["sortExpresion"].ToString() != "") { dw.Sort = (String)ViewState["sortExpresion"]; } this.gv_listar.DataSource = dw; this.gv_listar.DataBind(); }
protected void btn_eliminarTimer_Click(object sender, EventArgs e) { TimerProcesosBC tp = new TimerProcesosBC(); if (tp.Eliminar(int.Parse(hf_idTimerProcesos.Value))) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Eliminado sin problemas');", true); ObtenerTimers(true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Ocurrió un error!');", true); } }
protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e) { TimerProcesosBC tp = new TimerProcesosBC(); if (e.CommandName == "ELIMINAR") { hf_idTimerProcesos.Value = e.CommandArgument.ToString(); tp = tp.ObtenerXId(int.Parse(hf_idTimerProcesos.Value)); lblRazonEliminacion.Text = "Eliminar Tipo Playa"; msjEliminacion.Text = "Se eliminará el tipo tp seleccionado, ¿desea continuar?"; btnModalEliminar.Attributes.Remove("onclick"); btnModalEliminar.Attributes.Add("onclick", "eliminarTimer();"); btnModalEliminar.Text = "Eliminar"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "asdf", "modalConfirmacion();", true); } }
protected void gv_listar_RowEditing(object sender, GridViewEditEventArgs e) { Limpiar(); TimerProcesosBC tp = new TimerProcesosBC(); gv_listar.SelectedIndex = e.NewEditIndex; hf_idTimerProcesos.Value = this.gv_listar.SelectedDataKey.Value.ToString(); tp = tp.ObtenerXId(int.Parse(hf_idTimerProcesos.Value)); txt_editCodigo.Text = tp.CODIGO; txt_editDesc.Text = tp.DESCRIPCION; txt_editMins.Text = tp.TIEMPO_MAX.ToString(); txt_editColor.Text = tp.COLOR; ddl_editSite.SelectedValue = tp.SITE_ID.ToString(); ddl_editSite.Enabled = false; ddl_editEstadoSoli.Enabled = true; ddl_editTipoZona.Enabled = true; ddl_editTipoPlaya.Enabled = true; ddl_editEstadoSoli.SelectedValue = tp.SOES_ID.ToString(); ddl_editTipoZona.SelectedValue = tp.ZOTI_ID.ToString(); ddl_editTipoPlaya.SelectedValue = tp.PYTI_ID.ToString(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "modalTimers();", true); }
protected void btn_editGrabar_Click(object sender, EventArgs e) { TimerProcesosBC tp = new TimerProcesosBC(); tp.CODIGO = txt_editCodigo.Text; tp.DESCRIPCION = txt_editDesc.Text; tp.TIEMPO_MAX = int.Parse(txt_editMins.Text); tp.COLOR = txt_editColor.Text; tp.SITE_ID = int.Parse(ddl_editSite.SelectedValue); tp.SOES_ID = int.Parse(ddl_editEstadoSoli.SelectedValue); tp.ZOTI_ID = int.Parse(ddl_editTipoZona.SelectedValue); tp.PYTI_ID = int.Parse(ddl_editTipoPlaya.SelectedValue); if (string.IsNullOrEmpty(hf_idTimerProcesos.Value)) { if (tp.Crear(tp)) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Timer procesos agregado correctamente');", true); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "limpiar", "limpiarForm();", true); ObtenerTimers(true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error. Revise que los datos sean correctos.');", true); } } else { tp.ID = int.Parse(hf_idTimerProcesos.Value); if (tp.Modificar(tp)) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Timer procesos agregado correctamente');", true); ObtenerTimers(true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error. Revise que los datos sean correctos.');", true); } } }
public bool Modificar(TimerProcesosBC tp) { return(tran.TimerProcesos_Modificar(tp)); }
public bool Crear(TimerProcesosBC tp) { return(tran.TimerProcesos_Crear(tp)); }