Пример #1
0
    protected void gvPesquisa_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Matricular")
            {
                int alunoID = int.Parse(e.CommandArgument.ToString());

                var consulta = (from p in bd.db._GEM_Matriculas
                                where p.alunoID == alunoID && p._GEM.status == 2 //verifica se o aluno já está matriculado em uma GEM ativa
                                select p).ToList();
                if (consulta.Count > 0)
                {
                    ClientScript.RegisterStartupScript(GetType(), "alerta", "alert('Aluno já matriculado na GEM id: " + consulta[0].gemID.ToString() + ". Consulte o suporte para mais informações!');", true);
                }
                else
                {
                    var matricula = new _GEM_Matricula();
                    matricula.alunoID  = alunoID;
                    matricula.data     = app.DateTimeCorrigido();
                    matricula.gemID    = idGem;
                    matricula.statusID = 1;

                    bd.db._GEM_Matriculas.InsertOnSubmit(matricula);

                    var gem = (from p in bd.db._GEMs
                               where p.Id == idGem
                               select p).Single();
                    gem.status = 2;

                    var aluno = (from p in bd.db._alunos
                                 where p.id == alunoID
                                 select p).Single();

                    if (aluno.matricula == null)
                    {
                        aluno.matricula = GeraMatricula(idGem, gem.periodoID.Value, alunoID).ToString();
                    }

                    bd.db.SubmitChanges();

                    //lança no log
                    _user usuarioLogado = (_user)Session["usuarioLogado"];
                    log.AdicionarEntrada(26, usuarioLogado.id, 6, "", 1, 0);

                    CarregaForm();

                    txtNome.Text          = string.Empty;
                    gvPesquisa.DataSource = null;
                    gvPesquisa.DataBind();

                    ClientScript.RegisterStartupScript(GetType(), "alerta", "alert('Matrícula realizada com sucesso!');", true);
                }
            }
        }
        catch (Exception e3)
        {
            ClientScript.RegisterStartupScript(GetType(), "alerta", "alert('" + e3.Message + "');", true);
        }
    }
Пример #2
0
    protected void btnLancarMts_Click(object sender, EventArgs e)
    {
        try
        {
            var mts = (from p in bd.db._GEM_MTS_Teoria_Assuntos
                       where p.modulo == int.Parse(ddlModuloMts.SelectedValue) &&
                       p.assunto == ddlAssuntosMts.SelectedValue
                       select p.id).Single();

            _GEM_Academico acad = new _GEM_Academico();
            acad.data  = DateTime.Parse(txtDataMts.Text);
            acad.gemID = idGem;
            acad.mts   = mts;

            bd.db._GEM_Academicos.InsertOnSubmit(acad);
            bd.db.SubmitChanges();

            //lança no log
            _user usuarioLogado = (_user)Session["usuarioLogado"];
            log.AdicionarEntrada(32, usuarioLogado.id, 6, "", 1, 0);

            CarregaHistoricoAssuntosMTS();

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Assunto da aula registrado com sucesso!!');", true);

            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Funcionalidade ainda não Liberada pelo desenvolvedor!');", true);
        }
        catch
        { }
    }
Пример #3
0
    protected void btnCadastrar_Click(object sender, EventArgs e)
    {
        try
        {
            var chekCodigo = (from p in bd.db._igrejas
                              where p.codigoRelatorio == int.Parse(txtCodigoRelatorio.Text.Trim())
                              select p).ToList();
            if (chekCodigo.Count > 0)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Já existe uma Congregação cadastrada com esse código do relatório!');", true);
            }
            else
            {
                _igreja igreja = new _igreja();
                igreja.cidadeID        = (from p in bd.db._municipios where p.descricao == ddlCidade.SelectedValue select p.id).Single();
                igreja.cidadeRegiaoID  = (from p in bd.db._cidadeRegiaos where p.descricao == ddlRegiao.SelectedValue select p.id).Single();
                igreja.codigoRelatorio = int.Parse(txtCodigoRelatorio.Text.Trim());
                igreja.descricao       = txtNome.Text.Trim();

                bd.db._igrejas.InsertOnSubmit(igreja);
                bd.db.SubmitChanges();

                _user usuarioLogado = (_user)Session["usuarioLogado"];
                log.AdicionarEntrada(10, usuarioLogado.id, 6, "", 1, 0);

                CarregaForm();

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Congregação cadastrada com Sucesso!');", true);
            }
        }
        catch
        {
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        usuarioLogado = (_user)Session["usuarioLogado"];

        if (!IsPostBack)
        {
            CarregaForm();
        }
    }
Пример #5
0
    public void addNewUser(_user _user)
    {
        string time_now = DateTime.Now.ToString("yyyy-MM-dd");
        string dob      = (_user.dob).ToString("yyyy-MM-dd");
        string query    = "INSERT INTO _user (user_name,user_code,private_email,searching_email,password,dob,gender,nationality,address,member_date,contact_number,active,position_id,credits) VALUES ('" + _user.user_name + "', '" + _user.user_code + "', '" + _user.private_email + "', '" + _user.searching_email + "', '" + _user.password + "', '" + dob + "', '" + _user.gender + "', '" + _user.nationality + "', '" + _user.address + "', '" + time_now + "','" + _user.contact_number + "',1,2,0)";

        performQuery(query).ExecuteNonQuery();

        dbRef.close();
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        usuarioLogado = (_user)Session["usuarioLogado"];

        if (!IsPostBack)
        {
            CarregaForm();
            ddlCidade_SelectedIndexChanged(sender, e);
        }
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        usuarioLogado = (_user)Session["usuarioLogado"];
        editMode      = Request.QueryString["editMode"];
        alunoID       = Request.QueryString["alunoId"];

        if (!IsPostBack)
        {
            CarregaForm(editMode);
        }
    }
Пример #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        usuarioLogado = (_user)Session["usuarioLogado"];

        exameID = int.Parse(Request.QueryString["exameid"]);

        if (!IsPostBack)
        {
            CarregaAlunosIncluidos();
        }
    }
 protected void imgbPerfil_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         _user usuarioLogado = (_user)Session["usuarioLogado"];
         Response.Redirect("~/perfil/?user=" + usuarioLogado.id);
     }
     catch
     {
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["usuarioLogado"] != null)
     {
         usuario = (_user)Session["usuarioLogado"];
     }
     else
     {
         Response.Redirect("~/Logoff.aspx");
     }
 }
Пример #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        usuarioLogado = (_user)Session["usuarioLogado"];
        carregaForma();

        Usuarios();
        Acoes();
        GemsAtivas();
        CandidatosCidade();
        CandidatosInstrumento();
        AlunosInstrumento();
    }
Пример #12
0
 private void CarregarForm()
 {
     try
     {
         _user usuarioLogado = (_user)Session["usuarioLogado"];
         imgbPerfil.ImageUrl = "~/data/user/" + usuarioLogado.id + "/img/perfil.jpg";
         //imgbPerfil.PostBackUrl = "~/perfil/?user=" + usuarioLogado.id;
     }
     catch
     {
     }
 }
Пример #13
0
    public void addNewUser(_user _user)
    {
        string time_now = DateTime.Now.ToString("yyyy-MM-dd");

        string dob   = (_user.dob).ToString("yyyy-MM-dd");
        string query = "INSERT INTO _user (user_name,user_code,private_email,searching_email,password,dob,gender,nationality,address,member_date,contact_number,active,position_id,credits) VALUES ('" + _user.user_name + "', '" + _user.user_code + "', '" + _user.private_email + "', '" + _user.searching_email + "', '" + _user.password + "', '" + dob + "', '" + _user.gender + "', '" + _user.nationality + "', '" + _user.address + "', '" + time_now + "','" + _user.contact_number + "',1," + _user.position_id + ",0)";

        performQuery(query).ExecuteNonQuery();

        dbRef.close();
        System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('User has been Added');", true);
    }
Пример #14
0
    protected void gvMatriculados_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int alunoID = int.Parse(e.CommandArgument.ToString());
            if (e.CommandName == "excluir")
            {
                ////!!!! AQUI FALTA CHECAR SE O ALUNO PODE OU NÃO SER DELETADO!!!

                var matricula = (from p in bd.db._GEM_Matriculas
                                 where p.alunoID == alunoID && p.gemID == idGem
                                 select p).Single();

                bd.db._GEM_Matriculas.DeleteOnSubmit(matricula);
                bd.db.SubmitChanges();

                //lança no log
                _user usuarioLogado = (_user)Session["usuarioLogado"];
                log.AdicionarEntrada(50, usuarioLogado.id, 6, "", 1, 0);

                CarregaForm();

                ClientScript.RegisterStartupScript(GetType(), "alerta", "alert('Matrícula deletada com sucesso!');", true);
            }
            if (e.CommandName == "transferir")
            {
                var aluno = (from p in bd.db._alunos
                             where p.id == alunoID
                             select p).Single();

                var gemAtual = (from p in bd.db._GEM_Matriculas
                                where p.alunoID == alunoID &&
                                p.statusID == 1
                                select p._GEM._municipio.descricao + " - " + p._GEM._igreja.descricao + " - " + p._GEM._instrumentoNipe.descricao + " - " + p._GEM._GEM_Periodo.descricao).Single();

                lblAlunoId.Text   = alunoID.ToString();
                lblNomeAluno.Text = aluno.nome;
                lblGemAtual.Text  = gemAtual;
                CarregaGensDdl();


                fdsPesquisa.Visible           = false;
                fdsAlunosMatriculados.Visible = false;
                fdsTransferir.Visible         = true;
                hlBackMatricula.Visible       = true;
            }
        }
        catch (Exception e4)
        {
            ClientScript.RegisterStartupScript(GetType(), "alerta", "alert('" + e4.Message + "');", true);
        }
    }
Пример #15
0
    private void CarregaForm()
    {
        try
        {
            _user usuario = new _user();
            usuario = (_user)Session["usuarioLogado"];

            //encarregados locais
            if (usuario.tipoID == 2)
            {
                var pedidos = (from p in bd.db._PedidoDeInstrumentos
                               where p.usuarioID == usuario.id
                               select new
                {
                    ID = p.id,
                    RECEBEDOR = p.nomeRecebedor,
                    COMUM = p._igreja.descricao,
                    INSTRUMENTO = p._instrumento.descricao,
                    TONALIDADE = p.tonalidade,
                    ENCARREGADO = p.encarregado,
                    SOLICITANTE = p._user.nome,
                    STATUS = p._PedidoInstrumentoStatus.descricao,
                    OBSERVAÇÕES = (p.obs.Length > 0) ? p.obs : "---"
                }).ToList();
                gvPedidos.DataSource = pedidos;
                gvPedidos.DataBind();
            }
            //desenvolvedores, secretarios e encarregados regionais
            else if (usuario.tipoID == 8 || usuario.tipoID == 9 || usuario.tipoID == 1)
            {
                var pedidos = (from p in bd.db._PedidoDeInstrumentos
                               select new
                {
                    ID = p.id,
                    RECEBEDOR = p.nomeRecebedor,
                    COMUM = p._igreja.descricao,
                    INSTRUMENTO = p._instrumento.descricao,
                    TONALIDADE = p.tonalidade,
                    ENCARREGADO = p.encarregado,
                    SOLICITANTE = p._user.nome,
                    STATUS = p._PedidoInstrumentoStatus.descricao,
                    OBSERVAÇÕES = (p.obs.Length > 0) ? p.obs : "---"
                }).ToList();
                gvPedidos.DataSource = pedidos;
                gvPedidos.DataBind();
            }
        }
        catch
        {
        }
    }
Пример #16
0
    private void CarregaID()
    {
        userID        = null;
        usuarioLogado = (_user)Session["usuarioLogado"];

        if (Request.QueryString["user"] == null || Request.QueryString["user"] == string.Empty)
        {
            userID = usuarioLogado.id.ToString();
        }
        else
        {
            userID = Request.QueryString["user"];
        }
    }
Пример #17
0
    protected void btnCadastrar_Click(object sender, EventArgs e)
    {
        try
        {
            _bemPatrimonio novo = new _bemPatrimonio();
            novo.anoFabricacao   = txtAnoFabricacao.Text.Trim();
            novo.caracteristicas = txtCaracteristicas.Text.Trim();
            novo.componentes     = txtComponentes.Text.Trim();
            if (txtDtEntrada.Text != string.Empty)
            {
                novo.dataEntrada = DateTime.Parse(txtDtEntrada.Text.Trim()).Date;
            }
            novo.empresa          = txtEmpresa.Text.Trim();
            novo.instrumentoID    = (from p in bd.db._instrumentos where p.descricao == ddlDescricao.SelectedValue select p.id).Single();
            novo.marca            = txtMarca.Text.Trim();
            novo.naturezaID       = (from p in bd.db._instrumentoNaturezas where p.descricao == ddlNatureza.SelectedValue select p.id).Single();
            novo.numeroNotaFiscal = txtNumeroNota.Text.Trim();
            novo.numeroTombamento = txtNumeroTombamento.Text.Trim();
            novo.obs        = txtObs.Text.Trim();
            novo.tonalidade = txtTonalidade.Text.Trim();
            if (txtValor.Text.Length > 0)
            {
                novo.valor = decimal.Parse(txtValor.Text.Trim());
            }
            else
            {
                novo.valor = 0;
            };
            novo.statusID = 1;

            bd.db._bemPatrimonios.InsertOnSubmit(novo);
            bd.db.SubmitChanges();

            _user usuarioLogado = (_user)Session["usuarioLogado"];
            log.AdicionarEntrada(3, usuarioLogado.id, 6, "", 1, 0);

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Bem Cadastrado com Sucesso!');", true);

            LimparForm();
            CarregaForm();
        }
        catch (Exception er1)
        {
            lblError.Text = er1.Message;
        }
    }
Пример #18
0
    protected void btnLancarMetodo_Click(object sender, EventArgs e)
    {
        try
        {
            var aluno = (from p in bd.db._alunos
                         where p.id == int.Parse(Session["alunoID"].ToString())
                         select p).Single();

            var instrumentoAluno = (from p in bd.db._instrumentos
                                    where p.id == aluno.instrumentoID
                                    select p).Single();

            _GEM_Academico academico = new _GEM_Academico();
            academico.data         = Convert.ToDateTime(txtDataMetodo.Text);
            academico.alunoID      = int.Parse(Session["alunoID"].ToString());
            academico.gemID        = idGem;
            academico.metodo       = (from p in bd.db._instrumentoMetodos where p.descricao == ddlMetodos.Text && p.instrumentoID == instrumentoAluno.id select p.id).Single();
            academico.metodoPagina = int.Parse(txtMetodoPagina.Text.Trim());
            academico.metodoLicao  = txtMetodoLicao.Text.Trim();
            academico.metodoObs    = txtMetodoObs.Text.Trim();


            bd.db._GEM_Academicos.InsertOnSubmit(academico);
            bd.db.SubmitChanges();

            //lança no log
            _user usuarioLogado = (_user)Session["usuarioLogado"];
            log.AdicionarEntrada(34, usuarioLogado.id, 6, "", 1, 0);

            txtMetodoPagina.Text = "";
            txtMetodoLicao.Text  = "";
            txtMetodoObs.Text    = "";



            CarregaMetodo(int.Parse(Session["alunoID"].ToString()));

            //mtv.SetActiveView(viewHome);

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Lançamento de prática inserido com sucesso!');", true);
        }
        catch (Exception er2)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('" + er2.Message + "');", true);
        }
    }
Пример #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            txtNome.Focus();
            CarregaTipos();
        }

        if (Session["usuarioLogado"] != null)
        {
            usuario = (_user)Session["usuarioLogado"];
        }
        else
        {
            Response.Redirect("~/Logoff.aspx");
        }
    }
Пример #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        usuarioLogado = (_user)Session["usuarioLogado"];

        exameID = int.Parse(Request.QueryString["exameid"]);

        GetDadosExame();

        if (!IsPostBack)
        {
            GetAlunosExame(exameID);
        }



        //link do botao voltar
        hlBackResultado.NavigateUrl = "LancarResultado.aspx?exameid=" + exameID;
    }
Пример #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        usuarioLogado = (_user)Session["usuarioLogado"];

        idGem = int.Parse(Request.QueryString["idg"].ToString());


        //links dos botões de voltar
        hlBack.NavigateUrl         = "~/gem/Academico.aspx?idg=" + idGem;
        hlBackMts.NavigateUrl      = "~/gem/Academico.aspx?idg=" + idGem;
        hlBackPresenca.NavigateUrl = "~/gem/Academico.aspx?idg=" + idGem;
        hlBackMetodo.NavigateUrl   = "~/gem/Academico.aspx?idg=" + idGem;

        if (!IsPostBack)
        {
            CarregaForm();
            mtv.SetActiveView(viewHome);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            usuarioLogado = (_user)Session["usuarioLogado"];


            descricao             = Request.QueryString["desc"].ToString();
            lblDescricaoTemp.Text = descricao;

            imgTemp.ImageUrl = "~/data/user/" + usuarioLogado.id.ToString() + "/img/tempPostImage.jpg";

            privado      = Request.QueryString["p"].ToString();
            visibilidade = Request.QueryString["v"].ToString();
        }
        catch
        {
        }
    }
Пример #23
0
    protected void btnGravar_Click(object sender, EventArgs e)
    {
        try
        {
            _user usuario = new _user();
            usuario = (_user)Session["usuarioLogado"];

            string[] comum = ddlCongregação.SelectedValue.Split('-');

            _PedidoDeInstrumento novo = new _PedidoDeInstrumento();
            if (txtEmail.Text.Length > 0)
            {
                novo.email = txtEmail.Text.Trim();
            }
            else
            {
                novo.email = null;
            }
            novo.encarregado   = txtEncarregado.Text.Trim();
            novo.endereco      = txtEndereço.Text.Trim();
            novo.igrejaID      = bd.db._igrejas.Where(x => x.descricao == comum[0].Trim()).Select(x => x.id).Single();
            novo.inicioEstudos = DateTime.Parse(txtDataInicio.Text.Trim()).Date;
            novo.instrumentoID = bd.db._instrumentos.Where(x => x.descricao == ddlInstrumento.SelectedValue).Select(x => x.id).Single();
            novo.nomeRecebedor = txtRecebedor.Text.Trim();
            novo.statusID      = 1;
            novo.telefone      = txtTelefone.Text.Trim();
            novo.tonalidade    = ddlTonalidade.SelectedValue;
            novo.usuarioID     = usuario.id;
            novo.dataPedido    = app.DateTimeCorrigido();

            bd.db._PedidoDeInstrumentos.InsertOnSubmit(novo);
            bd.db.SubmitChanges();

            LimpaForm();

            log.AdicionarEntrada(19, usuario.id, 6, "", 1, 0);

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Seu pedido foi Enviado com sucesso! Você pode acompanhar o status do seu pedido na tela de Pedidos Realizados.');", true);
        }
        catch
        {
        }
    }
Пример #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Session["usuarioLogado"] != null)
         {
             _user usuarioLogado = (_user)Session["usuarioLogado"];
             log.AdicionarEntrada(2, usuarioLogado.id, 6, "", 1, 0);
             Session.Clear();
             Response.Redirect("~/Default.aspx");
         }
         else
         {
             Response.Redirect("~/Default.aspx");
         }
     }
     catch
     {
     }
 }
Пример #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //passa as tags dos usuarios
        //-----------------------------------------------
        var usuarios = (from p in bd.db._users
                        select p).ToList();

        ArrayList arrayList = new ArrayList();

        for (int i = 0; i < usuarios.Count; i++)
        {
            arrayList.Add(usuarios[i].nome);
        }

        //Atribuindo os valores ao HiddenField
        HiddenField1.Value = ArrayListToString(arrayList);

        //-----------------------------------------------


        if (Session["usuarioLogado"] != null)
        {
            _user usuario = new _user();
            usuario = (_user)Session["usuarioLogado"];

            lblLogadoComo.Text = "Bem vindo " + usuario.nome;
        }
        else
        {
            Response.Redirect("~/Logoff.aspx");
        }

        if (!IsPostBack)
        {
            CarregarForm();
        }

        MontaMenu();

        lblVersion.Text = app.GetVersion();
    }
Пример #26
0
    protected void add_user__btn_Click(object sender, EventArgs e)
    {
        if (user_name.Text == "" || user_code.Text == "" || private_email.Text == "" || searching_email.Text == "" || password1.Text == "" || dob.Text == "" || gender.Text == "" || nationality.Text == "" || address.Text == "" || contact_number.Text == "")
        {
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert(' Please fill up all details!!');", true);
        }
        else
        {
            _user USER = new _user();

            USER.user_name      = user_name.Text; USER.user_code = user_code.Text;
            USER.private_email  = private_email.Text; USER.searching_email = searching_email.Text.Trim();
            USER.password       = password1.Text; USER.dob = DateTime.Parse(dob.Text);
            USER.gender         = Char.Parse(gender.SelectedValue.ToString());
            USER.nationality    = nationality.Text;
            USER.position_id    = Convert.ToInt16(position_txt.SelectedValue);
            USER.address        = address.Text;
            USER.contact_number = contact_number.Text;


            addNewUser(USER);



            Literal Literal1 = new Literal();
            Literal1.Text = "The New User " + user_name.Text + " with ID:" + user_code.Text + " has been added, thank you";

            Literal Literal2 = new Literal();
            Literal2.Text = "The New User " + user_name.Text + " with ID:" + user_code.Text + " has been added, thank you";

            // PlaceHolder1.Controls.Add(Literal1);
            PlaceHolder2.Controls.Add(Literal1);



            msg.Text  = "The New User " + user_name.Text + " with ID:" + user_code.Text + " has been added, thank you";
            msg1.Text = "The New User " + user_name.Text + " with ID:" + user_code.Text + " has been added, thank you";
        }
        System.Threading.Thread.Sleep(3000);
    }
Пример #27
0
 public bool load(string location)
 {
     try
     {
         if (!File.Exists(location))
         {
             return(false);
         }
         int i = 0;
         using (var reader = new StreamReader(location))//https://stackoverflow.com/questions/5282999/reading-csv-file-and-storing-values-into-an-array
         {
             while (!reader.EndOfStream)
             {
                 string   line      = reader.ReadLine();
                 string[] delimiter = { ", " };
                 var      values    = line.Split(delimiter, StringSplitOptions.None);
                 if (values.Count() == 1 || values[1] == "SD Tickets")
                 {
                     continue;
                 }
                 _user temp = new _user();
                 temp.name         = values[0];
                 temp.sd           = Int32.Parse(values[1]);
                 temp.ml           = Int32.Parse(values[2]);
                 temp.email        = Int32.Parse(values[3]);
                 temp.sd_change    = Int32.Parse(values[4]);
                 temp.ml_change    = Int32.Parse(values[5]);
                 temp.email_change = Int32.Parse(values[6]);
                 userdb[i++]       = temp;
             }
         }
         return(true);
     }
     catch (Exception e)
     {
         errorlogging(e);
         return(false);
     }
 }
Пример #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            usuarioLogado = (_user)Session["usuarioLogado"];

            if (!IsPostBack)
            {
                CarregaDownloads();
            }

            if (usuarioLogado._userTipo.id == 9 || usuarioLogado._userTipo.id == 8)
            {
            }
            else
            {
                fsUpload.Visible = false;
            }
        }
        catch (Exception)
        {
            Response.Redirect("~/");
        }
    }
