Пример #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvSalas.CurrentRow != null)
                {
                    if (Util.ConfirmationMessage("¿Desea eliminar la Sala seleccionada?") == false)
                    {
                        return;
                    }

                    var uiSala = (BE.UI.Sala) this.dgvSalas.CurrentRow.DataBoundItem;

                    bool rpta = new LN.Sala().Eliminar(uiSala.ID);

                    if (rpta == true)
                    {
                        Util.InformationMessage("Se eliminó la Sala seleccionada");
                        this.CargarListadoSalas();
                    }
                }
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }
Пример #2
0
        private void CargarSalas()
        {
            var lstBeSalas = new LN.Sala().ListaSimple();

            this.cboSalas.DataSource    = lstBeSalas;
            this.cboSalas.DisplayMember = "Nombre";
            this.cboSalas.ValueMember   = "IdSala";
        }
Пример #3
0
        private void CargarSalas()
        {
            var lstSalas = new LN.Sala().ListaSimple();

            lstSalas.Insert(0, new BE.Sala()
            {
                IdSala = 0, Nombre = "Todas"
            });

            this.cboSala.DataSource    = lstSalas;
            this.cboSala.DisplayMember = "Nombre";
            this.cboSala.ValueMember   = "IdSala";
        }
Пример #4
0
        private void CargarSalas(bool Seleccione = false)
        {
            var lstSalas = new LN.Sala().ListaSimple();

            if (Seleccione == true)
            {
                lstSalas.Insert(0, new BE.Sala()
                {
                    IdSala = 0, Nombre = "Seleccione"
                });
            }

            this.cboSala.DataSource    = lstSalas;
            this.cboSala.DisplayMember = "Nombre";
            this.cboSala.ValueMember   = "IdSala";
        }
Пример #5
0
        public void CargarListadoSalas()
        {
            try
            {
                var lstUiSalas = new LN.Sala().Listar();

                var source = new BindingSource();
                source.DataSource = lstUiSalas;

                this.dgvSalas.DataSource = source;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        private void CargarSalas()
        {
            try
            {
                var lstBeSalas = new LN.Sala().ListaSimple();

                lstBeSalas.Insert(0, new BE.Sala()
                {
                    IdSala = 0, Nombre = "Seleccione"
                });

                this.cboSala.DataSource    = lstBeSalas;
                this.cboSala.DisplayMember = "Nombre";
                this.cboSala.ValueMember   = "IdSala";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #7
0
        public void CargarListaMetas()
        {
            try
            {
                int anho = int.Parse(this.cboAnho.SelectedValue.ToString());
                int mes  = int.Parse(this.cboMes.SelectedValue.ToString());

                this.lstUiMetasSalas = new LN.MetaSala().Listar(anho, mes);

                if (this.lstUiMetasSalas.Count == 0)
                {
                    var lstUiSalas = new LN.Sala().Listar();

                    foreach (BE.UI.Sala uiSala in lstUiSalas)
                    {
                        var uiMetaSala = new BE.UI.MetaSala();

                        uiMetaSala.SalaId     = uiSala.ID;
                        uiMetaSala.SalaNombre = uiSala.Nombre;
                        uiMetaSala.Anho       = anho;
                        uiMetaSala.Mes        = mes;

                        this.lstUiMetasSalas.Add(uiMetaSala);
                    }
                }

                var source = new BindingSource();
                source.DataSource = this.lstUiMetasSalas;

                this.dgvMetaSala.DataSource = source;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #8
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                #region Validaciones del formulario

                if (this.cboDepartamento.SelectedIndex == 0)
                {
                    this.cboDepartamento.Focus();
                    throw new Exception("Seleccione un departamento");
                }

                if (this.cboProvincia.SelectedIndex == 0)
                {
                    this.cboProvincia.Focus();
                    throw new Exception("Seleccione una provincia");
                }

                if (this.cboDistrito.SelectedIndex == 0)
                {
                    this.cboProvincia.Focus();
                    throw new Exception("Seleccione un distrito");
                }

                if (this.txtNombre.Text.Trim().Length == 0)
                {
                    this.txtNombre.Focus();
                    throw new Exception("Ingrese el nombre de la sala");
                }

                if (this.txtZona.Text.Trim().Length == 0)
                {
                    this.txtZona.Focus();
                    throw new Exception("Ingrese la zona");
                }

                if (this.txtDireccion.Text.Trim().Length == 0)
                {
                    this.txtDireccion.Focus();
                    throw new Exception("Ingrese la direccion");
                }

                #endregion

                #region Guardar

                this.beSala.Nombre      = this.txtNombre.Text;
                this.beSala.Descripcion = this.txtDescripcion.Text;
                this.beSala.Zona        = this.txtZona.Text;
                this.beSala.Direccion   = this.txtDireccion.Text;
                this.beSala.Referencia  = this.txtReferencia.Text;

                this.beSala.Activo = this.chkActivo.Checked;

                var beUbigeo = new BE.Ubigeo();
                beUbigeo.Departamento = int.Parse(this.cboDepartamento.SelectedValue.ToString());
                beUbigeo.Provincia    = int.Parse(this.cboProvincia.SelectedValue.ToString());
                beUbigeo.Distrito     = int.Parse(this.cboDistrito.SelectedValue.ToString());
                if (new LN.Ubigeo().Obtener(ref beUbigeo) == true)
                {
                    this.beSala.Ubigeo = beUbigeo;
                }

                bool   rpta   = false;
                string msg    = "";
                var    lnSala = new LN.Sala();
                if (this.beSala.IdSala == 0) //Nuevo
                {
                    rpta = lnSala.Insertar(ref this.beSala);
                    if (true)
                    {
                        msg = "Se registro una nuevo Sala";
                    }
                }
                else  //Actualizar
                {
                    rpta = lnSala.Actualizar(this.beSala);
                    if (true)
                    {
                        msg = "Se actualizo la Sala";
                    }
                }

                if (rpta == true)
                {
                    Util.InformationMessage(msg);
                    this.frmList.CargarListadoSalas();
                    this.Close();
                }

                #endregion
            }
            catch (Exception ex)
            {
                Util.ErrorMessage(ex.Message);
            }
        }
Пример #9
0
        private void CargarFiltros(string codigo = "")
        {
            var lstFiltro = new List <BE.Record>();

            switch (codigo)
            {
            case "1":     //Documento
                lstFiltro = new LN.Record().ListarTipoDocumento();
                break;

            case "2":     //Sala
                var lstBeSalas = new LN.Sala().ListaSimple();
                foreach (BE.Sala beSala in lstBeSalas)
                {
                    lstFiltro.Add(new BE.Record()
                    {
                        Codigo = beSala.IdSala.ToString(),
                        Nombre = beSala.Nombre
                    });
                }
                break;

            case "3":     //Sexo
                lstFiltro = new LN.Record().ListarSexos();
                break;

            case "4":     //Activo
                lstFiltro.Add(new BE.Record()
                {
                    Codigo = "Si", Nombre = "Si"
                });
                lstFiltro.Add(new BE.Record()
                {
                    Codigo = "No", Nombre = "No"
                });
                break;

            case "5":     //Cargo
                var lstUiCargos = new LN.Cargo().Listar();
                foreach (BE.UI.Cargo uiCargo in lstUiCargos)
                {
                    lstFiltro.Add(new BE.Record()
                    {
                        Codigo = uiCargo.Id.ToString(),
                        Nombre = uiCargo.Nombre
                    });
                }
                break;

            default:     //Todos
                break;
            }

            lstFiltro.Insert(0, new BE.Record()
            {
                Codigo = "", Nombre = "Todos"
            });

            this.cboFiltro.DataSource    = lstFiltro;
            this.cboFiltro.DisplayMember = "Nombre";
            this.cboFiltro.ValueMember   = "Codigo";
        }