public List <cArea> LayDanhSachArea() { List <cArea> tbl = new List <cArea>(); DataSet ds = db.ExecuteQueryDS("EXEC GetListArea", CommandType.Text); DataTable dt = new DataTable(); dt = ds.Tables[0]; foreach (DataRow item in dt.Rows) { cArea tb = new cArea(item); tbl.Add(tb); } return(tbl); }
protected void rptTabs_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { cArea item = (cArea)e.Item.DataItem; Literal ltTabs = (Literal)e.Item.FindControl("ltTabs"); if (e.Item.ItemIndex == 0) { ltTabs.Text = "<li class=\"active\"><a href=\"#tab1\" data-toggle=\"tab\">" + item.name + "</a></li>"; } else { ltTabs.Text = "<li><a href=\"#tab" + (e.Item.ItemIndex + 1).ToString() + "\" data-toggle=\"tab\">" + item.name + "</a></li>"; } } }
private void btnEliminar_Click(object sender, EventArgs e) { if (dgvDatos.RowCount > 0) { try { cArea temporal = arear.retornarPorId(Convert.ToInt32(dgvDatos.CurrentRow.Cells[0].Value)); arear.eliminar(temporal); MessageBox.Show("SE ELIMINARON LOS DATOS CON EXITO: ", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information); Actualizar(); } catch (Exception ex) { MessageBox.Show("ERROR AL ELIMINAR LOS DATOS: " + ex.Message, "ERROR!!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnModificar_Click(object sender, EventArgs e) { area = arear.retornarPorId(Convert.ToInt32(dgvDatos.CurrentRow.Cells[0].Value)); area.nombre = tbNombre.Text; area.detalle = tbDetalle.Text; try { arear.modificar(area); MessageBox.Show("SE MODIFICARON LOS DATOS SATISFACTORIAMENTE: ", "INFORMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information); Actualizar(); } catch (Exception ex) { MessageBox.Show("ERROR AL MODIFICAR LOS DATOS: " + ex.Message, "ERROR!!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected void rptTab_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { cArea item = (cArea)e.Item.DataItem; Panel pnTab = (Panel)e.Item.FindControl("pnTab"); pnTab.ID = "tab" + (e.Item.ItemIndex + 1).ToString(); if (e.Item.ItemIndex == 0) { pnTab.CssClass = "tab-pane active"; } else { pnTab.CssClass = "tab-pane"; } Repeater rptTabContent = (Repeater)e.Item.FindControl("rptTabContent"); rptTabContent.DataSource = item.courses; rptTabContent.DataBind(); } }