示例#1
0
        public List <ServicioExtraBE> BuscarServioExtraPorIdReserva(int idReserva)
        {
            using (OracleCommand oOracleCommand = new OracleCommand("PKG_SERVICIOS_EXTRA.SP_LISTAR_SERVI_EXTRA_POR_RES", conn))
            {
                try
                {
                    oOracleCommand.CommandType    = CommandType.StoredProcedure;
                    oOracleCommand.CommandTimeout = 10;
                    oOracleCommand.Parameters.Add(new OracleParameter("PN_RESERVA_ID", idReserva));
                    OracleParameter oParam = new OracleParameter("CUR_SERVI_EXTRA", OracleDbType.RefCursor);
                    oParam.Direction = ParameterDirection.Output;
                    oParam.Size      = 128;

                    oOracleCommand.Parameters.Add(oParam);


                    DataTable oDataTable = new DataTable();
                    conn.Open();
                    oDataTable.Load(oOracleCommand.ExecuteReader());
                    conn.Close();
                    listServicioExtra = new List <ServicioExtraBE>();
                    foreach (DataRow item in oDataTable.Rows)
                    {
                        oServicioExtra                       = new ServicioExtraBE();
                        oServicioExtra.IdServicio            = int.Parse(item[0].ToString());
                        oServicioExtra.DescripcionServicio   = item[1].ToString();
                        oServicioExtra.ValorServicio         = int.Parse(item[2].ToString());
                        oServicioExtra.CantidadPersonas      = int.Parse(item[3].ToString());
                        oServicioExtra.ValorTotalServicio    = int.Parse(item[4].ToString());
                        oServicioExtra.Propiedad.IdPropiedad = int.Parse(item[5].ToString());
                        oServicioExtra.EstadoServicio        = BuscarEstadoServioId(int.Parse(item[6].ToString()));
                        listServicioExtra.Add(oServicioExtra);
                    }
                    return(listServicioExtra);
                }
                catch (Exception ex)
                {
                    return(null);
                }
                finally
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
        }
示例#2
0
        private void GvServicioExtra_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            try
            {
                listServicioExtra = new List <ServicioExtraBE>();

                //reservaTemp = (ReservaBE)((DataGrid)sender).CurrentItem;
                oServicioExtra = new ServicioExtraBE();
                oServicioExtra = (ServicioExtraBE)((DataGrid)sender).CurrentItem;
                foreach (ServicioExtraBE item in ((List <ServicioExtraBE>)((DataGrid)sender).ItemsSource).ToList())
                {
                    ServicioExtraBE oServicio = new ServicioExtraBE();
                    oServicio = item;
                    if (item.IdServicio.Equals(oServicioExtra.IdServicio))
                    {
                        oServicio.IsSelected    = true;
                        txtValor.Text           = oServicio.ValorServicio.ToString();
                        txtCantidadPersona.Text = oServicio.CantidadPersonas.ToString();
                        txtValorTotal.Text      = oServicio.ValorTotalServicio.ToString();
                        txtEstado.Text          = oServicio.EstadoServicio.NombreEstadoServicio;
                        txtDescripcion.Text     = oServicio.DescripcionServicio;
                    }
                    else
                    {
                        oServicio.IsSelected = false;
                    }
                    listServicioExtra.Add(oServicio);
                }



                ((DataGrid)sender).ItemsSource = listServicioExtra;
            }
            catch (Exception)
            {
            }
        }