コード例 #1
0
        public static async Task<Professor> insertProfessor(string login, string nome, string senha, string matricula)
        {
            Usuario usuario = new Usuario() { Login = login, Nome = nome, Senha = senha };
            await App.MobileService.GetTable<Usuario>().InsertAsync(usuario);

            Professor professor = new Professor { Matricula = matricula, UsuarioId = usuario.Id };
            await App.MobileService.GetTable<Professor>().InsertAsync(professor);
            return professor;
        }
コード例 #2
0
        public static async Task<Responsavel> insertResponsavel(string login, string nome, string senha)
        {
            Usuario usuario = new Usuario() { Login = login, Nome = nome, Senha = senha };
            await App.MobileService.GetTable<Usuario>().InsertAsync(usuario);

            Responsavel responsavel = new Responsavel { UsuarioId = usuario.Id };
            await App.MobileService.GetTable<Responsavel>().InsertAsync(responsavel);
            return responsavel;
        }
コード例 #3
0
        public static async Task<Admin> insertAdmin(string login, string nome, string senha, string matricula)
        {
            Usuario usuario = new Usuario() { Login = login, Nome = nome, Senha = senha };
            await App.MobileService.GetTable<Usuario>().InsertAsync(usuario);

            Admin admin = new Admin { Matricula = matricula, UsuarioId = usuario.Id };
            await App.MobileService.GetTable<Admin>().InsertAsync(admin);
            return admin;
        }
コード例 #4
0
        public static async Task<Aluno> insertAluno(string login, string nome, string senha, string matricula, string turmaId)
        {
            Usuario usuario = new Usuario() { Login = login, Nome = nome, Senha = senha };
            await App.MobileService.GetTable<Usuario>().InsertAsync(usuario);

            Aluno aluno = new Aluno { Matricula = matricula, UsuarioId = usuario.Id, TurmaId = turmaId };
            await App.MobileService.GetTable<Aluno>().InsertAsync(aluno);
            return aluno;
        }
コード例 #5
0
 public static async void updateResponsavel(Responsavel responsavel, Usuario usuario)
 {
     await App.MobileService.GetTable<Usuario>().UpdateAsync(usuario);
     //responsavel.Usuario = null;
     //await App.MobileService.GetTable<Responsavel>().UpdateAsync(responsavel);
 }
コード例 #6
0
 public static async void updatetProfessor(Professor professor, Usuario usuario)
 {
     await App.MobileService.GetTable<Usuario>().UpdateAsync(usuario);
     professor.Usuario = null;
     await App.MobileService.GetTable<Professor>().UpdateAsync(professor);
 }
コード例 #7
0
 public static async void updateAlunoBasico(Aluno aluno, Usuario usuario)
 {
     try
     {
         await App.MobileService.GetTable<Usuario>().UpdateAsync(usuario);
         aluno.Usuario = null;
         await App.MobileService.GetTable<Aluno>().UpdateAsync(aluno);
     }
     catch (Exception) { }
 }
コード例 #8
0
        public static async void updateAlunoCompleto(Aluno aluno, Usuario usuario)
        {
            try
            {
                await App.MobileService.GetTable<Usuario>().UpdateAsync(usuario);
                aluno.Usuario = null;
                await App.MobileService.GetTable<Aluno>().UpdateAsync(aluno);

                List<Frequencia> fs = await getAllFrequenciasToListViewByAlunoId(aluno.Id);
                foreach (Frequencia f in fs)
                {
                    List<Aula> aulas = await getAllAulasToListViewByFrequenciaId(f.Id);
                    foreach (Aula a in aulas)
                    {
                        await App.MobileService.GetTable<Aula>().DeleteAsync(a);
                    }
                    await App.MobileService.GetTable<Frequencia>().DeleteAsync(f);
                }

                List<Nota> notas = await getAllNotasToListViewByAlunoId(aluno.Id);
                foreach (Nota n in notas)
                {
                    await App.MobileService.GetTable<Nota>().DeleteAsync(n);
                }

                List<TurmaDisciplina> tds = await getAllTurmaDisciplinasByTurmaId(aluno.TurmaId);
                foreach (TurmaDisciplina td in tds)
                {
                    Frequencia nf = await insertFrequencia(aluno.Id, td.Id);
                    await insertNota(0f, 0f, 0f, aluno.Id, td.Id);
                    await insertAula(false, nf.Id);
                    await insertAula(false, nf.Id);
                    await insertAula(false, nf.Id);
                    await insertAula(false, nf.Id);
                    await insertAula(false, nf.Id);
                }
                
            }
            catch (Exception)
            {
                await new MessageDialog("Não foi possível atualizar este Aluno!").ShowAsync();
            }
        }
コード例 #9
0
 public static async void updateAdmin(Admin admin, Usuario usuario)
 {
     await App.MobileService.GetTable<Usuario>().UpdateAsync(usuario);
     admin.Usuario = null;
     await App.MobileService.GetTable<Admin>().UpdateAsync(admin);
 }