public Leiloes_leilao(Licitacoes window, Leilao l, String username, String bidstatus) { InitializeComponent(); licitacoes_window = window; leilao = l; var mainWindow = (MainWindow)Application.Current.MainWindow; ahref = mainWindow.ah; this.username = username; this.bidstatus = bidstatus; initLeilaoCard(l); }
public void Inspect_Button_Click(Leilao insp_leilao) { current_insp_leilao = insp_leilao; init_inspect_fields(); // clean prev error LicitarError.Visibility = Visibility.Collapsed; LicitarSuccess.Visibility = Visibility.Collapsed; // clear value licitar_text.Text = ""; InspectGrid.Visibility = Visibility.Visible; contentGrid.Visibility = Visibility.Collapsed; }
private void add_leilao_confirm(object sender, RoutedEventArgs e) { int days; double value = 0; String desc = ""; String nome = ""; bool res = double.TryParse(TextBox_value.Text, out value); if (TextBox_name.Text.Length < 1) { Name_error_text.Text = "Insira um nome para o Leilão."; // display error NameError.Visibility = Visibility.Collapsed; ValueError.Visibility = Visibility.Collapsed; DescError.Visibility = Visibility.Collapsed; CategError.Visibility = Visibility.Collapsed; DayError.Visibility = Visibility.Collapsed; ImgError.Visibility = Visibility.Collapsed; NameError.Visibility = Visibility.Visible; } else if (TextBox_desc.Text.Length < 1) { Desc_error_text.Text = "Insira uma descrição para o Leilão."; // display error NameError.Visibility = Visibility.Collapsed; ValueError.Visibility = Visibility.Collapsed; DescError.Visibility = Visibility.Collapsed; CategError.Visibility = Visibility.Collapsed; DayError.Visibility = Visibility.Collapsed; ImgError.Visibility = Visibility.Collapsed; DescError.Visibility = Visibility.Visible; } else if (!res) { Value_error_text.Text = "Insira um valor inicial válido para o Leilão."; // display error NameError.Visibility = Visibility.Collapsed; ValueError.Visibility = Visibility.Collapsed; DescError.Visibility = Visibility.Collapsed; CategError.Visibility = Visibility.Collapsed; DayError.Visibility = Visibility.Collapsed; ImgError.Visibility = Visibility.Collapsed; ValueError.Visibility = Visibility.Visible; } else if (((ComboBoxItem)Categoria.SelectedItem) == null) { Categ_error_text.Text = "Insira uma Categoria para o Leilão."; // display error NameError.Visibility = Visibility.Collapsed; ValueError.Visibility = Visibility.Collapsed; DescError.Visibility = Visibility.Collapsed; CategError.Visibility = Visibility.Collapsed; DayError.Visibility = Visibility.Collapsed; ImgError.Visibility = Visibility.Collapsed; CategError.Visibility = Visibility.Visible; } else if (((ComboBoxItem)DayCount.SelectedItem) == null) { Day_error_text.Text = "Insira o número de dias para o Leilão."; // display error NameError.Visibility = Visibility.Collapsed; ValueError.Visibility = Visibility.Collapsed; DescError.Visibility = Visibility.Collapsed; CategError.Visibility = Visibility.Collapsed; DayError.Visibility = Visibility.Collapsed; ImgError.Visibility = Visibility.Collapsed; DayError.Visibility = Visibility.Visible; } else if (img_Path.Text.Length < 1) { Img_error_text.Text = "Insira uma Imagem para o Leilão."; // display error NameError.Visibility = Visibility.Collapsed; ValueError.Visibility = Visibility.Collapsed; DescError.Visibility = Visibility.Collapsed; CategError.Visibility = Visibility.Collapsed; DayError.Visibility = Visibility.Collapsed; ImgError.Visibility = Visibility.Collapsed; ImgError.Visibility = Visibility.Visible; } else { // clean prev error NameError.Visibility = Visibility.Collapsed; ValueError.Visibility = Visibility.Collapsed; DescError.Visibility = Visibility.Collapsed; CategError.Visibility = Visibility.Collapsed; DayError.Visibility = Visibility.Collapsed; ImgError.Visibility = Visibility.Collapsed; nome = TextBox_name.Text; desc = TextBox_desc.Text; TextBox_name.Text = ""; TextBox_desc.Text = ""; TextBox_value.Text = ""; String category = ((ComboBoxItem)Categoria.SelectedItem).Content.ToString(); String[] list = ((ComboBoxItem)DayCount.SelectedItem).Content.ToString().Split(' '); int.TryParse(list[0], out days); Leilao l = l = new Leilao(nome, desc, "Aberto", category, DateTime.Now.AddDays(days), img_Path.Text, false, username, value); ahref.addLeilao(l); SearchGrid.Visibility = Visibility.Visible; AddGrid.Visibility = Visibility.Collapsed; CreationSuccess.Visibility = Visibility.Visible; setLeiloes("", "Todos", "Preço asce."); } }
private void initLeilaoCard(Leilao l) { nome.Text = l.Nome; desc.Text = l.Descricao; estado.Text = l.Estado; lei_owner.Text = l.Owner; if (l.Estado == "Aberto") { estado.Foreground = Brushes.Green; if (bidstatus == null) { status.Visibility = Visibility.Collapsed; } else { if (bidstatus.Equals("leading")) { status.Text = "À frente"; status.Foreground = Brushes.Green; status.Visibility = Visibility.Visible; } else if (bidstatus.Equals("losing")) { status.Text = "Ultrapassado"; status.Foreground = Brushes.Red; status.Visibility = Visibility.Visible; } else { status.Visibility = Visibility.Collapsed; } } } else // Fechado { estado.Foreground = Brushes.PaleVioletRed; } if (l.hasLicitacoes()) { licit.Text = "Ultima licitação:"; licit_text.Text = " " + l.getCurrentValue() + " €"; } else { licit.Text = "Valor inicial:"; licit_text.Text = " " + l.getCurrentValue() + " €"; } String t = l.timeToEnd(); if (t == "") { tempo_text.Text = "0d 00:00:00h " + t; } else { tempo_text.Text = " " + t; } if (l.imgRelative) { img.Source = new BitmapImage(new Uri(l.imgPath, UriKind.Relative)); } else { img.Source = new BitmapImage(new Uri(l.imgPath, UriKind.Absolute)); } }
public String getLastLicitacaoUser(Leilao lei) // retorna o user à frente nas licitações de um leilão { return(lei.Licitacoes.Last().getUser()); }
public void addLeilao(Leilao l) { Leiloes.Add(l); }