Example #1
0
 protected void _grvParametros_DataBinding(object sender, EventArgs e)
 {
     try
     {
         GridView grv = ((GridView)sender);
         if (grv.DataSource == null)
         {
             grv.DataSource = CFG_ParametroDocumentoAlunoBO.GetSelect();
         }
     }
     catch (Exception ex)
     {
         ApplicationWEB._GravaErro(ex);
         _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar parâmetros de documentos do aluno.", UtilBO.TipoMensagem.Erro);
         _updMessage.Update();
     }
 }
Example #2
0
        protected void _grvParametros_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridView grv = ((GridView)sender);

            try
            {
                if (!Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()))
                {
                    CFG_ParametroDocumentoAluno entity = new CFG_ParametroDocumentoAluno
                    {
                        pda_id = Convert.ToInt32(grv.DataKeys[e.RowIndex]["pda_id"])
                        ,
                        rlt_id = Convert.ToInt32(grv.DataKeys[e.RowIndex]["rlt_id"])
                        ,
                        ent_id = new Guid(Convert.ToString(grv.DataKeys[e.RowIndex]["ent_id"]))
                        ,
                        pda_situacao = Byte.Parse(grv.DataKeys[e.RowIndex]["pda_situacao"].ToString())
                    };

                    if (CFG_ParametroDocumentoAlunoBO.Delete(entity))
                    {
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Delete, "pda_id: " + entity.pda_id + ", rlt_id: " + entity.rlt_id + ", ent_id: " + entity.ent_id);
                        _lblMessage.Text = UtilBO.GetErroMessage("Parâmetro de documentos do aluno excluído com sucesso.", UtilBO.TipoMensagem.Sucesso);

                        ApplicationWEB.RecarregarConfiguracoes();
                        grv.EditIndex = -1;
                        grv.DataBind();
                    }
                }
            }
            catch (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 parâmetro de documentos do aluno.", UtilBO.TipoMensagem.Erro);
            }
            finally
            {
                _updMessage.Update();
            }
        }
