Ejemplo n.º 1
0
        public static PivotItem getPivot(TB_CONTA account)
        {
            double size = 230;
            PivotItem temp = new PivotItem { Header = account.CTA_NOME };
            Grid grid = new Grid();
            StackPanel panel = new StackPanel();
            ListBox transBox = new ListBox();

            Button accVal = new Button() { Content = "$999.99", Height = 128, Width = size * 2 };
            Button credit = new Button() { Content = "+", Height = size, Width = size };
            Button debit = new Button() { Content = "-", Height = size, Width = size };
            StackPanel bts = new StackPanel() { Orientation = Orientation.Horizontal };

            List<String> source = new List<String>();
            source.Add("Item 1");
            source.Add("Item 2");
            source.Add("Item 3");
            source.Add("Item 4");
            source.Add("Item 5");
            source.Add("Item 6");
            source.Add("Item 12");
            source.Add("Item 13");
            source.Add("Item 14");
            source.Add("Item 15");
            source.Add("Item 16");
            source.Add("Item 17");
            source.Add("Item 18");
            source.Add("Item 19");
            source.Add("Item 20");

            ListBox box = new ListBox();
            box.ItemsSource = source;
            box.Height = 200;

            bts.Children.Add(credit);
            bts.Children.Add(debit);

            panel.Children.Add(accVal);
            panel.Children.Add(bts);
            panel.Children.Add(box);

            temp.Content = panel;
            return temp;
        } 
Ejemplo n.º 2
0
        public void SampleData()
        {
            string connection = App.Connection;
            using (var ctx = new ControleDeGastosDataContext(App.Connection))
            {
                TB_TIPO_CONTA novoTipoConta = new TB_TIPO_CONTA()
                {
                    TPC_NOME = "Banco",
                    TPC_FLAG_ATIVA = true
                };
                ctx.TB_TIPO_CONTAs.InsertOnSubmit(novoTipoConta);

                novoTipoConta = new TB_TIPO_CONTA()
                {
                    TPC_NOME = "Investimento",
                    TPC_FLAG_ATIVA = true
                };
                ctx.TB_TIPO_CONTAs.InsertOnSubmit(novoTipoConta);

                novoTipoConta = new TB_TIPO_CONTA()
                {
                    TPC_NOME = "Dinheiro",
                    TPC_FLAG_ATIVA = true
                };
                ctx.TB_TIPO_CONTAs.InsertOnSubmit(novoTipoConta);

                ctx.SubmitChanges();

                TB_MOEDA novaMoeda = new TB_MOEDA()
                {
                    MOE_NOME = "Real Brasil",
                    MOE_SIGLA = "R$",
                    MOE_COTACAO = 0,
                    MOE_PADRAO = true,
                    MOE_FLAG_ATIVA = true
                };
                ctx.TB_MOEDAs.InsertOnSubmit(novaMoeda);

                novaMoeda = new TB_MOEDA()
                {
                    MOE_NOME = "Dólar",
                    MOE_SIGLA = "$",
                    MOE_COTACAO = 0,
                    MOE_PADRAO = false,
                    MOE_FLAG_ATIVA = true
                };
                ctx.TB_MOEDAs.InsertOnSubmit(novaMoeda);

                ctx.SubmitChanges();

                TB_BENEFICIARIO novoBeneficiario = new TB_BENEFICIARIO()
                {
                    BNF_NOME = "Wagner Sommer",
                    BNF_OBSERVACAO = "Pai",
                    BNF_FLAG_ATIVA = true
                };
                ctx.TB_BENEFICIARIOs.InsertOnSubmit(novoBeneficiario);

                novoBeneficiario = new TB_BENEFICIARIO()
                {
                    BNF_NOME = "Margarete Sommer",
                    BNF_OBSERVACAO = "Mãe",
                    BNF_FLAG_ATIVA = true
                };
                ctx.TB_BENEFICIARIOs.InsertOnSubmit(novoBeneficiario);

                ctx.SubmitChanges();

                TB_CONTA novaConta = new TB_CONTA()
                {
                    CTA_NOME = "Pessoa Fisica",
                    TPC_ID = 1,
                    CTA_DT_INICIO = System.DateTime.Today,
                    CTA_DT_FIM = Convert.ToDateTime(System.DateTime.MaxValue.ToString()),
                    CTA_VALOR_INICIAL = 0,
                    MOE_ID = 1,
                    CTA_ENCERRADA = false,
                    CTA_FLAG_ATIVA = true
                };
                ctx.TB_CONTAS.InsertOnSubmit(novaConta);

                novaConta = new TB_CONTA()
                {
                    CTA_NOME = "Pessoa Juridica",
                    TPC_ID = 1,
                    CTA_DT_INICIO = System.DateTime.Today,
                    CTA_DT_FIM = Convert.ToDateTime(System.DateTime.MaxValue.ToString()),
                    CTA_VALOR_INICIAL = 0,
                    MOE_ID = 1,
                    CTA_ENCERRADA = false,
                    CTA_FLAG_ATIVA = true
                };
                ctx.TB_CONTAS.InsertOnSubmit(novaConta);

                novaConta = new TB_CONTA()
                {
                    CTA_NOME = "Acoes",
                    TPC_ID = 2,
                    CTA_DT_INICIO = System.DateTime.Today,
                    CTA_DT_FIM = Convert.ToDateTime(System.DateTime.MaxValue.ToString()),
                    CTA_VALOR_INICIAL = 0,
                    MOE_ID = 1,
                    CTA_ENCERRADA = false,
                    CTA_FLAG_ATIVA = true
                };
                ctx.TB_CONTAS.InsertOnSubmit(novaConta);

                ctx.SubmitChanges();

                TB_CATEGORIA novaCategoria = new TB_CATEGORIA()
                {
                    CAT_NOME = "Automovel",
                    CAT_PAI_ID = 1,
                    CAT_TIPO = "1",
                    CAT_FLAG_ATIVA = true,
                    CAT_OBSERVACAO = ""
                };
                ctx.TB_CATEGORIAs.InsertOnSubmit(novaCategoria);

                ctx.SubmitChanges();

                TB_ORCAMENTO novoOrcamento = new TB_ORCAMENTO()
                {
                    ORC_NOME = "Carro",
                    ORC_TIPO = 1,
                    MOE_ID = 1,
                    CAT_ID = 1,
                    ORC_VALOR = 100,
                    ORC_FLAG_ATIVA = true,
                    ORC_OBSERVACAO = "Mensal",
                    ORC_SUBCATEGORIA = false
                };
                ctx.TB_ORCAMENTOs.InsertOnSubmit(novoOrcamento);

                novoOrcamento = new TB_ORCAMENTO()
                {
                    ORC_NOME = "Casa",
                    ORC_TIPO = 2,
                    MOE_ID = 1,
                    CAT_ID = 1,
                    ORC_VALOR = 500,
                    ORC_FLAG_ATIVA = true,
                    ORC_OBSERVACAO = "Trimestral",
                    ORC_SUBCATEGORIA = false
                };
                ctx.TB_ORCAMENTOs.InsertOnSubmit(novoOrcamento);

                ctx.SubmitChanges();


            }
        }
 public void deleteAccount(TB_CONTA account)
 {
     using (var ctx = new ControleDeGastosDataContext(App.Connection))
     {
         // find a city to delete
         IQueryable<TB_CONTA> accountQuery = from c in ctx.TB_CONTAS where c.CTA_NOME == account.CTA_NOME select c;
         TB_CONTA accountToDelete = accountQuery.FirstOrDefault();
         // delete city from the context
         ctx.TB_CONTAS.DeleteOnSubmit(accountToDelete);
         // save changes to the database
         ctx.SubmitChanges();
     }
 }
