protected void btnGravar_Click(object sender, EventArgs e)
        {
            DateTime dti = Convert.ToDateTime(tbDtinicial.Text), dtf = Convert.ToDateTime(tbDtFinal.Text);
            DateTime dtiOc = Convert.ToDateTime(Session["dti"]), dtfOc = Convert.ToDateTime(Session["dtf"]);

            if (dti < dtf && dti >= dtiOc && dtf <= dtfOc)
            {
                int codigo = 0;
                if (hfCod.Value != "")
                {
                    codigo = Convert.ToInt32(hfCod.Value);
                }

                OfertaCursoModulo ocm = new OfertaCursoModulo(codigo, Convert.ToDateTime(tbDtinicial.Text), Convert.ToDateTime(tbDtFinal.Text), Convert.ToInt32(hfCodMod.Value), Convert.ToInt32(hfOferta.Value));
                if (ocm.GravarOCM())
                {
                    ocm.GravarProfOCM(ocm.Cod, Convert.ToInt32(hfprof.Value));
                    Novo();
                    Modulos mod = new Modulos();
                    gvModulos.DataSource = mod.PesqModCurso(int.Parse(Request.QueryString["cur"]));
                    gvModulos.DataBind();
                    btnFinal.Visible  = true;
                    btnGravar.Visible = false;
                }
            }
            else
            {
                Utils u = new Utils();
                u.MsgBox(this, "Verifique a Data inicial e a Data Final");
            }
        }
Beispiel #2
0
        protected void RecuperarModulos()
        {
            Modulos mod = new Modulos();

            gvModulos.DataSource = mod.PesqModCurso(Convert.ToInt32(hfCod.Value));
            gvModulos.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     btnPesqProf.OnClientClick = "return btnPesq_Click()";
     tbProf.Attributes.Add("readonly", "readonly");
     if (!Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(Request.QueryString["oferta"]))
         {
             lInfo.Text = "Informação da Oferta de Curso: Data Incial " + Session["dti"] + " Data Final " + Session["dtf"];
             Modulos mod = new Modulos();
             hfOferta.Value       = Request.QueryString["oferta"];
             gvModulos.DataSource = mod.PesqModCurso(int.Parse(Request.QueryString["cur"]));
             gvModulos.DataBind();
             Novo();
         }
     }
 }
        protected void lbtnExcluir_Command(object sender, CommandEventArgs e)
        {
            int codigo            = Convert.ToInt32(e.CommandArgument);
            OfertaCursoModulo ocm = new OfertaCursoModulo();

            if (ocm.ExcluirPROF_OCM(codigo))
            {
                if (ocm.ExcluirOCM(codigo))
                {
                    Novo();
                    Modulos mod = new Modulos();
                    gvModulos.DataSource = mod.PesqModCurso(int.Parse(Request.QueryString["cur"]));
                    gvModulos.DataBind();
                }
            }
            else
            {
                Utils u = new Utils();
                u.MsgBox(this, "Não foi possivel excluir.");
            }
        }