Example #3
0
        private void GerarRelatório()
        {
            try
            {
                __SessionWEB.PostMessages = String.Empty;
                string report          = String.Empty;
                string parametros      = String.Empty;
                string esc_ids         = String.Empty;
                string alu_ids_boletim = String.Empty;
                string tur_ids_boletim = String.Empty;
                string tur_ids         = String.Empty;

                _VS_AlunosSelecionados.Clear();

                if (chkTodos.Checked)
                {
                    DataTable dtAlunos = SelecionaDados();

                    foreach (DataRow row in dtAlunos.Rows)
                    {
                        if (!_VS_AlunosSelecionados.ContainsKey(Convert.ToInt64(row["alu_id"])))
                        {
                            _VS_AlunosSelecionados.Add(Convert.ToInt64(row["alu_id"]), true);
                        }

                        alu_ids_boletim = (String.IsNullOrEmpty(alu_ids_boletim) ? "" : alu_ids_boletim + ",") + row["alu_id"];
                        tur_ids_boletim = (String.IsNullOrEmpty(tur_ids_boletim) ? "" : tur_ids_boletim + ",") + row["tur_id"];
                    }
                }
                else // se só a pagina atual tem selecionados corre as linhas do grid pegando os alu_ids atuais
                {
                    foreach (GridViewRow row in grvResultados.Rows)
                    {
                        CheckBox chkSelecionar = (CheckBox)row.FindControl("chkSelecionar");

                        if (chkSelecionar.Checked)
                        {
                            if (!_VS_AlunosSelecionados.ContainsKey(Convert.ToInt64(grvResultados.DataKeys[row.RowIndex].Values["alu_id"])))
                            {
                                _VS_AlunosSelecionados.Add(Convert.ToInt64(grvResultados.DataKeys[row.RowIndex].Values["alu_id"]), true);
                            }

                            alu_ids_boletim = (String.IsNullOrEmpty(alu_ids_boletim) ? "" : alu_ids_boletim + ",") + grvResultados.DataKeys[row.RowIndex].Values["alu_id"];
                            tur_ids_boletim = (String.IsNullOrEmpty(tur_ids_boletim) ? "" : tur_ids_boletim + ",") + grvResultados.DataKeys[row.RowIndex].Values["tur_id"];
                        }
                    }
                }

                if (_VS_AlunosSelecionados.Count > 0)
                {
                    string alu_ids = String.Empty;

                    foreach (KeyValuePair <long, bool> kvp in _VS_AlunosSelecionados)
                    {
                        alu_ids = !String.IsNullOrEmpty(alu_ids) ? String.Concat(alu_ids + ',', kvp.Key) : kvp.Key.ToString();
                    }

                    String sDeclaracaoHMTL = string.Empty;
                    String sReportDev      = string.Empty;

                    sDeclaracaoHMTL = CFG_ParametroDocumentoAlunoBO.ParametroValor(ChaveParametroDocumentoAluno.DECLARACAO_HTML, __SessionWEB.__UsuarioWEB.Usuario.ent_id, (int)MSTech.GestaoEscolar.BLL.ReportNameGestaoAcademica.RelatorioGeralAtendimento);
                    report          = ((int)MSTech.GestaoEscolar.BLL.ReportNameGestaoAcademica.RelatorioGeralAtendimento).ToString();
                    parametros      = "alu_id=" + alu_ids_boletim +
                                      "&tur_id=" + tur_ids_boletim +
                                      "&rea_id=" + UCCRelatorioAtendimento.Valor +
                                      "&ent_id=" + __SessionWEB.__UsuarioWEB.Usuario.ent_id +
                                      "&nomeMunicipio=" + GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoPaisagem.Municipio") +
                                      "&nomeSecretaria=" + GetGlobalResourceObject("Reporting", "Reporting.DocDctSubCabecalhoPaisagem.Secretaria") +
                                      "&logo=" + String.Concat(MSTech.GestaoEscolar.BLL.CFG_ServidorRelatorioBO.CarregarServidorRelatorioPorEntidade(__SessionWEB.__UsuarioWEB.Usuario.ent_id, ApplicationWEB.AppMinutosCacheLongo).srr_pastaRelatorios.ToString()
                                                               , ApplicationWEB.LogoRelatorioSSRS);

                    SymmetricAlgorithm sa = new SymmetricAlgorithm(SymmetricAlgorithm.Tipo.TripleDES);

                    MSTech.GestaoEscolar.BLL.CFG_RelatorioBO.CallReport("Documentos", report, parametros, HttpContext.Current);
                }
                else
                {
                    throw new ValidationException("Selecione pelo menos um aluno para gerar relatório.");
                }
            }
            catch (ValidationException ex)
            {
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "ScrollToTop", "setTimeout('window.scrollTo(0,0);', 0);", true);
                lblMensagem.Text = UtilBO.GetErroMessage(ex.Message, UtilBO.TipoMensagem.Alerta);
            }
            catch (Exception err)
            {
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "ScrollToTop", "setTimeout('window.scrollTo(0,0);', 0);", true);
                ApplicationWEB._GravaErro(err);
                lblMensagem.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o relatório.", UtilBO.TipoMensagem.Erro);
            }
        }
Example #4
0
        protected void _btnNovo_Click(object sender, EventArgs e)
        {
            try
            {
                List <CFG_ParametroDocumentoAluno> parametros = CFG_ParametroDocumentoAlunoBO.GetSelect().ToList();
                parametros.Add(new CFG_ParametroDocumentoAluno
                {
                    IsNew = true
                    ,
                    pda_id = -1
                    ,
                    rlt_id = (byte)ParametroDocumentoAlunoRelatorio.BoletimEscolar
                    ,
                    ent_id = __SessionWEB.__UsuarioWEB.Usuario.ent_id
                    ,
                    pda_chave = Convert.ToString(ChaveParametroDocumentoAluno.FILTRA_POR_PERIODO)
                    ,
                    pda_descricao = ""
                    ,
                    pda_valor = ""
                    ,
                    pda_situacao = 1
                    ,
                    NomeRelatorio = ""
                });

                int index = (parametros.Count - 1);
                _grvParametros.EditIndex  = index;
                _grvParametros.DataSource = parametros;
                _grvParametros.DataBind();

                ImageButton imgEditar = (ImageButton)_grvParametros.Rows[index].FindControl("_imgEditar");
                if (imgEditar != null)
                {
                    imgEditar.Visible = false;
                }
                ImageButton imgSalvar = (ImageButton)_grvParametros.Rows[index].FindControl("_imgSalvar");
                if (imgSalvar != null)
                {
                    imgSalvar.Visible = true;
                }
                ImageButton imgCancelar = (ImageButton)_grvParametros.Rows[index].FindControl("_imgCancelarParametro");
                if (imgCancelar != null)
                {
                    imgCancelar.Visible = true;
                }

                ImageButton imgExcluir = (ImageButton)_grvParametros.Rows[index].FindControl("_imgExcluir");
                if (imgExcluir != null)
                {
                    imgExcluir.Visible = false;
                }

                string script = String.Format("SetConfirmDialogLoader('{0}','{1}');", String.Concat("#", imgExcluir.ClientID), "Confirma a exclusão?");
                Page.ClientScript.RegisterStartupScript(GetType(), imgExcluir.ClientID, script, true);

                _grvParametros.Rows[index].Focus();
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar adicionar novo parâmetro de documentos do aluno.", UtilBO.TipoMensagem.Erro);
                _updMessage.Update();
            }
        }
