Ejemplo n.º 1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            newItem = GlobalVars.item;
            GlobalVars.item = null;
            Item item = Database_Functions.GetItem(newItem.Item_ID);
            this.item_name.Text = item.Title;
            this.textBlock_description.Text = item.Description;
            textBlock_total.Text = Database_Functions.GetItemCost(item.ID).ToString("c");
            IList<Transaction> transactions = Database_Functions.GetItemTransactions(item.ID);
            IList<TextBlock> names = new List<TextBlock>();
            IList<TextBlock> amounts = new List<TextBlock>();
            IList<string> names_only = new List<string>();
            IList<Decimal> amounts_only = new List<Decimal>();
            int index = -1;

            foreach (Transaction t in transactions)
            {
                TextBlock name = new TextBlock();
                name.FontSize = 20;
                name.Margin = new Thickness(9, 64, 0, 0);
                name.Text = Database_Functions.GetMember((int)t.MemberID).Name;
                TextBlock amount = new TextBlock();
                amount.FontSize = 28;
                amount.Margin = new Thickness(9, 0, 0, 0);
                amounts_only.Add(t.Amount);
                if (t.Amount < 0)
                    amount.Text = "-" + (t.Amount * -1).ToString("c");
                else
                    amount.Text = t.Amount.ToString("c");
                if (!names_only.Contains(name.Text))
                {
                    names_only.Add(name.Text);
                    names.Add(name);
                    ContentPanel.Children.Add(name);
                    amounts.Add(amount);
                    ContentPanel.Children.Add(amount);
                }
                else
                {
                    index = names_only.IndexOf(name.Text);
                    Decimal temp = amounts_only[index] + t.Amount;
                    if (temp < 0)
                        amounts[index].Text = "-" + (temp * -1).ToString("c");
                    else
                        amounts[index].Text = temp.ToString("c");
                }
            }
        }
Ejemplo n.º 2
0
 private void loadSpecifics(NewItem load)
 {
     Member temp;
     for (int i = 0; i < listPicker.Items.Count; i++)
     {
         TextBlock newBlock = new TextBlock();
         newBlock.FontSize = 24;
         newBlock.Margin = new Thickness(0, 10, 0, 0);
         newBlock.Visibility = Visibility.Collapsed;
         temp = (Member)listPicker.Items[i];
         newBlock.Text = temp.Name;
         //newBlock.Text = load.textBlocks[i].Text;
         textBlocks.Add(newBlock);
         //ToggleSwitch toggle = new ToggleSwitch();
         //toggle.Content = "owe";
         //toggle.Checked += new EventHandler<RoutedEventArgs>(toggle_Checked);
         //toggle.Unchecked += new EventHandler<RoutedEventArgs>(toggle_Unchecked);
         //toggle.IsChecked = load.toggleSwitches[i].IsChecked;
         //toggle.Visibility = Visibility.Collapsed;
         //toggleSwitches.Add(toggle);
         TextBox newBox = new TextBox();
         newBox.Height = 71;
         newBox.Width = 460;
         newBox.Text = "";
         newBox.Margin = new Thickness(-18, -5, 0, 0);
         newBox.Visibility = Visibility.Collapsed;
         newBox.Text = load.textBoxes[i].Text;
         InputScope asdf = new InputScope();
         newBox.InputScope = new InputScope() { Names = { new InputScopeName() { NameValue = InputScopeNameValue.Number } } };
         textBoxes.Add(newBox);
         stackPanel_main.Children.Add(newBlock);
         //stackPanel_main.Children.Add(toggle);
         stackPanel_main.Children.Add(newBox);
     }
 }