Exemplo n.º 1
0
        private async Task <List <MacsViewModels> > ClientesFiltersAsync()
        {
            var turma     = cbTurmas.Text.Equals("[Selecione sua turma por favor]") ? null : turmasViewModelsBindingSource.Current as Turmas;
            var trimestre = cbTurmas.Text.Equals("[Selecione o triméstre por favor]") ? null : trimestresViewModelsBindingSource.Current as Trimestres;

            return
                (await MacsControllers.GetInstacia()
                 .GetList(trimestre == null ? 0 : (int)trimestre.TrimestreID,
                          turma == null ? null : (int?)turma.TurmasID));
        }
Exemplo n.º 2
0
        private async void Guardar()
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                var         trimestreResult = macsViewModelsBindingSource.DataSource as List <MacsViewModels>;
                List <Macs> MacsAdapter     = new List <Macs>();

                if (trimestreResult.Count > 0)
                {
                    trimestreResult.ForEach(x =>
                    {
                        var models = new Macs
                        {
                            MacsID      = x.MacsID,
                            nota1       = x.nota1,
                            nota2       = x.nota2,
                            nota3       = x.nota3,
                            nota4       = x.nota4,
                            nota5       = x.nota5,
                            nota6       = x.nota6,
                            nota7       = x.nota7,
                            nota8       = x.nota8,
                            AlunosID    = x.AlunosID,
                            TrimestreID = x.TrimestreID,
                        };
                        MacsAdapter.Add(models);
                    });
                }
                if ((await MacsControllers.GetInstacia().InsertAll(MacsAdapter)).IsSucess)
                {
                    XtraMessageBox.Show("Serviço Inserido com Sucesso!...", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ListGeral();
                }
                else
                {
                    XtraMessageBox.Show("Este Valor já existe tente novamente", "Má conclusão", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (System.Exception exception)
            {
                MessageBox.Show("Erro " + exception, "Erro de SQL", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }