예제 #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
        private bool ValidProducto(out string err)
        {
            err = string.Empty;

            if (ucIdentifSKU.SelectedValue == null)
            {
                err = "Debe seleccionar un producto.";
                return(false);
            }

            if (!((DTO.SKUDTO)CRUDHelper.Read(string.Format("IdentifSKU = '{0}'", ucIdentifSKU.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.SKU))).Activo)
            {
                err = "El producto no se encuentra Activo.";
                return(false);
            }

            if (rbTipoProd.SelectedItem == null)
            {
                err = "Debe seleccionar si el tipo de producto es Primario o Secundario.";
                return(false);
            }
            if (spCoeficiente.Value != null && (spCoeficiente.Number > 1 || spCoeficiente.Number < 0))
            {
                err = "El 'Coeficiente' debe estar entre los valores 0 y 1.";
                return(false);
            }

            return(true);
        }
예제 #3
0
        private void ucFrecuenciaChanged()
        {
            if (ucIdentifFrecuencia.SelectedValue != null)
            {
                DTO.FrecuenciaDTO frecuencia = CRUDHelper.Read(string.Format("IdentifFrecuencia = '{0}'", ucIdentifFrecuencia.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Frecuencia));

                trDia.Visible       = (frecuencia.SemMes.Trim().ToUpper() == MES);
                trDiaSemana.Visible = (frecuencia.SemMes.Trim().ToUpper() == SEMANA);
            }
            else
            {
                trDia.Visible       = false;
                trDiaSemana.Visible = false;
            }

            if (!trDia.Visible)         //Si no se muestra, va en NULL.
            {
                spDia.Value = null;
            }

            if (!trDiaSemana.Visible)   //Si no se muestra, va en NULL.
            {
                clDiaSemana.SelectedItem = null;
            }
        }
예제 #4
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"]), DAO);
                    FormsHelper.FillEntity(tblControls, entity);

                    if (!trDuracion.Visible)
                    {
                        (entity as DTO.PiezasArteDTO).Duracion = null;
                    }

                    Business.PiezasArte.Update(entity, Productos);

                    pnlControls.Visible = false;
                    RefreshGrid(gv);
                }
                else
                {
                    throw new Exception(err);
                }
            }
            catch (Exception ex)
            {
                FormsHelper.MsgError(lblError, ex);
            }
        }
예제 #5
0
        private void TipoDeEspacioChanged()
        {
            DTO.TipoEspacioDTO espacio = CRUDHelper.Read(string.Format("IdentifTipoEsp='{0}'", ucIdentifTipoEsp.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.TipoEspacio));
            trFrecuencia.Visible = espacio.Frecuencia;
            trHoraInicio.Visible = espacio.Hora;
            trHoraFin.Visible    = espacio.Hora;
            trIntervalo.Visible  = espacio.Intervalo;

            UpdatePanel1.Update();
        }
예제 #6
0
        void Pieza_SelectedIndexChanged(object sender, EventArgs e)
        {
            DTO.PiezasArteDTO pieza = CRUDHelper.Read(
                string.Format("IdentifPieza = '{0}'", ucIdentifPieza.SelectedValue),
                BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.PiezasArte));

            if ((pieza != null && pieza.Duracion.HasValue && pieza.Duracion > 0))
            {
                trDuracion.Visible = true;
                spDuracion.Value   = pieza.Duracion;
            }
            else
            {
                trDuracion.Visible = false;
                spDuracion.Value   = null;
            }
        }
예제 #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var entity = CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Frecuencia));

                FormsHelper.FillEntity(tblControls, entity);

                Business.Frecuencias.Update(entity, Detalles);

                pnlControls.Visible = false;
                RefreshGrid(gv);
            }
            catch (Exception ex)
            {
                FormsHelper.MsgError(lblError, ex);
            }
        }
예제 #8
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);
            }
        }
예제 #9
0
        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();
        }
예제 #10
0
        protected void ASPxMenu1_ItemClick(object source, MenuItemEventArgs e)
        {
            switch (e.Item.Name)
            {
            case "btnAdd":
                FormsHelper.ClearControls(tblControls, new DTO.IdentAtencionDTO());
                FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Add);
                pnlControls.Visible    = true;
                pnlControls.HeaderText = "Agregar Registro";

                break;

            case "btnEdit":
                if (FormsHelper.GetSelectedId(gv) != null)
                {
                    FormsHelper.ClearControls(tblControls, new DTO.IdentAtencionDTO());
                    var entity = CRUDHelper.Read(FormsHelper.GetSelectedId(gv).Value, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion));
                    FormsHelper.FillControls(entity, tblControls);
                    FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Edit);
                    pnlControls.Attributes.Add("RecId", entity.RecId.ToString());
                    pnlControls.Visible    = true;
                    pnlControls.HeaderText = "Modificar Registro";

                    TipIdentifChanged();
                }
                else
                {
                    pnlControls.Visible = false;
                }
                break;

            case "btnDelete":
                if (FormsHelper.GetSelectedId(gv) != null)
                {
                    FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Delete);
                    pnlControls.Attributes.Add("RecId", FormsHelper.GetSelectedId(gv).ToString());
                    pnlControls.Visible    = true;
                    pnlControls.HeaderText = "Eliminar Registros";
                }
                else
                {
                    pnlControls.Visible = false;
                }
                break;

            case "btnExport":
            case "btnExportXls":
                if (ASPxGridViewExporter1 != null)
                {
                    ASPxGridViewExporter1.WriteXlsToResponse();
                }
                break;

            case "btnExportPdf":
                if (ASPxGridViewExporter1 != null)
                {
                    ASPxGridViewExporter1.WritePdfToResponse();
                }
                break;

            default:
                break;
            }
        }
