示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var usu = UsuarioBLL.BuscarPorId(Convert.ToInt32(Session["UsuarioId"]));

                if (usu != null)
                {
                    lblUsuario.Text = "Bem vindo(a) " + usu.Pessoa.Nome + "";
                }
            }
        }
示例#2
0
        public void CarregarCombos()
        {
            var lUuario    = UsuarioBLL.BuscarPorId(Convert.ToInt32(Session["UsuarioId"]));
            var lProfessor = ProfessorBLL.Listar().Where(x => x.Id == lUuario.Pessoa.Id).FirstOrDefault();

            ddlTurma.DataSource = lProfessor.Turmas;
            ddlTurma.DataBind();
            ddlTurma.Items.Insert(0, new ListItem("Selecione", "0"));


            ddlDia.DataSource = Enum.GetNames(typeof(EDiaSemana));
            ddlDia.DataBind();
            ddlDia.Items.Insert(0, new ListItem("Selecione", "0"));

            ddlHorarioAula.Items.Clear();
            ddlHorarioAula.Items.Insert(0, new ListItem("Selecione", "0"));
        }
示例#3
0
        protected void btnSolicitar_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtDataInicio.Text) || (String.IsNullOrEmpty(txtDataFinal.Text)))
            {
                ErrorMessage.Visible = true;
                FailureText.Text     = "Por gentileza selecione as datas de inicio e fim da reserva.";
                return;
            }


            if (ddlTurma.SelectedValue == "0")
            {
                ErrorMessage.Visible = true;
                FailureText.Text     = "Por gentileza selecione uma turma.";
                return;
            }


            if (ddlDia.SelectedValue == "0")
            {
                ErrorMessage.Visible = true;
                FailureText.Text     = "Por gentileza selecione uma dia.";
                return;
            }


            if (ddlHorarioAula.SelectedValue == "0")
            {
                ErrorMessage.Visible = true;
                FailureText.Text     = "Por gentileza selecione uma Hora.";
                return;
            }

            IList <Sala> lSalas = new List <Sala>();

            foreach (GridViewRow row in gdvSalas.Rows)
            {
                CheckBox cb = (CheckBox)row.FindControl("chkbox");
                if (cb != null && cb.Checked)
                {
                    lSalas.Add(SalaBLL.BuscarPorId(Convert.ToInt32(gdvSalas.DataKeys[row.RowIndex].Value)));
                }
            }

            if (lSalas.Count == 0)
            {
                ErrorMessage.Visible = true;
                FailureText.Text     = "Por gentileza selecione uma Sala";
            }
            else
            {
                string lretorno = "";
                var    usu      = UsuarioBLL.BuscarPorId(Convert.ToInt32(Session["UsuarioId"]));
                if (!SolicitacaoReservaBLL.realizarSolicitacao(Convert.ToInt32(ddlTurma.SelectedValue),
                                                               usu.Pessoa.Id, Convert.ToInt32(ddlHorarioAula.SelectedValue), Convert.ToDateTime(txtDataInicio.Text),
                                                               Convert.ToDateTime(txtDataFinal.Text), out lretorno, lSalas.ToList(), usu.Id))
                {
                    ErrorMessage.Visible = true;
                    FailureText.Text     = lretorno;
                }
                else
                {
                    SucessMessage.Visible = true;
                    SucessText.Text       = lretorno;
                    LimparCompenentes();
                }
            }
        }