Example #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            ComensalBR oBR = new ComensalBR();

            if (dgv.RowCount > 0)
            {
                int oid = new int();

                if (dgv.RowCount > 1)
                {
                    oid = int.Parse(dgv.Rows[dgv.SelectedRows[0].Index].Cells[0].Value.ToString());
                }
                else
                {
                    oid = int.Parse(dgv.Rows[0].Cells[0].Value.ToString());
                }

                oBR.Eliminar(oid);

                CargarDGV();

                MessageBox.Show("Comensal Eliminado");
            }

            else
            {
                MessageBox.Show("Debe Seleccionar un Comensal");
            }
        }
Example #2
0
        public void CargarDGV()
        {
            ComensalBR oComensalBR = new ComensalBR();

            dt                     = oComensalBR.ObtenerListado();
            dgv.DataSource         = dt;
            dgv.Columns[0].Visible = false;
        }
        private void btnCargarExcel_Click_1(object sender, EventArgs e)
        {
            ComensalBR oComensalBR = new ComensalBR();

            int oid_proy = Global.oid_proy;

            DataRowView rvClie = cboCliente.SelectedItem as DataRowView;

            int oid_clie = Int32.Parse(rvClie["Codigo"].ToString());

            DataRowView rvCome = cboComedor.SelectedItem as DataRowView;

            int oid_come = Int32.Parse(rvCome["Codigo"].ToString());

            oComensalBR.CargarDesdeExcel(txtArchivoExcel.Text, oid_clie, oid_proy, oid_come);

            MessageBox.Show("Archivo Excel Cargado con Exito");
        }
Example #4
0
        private void txtNumeroIdentificacionComedor_Leave(object sender, EventArgs e)
        {
            ComensalBR oBR = new ComensalBR();

            int ind_exis;

            ind_exis = oBR.ValidarIdentificacionComedor(txtNumeroIdentificacionComedor.Text);

            if (ind_exis > 0)
            {
                MessageBox.Show("El numero de identificacion en comedor ya existe");
                //txtNumeroIdentificacionComedor.BackColor = Color.White;
                txtNumeroIdentificacionComedor.Text = String.Empty;
                txtNumeroIdentificacionComedor.Focus();
            }
            else
            {
                txtNumeroIdentificacionComedor.BackColor = Color.White;
            }
        }
Example #5
0
        private void txtIdentificacion_KeyDown(object sender, KeyEventArgs e)
        {
            if (txtIdentificacion.Text == String.Empty)
            {
            }
            else
            {
                if (e.KeyCode == Keys.Enter)
                {
                    ComensalBR oBR = new ComensalBR();
                    string     nombre;
                    string     num_iden_come;
                    num_iden_come = txtIdentificacion.Text;

                    //MessageBox.Show(num_iden_come);
                    //MessageBox.Show(come_oid_come.ToString());

                    nombre = oBR.ObtenerNombreByIdentificador(num_iden_come, come_oid_come);

                    if (nombre != "NE")
                    {
                        txtNombre.Text = nombre;

                        int oid_come_clie;

                        oid_come_clie = oBR.ObtenerOidByIdentificador(num_iden_come, come_oid_come);

                        TurnoDetalleBE oBETurnoDetalle = new TurnoDetalleBE();
                        TurnoDetalleBR oBRTurnoDetalle = new TurnoDetalleBR();

                        // Validando si ya ingreso al comedor
                        oBETurnoDetalle.turn_oid_turn = oid_turn;
                        oBETurnoDetalle.oid_come_clie = oid_come_clie;
                        oBETurnoDetalle.ind_tipo_entr = "A";

                        int ind_vali_come = 0;

                        ind_vali_come = oBRTurnoDetalle.ValidarComensal(oid_turn, oid_come_clie);

                        if (ind_vali_come == 0)
                        {
                            oBRTurnoDetalle.Insertar(oBETurnoDetalle);
                            CargarDGV();

                            ImprimirTicket(txtComedor.Text, txtTipoServicio.Text, dtpFecha.Value.Date.ToString("dd/MM/yyyy"), num_iden_come);

                            //AutoClosingMessageBox oAutoClosingMessageBox = new AutoClosingMessageBox("Ingreso Autorizado", "Acceso Comedor", 2000);

                            txtIdentificacion.Text = "";
                            txtNombre.ForeColor    = Color.Blue;
                            txtNombre.Text         = "INGRESO CORRECTO";
                            txtIdentificacion.Focus();
                        }
                        else
                        {
                            AutoClosingMessageBox oAutoClosingMessageBox = new AutoClosingMessageBox("Usuario Ya Fue Registrado en el Comedor", "Acceso Comedor", 2000);

                            txtIdentificacion.Text = "";
                            txtNombre.ForeColor    = Color.Red;
                            txtNombre.Text         = "USUARIO YA INGRESO AL COMEDOR";
                            txtIdentificacion.Focus();
                        }
                    }
                    else
                    {
                        AutoClosingMessageBox oAutoClosingMessageBox = new AutoClosingMessageBox("Ingreso No Autorizado", "Acceso Comedor", 3000);

                        txtIdentificacion.Text = "";
                        txtNombre.ForeColor    = Color.Red;
                        txtNombre.Text         = "INGRESO NO AUTORIZADO";
                        txtIdentificacion.Focus();
                    }
                }
            }
        }