예제 #11
0
        protected void ASPxMenu1_ItemClick(object source, MenuItemEventArgs e)
        {
            try
            {
                switch (e.Item.Name)
                {
                case "btnAdd":
                    FormsHelper.ClearControls(tblControls, new DTO.AvisosDTO());
                    cbIdentifIdentAte.SelectedIndex = -1;
                    FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Add);

                    Atencion = new List <DTO.AvisosIdAtenDTO>();
                    RefreshAbmGrid(gvABM);

                    pnlControls.Visible    = true;
                    pnlControls.HeaderText = "Agregar Registro";
                    trDias.Visible         = true;
                    break;

                case "btnEdit":
                    if (FormsHelper.GetSelectedId(gv) != null)
                    {
                        FormsHelper.ClearControls(tblControls, new DTO.AvisosDTO());
                        cbIdentifIdentAte.SelectedIndex = -1;
                        var entity = CRUDHelper.Read(FormsHelper.GetSelectedId(gv).Value, DAO);
                        FormsHelper.FillControls(entity, tblControls);
                        FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Edit);

                        Atencion = Business.Avisos.ReadAllAtencion((string)entity.IdentifAviso);

                        gvABM.Attributes.Add("IdentifAviso", entity.IdentifAviso);
                        trDias.Visible = true;
                        RefreshAbmGrid(gvABM);

                        pnlControls.Attributes.Add("RecId", entity.RecId.ToString());
                        pnlControls.Visible    = true;
                        pnlControls.HeaderText = "Modificar Registro";
                    }
                    else
                    {
                        pnlControls.Visible = false;
                    }
                    break;

                case "btnDelete":
                    if (FormsHelper.GetSelectedId(gv) != null)
                    {
                        FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Delete);
                        pnlControls.Attributes.Add("RecId", FormsHelper.GetSelectedId(gv).ToString());
                        pnlControls.Visible    = true;
                        pnlControls.HeaderText = "Eliminar Registros";
                    }
                    else
                    {
                        pnlControls.Visible = false;
                    }
                    break;

                case "btnExport":
                case "btnExportXls":
                    if (ASPxGridViewExporter1 != null)
                    {
                        ASPxGridViewExporter1.WriteXlsToResponse();
                    }
                    break;

                case "btnExportPdf":
                    if (ASPxGridViewExporter1 != null)
                    {
                        ASPxGridViewExporter1.WritePdfToResponse();
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                FormsHelper.MsgError(lblError, ex);
            }
        }
예제 #12
0
        protected void ASPxMenu1_ItemClick(object source, MenuItemEventArgs e)
        {
            try
            {
                switch (e.Item.Name)
                {
                case "btnAdd":

                    FormsHelper.ClearControls(tblControls, new DTO.FrecuenciaDTO());
                    FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Add);

                    pnlDias.Visible = false;
                    Detalles        = new List <DTO.FrecuenciaDetDTO>();

                    RefreshAbmGrid(gvABM);

                    pnlControls.Visible    = true;
                    pnlControls.HeaderText = "Agregar Registro";
                    trDias.Visible         = true;
                    rbSemMes.Enabled       = true;

                    break;

                case "btnEdit":

                    if (FormsHelper.GetSelectedId(gv) != null)
                    {
                        FormsHelper.ClearControls(tblControls, new DTO.FrecuenciaDTO());
                        var entity = CRUDHelper.Read(FormsHelper.GetSelectedId(gv).Value, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Frecuencia));
                        FormsHelper.FillControls(entity, tblControls);
                        FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Edit);

                        Detalles = CRUDHelper.ReadAll(string.Format("IdentifFrecuencia = '{0}'", entity.IdentifFrecuencia), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.FrecuenciaDet));

                        rbSemMes.Enabled = (Detalles.Count == 0);

                        rbSemMesChanged();

                        gvABM.Attributes.Add("IdentifFrecuencia", entity.IdentifFrecuencia);
                        trDias.Visible = true;
                        RefreshAbmGrid(gvABM);

                        pnlControls.Attributes.Add("RecId", entity.RecId.ToString());
                        pnlControls.Visible    = true;
                        pnlControls.HeaderText = "Modificar Registro";
                    }
                    else
                    {
                        pnlControls.Visible = false;
                    }
                    break;

                case "btnDelete":
                    rbSemMes.Enabled = (Detalles.Count == 0);
                    if (FormsHelper.GetSelectedId(gv) != null)
                    {
                        FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Delete);
                        pnlControls.Attributes.Add("RecId", FormsHelper.GetSelectedId(gv).ToString());
                        pnlControls.Visible    = true;
                        pnlControls.HeaderText = "Eliminar Registros";
                    }
                    else
                    {
                        pnlControls.Visible = false;
                    }
                    break;

                case "btnExport":
                case "btnExportXls":
                    if (ASPxGridViewExporter1 != null)
                    {
                        ASPxGridViewExporter1.GridViewID = "gv";
                    }
                    ASPxGridViewExporter1.WriteXlsToResponse();
                    break;

                case "btnExportPdf":
                    if (ASPxGridViewExporter1 != null)
                    {
                        ASPxGridViewExporter1.GridViewID = "gv";
                    }
                    ASPxGridViewExporter1.WritePdfToResponse();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                FormsHelper.MsgError(lblError, ex);
            }
        }
예제 #13
0
        void TipoPieza_SelectedIndexChanged(object sender, EventArgs e)
        {
            DTO.TipoPiezaDTO tipoPieza = CRUDHelper.Read(string.Format("IdentifTipoPieza = '{0}'", ucIdentifTipoPieza.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.TipoPieza));

            trDuracion.Visible = (tipoPieza != null && tipoPieza.Duracion);
        }