Esempio n. 1
0
        protected void btnGrabar_Click(object sender, EventArgs e)
        {
            int itemsCheckeados = 0;
            List <DocumentoPagoTallerDTO> _listDocPagoTaller = new List <DocumentoPagoTallerDTO>();

            //Recorrer el grid y poblar DTO DocumentoPagoTaller con los items chekeados
            foreach (GridViewRow item in gridDetalleAsignaciones.Rows)
            {
                bool check = ((CheckBox)item.FindControl("chkSeleccionar")).Checked;
                if (check)
                {
                    itemsCheckeados++;
                    //Buscar Detalle/Procesos de Asignacion Agrupada
                    DataTable dtDetalle = _asignacionOrdenesBll.ListarDetalleProcesoAsignacionOrdenes(hidCodProveedor.Value,
                                                                                                      item.Cells[2].Text, item.Cells[3].Text,
                                                                                                      int.Parse(item.Cells[4].Text),
                                                                                                      int.Parse(item.Cells[5].Text));

                    foreach (DataRow row in dtDetalle.Rows)
                    {
                        DocumentoPagoTallerDTO _docTaller = new DocumentoPagoTallerDTO()
                        {
                            CodProveedor   = row["Cod_Proveedor"].ToString(),
                            TipoDocumento  = ddlTipoDocs.SelectedValue,
                            SerieDocumento = 0,
                            //NroDocumento -> NroLiquidacion (generado en BLL)
                            CategoriaOperacion = int.Parse(row["Categoria_Operacion"].ToString()),
                            NumOrdenAsignacion = row["Numero_Orden"].ToString(),
                            Orden                   = row["Orden"].ToString(),
                            Lote                    = int.Parse(row["Lote"].ToString()),
                            Categoria               = int.Parse(row["Categoria"].ToString()),
                            CodProceso              = int.Parse(row["Proceso"].ToString()),
                            MontoFacturacionSoles   = double.Parse(row["Costo_Soles"].ToString()),
                            MontoFacturacionDolares = double.Parse(row["Costo_Dolares"].ToString())
                        };
                        _listDocPagoTaller.Add(_docTaller);
                    }
                }
            }

            if (itemsCheckeados > 0)
            {
                //Ingresar DocumentoPagoTaller
                int nroLiquidacion = _docPagoTallerBll.IngresarDocumentoPagoTaller(_listDocPagoTaller, ddlMoneda.SelectedValue, usuarioActual);
                Session["NroLiquidacion"] = nroLiquidacion;
                Response.Redirect("GeneracionDocumento.aspx");
            }
            else
            {
                lblMensajeError.Visible = true;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Ejecuta una consulta de actualización de Número de Orden2 en la tabla Asignacion_de_ordenes_det.
        /// </summary>
        /// <param name="_docPagoTaller">Objeto de DocumentoPagoTallerDTO</param>
        /// <returns>Variable de tipo int con la cantidad de registros actualizados.</returns>
        public int UpdateNumeroOrden2AsignacionOrdenes(DocumentoPagoTallerDTO _docPagoTaller)
        {
            List <SqlParameter> _sqlParam = new List <SqlParameter>();
            string query = @"
                update Asignacion_de_ordenes_det 
	                set Numero_Orden_2 = @numdocumento 
                where 
	                Cod_Proveedor = @codproveedor 
	                and Numero_Orden = @numorden 
	                and Orden = @orden 
	                and Lote = @lote 
	                and Categoria = @categoria 
	                and Proceso = @proceso"    ;

            _sqlParam.Add(new SqlParameter("@codproveedor", SqlDbType.VarChar)
            {
                Value = _docPagoTaller.CodProveedor
            });
            _sqlParam.Add(new SqlParameter("@numorden", SqlDbType.Float)
            {
                Value = _docPagoTaller.NumOrdenAsignacion
            });
            _sqlParam.Add(new SqlParameter("@orden", SqlDbType.VarChar)
            {
                Value = _docPagoTaller.Orden
            });
            _sqlParam.Add(new SqlParameter("@lote", SqlDbType.Int)
            {
                Value = _docPagoTaller.Lote
            });
            _sqlParam.Add(new SqlParameter("@categoria", SqlDbType.Int)
            {
                Value = _docPagoTaller.Categoria
            });
            _sqlParam.Add(new SqlParameter("@proceso", SqlDbType.Int)
            {
                Value = _docPagoTaller.CodProceso
            });
            _sqlParam.Add(new SqlParameter("@numdocumento", SqlDbType.Int)
            {
                Value = _docPagoTaller.NroDocumento
            });
            return(_trans.ExecuteQuery(query, _sqlParam));
        }
Esempio n. 3
0
        /// <summary>
        /// Ejecuta una consulta de inserción a la tabla Doc_pago_taller_asig.
        /// </summary>
        /// <param name="_docPagoTaller">Objeto de tipo DocumentoPagoTallerDTO</param>
        /// <returns>Variable de tipo int con la cantidad de registros ingresados.</returns>
        public int InsertDocumentoPagoTaller(DocumentoPagoTallerDTO _docPagoTaller)
        {
            List <SqlParameter> _sqlParam = new List <SqlParameter>();

            string query = @"
                insert into Doc_pago_taller_asig(
	                cod_proveedor, 
	                tipo_movimiento, 
	                serie_documento, 
	                nro_documento, 
	                Cod_Cat_Oper, 
	                Nro_Ord_Asig, 
	                Orden, 
                    Lote, 
	                Categoria, 
	                Cod_Proceso
                ) values(
	                @codproveedor, @tipomov, @seriedoc, @nrodoc, @codcatoper, 
                    @nroorden, @orden, @lote, @categoria, @codproceso )";

            _sqlParam.Add(new SqlParameter("@codproveedor", SqlDbType.VarChar)
            {
                Value = _docPagoTaller.CodProveedor
            });
            _sqlParam.Add(new SqlParameter("@tipomov", SqlDbType.VarChar)
            {
                Value = _docPagoTaller.TipoDocumento
            });
            _sqlParam.Add(new SqlParameter("@seriedoc", SqlDbType.Int)
            {
                Value = _docPagoTaller.SerieDocumento
            });
            _sqlParam.Add(new SqlParameter("@nrodoc", SqlDbType.Int)
            {
                Value = _docPagoTaller.NroDocumento
            });
            _sqlParam.Add(new SqlParameter("@codcatoper", SqlDbType.Int)
            {
                Value = _docPagoTaller.CategoriaOperacion
            });
            _sqlParam.Add(new SqlParameter("@nroorden", SqlDbType.Float)
            {
                Value = _docPagoTaller.NumOrdenAsignacion
            });
            _sqlParam.Add(new SqlParameter("@orden", SqlDbType.VarChar)
            {
                Value = _docPagoTaller.Orden
            });
            _sqlParam.Add(new SqlParameter("@lote", SqlDbType.Int)
            {
                Value = _docPagoTaller.Lote
            });
            _sqlParam.Add(new SqlParameter("@categoria", SqlDbType.Int)
            {
                Value = _docPagoTaller.Categoria
            });
            _sqlParam.Add(new SqlParameter("@codproceso", SqlDbType.Int)
            {
                Value = _docPagoTaller.CodProceso
            });
            return(_trans.ExecuteQuery(query, _sqlParam));
        }