예제 #1
0
        private void CargarSectorRequerimiento()
        {
            try
            {
                BLL.Tables.COMSECTORREQUERIMIENTO _sector = new BLL.Tables.COMSECTORREQUERIMIENTO();
                _sector.ItemList();
                Entities.Tables.COMSECTORREQUERIMIENTO _itemSeleccion = new Entities.Tables.COMSECTORREQUERIMIENTO();
                //Limpia el combo
                this.comboBoxSector.SuspendLayout();
                this.comboBoxSector.DataSource = null;
                this.comboBoxSector.Items.Clear();

                //Carga el item de Seleccion.-
                _itemSeleccion.DESCRIPCION            = "<Seleccione un Sector>";
                _itemSeleccion.SECTORREQUERIMIENTO_ID = 0;
                _sector.Result.Insert(0, _itemSeleccion);

                //Carga el combo
                this.comboBoxSector.ValueMember   = "SECTORREQUERIMIENTO_ID";
                this.comboBoxSector.DisplayMember = "DESCRIPCION";
                this.comboBoxSector.DataSource    = _sector.Result;
                this.comboBoxSector.SelectedValue = 0;
                this.comboBoxSector.ResumeLayout();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        //FIN PERMISOS

        private void CargarSectores()
        {
            try
            {
                BLL.Tables.COMSECTORREQUERIMIENTO _sector = new BLL.Tables.COMSECTORREQUERIMIENTO();
                _sector.OrderByParameter.Add(DAL.Tables.COMSECTORREQUERIMIENTO.ColumnEnum.Descripcion);
                this.bindingSourceSectores.DataSource = _sector.ItemList();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        private void toolStripButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                Entities.Tables.COMSECTORREQUERIMIENTO _item = new Entities.Tables.COMSECTORREQUERIMIENTO();
                BLL.Tables.COMSECTORREQUERIMIENTO      _tipo = new BLL.Tables.COMSECTORREQUERIMIENTO();

                _item.SECTORREQUERIMIENTO_ID = _idTipo;
                _item.DESCRIPCION            = this.textBoxDescrip.Text.Trim();
                //verifico si la variable es distinta de cero
                if (_idTipo != 0)
                {
                    //ESTOY ACTUALIZANDO UN TIPO
                    if (this.textBoxDescrip.Text.Trim() != string.Empty)
                    {
                        _tipo.Update(_item);
                        _idTipo = 0;
                        this.textBoxDescrip.Text = string.Empty;
                        MessageBox.Show("La Operación se realizó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Debe ingresar una descripción", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.textBoxDescrip.Focus();
                    }
                }
                else
                {
                    //ES UN NUEVO INGRESO
                    if (this.textBoxDescrip.Text.Trim() != string.Empty)
                    {
                        _tipo.Add(_item);
                        _idTipo = 0;
                        this.textBoxDescrip.Text = string.Empty;
                        MessageBox.Show("La Operación se realizó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Debe ingresar una descripción", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.textBoxDescrip.Focus();
                    }
                }
                CargarSectores();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void toolStripButtonRemove_Click(object sender, EventArgs e)
        {
            try
            {
                if (_idTipo > 0 && this.textBoxDescrip.Text != string.Empty)
                {
                    DialogResult _result = MessageBox.Show("Está por eliminar el sector: " + this.textBoxDescrip.Text.Trim() + " desea continaur ?", "Mensaje", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (_result == System.Windows.Forms.DialogResult.OK)
                    {
                        BLL.Tables.COMSECTORREQUERIMIENTO      _elimina = new BLL.Tables.COMSECTORREQUERIMIENTO();
                        Entities.Tables.COMSECTORREQUERIMIENTO _item    = new Entities.Tables.COMSECTORREQUERIMIENTO();
                        _item.SECTORREQUERIMIENTO_ID = _idTipo;
                        _item.DESCRIPCION            = this.textBoxDescrip.Text;

                        _elimina.Remove(_item);
                        MessageBox.Show("La operación se guardó correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }