示例#1
0
        public NotaDTO LancarCFD10(NotaDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_NOTA_LANCAR_CFD_10";

                BaseDados.AddParameter("@MATRICULA", dto.Matricula);
                BaseDados.AddParameter("@DISCIPLINA", dto.DisciplinaID);
                BaseDados.AddParameter("@INSCRICAO", dto.Inscricao);
                BaseDados.AddParameter("@NOME", dto.NomeCompleto);
                BaseDados.AddParameter("@NOTA", dto.CA10);
                BaseDados.AddParameter("@DISPLAY", dto.Disciplina);
                BaseDados.AddParameter("@TURMA", dto.Turma);
                BaseDados.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }
            return(dto);
        }
示例#2
0
        // POST: api/Nota
        public HttpResponseMessage Post(HttpRequestMessage request)
        {
            var msg = new HttpResponseMessage();

            try
            {
                var value = request.Content.ReadAsStringAsync().Result;

                NotaDTO nota     = JsonConvert.DeserializeObject <NotaDTO>(value);
                t_nota  notanoua = Mapper.Map <NotaDTO, t_nota>(nota);

                catalog.Note.Add(notanoua);
                catalog.SaveChanges();

                msg.StatusCode = System.Net.HttpStatusCode.OK;
                msg.Content    = new StringContent("O nota noua a fost adaugata!");
            }
            catch (Exception ex)
            {
                msg.StatusCode = System.Net.HttpStatusCode.BadRequest;
                msg.Content    = new StringContent("Nu s-a putut adauga o nota noua!");
            }

            return(msg);
        }
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                buttonApply = EnumApplyAction.Update;

                //Lists
                dataGridInvoice.Visibility = Visibility.Hidden;

                //Buttons
                btnNew.Visibility   = btnEdit.Visibility = btnRemove.Visibility = Visibility.Hidden;
                btnApply.Visibility = btnCancel.Visibility = Visibility.Visible;

                //Pegando informações das notas apenas
                notaDTO = new NotaDTO();
                notaDTO = dataGridInvoice.SelectedItem as NotaDTO;

                txtInvoice.Text          = notaDTO.NumeroNota.ToString();
                dpDate.SelectedDate      = notaDTO.DataNota;
                cbProvider.SelectedValue = notaDTO.Fornecedor.Pessoa.NomePessoa;
                cbFilial.SelectedValue   = notaDTO.Filial.Pessoa.NomePessoa;

                newCollection = notaProdutoBLL.ReadInvoice(notaDTO);
                oldCollection = notaProdutoBLL.ReadInvoice(notaDTO);

                dataGridAddStuff.ItemsSource = newCollection;
                LiberarRemoveStuff();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void btnRemove_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                notaDTO = dataGridInvoice.SelectedItem as NotaDTO;

                if (MessageBox.Show("Realmente deseja excluir a nota " + notaDTO.NumeroNota + "?", "Remover Nota", MessageBoxButton.YesNo, MessageBoxImage.Exclamation) == MessageBoxResult.Yes)
                {
                    oldCollection = notaProdutoBLL.ReadInvoice(notaDTO);
                    notaProdutoBLL.Delete(notaDTO);
                    notaBLL.Delete(notaDTO);

                    foreach (NotaProdutoDTO item in oldCollection)
                    {
                        estoqueDTO            = new EstoqueDTO();
                        estoqueDTO.Produto    = item.Produto;
                        estoqueDTO.Filial     = item.Nota.Filial;
                        estoqueDTO.Quantidade = item.QuantidadeComprada;
                        estoqueBLL.Delete(estoqueDTO);
                    }

                    InitialConditionPage();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#5
0
        public NotaDTO AdicionarExame(NotaDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_NOTA_ADICIONAR_EPOCA_EXTRA";

                BaseDados.AddParameter("@ALUNO", dto.Matricula);
                BaseDados.AddParameter("@TURMA", dto.Turma);
                BaseDados.AddParameter("@DISCIPLINA", dto.Disciplina);
                BaseDados.AddParameter("@INSCRICAO", dto.Inscricao);
                BaseDados.AddParameter("@NOME", dto.NomeCompleto);
                BaseDados.AddParameter("@AVALIACAO", dto.Avaliacao);
                BaseDados.AddParameter("@RESULTADO", dto.Exame);
                BaseDados.AddParameter("@UTILIZADOR", dto.Utilizador);

                BaseDados.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
                BaseDados.GenerateErroFile(dto.MensagemErro);
            }
            finally
            {
                BaseDados.FecharConexao();
            }
            return(dto);
        }
示例#6
0
        public async Task <TicketDTO> ConsultarDetalhes(int id)
        {
            var ticket = context.Tickets.FirstOrDefault(t => t.Id == id);

            if (ticket == null)
            {
                return(null);
            }

            TicketDTO ticketDTO = new TicketDTO()
            {
                Id                 = ticket.Id,
                DataAbertura       = Convert.ToString(ticket.DataAbertura),
                Titulo             = ticket.Titulo,
                Descricao          = ticket.Descricao,
                StatusAtual        = ticket.StatusAtual.ToString(),
                Prioridade         = ticket.PrioridadeAtual.ToString(),
                DataFechamento     = ticket.DataFechamento.ToString(),
                Tempo              = ticket.Tempo.ToString(),
                DataCancelamento   = ticket.DataCancelamento.ToString(),
                MotivoCancelamento = ticket.MotivoCancelamento,
                Criador            = ticket.Criador.Nome,
                Projeto            = ticket.Projeto.Nome,
                Categoria          = ticket.Categoria.Nome,
                //se o ticket estiver aberto não possui usuario que fechou ou cancelou
                UsuarioFechamento   = ticket.UsuarioFechamento == null ? "null" : ticket.UsuarioFechamento.Nome,
                UsuarioCancelamento = ticket.UsuarioCancelamento == null ? "null" : ticket.UsuarioCancelamento.Nome
            };

            foreach (var n in ticket.Notas)
            {
                NotaDTO notaDTO = new NotaDTO
                {
                    Id          = n.Id,
                    Titulo      = n.Titulo,
                    Descricao   = n.Descricao,
                    DataCriacao = null,
                    Usuario     = n.Usuario.Nome
                };
                ticketDTO.Notas.Add(notaDTO);
            }

            foreach (var a in ticket.Anexos)
            {
                AnexoDTO anexoDTO = new AnexoDTO
                {
                    Id   = a.Id,
                    Nome = a.Nome,
                    URL  = a.URL
                };
                ticketDTO.Anexos.Add(anexoDTO);
            }

            return(await Task.FromResult(ticketDTO));
        }
        /// <summary>
        /// Consulta informações de privilegio por nome.
        /// </summary>
        /// <param name="nota">Nome do privilegio que será consultado.</param>
        /// <returns>Informações do privilegio encontrado.</returns>
        public NotaProdutoCollectionDTO ReadInvoice(NotaDTO nota)
        {
            NotaProdutoCollectionDTO notaProdutoCollectionDTO = new NotaProdutoCollectionDTO();

            try
            {
                dataBaseAccess.ClearParameters();
                dataBaseAccess.AddParameters("_idNota", nota.IdNota);

                DataTable dataTable = new DataTable();
                dataTable = dataBaseAccess.Consult(CommandType.StoredProcedure, "sp_nota_produto_nota");

                foreach (DataRow row in dataTable.Rows)
                {
                    NotaProdutoDTO notaProdutoDTO = new NotaProdutoDTO();
                    notaProdutoDTO.Nota               = new NotaDTO();
                    notaProdutoDTO.Nota.IdNota        = Convert.ToInt32(row["IdNota"]);
                    notaProdutoDTO.QuantidadeComprada = float.Parse(row["QuantidadeComprada"].ToString());
                    notaProdutoDTO.ValorUnitario      = Convert.ToDecimal(row["ValorUnitario"]);
                    notaProdutoDTO.ValorTotal         = Convert.ToDecimal(row["ValorTotal"]);

                    notaProdutoDTO.Nota.Filial = new FilialDTO();
                    notaProdutoDTO.Nota.Filial.Pessoa.IdPessoa   = Convert.ToInt32(row["IdPessoaFilial"]);
                    notaProdutoDTO.Nota.Filial.Pessoa.NomePessoa = row["NomeFilial"].ToString();

                    notaProdutoDTO.Nota.Fornecedor = new FornecedorDTO();
                    notaProdutoDTO.Nota.Fornecedor.Pessoa.IdPessoa   = Convert.ToInt32(row["IdPessoaFornecedor"]);
                    notaProdutoDTO.Nota.Fornecedor.Pessoa.NomePessoa = row["NomeFornecedor"].ToString();

                    notaProdutoDTO.Produto                  = new ProdutoDTO();
                    notaProdutoDTO.Produto.IdProduto        = Convert.ToInt32(row["IdProduto"]);
                    notaProdutoDTO.Produto.DescricaoProduto = row["DescricaoProduto"].ToString();

                    notaProdutoDTO.Produto.Unidade              = new UnidadeDTO();
                    notaProdutoDTO.Produto.Unidade.IdUnidade    = Convert.ToInt32(row["IdProduto"]);
                    notaProdutoDTO.Produto.Unidade.SiglaUnidade = row["SiglaUnidade"].ToString();

                    notaProdutoCollectionDTO.Add(notaProdutoDTO);
                }

                return(notaProdutoCollectionDTO);
            }
            catch (Exception ex)
            {
                StringBuilder message = new StringBuilder();
                message.Append("Não foi possível consultar produto por nota:\n\n").Append(ex.Message);
                throw new Exception(message.ToString());
            }
            finally
            {
                dataBaseAccess.ClearParameters();
            }
        }
