Exemplo n.º 1
0
        protected void gdvAberturaAnosAnteriores_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Deletar")
            {
                try
                {
                    int index  = int.Parse(e.CommandArgument.ToString());
                    int tab_id = Convert.ToInt32(gdvAberturaAnosAnteriores.DataKeys[index].Values["tab_id"].ToString());

                    TUR_TurmaAberturaAnosAnteriores entity = new TUR_TurmaAberturaAnosAnteriores {
                        tab_id = tab_id
                    };
                    TUR_TurmaAberturaAnosAnterioresBO.GetEntity(entity);

                    if (TUR_TurmaAberturaAnosAnterioresBO.Delete(entity))
                    {
                        gdvAberturaAnosAnteriores.PageIndex = 0;
                        gdvAberturaAnosAnteriores.DataBind();
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "tab_id: " + tab_id);
                        lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "AberturaTurmasAnosAnteriores.Busca.AgendamentoExcluidoSucesso").ToString(), UtilBO.TipoMensagem.Sucesso);
                    }
                }
                catch (ValidationException ex)
                {
                    lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
                }
                catch (Exception ex)
                {
                    ApplicationWEB._GravaErro(ex);
                    lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "AberturaTurmasAnosAnteriores.Busca.ErroExcluirAgendamento").ToString(), UtilBO.TipoMensagem.Erro);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Insere e altera os dados da abertura de anos anteriores
        /// </summary>
        public void Salvar()
        {
            try
            {
                TUR_TurmaAberturaAnosAnteriores entityTurmaAberturaAnosAnteriores = new TUR_TurmaAberturaAnosAnteriores
                {
                    tab_id         = VS_tab_id,
                    tab_ano        = Convert.ToInt32(txtAno.Text),
                    uad_idSuperior = ucComboUAEscola.Uad_ID,
                    esc_id         = ucComboUAEscola.Esc_ID,
                    uni_id         = ucComboUAEscola.Uni_ID,
                    tab_dataInicio = Convert.ToDateTime(txtDataInicial.Text),
                    tab_dataFim    = string.IsNullOrEmpty(txtDataFinal.Text) ? DateTime.MinValue : Convert.ToDateTime(txtDataFinal.Text),
                    tab_status     = (byte)TUR_TurmaAberturaAnosAnterioresBO.EnumTurmaAberturaAnosAnterioresStatus.AguardandoExecucao,
                    tab_situacao   = (byte)TUR_TurmaAberturaAnosAnterioresBO.EnumTurmaAberturaAnosAnterioresSituacao.Ativo,
                    IsNew          = (VS_tab_id > 0) ? false : true
                };

                if (TUR_TurmaAberturaAnosAnterioresBO.Save(entityTurmaAberturaAnosAnteriores))
                {
                    if (VS_tab_id <= 0)
                    {
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Insert, "tab_id: " + entityTurmaAberturaAnosAnteriores.tab_id);
                        __SessionWEB.PostMessages = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "AberturaTurmasAnosAnteriores.Cadastro.SucessoIncluir").ToString(), UtilBO.TipoMensagem.Sucesso);
                    }
                    else
                    {
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "tab_id: " + entityTurmaAberturaAnosAnteriores.tab_id);
                        __SessionWEB.PostMessages = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "AberturaTurmasAnosAnteriores.Cadastro.SucessoAlterar").ToString(), UtilBO.TipoMensagem.Sucesso);
                    }

                    Response.Redirect("Busca.aspx", false);
                    HttpContext.Current.ApplicationInstance.CompleteRequest();
                }
                else
                {
                    lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "AberturaTurmasAnosAnteriores.Cadastro.ErroSalvar").ToString(), UtilBO.TipoMensagem.Erro);
                }
            }
            catch (MSTech.Validation.Exceptions.ValidationException e)
            {
                lblMessage.Text = UtilBO.GetErroMessage(e.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (DuplicateNameException e)
            {
                lblMessage.Text = UtilBO.GetErroMessage(e.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (ArgumentException e)
            {
                lblMessage.Text = UtilBO.GetErroMessage(e.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception e)
            {
                ApplicationWEB._GravaErro(e);
                lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "AberturaTurmasAnosAnteriores.Cadastro.ErroSalvar").ToString(), UtilBO.TipoMensagem.Erro);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Carrega dados a partir da entidade
        /// </summary>
        private void Carregar(long tab_id)
        {
            try
            {
                TUR_TurmaAberturaAnosAnteriores entity = new TUR_TurmaAberturaAnosAnteriores {
                    tab_id = tab_id
                };
                TUR_TurmaAberturaAnosAnterioresBO.GetEntity(entity);

                VS_tab_id              = entity.tab_id;
                txtAno.Text            = entity.tab_ano.ToString();
                ucComboUAEscola.Uad_ID = entity.uad_idSuperior;

                UCFiltroEscolas1__Selecionar();

                ucComboUAEscola.SelectedValueEscolas = new[] { entity.esc_id, entity.uni_id };
                txtDataInicial.Text = entity.tab_dataInicio.ToString("dd/MM/yyyy");
                txtDataFinal.Text   = entity.tab_dataFim != DateTime.MinValue ? entity.tab_dataFim.ToString("dd/MM/yyyy") : string.Empty;

                VS_dataIncialAnterior = entity.tab_dataInicio;

                if (entity.tab_status != (byte)TUR_TurmaAberturaAnosAnterioresBO.EnumTurmaAberturaAnosAnterioresStatus.AguardandoExecucao)
                {
                    txtDataInicial.Enabled = false;
                }

                if (entity.tab_dataFim != DateTime.MinValue)
                {
                    txtDataFinal.Text = entity.tab_dataFim.ToString("dd/MM/yyyy");

                    if (entity.tab_dataFim <= DateTime.Now.Date)
                    {
                        txtDataFinal.Enabled = false;
                    }
                }

                txtAno.Enabled = false;
                ucComboUAEscola.PermiteAlterarCombos = false;
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMessage.Text = UtilBO.GetErroMessage(GetGlobalResourceObject("Academico", "AberturaTurmasAnosAnteriores.Cadastro.ErroCarregarDadosAgendamentos").ToString(), UtilBO.TipoMensagem.Erro);
            }
        }
Exemplo n.º 4
0
        protected void gdvAberturaAnosAnteriores_DataBound(object sender, EventArgs e)
        {
            UCTotalRegistros.Total = TUR_TurmaAberturaAnosAnterioresBO.GetTotalRecords();
            // Seta propriedades necessárias para ordenação nas colunas.
            ConfiguraColunasOrdenacao(gdvAberturaAnosAnteriores);

            if ((!string.IsNullOrEmpty(gdvAberturaAnosAnteriores.SortExpression)) &&
                (__SessionWEB.BuscaRealizada.PaginaBusca == PaginaGestao.AberturaTurmasAnosAnteriores))
            {
                Dictionary <string, string> filtros = __SessionWEB.BuscaRealizada.Filtros;

                if (filtros.ContainsKey("VS_Ordenacao"))
                {
                    filtros["VS_Ordenacao"] = gdvAberturaAnosAnteriores.SortExpression;
                }
                else
                {
                    filtros.Add("VS_Ordenacao", gdvAberturaAnosAnteriores.SortExpression);
                }

                if (filtros.ContainsKey("VS_SortDirection"))
                {
                    filtros["VS_SortDirection"] = gdvAberturaAnosAnteriores.SortDirection.ToString();
                }
                else
                {
                    filtros.Add("VS_SortDirection", gdvAberturaAnosAnteriores.SortDirection.ToString());
                }

                __SessionWEB.BuscaRealizada = new BuscaGestao
                {
                    PaginaBusca = PaginaGestao.AberturaTurmasAnosAnteriores
                    ,
                    Filtros = filtros
                };
            }
        }