コード例 #1
0
        private void Btn_eliminar_eliminar(object sender, RoutedEventArgs e)
        {
            try
            {
                object selectRow = dtg_huespedes.SelectedItem;

                if (selectRow.GetType() == typeof(Huespedes))
                {
                    Huespedes huesped = (Huespedes)selectRow;
                    huespedBusiness.EliminarHuesped(huesped);
                    LimpiarCampos();
                    RefreshDataGrid();
                    lbl_mensaje.Content    = "Huésped eliminado";
                    lbl_mensaje.Foreground = Brushes.Green;
                }
                else
                {
                    lbl_mensaje.Content    = "Debe seleccionar fila para eliminar";
                    lbl_mensaje.Foreground = Brushes.Red;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
コード例 #2
0
        private Huespedes CrearHuesped()
        {
            Huespedes huesped = new Huespedes();

            if (txt_rut_huesped != null && txt_rut_huesped.Text.Count() > 0)
            {
                huesped.RutHuesped      = txt_rut_huesped.Text;
                huesped.NombreHuesped   = txt_nombre.Text;
                huesped.ApellidoHuesped = txt_apellido.Text;
                huesped.Habitacion      = int.Parse(txt_numero_habitacion.Text);
                huesped.OrdenDeCompra   = int.Parse(txt_orden_compra.Text);
                huesped.Cliente         = txt_rut_empresa.Text;
            }
            return(huesped);
        }
コード例 #3
0
        public void RellenaCampos()
        {
            object selectRow = dtg_huespedes.SelectedItem;

            if (selectRow != null)
            {
                if (selectRow.GetType() == typeof(Huespedes))
                {
                    Huespedes huesped = new Huespedes();
                    txt_rut_huesped.Text       = huesped.RutHuesped;
                    txt_nombre_huesped.Text    = huesped.NombreHuesped;
                    txt_apellido_huesped.Text  = huesped.ApellidoHuesped;
                    txt_numero_habitacion.Text = huesped.Habitacion.ToString();
                    txt_orden_compra.Text      = huesped.OrdenDeCompra.ToString();
                    txt_rut_empresa.Text       = huesped.Cliente;
                }
            }
        }