//ArrayList lista = new ArrayList(); //public void CargarEstado() //{ // lista.Add("HABILITADO"); // lista.Add("DESHABILITADO"); // this.ddlEstado.DataSource = lista; // DataBind(); //} protected void btnGuardar_Click(object sender, EventArgs e) { try { lbl_mensaje.Text = ""; if (validarDatos()) { DtoServicio prof = new DtoServicio(); CtrServicio ctrprof = new CtrServicio(); prof.codServicio = int.Parse(Request.Params["c"]); prof.nombre = txtNombre.Text.Trim(); prof.descripcion = txtDescripcion.Text.Trim(); if (ddlEstado.SelectedValue.ToString() == "1") { prof.estado = 1; } else { prof.estado = 0; } ctrprof.modificarServicio(prof); lbl_mensaje.Text = "Se modificó exitósamente el servicio: " + prof.nombre; } } catch { lbl_mensaje.Text = "Error al intentar modificar el servicio"; } }
public bool getServicio(DtoServicio serv) { SqlCommand cmd = new SqlCommand("sp_getServicio", conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@codServicio", serv.codServicio); conexion.Open(); bool hayRegistros; SqlDataReader reader = cmd.ExecuteReader(); hayRegistros = reader.Read(); if (hayRegistros) { serv.nombre = reader[1].ToString(); serv.descripcion = reader[2].ToString(); //serv.estado = int.Parse(reader[3].ToString()); } conexion.Close(); return(hayRegistros); }
public void disableServicio(DtoServicio serv) { SqlCommand cmd = new SqlCommand("sp_disableServicio", conexion); cmd.CommandType = CommandType.StoredProcedure; conexion.Open(); cmd.ExecuteNonQuery(); conexion.Close(); }
public void cargarDatos() { CtrServicio ctrser = new CtrServicio(); DtoServicio serv = new DtoServicio(); serv.codServicio = int.Parse(Session["c"].ToString()); ctrser.consultarServicio(serv); txtNombre.Text = serv.nombre; txtDescripcion.Text = serv.descripcion; }
public void InsertServicio(DtoServicio serv) { SqlCommand cmd = new SqlCommand("sp_insertServicio", conexion); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@nombre", serv.nombre); cmd.Parameters.AddWithValue("@descripcion", serv.descripcion); conexion.Open(); cmd.ExecuteNonQuery(); conexion.Close(); }
protected void btnGuardar_Click(object sender, EventArgs e) { try { lbl_mensaje.Text = ""; if (validarDatos()) { DtoServicio ser = new DtoServicio(); ser.nombre = txtNombre.Text.Trim(); ser.descripcion = txtDescripcion.Text.Trim(); //ser.estado =1; CtrServicio ctrser = new CtrServicio(); ctrser.registrarServicio(ser); lbl_mensaje.Text = "Se registró exitósamente el servicio : " + ser.nombre; limpiar(); } } catch { lbl_mensaje.Text = "Error al intentar registrar el servicio"; } }
public bool consultarServicio(DtoServicio serv) { return(daoservi.getServicio(serv)); }
public void inhabilitarServicio(DtoServicio serv) { daoservi.disableServicio(serv); }
public void modificarServicio(DtoServicio serv) { daoservi.updateServicio(serv); }
public void registrarServicio(DtoServicio serv) { daoservi.InsertServicio(serv); }