示例#8
0
        public ActionResult Save(NotaDTO dto)
        {
            PersistedState ps = _notasService.Edit(dto);

            if (ps == PersistedState.OK)
            {
                NotasCache cached = GetSessionItem <NotasCache>(Resources.MisNotas);
                RemoveFromSession(Resources.MisNotas);
                SetSessionItem(Resources.MisNotas, _notasService.UpdateCache(cached, dto));
            }
            return(SimpleJSONFeedback(ps));
        }
        public PersistedState Edit(NotaDTO dto)
        {
            Nota       nota = FindById(dto.NotaId);
            AES_Result res  = CryptoService.AES_Encrypt(dto.NoteContent);

            nota.NoteContent = res.CipherData;
            nota.Nonce       = res.Nonce;
            nota.LUDT        = DateTime.Now;
            PersistedState ps = _notasRepo.TrySaveChanges();

            _notasRepo.Dispose();
            return(ps);
        }
示例#10
0
        public NotaDTO Lancar(NotaDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_NOTA_LANCAR";

                BaseDados.AddParameter("@ALUNO", dto.Matricula);
                BaseDados.AddParameter("@TURMA", dto.Turma);
                BaseDados.AddParameter("@DISCIPLINA", dto.Disciplina);
                BaseDados.AddParameter("@INSCRICAO", dto.Inscricao);
                BaseDados.AddParameter("@NOME", dto.NomeCompleto);
                BaseDados.AddParameter("@PP1T1", dto.PP1T1);
                BaseDados.AddParameter("@PP2T1", dto.PP2T1);
                BaseDados.AddParameter("@TP1T1", dto.TP1T1);
                BaseDados.AddParameter("@TP2T1", dto.TP2T1);
                BaseDados.AddParameter("@MTPT1", dto.MTPT1);
                BaseDados.AddParameter("@MAC1", dto.MACT1);
                BaseDados.AddParameter("@MTT1", dto.MT1);
                BaseDados.AddParameter("@PP1T2", dto.PP1T2);
                BaseDados.AddParameter("@PP2T2", dto.PP2T2);
                BaseDados.AddParameter("@TP1T2", dto.TP1T2);
                BaseDados.AddParameter("@TP2T2", dto.TP2T2);
                BaseDados.AddParameter("@MTPT2", dto.MTPT2);
                BaseDados.AddParameter("@MAC2", dto.MACT2);
                BaseDados.AddParameter("@MTT2", dto.MT2);
                BaseDados.AddParameter("@PP1T3", dto.PP1T3);
                BaseDados.AddParameter("@PP2T3", dto.PP2T3);
                BaseDados.AddParameter("@TP1T3", dto.TP1T3);
                BaseDados.AddParameter("@TP2T3", dto.TP2T3);
                BaseDados.AddParameter("@MTPT3", dto.MTPT3);
                BaseDados.AddParameter("@MAC3", dto.MACT3);
                BaseDados.AddParameter("@MTT3", dto.MT3);
                BaseDados.AddParameter("@CAP", dto.CAP);
                BaseDados.AddParameter("@CPE", dto.CPE);
                BaseDados.AddParameter("@CF", dto.CF);
                BaseDados.AddParameter("@ESTADO", dto.Status);
                BaseDados.AddParameter("@UTILIZADOR", dto.Utilizador);
                BaseDados.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
                //BaseDados.GenerateErroFile(dto.MensagemErro);
            }
            finally
            {
                BaseDados.FecharConexao();
            }
            return(dto);
        }
        public static Nota ConvertToNota(NotaDTO dto, ApplicationUser user)
        {
            AES_Result res = CryptoService.AES_Encrypt(dto.NoteContent);

            return(new Nota()
            {
                NotaId = dto.NotaId,
                LUDT = DateTime.Now,
                CDT = DateTime.Now,
                NoteContent = res.CipherData,
                Nonce = res.Nonce,
                Anchor = dto.Anchor,
                User = user
            });
        }
示例#12
0
        public Task <NotaDTO> GetNotaAsync(int _notaID)
        {
            return(Task.Factory.StartNew(() =>
            {
                var requestLink = "/Nota/";

                var uri = new Uri(WebSiteAPI + requestLink + _notaID.ToString());

                var response = _client.GetAsync(uri).Result;
                if (response.IsSuccessStatusCode)
                {
                    var content = response.Content.ReadAsStringAsync().Result;

                    NotaDTO notaCautata = JsonConvert.DeserializeObject <NotaDTO>(content);

                    return notaCautata;
                }

                return null;
            }));
        }
示例#13
0
 /// <summary>
 /// Remove o registro do banco.
 /// </summary>
 /// <param name="nota">Objeto que contém as informações necessárias para remover o registro do banco.</param>
 public string Delete(NotaDTO nota)
 {
     try
     {
         dataBaseAccess.AddParameters("_id", nota.IdNota);
         dataBaseAccess.AddParameters("_table_name", "nota");
         dataBaseAccess.AddParameters("_colum_name", "IdNota");
         dataBaseAccess.AddParameters("_message", ErrorMessage.MensagemErro);
         return(dataBaseAccess.ExecuteQuery(CommandType.StoredProcedure, "sp_remover"));
     }
     catch (Exception ex)
     {
         StringBuilder message = new StringBuilder();
         message.Append("Não foi possível remover a nota:\n\n").Append(ex.Message);
         throw new Exception(message.ToString());
     }
     finally
     {
         dataBaseAccess.ClearParameters();
     }
 }
示例#14
0
        /// <summary>
        /// Consulta informações de privilegio por nome.
        /// </summary>
        /// <returns>Informações do privilegio encontrado.</returns>
        public NotaCollectionDTO ReadAll()
        {
            NotaCollectionDTO notaCollectionDTO = new NotaCollectionDTO();

            try
            {
                DataTable dataTable = new DataTable();
                dataTable = dataBaseAccess.Consult(CommandType.StoredProcedure, "sp_nota_todos");

                foreach (DataRow row in dataTable.Rows)
                {
                    NotaDTO notaDTO = new NotaDTO();
                    notaDTO.IdNota     = Convert.ToInt32(row["IdNota"]);
                    notaDTO.NumeroNota = row["NumeroNota"].ToString();
                    notaDTO.DataNota   = Convert.ToDateTime(row["DataNota"]);

                    notaDTO.Filial = new FilialDTO();
                    notaDTO.Filial.Pessoa.IdPessoa   = Convert.ToInt32(row["IdPessoaFilial"]);
                    notaDTO.Filial.Pessoa.NomePessoa = row["NomeFilial"].ToString();

                    notaDTO.Fornecedor = new FornecedorDTO();
                    notaDTO.Fornecedor.Pessoa.IdPessoa   = Convert.ToInt32(row["IdPessoaFornecedor"]);
                    notaDTO.Fornecedor.Pessoa.NomePessoa = row["NomeFornecedor"].ToString();
                    notaCollectionDTO.Add(notaDTO);
                }

                return(notaCollectionDTO);
            }
            catch (Exception ex)
            {
                StringBuilder message = new StringBuilder();
                message.Append("Não foi possível consultar notas fiscais:\n\n").Append(ex.Message);
                throw new Exception(message.ToString());
            }
            finally
            {
                dataBaseAccess.ClearParameters();
            }
        }
示例#15
0
        /// <summary>
        /// Consulta informações de privilegio por nome.
        /// </summary>
        /// <returns>Informações do privilegio encontrado.</returns>

        public string Create(NotaDTO nota)
        {
            try
            {
                dataBaseAccess.ClearParameters();
                dataBaseAccess.AddParameters("_idPessoaFilial", nota.Filial.Pessoa.IdPessoa);
                dataBaseAccess.AddParameters("_idPessoaFornecedor", nota.Fornecedor.Pessoa.IdPessoa);
                dataBaseAccess.AddParameters("_numeroNota", nota.NumeroNota);
                dataBaseAccess.AddParameters("_dataNota", nota.DataNota);
                dataBaseAccess.AddParameters("_message", ErrorMessage.MensagemErro);
                return(dataBaseAccess.ExecuteQuery(CommandType.StoredProcedure, "sp_nota_criar"));
            }
            catch (Exception ex)
            {
                StringBuilder message = new StringBuilder();
                message.Append("Não foi possível cadastrar a nota fiscal: ").Append(ex.Message);
                throw new Exception(message.ToString());
            }
            finally
            {
                dataBaseAccess.ClearParameters();
            }
        }
示例#16
0
        public void Excluir(NotaDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_NOTA_EXCLUIR";


                BaseDados.AddParameter("@DISCIPLINA", dto.DisciplinaID);
                BaseDados.AddParameter("@TURMA", dto.TurmaID);
                BaseDados.AddParameter("@MATRICULA", dto.Matricula);

                BaseDados.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }
        }
示例#17
0
        public Task <string> PostNotaAsync(NotaDTO notaNoua)
        {
            return(Task.Factory.StartNew(() =>
            {
                var requestLink = "/Nota";

                var uri = new Uri(WebSiteAPI + requestLink);

                var myContent = JsonConvert.SerializeObject(notaNoua);
                var buffer = Encoding.UTF8.GetBytes(myContent);
                var byteContent = new ByteArrayContent(buffer);

                var response = _client.PostAsync(uri, byteContent).Result;
                if (response.IsSuccessStatusCode)
                {
                    var content = response.Content.ReadAsStringAsync().Result;

                    return content;
                }

                return null;
            }));
        }
示例#18
0
        // PUT: api/Nota/5
        public HttpResponseMessage Put(int id, HttpRequestMessage request)
        {
            var msg = new HttpResponseMessage();

            try
            {
                var value = request.Content.ReadAsStringAsync().Result;

                t_nota  nota     = catalog.Note.Where(notacautata => notacautata.Id == id).FirstOrDefault();
                NotaDTO notanoua = JsonConvert.DeserializeObject <NotaDTO>(value);

                nota.Id        = notanoua.Id;
                nota.Data      = notanoua.Data;
                nota.Nota      = notanoua.Nota;
                nota.Semestrul = notanoua.Semestrul;
                nota.Teza      = notanoua.Teza;

                t_elev elev = catalog.Elevi.Where(elevcautat => elevcautat.Id == notanoua.ElevID).FirstOrDefault();
                nota.Elev = elev;
                t_materie materie = catalog.Materii.Where(materiecautata => materiecautata.Id == notanoua.MaterieID).FirstOrDefault();
                nota.Materie = materie;

                //Lista de elevi

                catalog.SaveChanges();

                msg.StatusCode = System.Net.HttpStatusCode.OK;
                msg.Content    = new StringContent("Modificarile au fost procesate cu succes!");
            }
            catch (Exception ex)
            {
                msg.StatusCode = System.Net.HttpStatusCode.BadRequest;
                msg.Content    = new StringContent("Nu s-au putut executa modificarile dorite!");
            }

            return(msg);
        }
示例#19
0
        public NotaDTO Adicionar(NotaDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_NOTA_ADICIONAR";

                BaseDados.AddParameter("@ALUNO", dto.Matricula);
                BaseDados.AddParameter("@TURMA", dto.Turma);
                BaseDados.AddParameter("@DISCIPLINA", dto.Disciplina);
                BaseDados.AddParameter("@INSCRICAO", dto.Inscricao);
                BaseDados.AddParameter("@NOME", dto.NomeCompleto.Replace("&nbsp;", string.Empty));
                BaseDados.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }
            return(dto);
        }
示例#20
0
        public void AddCFDAnterior(NotaDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_NOTA_IMPORTAR_CAA";

                BaseDados.AddParameter("@MATRICULA", dto.Matricula);
                BaseDados.AddParameter("@DISCIPLINA", dto.DisciplinaID);
                BaseDados.AddParameter("@ANO_LECTIVO", dto.AnoLectivo);
                BaseDados.AddParameter("@CAA", dto.CFD);

                BaseDados.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
                BaseDados.GenerateErroFile(dto.MensagemErro);
            }
            finally
            {
                BaseDados.FecharConexao();
            }
        }
        public NotasCache UpdateCache(NotasCache cached, NotaDTO updated)
        {
            NotaDTO mod = null;

            if (updated.Anchor)
            {
                if (cached.anchored.Any(nota => nota.NotaId == updated.NotaId))//No habría cambiado la prioridad
                {
                    mod = cached.anchored.First(nota => nota.NotaId == updated.NotaId);
                }
                else//eliminar y acoplar en el otro grupo
                {
                    mod = cached.notAnchored.First(nota => nota.NotaId == updated.NotaId);
                    cached.anchored.Add(mod);
                    cached.anchored = cached.anchored.OrderByDescending(nota => nota.CDT).ToList();
                    cached.notAnchored.Remove(mod);
                }
            }
            else
            {
                if (cached.notAnchored.Any(nota => nota.NotaId == updated.NotaId))//No habría cambiado la prioridad
                {
                    mod = cached.notAnchored.First(nota => nota.NotaId == updated.NotaId);
                }
                else//eliminar y acoplar en el otro grupo
                {
                    mod = cached.anchored.First(nota => nota.NotaId == updated.NotaId);
                    cached.notAnchored.Add(mod);
                    cached.notAnchored = cached.notAnchored.OrderByDescending(nota => nota.CDT).ToList();
                    cached.anchored.Remove(mod);
                }
            }
            mod.NoteContent = updated.NoteContent;
            mod.LUDT        = DateTime.Now;
            return(cached);
        }
示例#22
0
        public void ValidaMiniPauta(NotaDTO dto)
        {
            try
            {
                BaseDados.ComandText = "stp_ACA_VALIDACAO_MINI_PAUTA_ADICIONAR";

                BaseDados.AddParameter("@TURMA_ID", dto.Turma);
                BaseDados.AddParameter("@DISCIPLINA_ID", dto.Disciplina);
                BaseDados.AddParameter("@EPOCA_ID", dto.Epoca);
                BaseDados.AddParameter("@UTILIZADOR", dto.Utilizador);
                BaseDados.AddParameter("@PERIODO_ID", dto.Periodo ?? "-1");

                BaseDados.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                dto.Sucesso      = false;
                dto.MensagemErro = ex.Message.Replace("'", "");
            }
            finally
            {
                BaseDados.FecharConexao();
            }
        }
示例#23
0
        public EstudioDTO ObtenerDTO(Estudio estudio, bool soloPendientes)
        {
            EstudioDTO   estudioDTO   = null;
            DocumentoDTO documentoDTO = null;
            NotaDTO      notaDTO      = null;

            estudioDTO = DameEstudioDTO(estudio);
            estudioDTO.InvestigadoresPrincipalesProfesional = estudio.InvestigadoresPrincipalesProfesional;

            var docsTratados = from docs in estudio.Documentos
                               orderby docs.TipoDocumentoDescripcion, docs.Id
            select docs;


            docsTratados.ToList <Documento>().ForEach(delegate(Documento documento)
            {
                bool agregarDoc = true;

                if (soloPendientes)
                {
                    agregarDoc = !documento.VersionEstadoActual.EstadoFinal.Value;
                }


                if (agregarDoc)
                {
                    documentoDTO = new DocumentoDTO();

                    documentoDTO.Id                           = documento.Id;
                    documentoDTO.Descripcion                  = documento.Descripcion;
                    documentoDTO.IdTipoDocumento              = documento.TipoDocumento.Id;
                    documentoDTO.TipoDocumentoDescripcion     = documento.TipoDocumento.Descripcion;
                    documentoDTO.TipoDocumentoIdDescripcion   = string.Format("{0}-{1}", documento.TipoDocumento.Id, documento.TipoDocumento.Descripcion);
                    documentoDTO.TipoDocumentoRequiereVersion = documento.TipoDocumento.RequiereVersion.ConvertirBool();
                    documentoDTO.IdEstudio                    = estudio.Id;
                    documentoDTO.NombreEstudio                = estudio.NombreEstudioListados;
                    documentoDTO.IdVersionActual              = (documento.VersionActual != null) ? documento.VersionActual.Id : -1;
                    documentoDTO.VersionActualDescripcion     = (documento.VersionActual != null) ? documento.VersionActual.Descripcion : string.Empty;
                    documentoDTO.VersionActualFecha           = (documento.VersionActual != null) ? documento.VersionActual.FechaToString : string.Empty;
                    documentoDTO.VersionActualArchivo         = (documento.VersionActual != null) ? documento.VersionActual.Archivo : string.Empty;
                    documentoDTO.EstadoActual                 = (documento.VersionEstadoActual != null && documento.VersionEstadoActual.Estado != null) ? documento.VersionEstadoActual.Estado.Descripcion : string.Empty;
                    documentoDTO.EstadoActualFecha            = (documento.VersionEstadoActual != null && documento.VersionEstadoActual.Estado != null) ? documento.VersionEstadoActual.FechaToString : string.Empty;
                    documentoDTO.EstadoFinal                  = documento.EstadoFinal;

                    if (documento.VersionActual != null && documento.VersionActual.Participantes != null)
                    {
                        documento.VersionActual.Participantes.ToList <DocumentoVersionParticipante>().ForEach(delegate(DocumentoVersionParticipante dvParticipante)
                        {
                            documentoDTO.Participantes.Add(dvParticipante.Profesional);
                        });
                    }

                    estudioDTO.Documentos.Add(documentoDTO);
                }
            });

            estudio.Notas.ToList <Nota>().ForEach(delegate(Nota nota)
            {
                notaDTO = new NotaDTO();

                notaDTO.Id          = nota.Id;
                notaDTO.Descripcion = nota.Descripcion;
                notaDTO.IdEstudio   = nota.IdEstudio.ToString();
                notaDTO.Fecha       = nota.FechaToString;
                notaDTO.IdAutor     = (nota.Autor != null) ? nota.Autor.Id.ToString() : string.Empty;

                estudioDTO.Notas.Add(notaDTO);
            });

            return(estudioDTO);
        }
