コード例 #1
0
        public List <sUsrDocente> GetDocentesPorUsuarioGrupo(Guid usu_id, Guid gru_id, int sis_id, string usu_login, string usu_email, string pes_nome)
        {
            try
            {
                List <sUsrDocente> lstUsrDocentes = new List <sUsrDocente>();
                IDictionary <string, ICFG_Configuracao> lstConfig = new Dictionary <string, ICFG_Configuracao>();
                CFG_ConfiguracaoBO.Consultar(eConfig.Academico, out lstConfig);
                if (lstConfig.Any() && lstConfig.ContainsKey("appSistemaID") && !string.IsNullOrEmpty(lstConfig["appSistemaID"].cfg_valor) &&
                    sis_id == Convert.ToInt32(lstConfig["appSistemaID"].cfg_valor))
                {
                    lstUsrDocentes = ApiBO.SelecionarUsrDocentesPorUsuarioGrupo(usu_id, gru_id, sis_id, usu_login, usu_email, pes_nome);
                }

                if (lstUsrDocentes != null && lstUsrDocentes.Count > 0)
                {
                    return(lstUsrDocentes);
                }
            }
            catch (Exception e)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent("Erro: " + e.Message)
                });
            }

            throw new HttpResponseException(HttpStatusCode.NotFound);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager sm = ScriptManager.GetCurrent(Page);

            if (sm != null)
            {
                sm.Scripts.Add(new ScriptReference("~/includes/Angular/angular.js"));
                sm.Scripts.Add(new ScriptReference("~/includes/Angular/module.js"));
                sm.Scripts.Add(new ScriptReference("~/includes/Angular/Boletim.controller.js"));
            }

            if (!IsPostBack)
            {
                IDictionary <string, ICFG_Configuracao> configuracao;
                CFG_ConfiguracaoBO.Consultar(eConfig.Academico, out configuracao);
                if (configuracao.ContainsKey("AppURLAreaAlunoInfantil") && !string.IsNullOrEmpty(configuracao["AppURLAreaAlunoInfantil"].cfg_valor))
                {
                    string url            = HttpContext.Current.Request.Url.AbsoluteUri;
                    string configInfantil = configuracao["AppURLAreaAlunoInfantil"].cfg_valor;

                    infantil = url.Contains(configInfantil);
                    if (infantil)
                    {
                        VS_nomeBoletim = (string)GetGlobalResourceObject("AreaAluno.MasterPageAluno", "MenuBoletimInfantil");
                    }
                    else
                    {
                        VS_nomeBoletim = ((string)GetGlobalResourceObject("AreaAluno.MasterPageAluno", "MenuBoletimOnline")).Replace(" Online", "");
                    }
                }

                var textoRodape = GetGlobalResourceObject("Mensagens", "MSG_RODAPEBOLETIMCOMPLETO").ToString();
                divRodape.Visible = !string.IsNullOrWhiteSpace(textoRodape);
                lblRodape.Text    = textoRodape;

                var textoRodapeInfantil = GetGlobalResourceObject("Mensagens", "MSG_RODAPEBOLETIMCOMPLETOInfantil").ToString();
                divRodapeInfantil.Visible = !string.IsNullOrWhiteSpace(textoRodapeInfantil);
                lblRodapeInfantil.Text    = textoRodapeInfantil;

                var textoRodapeFreqExterna = ACA_ParametroAcademicoBO.ParametroValorPorEntidade(eChaveAcademico.MENSAGEM_FREQUENCIA_EXTERNA, __SessionWEB.__UsuarioWEB.Usuario.ent_id);
                lblFreqExterna.Text         = !string.IsNullOrEmpty(textoRodapeFreqExterna) ? "* " + textoRodapeFreqExterna : textoRodapeFreqExterna;
                lblFreqExternaInfantil.Text = !string.IsNullOrEmpty(textoRodapeFreqExterna) ? "* " + textoRodapeFreqExterna : textoRodapeFreqExterna;
            }
        }
コード例 #3
0
        /// <summary>
        /// Recarrega as configurações do sistema
        /// </summary>
        public static void RecarregarConfiguracoes()
        {
            IDictionary <string, CFG_Configuracao> configuracoes = new Dictionary <string, CFG_Configuracao>();

            foreach (CFG_Configuracao p in CFG_ConfiguracaoBO.Consultar())
            {
                configuracoes.Add(p.cfg_chave, p);
            }

            try
            {
                HttpContext.Current.Application.Lock();
                HttpContext.Current.Application["Config"] = configuracoes;
            }
            finally
            {
                HttpContext.Current.Application.UnLock();
            }
        }