Пример #29
0
    protected void btnLancarPresenca_Click(object sender, EventArgs e)
    {
        try
        {
            //checar se a resença já foi dada naquele dia.
            DateTime dtGem = Convert.ToDateTime(String.Format("{0:MM/dd/yyyy}", txtPresencaData.Text));

            var presencaGem = (from p in bd.db._GEM_Presencas
                               where p.gemID == idGem && p.dataGem == dtGem
                               select p).ToList();

            if (presencaGem.Count < 1)
            {
                int quantPresencas = 0;
                int idGEM          = 0;

                //Pegar todos os itens do repeater (item por item)
                for (int i = 0; i < rpPresenca.Items.Count; i++)
                {
                    //Pegando os HiddenFields dentro do repeater
                    HiddenField hfAlunoID = (HiddenField)rpPresenca.Items[i].FindControl("hfAlunoID");
                    HiddenField hfGemID   = (HiddenField)rpPresenca.Items[i].FindControl("hfGemID");
                    idGEM = int.Parse(hfGemID.Value.ToString());

                    //Pegando o CheckBox dentro do repeater
                    CheckBox cb = (CheckBox)rpPresenca.Items[i].FindControl("cb1");



                    //Verificar se foi selecionado (presenca dada)
                    if (cb.Checked)
                    {
                        //gravar presenca
                        _user usuarioLogado = (_user)Session["usuarioLogado"];

                        _GEM_Presenca presenca = new _GEM_Presenca();
                        presenca.alunoID          = int.Parse(hfAlunoID.Value.ToString());
                        presenca.dataGem          = dtGem;
                        presenca.dataHoraRegistro = DateTime.Now;
                        presenca.gemID            = int.Parse(hfGemID.Value.ToString());
                        presenca.usuarioID        = usuarioLogado.id;

                        bd.db._GEM_Presencas.InsertOnSubmit(presenca);
                        bd.db.SubmitChanges();


                        //lança no log

                        log.AdicionarEntrada(37, usuarioLogado.id, 6, "", 1, 0);
                        quantPresencas++;
                    }
                }

                if (quantPresencas == 0)
                {
                    //nenhum aluno veio, e nada foi selecionado

                    //gravar presenca
                    _user usuarioLogado = (_user)Session["usuarioLogado"];

                    _GEM_Presenca presenca = new _GEM_Presenca();
                    presenca.alunoID          = null;
                    presenca.dataGem          = dtGem;
                    presenca.dataHoraRegistro = DateTime.Now;
                    presenca.gemID            = idGEM;
                    presenca.usuarioID        = usuarioLogado.id;

                    bd.db._GEM_Presencas.InsertOnSubmit(presenca);
                    bd.db.SubmitChanges();


                    //lança no log

                    log.AdicionarEntrada(37, usuarioLogado.id, 6, "", 1, 0);
                }


                // tudo isso só pra regarregar os gvs!!!!!
                var alunosGem = (from p in bd.db._alunos
                                 join m in bd.db._GEM_Matriculas
                                 on p.id equals m.alunoID
                                 where m.gemID == idGem && m.statusID == 1
                                 select p).ToList();



                var presencasLancadas = (from p in bd.db._GEM_Presencas
                                         where p.gemID == idGem

                                         select new
                {
                    //ID = p.Id,
                    DATA = String.Format("{0:dd/MM/yyyy}", p.dataGem),
                    PRESENCAS = (from a in bd.db._GEM_Presencas
                                 where a.gemID == idGem &&
                                 a.dataGem == p.dataGem &&
                                 a.alunoID != null
                                 select p).ToList().Count(),
                    FALTAS = alunosGem.Count() - (from a in bd.db._GEM_Presencas
                                                  where a.gemID == idGem &&
                                                  a.dataGem == p.dataGem &&
                                                  a.alunoID != null
                                                  select p).ToList().Count()
                }).ToList().Distinct();


                gvPresencaLancada.DataSource = presencasLancadas;
                gvPresencaLancada.DataBind();

                //-------------------

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Presenças lançadas com sucesso!!');", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Já foram dadas as presenças para a GEM na data " + String.Format("{0:dd/MM/yyyy}", dtGem.Date.ToString().Replace(" 00:00:00", "")) + ". Re-lançamento em desenvolvimento.');", true);
            }
        }
        catch (Exception e43)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('" + e43.Message + "');", true);
        }
    }