示例#24
0
        public List <NotaDTO> ObterPorFiltro(NotaDTO dto)
        {
            List <NotaDTO> notas = new List <NotaDTO>();

            try
            {
                BaseDados.ComandText = "stp_ACA_NOTA_OBTERPORFILTRO";

                BaseDados.AddParameter("@DISCIPLINA", dto.Disciplina ?? "-1");
                BaseDados.AddParameter("@TURMA", dto.Turma ?? "-1");
                BaseDados.AddParameter("@ALUNO", dto.Matricula);
                BaseDados.AddParameter("@ANO_LECTIVO", dto.AnoLectivo);
                BaseDados.AddParameter("@FILIAL", dto: dto.Filial ?? "-1");
                string vNivel = dto.NivelEnsino;

                MySqlDataReader dr = BaseDados.ExecuteReader();

                int ordem = 1;
                foreach (var dr in reader)
                {
                    dto = new NotaDTO
                    {
                        NumeroOrdem   = ordem,
                        Matricula     = int.Parse(dr[0]),
                        Turma         = dr[1],
                        Disciplina    = dr[2],
                        Inscricao     = dr[3],
                        NomeCompleto  = dr[4],
                        SocialName    = dr[4],
                        PP1T1         = decimal.Parse(dr[5] ?? "-1"),
                        PP2T1         = decimal.Parse(dr[6] ?? "-1"),
                        TP1T1         = decimal.Parse(dr[7] ?? "-1"),
                        TP2T1         = decimal.Parse(dr[8] ?? "-1"),
                        MTPT1         = decimal.Parse(dr[9] ?? "-1"),
                        MACT1         = decimal.Parse(dr[10] ?? "-1"),
                        MT1           = decimal.Parse(dr[11] ?? "-1"),
                        PP1T2         = decimal.Parse(dr[12] ?? "-1"),
                        PP2T2         = decimal.Parse(dr[13] ?? "-1"),
                        TP1T2         = decimal.Parse(dr[14] ?? "-1"),
                        TP2T2         = decimal.Parse(dr[15] ?? "-1"),
                        MTPT2         = decimal.Parse(dr[16] ?? "-1"),
                        MACT2         = decimal.Parse(dr[17] ?? "-1"),
                        MT2           = decimal.Parse(dr[18] ?? "-1"),
                        PP1T3         = decimal.Parse(dr[19] ?? "-1"),
                        PP2T3         = decimal.Parse(dr[20] ?? "-1"),
                        TP1T3         = decimal.Parse(dr[21] ?? "-1"),
                        TP2T3         = decimal.Parse(dr[22] ?? "-1"),
                        MTPT3         = decimal.Parse(dr[23] ?? "-1"),
                        MACT3         = decimal.Parse(dr[24] ?? "-1"),
                        MT3           = decimal.Parse(dr[25] ?? "-1"),
                        CAP           = decimal.Parse(dr[26] ?? "-1"),
                        CPE           = decimal.Parse(dr[27] ?? "-1"),
                        CF            = decimal.Parse(dr[28] ?? "-1"),
                        Curso         = dr[29],
                        Classe        = dr[30],
                        Observacao    = dr[31],
                        AlunoID       = dr[32],
                        NroProcesso   = dr[33],
                        Formacao      = dr[34],
                        CFD           = decimal.Parse(dr[35] ?? "-1"),
                        Exame         = decimal.Parse(dr[36] ?? "-1"),
                        Recurso       = decimal.Parse(dr[37] ?? "-1"),
                        CAA           = decimal.Parse(dr[38] ?? "-1"),
                        DirectorTurma = dr[39]
                    };

                    if (dr[40] == "M")
                    {
                        dto.Turno = "MANHÃ";
                    }
                    else if (dr[40] == "T")
                    {
                        dto.Turno = "TARDE";
                    }
                    else if (dr[40] == "N")
                    {
                        dto.Turno = "NOITE";
                    }
                    dto.Sala         = dr[41];
                    dto.Sexo         = dr[42];
                    dto.DisciplinaID = int.Parse(dr[43]);
                    dto.CA10         = decimal.Parse(dr[44] ?? "-1");
                    dto.Recurso      = dto.Recurso <= 0 ? dto.Exame : dto.Recurso;
                    dto.Exame        = dto.Exame <= 0 && dto.Recurso > 0 ? dto.Recurso : dto.Exame;
                    if (dr[45] == "F")
                    {
                        dto.IsFinalizante = true;
                    }
                    else if (dr[45] == "A")
                    {
                        dto.IsAnual = true;
                    }
                    else if (dr[45] == "J" || dr[45] == "P")
                    {
                        dto.IsProjectoFinal = true;

                        if (dr[45] == "P")
                        {
                            dto.IsPAP = true;
                        }
                    }
                    else if (dr[45] == "T")
                    {
                        dto.IsTerminal = true;
                    }
                    else if (dr[45] == "E")
                    {
                        dto.IsTerminalEspecial = true;
                    }
                    else
                    {
                        dto.IsContinua = true;
                    }

                    dto.AnoLectivo   = int.Parse(dr[46]);
                    dto.TurmaID      = int.Parse(dr[47]);
                    dto.DisciplinaID = int.Parse(dr[48]);

                    dto.Picture        = dr[49] != null ? dr[49].ToString() : string.Empty;
                    dto.Pai            = dr[50] != null ? dr[50].ToString() : string.Empty;
                    dto.Mae            = dr[51] != null ? dr[51].ToString() : string.Empty;
                    dto.Encarregado    = dr[52] != null ? dr[52].ToString() : string.Empty;
                    dto.DataNascimento = dr[53] != null?DateTime.Parse(dr[53]) : DateTime.MinValue;

                    dto.LocalNascimento = dr[54] != null ? dr[54].ToString() : string.Empty;
                    dto.Naturalidade    = dr[55] != null ? dr[55].ToString() : string.Empty;

                    dto.isValidaEpocaNormal   = int.Parse(dr[57]) > 0 ? true : false;
                    dto.isValidaEpocaExame    = int.Parse(dr[58]) > 0 ? true : false;
                    dto.isValidaEpocaEspecial = int.Parse(dr[59]) > 0 ? true : false;

                    notas.Add(dto);
                    ordem++;
                }
            }
            catch (Exception ex)
            {
                dto.MensagemErro = ex.Message.Replace("'", "");
                dto.Sucesso      = false;
                notas            = new List <NotaDTO>();
                notas.Add(dto);
                BaseDados.GenerateErroFile(dto.MensagemErro);
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(notas);
        }
示例#25
0
        public List <NotaDTO> ObterCFD10(NotaDTO dto)
        {
            List <NotaDTO> notas = new List <NotaDTO>();

            try
            {
                BaseDados.ComandText = "stp_ACA_NOTA_OBTERCFD10";

                BaseDados.AddParameter("@DISCIPLINA", dto.Disciplina == null ? "-1" : dto.Disciplina);
                BaseDados.AddParameter("@TURMA", dto.Turma == null ? "-1" : dto.Turma);
                BaseDados.AddParameter("@ALUNO", dto.Matricula);

                MySqlDataReader dr = BaseDados.ExecuteReader();

                int ordem = 1;
                while (dr.Read())
                {
                    dto              = new NotaDTO();
                    dto.NumeroOrdem  = ordem;
                    dto.Matricula    = int.Parse(dr[0]);
                    dto.DisciplinaID = int.Parse(dr[1]);
                    dto.Inscricao    = dr[2];
                    dto.NomeCompleto = dr[3];
                    dto.SocialName   = dr[3];
                    dto.Exame        = decimal.Parse(dr[4]);
                    dto.Disciplina   = dr[5];
                    dto.Turma        = dr[6];
                    dto.PP1T1        = -1;
                    dto.PP2T1        = -1;
                    dto.TP1T1        = -1;
                    dto.TP2T1        = -1;
                    dto.MTPT1        = -1;
                    dto.MACT1        = -1;
                    dto.MT1          = -1;
                    dto.PP1T2        = -1;
                    dto.PP2T2        = -1;
                    dto.TP1T2        = -1;
                    dto.TP2T2        = -1;
                    dto.MTPT2        = -1;
                    dto.MACT2        = -1;
                    dto.MT2          = -1;
                    dto.PP1T3        = -1;
                    dto.PP2T3        = -1;
                    dto.TP1T3        = -1;
                    dto.TP2T3        = -1;
                    dto.MTPT3        = -1;
                    dto.MACT3        = -1;
                    dto.MT3          = -1;
                    dto.CAP          = -1;
                    dto.CPE          = -1;
                    dto.CF           = -1;
                    dto.Observacao   = "";
                    dto.CA10         = dto.Exame;
                    notas.Add(dto);
                    ordem++;
                }
            }
            catch (Exception ex)
            {
                dto.MensagemErro = ex.Message.Replace("'", "");
                dto.Sucesso      = false;
                notas            = new List <NotaDTO>();
                notas.Add(dto);
            }
            finally
            {
                BaseDados.FecharConexao();
            }

            return(notas);
        }