コード例 #4
0
    protected void grvConfig_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        GridView grv = ((GridView)sender);

        try
        {
            if (!Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()))
            {
                CFG_Configuracao entityConfiguracao = new CFG_Configuracao()
                {
                    cfg_id = new Guid(grv.DataKeys[e.RowIndex]["cfg_id"].ToString())
                    ,
                    cfg_situacao = Byte.Parse(grv.DataKeys[e.RowIndex]["cfg_situacao"].ToString())
                };

                if (CFG_ConfiguracaoBO.Deletar(entityConfiguracao))
                {
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "cfg_id: " + entityConfiguracao.cfg_id);
                    lblMessage.Text = UtilBO.GetErroMessage("Configuração excluída com sucesso.", UtilBO.TipoMensagem.Sucesso);

                    ApplicationWEB.RecarregarConfiguracoes();
                    grv.DataBind();
                }
            }
        }
        catch (CoreLibrary.Validation.Exceptions.ValidationException ex)
        {
            lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
        }
        catch (Exception ex)
        {
            ApplicationWEB._GravaErro(ex);
            lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar excluir configuração.", UtilBO.TipoMensagem.Erro);
        }
        finally
        {
            updMessage.Update();
        }
    }
コード例 #5
0
ファイル: Util.cs プロジェクト: rafysanchez/SME-autenticador
        public static bool GravarErro(Exception ex)
        {
            try
            {
                string strSisID = CFG_ConfiguracaoBO.SelecionaValorPorChave("appSistemaID");
                int    sis_id;

                if (!Int32.TryParse(strSisID, out sis_id))
                {
                    sis_id = 1;
                }

                LOG_Erros entity = new LOG_Erros();
                entity.sis_id          = sis_id;
                entity.err_descricao   = GetErrorMessage(ex);
                entity.err_erroBase    = ex.GetBaseException().Message;
                entity.err_tipoErro    = ex.GetBaseException().GetType().FullName;
                entity.err_dataHora    = DateTime.Now;
                entity.err_machineName = Environment.MachineName;

                string strHostName;
                string clientIPAddress = "";
                try
                {
                    strHostName     = System.Net.Dns.GetHostName();
                    clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(1).ToString();
                }
                catch { }

                entity.err_ip = String.IsNullOrEmpty(clientIPAddress) ? "0.0.0.0" : clientIPAddress;

                LOG_ErrosBO.Save(entity);
            }
            catch { }

            return(false);
        }
コード例 #6
0
    protected void grvConfig_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridView grv = ((GridView)sender);

        try
        {
            CFG_Configuracao entityConfiguracao = new CFG_Configuracao()
            {
                IsNew = Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString())
                ,
                cfg_id = new Guid(grv.DataKeys[e.RowIndex]["cfg_id"].ToString())
                ,
                cfg_situacao = Byte.Parse(grv.DataKeys[e.RowIndex]["cfg_situacao"].ToString())
            };

            TextBox txtValor = (TextBox)grvConfig.Rows[e.RowIndex].FindControl("txtValor");
            if (txtValor != null)
            {
                entityConfiguracao.cfg_valor = txtValor.Text;
            }
            TextBox txtDescricao = (TextBox)grvConfig.Rows[e.RowIndex].FindControl("txtDescricao");
            if (txtDescricao != null)
            {
                entityConfiguracao.cfg_descricao = txtDescricao.Text;
            }
            TextBox txtChave = (TextBox)grvConfig.Rows[e.RowIndex].FindControl("txtChave");
            if (txtChave != null)
            {
                entityConfiguracao.cfg_chave = txtChave.Text;
            }

            if (CFG_ConfiguracaoBO.Salvar(entityConfiguracao))
            {
                if (Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()))
                {
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Insert, "cfg_id: " + entityConfiguracao.cfg_id);
                    lblMessage.Text = UtilBO.GetErroMessage("Configuração incluída com sucesso.", UtilBO.TipoMensagem.Sucesso);
                }
                else
                {
                    ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "cfg_id: " + entityConfiguracao.cfg_id);
                    lblMessage.Text = UtilBO.GetErroMessage("Configuração alterada com sucesso.", UtilBO.TipoMensagem.Sucesso);
                }
                ApplicationWEB.RecarregarConfiguracoes();
                grv.EditIndex = -1;
                grv.DataBind();
            }
        }
        catch (CoreLibrary.Validation.Exceptions.ValidationException ex)
        {
            lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
        }
        catch (DuplicateNameException ex)
        {
            lblMessage.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
        }
        catch (Exception ex)
        {
            ApplicationWEB._GravaErro(ex);
            lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar salvar configuração.", UtilBO.TipoMensagem.Erro);
        }
        finally
        {
            updMessage.Update();
        }
    }