private void newAccountType() { using (var ctx = new ControleDeGastosDataContext(App.Connection)) { TB_TIPO_CONTA newAccountType = new TB_TIPO_CONTA() { TPC_NOME = txtName.Text, TPC_FLAG_ATIVA = true }; ctx.TB_TIPO_CONTAs.InsertOnSubmit(newAccountType); ctx.SubmitChanges(); } NavigationService.GoBack(); }
private void appBarConfirmarButton_Click(object sender, EventArgs e) { if (txtName != null /*&& novoTipo != null*/) { 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); ctx.SubmitChanges(); TB_CONTA novaConta = new TB_CONTA() { CTA_NOME = txtName.Text, TPC_ID = 1, CTA_DT_INICIO = System.DateTime.Today, CTA_DT_FIM = System.DateTime.Today, CTA_FLAG_ATIVA = true }; ctx.TB_CONTAS.InsertOnSubmit(novaConta); ctx.SubmitChanges(); NavigationService.GoBack(); } } else { MessageBox.Show("Digite um nome e tipo"); } }