protected void btnInsert_Click(object sender, EventArgs e) { NegocioPeriodo NegPer = new NegocioPeriodo(); String nombre = ""; String fechaIni = Calendar1.SelectedDate.ToShortDateString(); String fechaFin = Calendar2.SelectedDate.ToShortDateString(); String F = "0001"; nombre = fechaIni.Substring(6, 4) + "-" + fechaFin.Substring(6, 4); bool b = nombre.Contains(F); if (b != true) { if (NegPer.AltaPeriodo(nombre, DateTime.Parse(fechaIni), DateTime.Parse(fechaFin)) > 0) { //se manda a llamar al load grid para que cada vez que //se inserte un periodo se refleje a la hora de cargar el grid txFechaF.Text = ""; txFechaI.Text = ""; LoadGrid(); MessageBox.Show("Periodo Insertado"); } } else { MessageBox.Show("Necesitas ingresar una fecha para periodo que sea valida"); } }
/* protected void Reset_Lemas_Click(object sender, EventArgs e) { // txNombre.Text = ""; txFechaI.Text = ""; txFechaF.Text = ""; }*/ private void LoadGrid() { NegocioPeriodo NegPer = new NegocioPeriodo(); grvPeriodos.DataSource = NegPer.ObtenerPeriodos(); grvPeriodos.DataBind(); }