Example #6
0
        /*
         * public FrmComensalAdd(FrmComensal p_oFrm): this()
         * {
         *  this.oFrm = p_oFrm;
         *  txtOid.Visible = false;
         *
         *  txtOid.ReadOnly = false;
         *  txtDenoSoci.ReadOnly = false;
         *
         *  this.mod = "C";
         * }
         */

        public FrmComensalAdd(FrmComensal p_oFrm, int p_oid, string mod)
            : this()
        {
            this.oFrm = p_oFrm;
            this.oid  = p_oid;
            this.mod  = mod;

            CHelper oCHelper = new CHelper();

            oCHelper.FormatearFormularioMantenimientoAdd(this);

            txtProyecto.Text = Global.des_proy;

            ClienteBR oBRCliente = new ClienteBR();

            DataTable dt = new DataTable();

            dt = oBRCliente.ObtenerListadoPorProyecto(Global.oid_proy);
            cboCliente.DataSource    = dt;
            cboCliente.DisplayMember = "Descripcion";

            TipoDocumentoIdentidadBR oBRTipo = new TipoDocumentoIdentidadBR();

            dt = oBRTipo.ObtenerListado();
            cboTipoDocuIden.DataSource    = dt;
            cboTipoDocuIden.DisplayMember = "Descripcion";

            ComensalBR oBRComensal = new ComensalBR();

            dt = oBRComensal.ObtenerComedoresAtencion(p_oid);
            //dgvComedoresAtencion.DataSource = dt;

            int i = 0;

            foreach (DataRow dr in dt.Rows)
            {
                DataGridViewRow rowDGV = (DataGridViewRow)dgvComedoresAtencion.Rows[0].Clone();
                rowDGV.Cells[0].Value = dr.Field <int>(0);
                rowDGV.Cells[1].Value = dr.Field <string>(1);
                dgvComedoresAtencion.Rows.Add(rowDGV);
                i = 1 + 1;
            }

            switch (this.mod)
            {
            case "C":

                txtOid.Visible = true;

                txtOid.ReadOnly         = true;
                txtDescripcion.ReadOnly = false;
                txtNumeroIdentificacionComedor.ReadOnly = false;
                txtCargo.ReadOnly = false;
                break;

            case "U":

                txtOid.Visible = true;

                txtOid.ReadOnly         = true;
                txtDescripcion.ReadOnly = false;

                ComensalBE oBE = new ComensalBE();
                ComensalBR oBR = new ComensalBR();

                oBE = oBR.obtenerComensalByOid(oid);

                txtOid.Text = oBE.oid_come.ToString();

                TipoDocumentoIdentidadBE oBETipoDocumento = new TipoDocumentoIdentidadBE();
                TipoDocumentoIdentidadBR oBRTipoDocumento = new TipoDocumentoIdentidadBR();

                oBETipoDocumento = oBRTipoDocumento.obtenerTipoDocumentoIdentidadByCod(oBE.tipo_cod_tipo_docu_iden);
                cboTipoDocuIden.SelectedIndex = cboTipoDocuIden.FindStringExact(oBETipoDocumento.val_desc);

                txtNumeroIdentificacionComedor.Text = oBE.num_iden_come;
                txtDescripcion.Text = oBE.val_desc;
                txtNumDocuIden.Text = oBE.val_num_docu_iden;
                txtCargo.Text       = oBE.val_carg;
                txtTipoCargo.Text   = oBE.val_tipo_carg;

                break;


            case "R":

                txtOid.Visible = true;

                txtOid.ReadOnly         = true;
                txtDescripcion.ReadOnly = true;
                break;
            }
        }
Example #7
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            ComensalBE oBE = new ComensalBE();
            ComensalBR oBR = new ComensalBR();

            ComensalComedorBE oComeBE = new ComensalComedorBE();
            ComensalComedorBR oComeBR = new ComensalComedorBR();

            int oid_come_clie;

            /*
             * oBE.num_iden_come = txtNumeroIdentificacionComedor.Text;
             * oBE.val_num_docu_iden = txtNumDocuIden.Text;
             *
             * if (this.mod == "C") {
             *
             * }
             *
             */

            oBE.num_iden_come     = txtNumeroIdentificacionComedor.Text;
            oBE.val_num_docu_iden = txtNumDocuIden.Text;

            oBE.val_desc      = txtDescripcion.Text;
            oBE.val_carg      = txtCargo.Text;
            oBE.val_tipo_carg = txtTipoCargo.Text;

            DataRowView rv = cboTipoDocuIden.SelectedItem as DataRowView;

            oBE.tipo_cod_tipo_docu_iden = rv["Codigo"].ToString();

            DataRowView rvClie = cboCliente.SelectedItem as DataRowView;

            oBE.clie_oid_clie = Int32.Parse(rvClie["Codigo"].ToString());

            oBE.proy_oid_proy = Global.oid_proy;

            if (mod == "C")
            {
                oBR.Insertar(oBE);
            }
            else
            {
                oBE.oid_come = Int32.Parse(txtOid.Text);
                oBR.Actualizar(oBE);
            }

            oid_come_clie = oBR.ObtenerOidByDocumentoIdentidad(oBE.val_num_docu_iden);

            foreach (DataGridViewRow row in dgvComedoresAtencion.Rows)
            {
                if (row.Cells[0].Value != null)
                {
                    oComeBE.oid_come_aten = Int32.Parse(row.Cells[0].Value.ToString());
                    oComeBE.oid_come_clie = oid_come_clie;
                    oComeBE.clie_oid_clie = oBE.clie_oid_clie;
                    oComeBE.proy_oid_proy = oBE.proy_oid_proy;

                    oComeBR.Insertar(oComeBE);
                }
            }

            oFrm.CargarDGV();

            this.Close();
        }