protected void btnAdd_Click(object sender, EventArgs e) { string err = string.Empty; try { if (Valid(out err)) { var entity = new DTO.EspacioContDTO(); FormsHelper.FillEntity(tblControls, entity); if (!trIntervalo.Visible) { entity.IdentifIntervalo = null; } if (!trFrecuencia.Visible) { entity.IdentifFrecuencia = null; } if (!trHoraFin.Visible || !trHoraInicio.Visible) { entity.HoraFin = null; entity.HoraInicio = null; } CRUDHelper.Create(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); pnlControls.Visible = false; RefreshGrid(gv); } else { throw new Exception(err); } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
private void ucEspacioChanged() { trTipoHorario.Visible = false; rbHorario.SelectedItem = rbHorario.Items.FindByValue(TODO); if (ucIdentifEspacio.SelectedValue != null) { DTO.EspacioContDTO espacio = CRUDHelper.Read(string.Format("IdentifEspacio = '{0}'", ucIdentifEspacio.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); trTipoHorario.Visible = (espacio.HoraFin.HasValue && espacio.HoraFin.Value.TotalMinutes > 0); if (!(espacio.HoraFin.HasValue && espacio.HoraFin.Value.TotalMinutes > 0)) { rbHorario.SelectedItem = rbHorario.Items.FindByValue(TODO); } } rbHorarioChanged(); }
protected void btnAdd_Click(object sender, EventArgs e) { string err = string.Empty; try { if (Valid(out err)) { var entity = new DTO.EspacioContDTO(); FormsHelper.FillEntity(tblControls, entity); if (!trIntervalo.Visible) entity.IdentifIntervalo = null; if (!trFrecuencia.Visible) entity.IdentifFrecuencia = null; if (!trHoraFin.Visible || !trHoraInicio.Visible) { entity.HoraFin = null; entity.HoraInicio = null; } CRUDHelper.Create(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); pnlControls.Visible = false; RefreshGrid(gv); } else { throw new Exception(err); } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }