Esempio n. 1
0
        private void CargarItemsRequerimiento(int _index, int _nivelAutorizazion)
        {
            try
            {
                BLL.Procedures.TRAEREQUERIMIENTOITEM _item = new BLL.Procedures.TRAEREQUERIMIENTOITEM();

                this.dataGridViewReqItems.Rows.Clear();
                int indice;
                foreach (Entities.Procedures.TRAEREQUERIMIENTOITEM item in _item.ItemList(dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.CODEMP].Value.ToString(), Convert.ToInt32(dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.REQ_ID].Value), _nivelAutorizazion))
                {
                    indice = dataGridViewReqItems.Rows.Add();
                    dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.CODEMP].Value      = item.codemp;                                //CODIGO EMPRESA
                    dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.CODIGO].Value      = item.articulo_id;                           //ARTICULO
                    dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.NROREQ].Value      = item.requerimiento_id;                      //OC
                    dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.NROITEM].Value     = item.nroitem;                               //NRO ITEM
                    dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.DESCRIPCION].Value = item.art_descgen.ToString();                //DESCRIP ARTICULO
                    dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.UNIDAD].Value      = item.unimed;                                //TRAE UNIMED
                    dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.CANTIDAD].Value    = item.cantidad.ToString().Replace(",", "."); //CANTIDAD
                    dataGridViewReqItems.Rows[indice].Cells[(int)Col_ReqItem.FENTREGA].Value    = item.fechaentrega;                          //FECHA ENTREGA
                }
                REQ_ID  = Convert.ToInt32(dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.REQ_ID].Value);                               // Salvo Orden de compra ID
                _codemp = dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.CODEMP].Value.ToString();                                     // Salvo el CODEMP

                //TRAIGO LAS OBSERVACIOENS EN EL TEXT.. POR SI LA QUIERE MODIFICAR
                this.textBoxObs.Text = dataGridViewReqCab.Rows[_index].Cells[(int)Col_ReqCab.OBSERVACIONES].Value.ToString();

                //TRAIGO ARTICULOS PROVISORIOS SI LOS TIVIERA DE ESTE REQUERIMIENTO
                BLL.Tables.COMARTICULOSPROVISORIOS _provisorios = new BLL.Tables.COMARTICULOSPROVISORIOS();
                indice = 0;
                this.dataGridViewProvisorios.Rows.Clear();
                _provisorios.WhereParameter.Add(DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.codEmp, DAL.SqlEnums.OperandEnum.Equal, _codemp);
                _provisorios.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.requerimiento_id, DAL.SqlEnums.OperandEnum.Equal, REQ_ID);
                _provisorios.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.pendienteEnBejerman, DAL.SqlEnums.OperandEnum.Equal, 1);

                foreach (Entities.Tables.COMARTICULOSPROVISORIOS itemprov in _provisorios.Items())
                {
                    indice = dataGridViewProvisorios.Rows.Add();
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.DESCRIPCION].Value   = itemprov.DESCRIPCION;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.PRESENTACION].Value  = itemprov.PRESENTACION;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.UNIDAD].Value        = itemprov.UNIMED;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.MARCA].Value         = itemprov.MARCA;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.EMBALAJE].Value      = itemprov.EMBALAJE;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.CANTIDAD].Value      = itemprov.CANTIDAD;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.ID].Value            = itemprov.ID;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.CODPROVISORIO].Value = itemprov.CODPROVISORIO;
                    NroProvisorio = itemprov.CODPROVISORIO; //GUARDO ESTE NUMERO PARA HACR MODIFICACIONES EN ESA TABLA
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.CODEMP].Value              = itemprov.CODEMP;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.REQUERIMIENTO_ID].Value    = itemprov.REQUERIMIENTO_ID;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.NROITEM].Value             = itemprov.NROITEM;
                    dataGridViewProvisorios.Rows[indice].Cells[(int)col_Provisorios.PENDIENTEENBEJERMAN].Value = itemprov.PENDIENTEENBEJERMAN;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                var senderGrid = (DataGridView)sender;

                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                    e.RowIndex >= 0)
                {
                    //Enviar Mail
                    Entities.Tables.COMARTICULOSPROVISORIOS _item = new Entities.Tables.COMARTICULOSPROVISORIOS();
                    BLL.Tables.COMARTICULOSPROVISORIOS      _Actu = new BLL.Tables.COMARTICULOSPROVISORIOS();

                    _item.ID                  = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.ID].Value);
                    _item.CODPROVISORIO       = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.CODPROVISORIO].Value);
                    _item.CODEMP              = dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.CODEMP].Value.ToString();
                    _item.REQUERIMIENTO_ID    = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.REQUERIMIENTO_ID].Value);
                    _item.NROITEM             = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.NROITEM].Value);
                    _item.PENDIENTEENBEJERMAN = 0;
                    _item.DESCRIPCION         = dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.DESCRIPCION].Value.ToString();
                    _item.PRESENTACION        = dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.PRESENTACION].Value.ToString();
                    _item.UNIMED              = dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.UNIMED].Value.ToString();
                    _item.MARCA               = dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.MARCA].Value.ToString();
                    _item.EMBALAJE            = dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.EMBALAJE].Value.ToString();
                    _item.CANTIDAD            = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.CANTIDAD].Value);
                    _item.USUARIO_ID          = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.USUARIO_ID].Value);
                    if (_item.USUARIO_MAIL == null)
                    {
                        _item.USUARIO_MAIL = "";
                    }
                    else
                    {
                        _item.USUARIO_MAIL = dataGridView1.Rows[e.RowIndex].Cells[(int)Col_Articulos.EMAIL].Value.ToString();
                    }


                    _Actu.UpdateItem(_item);

                    string _codEmp = this.comboBoxEmpresa.SelectedValue.ToString();
                    TraerArticulosProvisorios(_codEmp);

                    _articulosBejerman.Clear();
                    CargarArticulosBejerman(_codEmp);
                }
            }

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

        private void TraerArticulosProvisorios(string _codEmp)
        {
            try
            {
                BLL.Tables.COMARTICULOSPROVISORIOS _provisorio = new BLL.Tables.COMARTICULOSPROVISORIOS();
                _provisorio.WhereParameter.Add(DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.codEmp, DAL.SqlEnums.OperandEnum.Equal, _codEmp);
                _provisorio.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.pendienteEnBejerman, DAL.SqlEnums.OperandEnum.Equal, 1);
                _provisorio.OrderByParameter.Add(DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.requerimiento_id);

                this.bindingSourceArt.DataSource = _provisorio.Items();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
        private void dataGridViewReqCab_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                BLL.Procedures.TRAEREQUERIMIENTOITEM _item = new BLL.Procedures.TRAEREQUERIMIENTOITEM();

                this.dataGridViewReqItem.Rows.Clear();
                int    indice;
                int    _requerimiento_id = Convert.ToInt32(dataGridViewReqCab.Rows[e.RowIndex].Cells[(int)Col_RequerimientoCab.NRO_REQUERIMIENTO].Value);
                string _codEmpresa       = dataGridViewReqCab.Rows[e.RowIndex].Cells[(int)Col_RequerimientoCab.CODEMP].Value.ToString();
                //ANTES DE TRAER LOS ITEMS VERIFICO SI ESTE REQUERIMIENTO TIENE ARTICULOS PROVISORIOS
                BLL.Tables.COMARTICULOSPROVISORIOS _provisorio = new BLL.Tables.COMARTICULOSPROVISORIOS();
                _provisorio.WhereParameter.Add(DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.requerimiento_id, DAL.SqlEnums.OperandEnum.Equal, _requerimiento_id);
                _provisorio.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.codEmp, DAL.SqlEnums.OperandEnum.Equal, _codEmpresa);
                _provisorio.WhereParameter.Add(DAL.SqlEnums.ConjunctionEnum.AND, DAL.Tables.COMARTICULOSPROVISORIOS.ColumnEnum.pendienteEnBejerman, DAL.SqlEnums.OperandEnum.Equal, 1);
                if (_provisorio.Items().Count > 0)
                {
                    MessageBox.Show("Este requerimiento tiene artículos provisorios, antes de autorizarlo debe asignar los códigos de Bejerman", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else
                {
                    foreach (Entities.Procedures.TRAEREQUERIMIENTOITEM item in _item.ItemList(_codEmpresa, _requerimiento_id, 1))
                    {
                        indice = dataGridViewReqItem.Rows.Add();
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.CODEMPRESA].Value        = item.codemp.ToString();                     //DESCRIPCION DEL ARTICULO
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.ARTICULO].Value          = item.art_descgen;                           //DESCRIPCION DEL ARTICULO
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.NRO_REQUERIMIENTO].Value = item.requerimiento_id;                      //DESCRIPCION DEL ARTICULO
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.ARTICULO_ID].Value       = item.articulo_id;                           //ID DEL ARTICULO
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.CANTIDAD].Value          = item.cantidad.ToString().Replace(",", "."); //TRAE CANTIDAD
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.FECHA_DE_ENTREGA].Value  = item.fechaentrega.ToShortDateString();      //FECHA DE ENTREGA
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.UNIDAD_DE_MEDIDA].Value  = item.unimed;                                //TRAE UNIMED
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.MARCA].Value             = item.Marca;                                 //MARCA
                        dataGridViewReqItem.Rows[indice].Cells[(int)Col_RequerimientoItem.NRO_ITEM].Value          = item.nroitem;                               //TRAE NRO ITEM
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }