private void newAccount() { if (txtName.Text != null /*&& novoTipo != null*/) { string connection = App.Connection; using (var ctx = new ControleDeGastosDataContext(App.Connection)) { //Sets the AccountTypeID index to the same index as //the AccounType (option selected by the user) ListAccountTypeID.SelectedIndex = ListAccountType.SelectedIndex; TB_CONTA novaConta = new TB_CONTA() { CTA_NOME = txtName.Text, TPC_ID = (long)ListAccountTypeID.SelectedItem, CTA_DT_INICIO = System.DateTime.Today, CTA_DT_FIM = Convert.ToDateTime(System.DateTime.MaxValue.ToString()), CTA_VALOR_INICIAL = Convert.ToDecimal(txtInitialValue.Text), MOE_ID = 1, CTA_ENCERRADA = (bool) checkEncerrada.IsChecked, CTA_FLAG_ATIVA = true }; ctx.TB_CONTAS.InsertOnSubmit(novaConta); ctx.SubmitChanges(); } NavigationService.GoBack(); } else { MessageBox.Show("Digite um nome"); } }
private void newCurrency() { if (txtName.Text != null /*&& novoTipo != null*/) { string connection = App.Connection; using (var ctx = new ControleDeGastosDataContext(App.Connection)) { TB_MOEDA novaMoeda = new TB_MOEDA() { MOE_NOME = txtName.Text, MOE_SIGLA = txtSigla.Text, MOE_PADRAO = (bool) checkDefault.IsChecked, MOE_COTACAO = Convert.ToDecimal(txtCotacao.Text), MOE_FLAG_ATIVA = true }; ctx.TB_MOEDAs.InsertOnSubmit(novaMoeda); ctx.SubmitChanges(); } NavigationService.GoBack(); } else { MessageBox.Show("Digite um nome"); } }
private void newBudget() { if (txtName.Text != null) { string connection = App.Connection; using (var ctx = new ControleDeGastosDataContext(App.Connection)) { //ListAccountTypeID.SelectedIndex = ListAccountType.SelectedIndex; // TB_ORCAMENTO novoOrcamento = new TB_ORCAMENTO() { ORC_NOME = txtName.Text, ORC_TIPO = Convert.ToInt16(txtType.Text), ORC_VALOR = Convert.ToDecimal(txtBudgetAmount.Text), CAT_ID = (long)ListCategoryID.SelectedItem, MOE_ID = (long)ListCurrencyID.SelectedItem, ORC_SUBCATEGORIA = (bool)checkSubcategory.IsChecked, ORC_OBSERVACAO = txtObservation.Text, ORC_FLAG_ATIVA = true }; ctx.TB_ORCAMENTOs.InsertOnSubmit(novoOrcamento); ctx.SubmitChanges(); } NavigationService.GoBack(); } else { MessageBox.Show("Digite um nome"); } }
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"); } }
private void newBeneficiary() { using (var ctx = new ControleDeGastosDataContext(App.Connection)) { TB_BENEFICIARIO newBeneficiary = new TB_BENEFICIARIO() { BNF_NOME = txtName.Text, BNF_OBSERVACAO = txtObservacao.Text, BNF_FLAG_ATIVA = true }; ctx.TB_BENEFICIARIOs.InsertOnSubmit(newBeneficiary); ctx.SubmitChanges(); } NavigationService.GoBack(); }
private void editExistingAccountType() { using (var ctx = new ControleDeGastosDataContext(App.Connection)) { IQueryable<TB_TIPO_CONTA> typeQuery = from TB_TIPO_CONTAs in ctx.TB_TIPO_CONTAs where TB_TIPO_CONTAs.TPC_ID.Equals(param1) select TB_TIPO_CONTAs; TB_TIPO_CONTA typeToUpdate = typeQuery.FirstOrDefault(); typeToUpdate.TPC_NOME = txtName.Text; ctx.SubmitChanges(); } NavigationService.GoBack(); }
private void editExistingBeneficiary() { using (var ctx = new ControleDeGastosDataContext(App.Connection)) { IQueryable<TB_BENEFICIARIO> beneficiaryQuery = from TB_BENEFICIARIOs in ctx.TB_BENEFICIARIOs where TB_BENEFICIARIOs.BNF_ID.Equals(param1) select TB_BENEFICIARIOs; TB_BENEFICIARIO beneficiaryToUpdate = beneficiaryQuery.FirstOrDefault(); beneficiaryToUpdate.BNF_NOME = txtName.Text; beneficiaryToUpdate.BNF_OBSERVACAO = txtObservacao.Text; ctx.SubmitChanges(); } NavigationService.GoBack(); }
private void editExistingAccount() { string connection = App.Connection; using (var ctx = new ControleDeGastosDataContext(App.Connection)) { IQueryable<TB_CONTA> contaQuery = from TB_CONTAS in ctx.TB_CONTAS where TB_CONTAS.CTA_ID.Equals(accountId) select TB_CONTAS; TB_CONTA contaToUpdate = contaQuery.FirstOrDefault(); contaToUpdate.CTA_NOME = txtName.Text; //Sets the AccountTypeID index to the same index as //the AccounType (option selected by the user) ListAccountTypeID.SelectedIndex = ListAccountType.SelectedIndex; contaToUpdate.TPC_ID = (long)ListAccountTypeID.SelectedItem; if ((bool)checkEncerrada.IsChecked) { contaToUpdate.CTA_DT_FIM = System.DateTime.Today; } contaToUpdate.CTA_VALOR_INICIAL = Convert.ToDecimal(txtInitialValue.Text); //Finalizar Moeda contaToUpdate.MOE_ID = 1; ctx.SubmitChanges(); } NavigationService.GoBack(); }
private void editExistingBudget() { string connection = App.Connection; using (var ctx = new ControleDeGastosDataContext(App.Connection)) { IQueryable<TB_ORCAMENTO> budgetQuery = from TB_ORCAMENTO in ctx.TB_ORCAMENTOs where TB_ORCAMENTO.ORC_ID.Equals(param1) select TB_ORCAMENTO; TB_ORCAMENTO budgetToUpdate = budgetQuery.FirstOrDefault(); budgetToUpdate.ORC_NOME = txtName.Text; budgetToUpdate.ORC_TIPO = Convert.ToInt16(txtType.Text); //Sets the AccountTypeID index to the same index as //the AccounType (option selected by the user) ListCategoryID.SelectedIndex = ListCategory.SelectedIndex; ListCurrencyID.SelectedIndex = ListCurrency.SelectedIndex; budgetToUpdate.CAT_ID = (long)ListCategoryID.SelectedItem; budgetToUpdate.MOE_ID = (long)ListCurrencyID.SelectedItem; budgetToUpdate.ORC_VALOR = Convert.ToDecimal(txtBudgetAmount.Text); budgetToUpdate.ORC_OBSERVACAO = txtObservation.Text; ctx.SubmitChanges(); } NavigationService.GoBack(); }
private void editExistingCurrency() { string connection = App.Connection; using (var ctx = new ControleDeGastosDataContext(App.Connection)) { IQueryable<TB_MOEDA> currencyQuery = from TB_MOEDAs in ctx.TB_MOEDAs where TB_MOEDAs.MOE_ID.Equals(param1) select TB_MOEDAs; TB_MOEDA moedaToUpdate = currencyQuery.FirstOrDefault(); moedaToUpdate.MOE_NOME = txtName.Text; moedaToUpdate.MOE_SIGLA = txtSigla.Text; moedaToUpdate.MOE_PADRAO = (bool)checkDefault.IsChecked; moedaToUpdate.MOE_COTACAO = Convert.ToDecimal(txtCotacao.Text); moedaToUpdate.MOE_FLAG_ATIVA = true; ctx.SubmitChanges(); } NavigationService.GoBack(); }