예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var dao = BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion);
                IdentAtencionDTO entity = (DTO.IdentAtencionDTO)CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), dao);

                FormsHelper.FillEntity(tblControls, entity);

                if (!entity.Estado && dao.ExisteAvisoEnVigencia(entity.IdentifIdentAte))
                {
                    throw new Exception("No se puede deshabilitar, ya que se encuentra en uso por un aviso vigente.");
                }

                CRUDHelper.Update(entity,
                                  BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion));

                pnlControls.Visible = false;
                RefreshGrid(gv);
            }
            catch (Exception ex)
            {
                FormsHelper.MsgError(lblError, ex);
            }
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string err = string.Empty;

            try
            {
                if (Valid(out err))
                {
                    var entity = CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont));

                    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.Update(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont));

                    pnlControls.Visible = false;

                    RefreshGrid(gv);
                }
                else
                {
                    throw new Exception(err);
                }
            }
            catch (Exception ex)
            {
                FormsHelper.MsgError(lblError, ex);
            }
        }
예제 #3
0
 private void Update(object entity)
 {
     CRUDHelper.Update(entity, dao);
 }