The domain context corresponding to the 'AdministracaoService' domain service.
Inheritance: DomainContext
        void convenioPlanoSaudeSetDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (((DataGrid)sender).SelectedItem != null)
            {
                dgrDescontosServicos.Visibility = Visibility.Visible;

                AdministracaoContext administracaoContext = new AdministracaoContext();
                ConvenioPlanoSaudeSet convenioSelecionado = (ConvenioPlanoSaudeSet)((DataGrid)sender).SelectedItem;

                listaDescontosServicos = new ObservableCollection<DescontoServico>();
                DescontoServico descontoServico = null;

                LoadOperation<ServicoMedicoSet> loadOpServicosMedicos = administracaoContext.Load<ServicoMedicoSet>(administracaoContext.GetServicoMedicoSetQuery());
                loadOpServicosMedicos.Completed += (s2, e2) =>
                {
                    LoadOperation<ConvenioServicoSet> loadOp = administracaoContext.Load<ConvenioServicoSet>(administracaoContext.GetConvenioServicoSet_CodigoConvenioQuery(convenioSelecionado.codigo));
                    loadOp.Completed += (s3, e3) =>
                    {
                        foreach (ConvenioServicoSet servico in ((LoadOperation)s3).Entities)
                        {
                            descontoServico = new DescontoServico(servico.id, servico.ServicoMedicoSet.nome, servico.ServicoMedicoSet.descricao, servico.porcentagem_desconto);
                            listaDescontosServicos.Add(descontoServico);
                        }

                        dgrDescontosServicos.ItemsSource = listaDescontosServicos;
                    };
                };
            }
            else
            {
                dgrDescontosServicos.Visibility = Visibility.Collapsed;
            }
        }
        void registroConvenio_Closed(object sender, EventArgs e)
        {
            RegistroConvenioPlanoSaude registro = (RegistroConvenioPlanoSaude)sender;
            AdministracaoContext context = (AdministracaoContext)convenioPlanoSaudeSetDomainDataSource.DomainContext;

            if (registro.DialogResult == true && registro.novoConvenio != null)
            {
                context.ConvenioPlanoSaudeSets.Add(registro.novoConvenio);
                convenioPlanoSaudeSetDomainDataSource.SubmitChanges();
                dfrConvenio.CurrentItem = registro.novoConvenio;

                ConvenioPlanoSaudeSet convenio = (ConvenioPlanoSaudeSet)registro.novoConvenio;
                ConvenioServicoSet desconto = null;

                AdministracaoContext administracaoContext = new AdministracaoContext();
                LoadOperation<ServicoMedicoSet> loadOpServicosMedicos = administracaoContext.Load<ServicoMedicoSet>(administracaoContext.GetServicoMedicoSetQuery());
                loadOpServicosMedicos.Completed += (s2, e2) =>
                {
                    foreach (ServicoMedicoSet servico in ((LoadOperation)s2).Entities)
                    {
                        desconto = new ConvenioServicoSet();
                        desconto.ConvenioPlanoSaude_codigo = convenio.codigo;
                        desconto.ServicoMedicoSet_codigo = servico.codigo;
                        desconto.porcentagem_desconto = 0;

                        context.ConvenioServicoSets.Add(desconto);
                    }
                    convenioPlanoSaudeSetDomainDataSource.SubmitChanges();
                };
            }
        }
        private void dgrDescontosServicos_RowEditEnded(object sender, DataGridRowEditEndedEventArgs e)
        {
            AdministracaoContext administracaoContext = new AdministracaoContext();
            ConvenioPlanoSaudeSet convenioSelecionado = (ConvenioPlanoSaudeSet)convenioPlanoSaudeSetDataGrid.SelectedItem;
            DescontoServico descontoServicoAlterado = (DescontoServico)((DataGrid)sender).SelectedItem;

            LoadOperation<ConvenioServicoSet> loadOp = administracaoContext.Load<ConvenioServicoSet>(administracaoContext.GetConvenioServicoSet_IdQuery(descontoServicoAlterado.Id));
            loadOp.Completed += (s3, e3) =>
            {
                ConvenioServicoSet descontoServico = administracaoContext.ConvenioServicoSets.Where<ConvenioServicoSet>(desc => desc.id == descontoServicoAlterado.Id).Single<ConvenioServicoSet>();
                descontoServico.porcentagem_desconto = descontoServicoAlterado.Desconto;
                administracaoContext.SubmitChanges();
            };
        }