Example #5
0
        protected void _grvParametros_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridView grv = ((GridView)sender);

            try
            {
                CFG_ParametroDocumentoAluno entity = new CFG_ParametroDocumentoAluno
                {
                    IsNew = Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString())
                    ,
                    pda_id = Convert.ToInt32(grv.DataKeys[e.RowIndex]["pda_id"])
                    ,
                    pda_situacao = Byte.Parse(grv.DataKeys[e.RowIndex]["pda_situacao"].ToString())
                    ,
                    ent_id = __SessionWEB.__UsuarioWEB.Usuario.ent_id
                };

                DropDownList _ddlRelatorio = (DropDownList)_grvParametros.Rows[e.RowIndex].FindControl("_ddlRelatorio");
                if (_ddlRelatorio != null)
                {
                    entity.rlt_id = Convert.ToByte(_ddlRelatorio.SelectedValue);
                }

                DropDownList _ddlChave = (DropDownList)_grvParametros.Rows[e.RowIndex].FindControl("_ddlChave");
                if (_ddlChave != null)
                {
                    entity.pda_chave = _ddlChave.SelectedItem.Text;
                }

                TextBox txtDescricao = (TextBox)_grvParametros.Rows[e.RowIndex].FindControl("_txtDescricao");
                if (txtDescricao != null)
                {
                    entity.pda_descricao = txtDescricao.Text;
                }

                TextBox txtValor = (TextBox)_grvParametros.Rows[e.RowIndex].FindControl("_txtValor");
                if (txtValor.Text.Length > 1000)
                {
                    _lblMessage.Text = UtilBO.GetErroMessage(
                        "O tamanho do campo Valor não pode ser maior que 1000.",
                        UtilBO.TipoMensagem.Alerta);
                    return;
                }
                if (txtValor != null)
                {
                    entity.pda_valor = HttpUtility.HtmlEncode(txtValor.Text);
                }

                if (CFG_ParametroDocumentoAlunoBO.Save(entity))
                {
                    CFG_ParametroDocumentoAlunoBO.RecarregaParametrosAtivos();

                    if (Boolean.Parse(grv.DataKeys[e.RowIndex]["IsNew"].ToString()))
                    {
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Insert, "pda_id: " + entity.pda_id + ", rlt_id: " + entity.rlt_id + ", ent_id: " + entity.ent_id);
                        _lblMessage.Text = UtilBO.GetErroMessage("Parâmetro de documentos do aluno incluído com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    }
                    else
                    {
                        ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Update, "pda_id: " + entity.pda_id + ", rlt_id: " + entity.rlt_id + ", ent_id: " + entity.ent_id);
                        _lblMessage.Text = UtilBO.GetErroMessage("Parâmetro de documentos do aluno alterado com sucesso.", UtilBO.TipoMensagem.Sucesso);
                    }
                    ApplicationWEB.RecarregarConfiguracoes();
                    grv.EditIndex = -1;
                    grv.DataBind();
                }
            }
            catch (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 parâmetro.", UtilBO.TipoMensagem.Erro);
            }
            finally
            {
                _updMessage.Update();
            }
        }