Ejemplo n.º 4
0
        void makePivot(TB_CONTA account)
        {
            if (account.CTA_FLAG_ATIVA == true)
            {

                PivotItem newPivot = new PivotItem()
                {
                    Header = account.CTA_NOME
                };

                //O pivot prescisa de um container para adicionar elements
                Grid pivotContent = new Grid()
                {
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Top,
                    Height = 572,
                    Width = 432
                };

                Button amount = new Button()
                {
                    Content = account.CTA_VALOR_INICIAL,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Top,
                    Width = 416,
                    Height = 82,
                    Margin = new Thickness(8, 0, 0, 0),
                };
                amount.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(onTap_Top);

                Button credit = new Button()
                {
                    Content = "+",
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Top,
                    Width = 214,
                    Height = 98,
                    Margin = new Thickness(8, 86, 0, 0)
                };
                credit.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(onTapCredit);


                Button debit = new Button()
                {
                    Content = "-",
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment = VerticalAlignment.Top,
                    Width = 214,
                    Height = 98,
                    Margin = new Thickness(210, 86, 0, 0)

                };

                //As Transacoes prescisam de um container
                StackPanel transactionHolder = new StackPanel()
                {
                    Margin = new Thickness(10)
                };

                //Faz com que o container das transacoes possa
                //ser scrollable (rolado)... xD
                //Esse meu portugues ta uma merda! =P
                ScrollViewer transScroller = new ScrollViewer()
                {
                    Content = transactionHolder, //adiciona o container das trasacoes no scrollViewer
                    Margin = new Thickness(21, 199, 20, 113),
                    BorderBrush = new SolidColorBrush(Colors.White),
                    BorderThickness = new Thickness(1)
                };


                for (int i = 20; i > 0; i--)
                {
                    TextBlock t1 = new TextBlock() { Text = "Bough " + i };
                    t1.Padding = new Thickness(10);
                    transactionHolder.Children.Add(t1);
                }

                pivotContent.Children.Add(amount);
                pivotContent.Children.Add(credit);
                pivotContent.Children.Add(debit);
                pivotContent.Children.Add(transScroller);

                newPivot.Content = pivotContent;
                newPivot.Name = account.CTA_ID.ToString();
                pivotAccounts.Items.Add(newPivot);
            }
        }
 partial void DeleteTB_CONTA(TB_CONTA instance);
 partial void UpdateTB_CONTA(TB_CONTA instance);
 partial void InsertTB_CONTA(TB_CONTA instance);
		private void detach_TB_CONTAs(TB_CONTA entity)
		{
			this.SendPropertyChanging();
			entity.TB_TIPO_CONTA = null;
		}
		private void attach_TB_CONTAs(TB_CONTA entity)
		{
			this.SendPropertyChanging();
			entity.TB_MOEDA = this;
		}