Пример #30
0
    protected void btnLancarHinos_Click(object sender, EventArgs e)
    {
        try
        {
            //Pegar todos os itens do repeater
            for (int i = 0; i < rpHinos.Items.Count; i++)
            {
                //Pegando o HiddenField dentro do repeater
                HiddenField hf = (HiddenField)rpHinos.Items[i].FindControl("hf1");

                //Pegando o CheckBox dentro do repeater
                CheckBox cb = (CheckBox)rpHinos.Items[i].FindControl("cb1");

                //Verificar se foi selecionado
                if (cb.Checked)
                {
                    //Pegar o Value e o Text dos itens selecionados do repeater
                    //Response.Write("Value:" + hf.Value + " Text:" + cb.Text + "<br />");
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('" + "Value:" + hf.Value + " Text:" + cb.Text + "<br />"+"');", true);

                    var hinosPassados = (from p in bd.db._GEM_Academicos
                                         where p.gemID == idGem
                                         select p).ToList();

                    if (hinosPassados.Count > 0)
                    {
                        for (int d = 0; d < hinosPassados.Count; d++)
                        {
                            //atualiza hinos hinosPassados
                            hinosPassados = (from p in bd.db._GEM_Academicos
                                             where p.gemID == idGem
                                             select p).ToList();
                            var check = (from p in bd.db._GEM_Academicos
                                         where p.gemID == idGem &&
                                         p.hino == int.Parse(hf.Value) &&
                                         p.vozID == (from v in bd.db._instrumentoVozs where v.voz == ddlVozHino.SelectedValue select v.id).Single() &&
                                         p.alunoID == int.Parse(hfAlunoID.Value)
                                         select p).ToList();

                            //checa se o hino já não foi passado
                            if (check.Count > 0)
                            {
                            }
                            else
                            {
                                _GEM_Academico academico = new _GEM_Academico();
                                academico.data    = Convert.ToDateTime(txtData.Text);
                                academico.alunoID = int.Parse(hfAlunoID.Value.ToString());
                                academico.gemID   = idGem;
                                academico.hino    = int.Parse(hf.Value);
                                academico.vozID   = (from p in bd.db._instrumentoVozs where p.voz == ddlVozHino.SelectedValue select p.id).Single();

                                bd.db._GEM_Academicos.InsertOnSubmit(academico);
                                bd.db.SubmitChanges();

                                //lança no log
                                _user usuarioLogado = (_user)Session["usuarioLogado"];
                                log.AdicionarEntrada(31, usuarioLogado.id, 6, "", 1, 0);
                            }
                        }
                    }
                    //nenhum hino foi passado
                    else
                    {
                        _GEM_Academico academico = new _GEM_Academico();
                        academico.data    = Convert.ToDateTime(String.Format("{0:MM/dd/yyyy}", txtData.Text));
                        academico.alunoID = int.Parse(hfAlunoID.Value.ToString());
                        academico.gemID   = idGem;
                        academico.hino    = int.Parse(hf.Value);
                        academico.vozID   = (from p in bd.db._instrumentoVozs where p.voz == ddlVozHino.SelectedValue select p.id).Single();

                        bd.db._GEM_Academicos.InsertOnSubmit(academico);
                        bd.db.SubmitChanges();

                        //lança no log
                        _user usuarioLogado = (_user)Session["usuarioLogado"];
                        log.AdicionarEntrada(31, usuarioLogado.id, 6, "", 1, 0);
                    }
                }
            }

            CarregaHinos(int.Parse(hfAlunoID.Value));
            CarregaHistoricoHinos(int.Parse(hfAlunoID.Value));

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('Hinos lançados com sucesso!!');", true);
        }
        catch (Exception e43)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alerta", "alert('" + e43.Message + "');", true);
        }
    }