protected void btnNovaMsg_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtResponder.Text)) { string prof = Session["nome"].ToString(); string[] nomeProf = prof.Split(' '); string usuario = nomeProf[0] + " " + nomeProf[nomeProf.Length - 1]; string matricula = Session["matricula"].ToString(); string msg = txtResponder.Text; int cod = Convert.ToInt32(lblMsgId.Text); Mensagem men = new Mensagem(cod, matricula, msg, usuario); if (Mensagem_DB.Insert(men) == 0) { Requerimento_DB.UpdateTime(cod); abrirMensagens(cod); } } txtResponder.Text = ""; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); UpdatePanel3.Update(); CarregarGridAtivos(); UpdatePanelAtivados.Update(); }
protected void btnModal_Command(object sender, CommandEventArgs e) { int ID = Convert.ToInt32(e.CommandArgument); Requerimento req = Requerimento_DB.Select(ID); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); lblMsgAssunto.Text = req.Assunto; lblMsgProfessor.Text = req.Usuario; //lblMsgCategoria.Text = req.Categoria; lblMsgId.Text = req.CodigoReq.ToString(); switch (req.Status) { case 1: lblMsgStatus.Text = "Aberto"; mdlHeader.Attributes["style"] = "background-color: #960d10;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; break; case 2: lblMsgStatus.Text = "Em Andamento"; mdlHeader.Attributes["style"] = "background-color: #f9ae0e;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; break; case 3: lblMsgStatus.Text = "Finalizado"; mdlHeader.Attributes["style"] = "background-color: #0D9643;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);;"; break; } abrirMensagens(req.CodigoReq); UpdatePanel3.Update(); }
public void CarregarGridAtivos() { //ABERTO DataSet ds = Requerimento_DB.SelectS(1); //criando um data set com as solicitações abertas int qtd = ds.Tables[0].Rows.Count; //qtd de linhas do ds //se qtd for maior que zero, ou seja, se tiver dados no data set gdvRequerimentoAberto.DataSource = ds.Tables[0].DefaultView; //fonte de dados do grid view recebe o ds criado anteriormente gdvRequerimentoAberto.DataBind(); //preenche o grid view com os dados if (qtd > 0) { lblQtdRegistro.Text = "Foram encontrados " + qtd + " Solicitações"; } else { lblQtdRegistro.Text = "Nenhuma Solicitação foi encontrada."; } //EM ANDAMENTO ds = Requerimento_DB.SelectS(2); //criando um data set com as solicitações abertas qtd = ds.Tables[0].Rows.Count; //qtd de linhas do ds //se qtd for maior que zero, ou seja, se tiver dados no data set gdvRequerimentoAndamento.DataSource = ds.Tables[0].DefaultView; //fonte de dados do grid view recebe o ds criado anteriormente gdvRequerimentoAndamento.DataBind(); //preenche o grid view com os dados if (qtd > 0) { lblQtdRegistroAnd.Text = "Foram encontrados " + qtd + " Solicitações"; } else { lblQtdRegistroAnd.Text = "Nenhuma Solicitação foi encontrada."; } //FINALIZADO ds = Requerimento_DB.SelectS(3); //criando um data set com as solicitações abertas qtd = ds.Tables[0].Rows.Count; //qtd de linhas do ds //se qtd for maior que zero, ou seja, se tiver dados no data set gdvRequerimentoFinalizado.DataSource = ds.Tables[0].DefaultView; //fonte de dados do grid view recebe o ds criado anteriormente gdvRequerimentoFinalizado.DataBind(); //preenche o grid view com os dados if (qtd > 0) { lblQtdRegistroFin.Text = "Foram encontrados " + qtd + " Solicitações"; } else { lblQtdRegistroFin.Text = "Nenhuma Solicitação foi encontrada."; } }
protected void btnLibera_Click(object sender, EventArgs e) { string[] assuntoGrupo = lblMsgAssunto.Text.Split('-'); //separa a string de assunto automática int codReq = Convert.ToInt32(lblMsgId.Text); Requerimento req = Requerimento_DB.Select(codReq); int codGrupo = req.CodigoGrupo; if (Requerimento_DB.Update(codReq, 2, codGrupo) == 0) { Grupo_DB.Update(codGrupo); Requerimento_DB.UpdateTime(codReq); lblMsgStatus.Text = "Em Andamento"; mdlHeader.Attributes["style"] = "background-color: #f9ae0e;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; txtResponder.Text = ""; UpdatePanel3.Update(); string usuario = Session["nome"].ToString(); string matricula = Session["matricula"].ToString(); string msg = "O grupo " + assuntoGrupo[1] + "foi liberado para edição de nota por " + usuario; Mensagem men = new Mensagem(codReq, matricula, msg, usuario); if (Mensagem_DB.Insert(men) == 0) { } else { } } else { } abrirMensagens(codReq); CarregarGridAtivos(); UpdatePanel3.Update(); UpdatePanel1.Update(); UpdatePanel2.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); }
protected void btnFinaliza_Click(object sender, EventArgs e) { int cod = Convert.ToInt32(lblMsgId.Text); if (Requerimento_DB.Update(cod, 3) == 0) { Requerimento_DB.UpdateTime(cod); lblMsgStatus.Text = "Finalizado"; mdlHeader.Attributes["style"] = "background-color: #0D9643;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; txtResponder.Attributes["style"] = "background-color: #ccc"; txtResponder.ReadOnly = true; btnNovaMsg.Visible = false; subMenu.Visible = false; btnNovaMsg.Visible = false; btnFinaliza.Visible = false; string usuario = Session["nome"].ToString(); string matricula = Session["matricula"].ToString(); string msg = "Esta solicitação foi finalizada por " + usuario; Mensagem men = new Mensagem(cod, matricula, msg, usuario); if (Mensagem_DB.Insert(men) == 0) { } abrirMensagens(cod); txtResponder.Text = ""; } else { } CarregarGridAtivos(); UpdatePanel3.Update(); UpdatePanel1.Update(); UpdatePanel2.Update(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); }
protected void btnNovaMsg_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtResponder.Text)) { string usuario = Session["nome"].ToString(); string matricula = Session["matricula"].ToString(); string msg = txtResponder.Text; int cod = Convert.ToInt32(lblMsgId.Text); Mensagem men = new Mensagem(cod, matricula, msg, usuario); if (Mensagem_DB.Insert(men) == 0) { Requerimento_DB.UpdateTime(cod); Requerimento_DB.Update(cod, 2); lblMsgStatus.Text = "Em andamento"; mdlHeader.Attributes["style"] = "background-color: #f9ae0e;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; abrirMensagens(cod); CarregarGridAtivos(); } else { } txtResponder.Text = ""; ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); UpdatePanelAtivados.Update(); UpdatePanel1.Update(); UpdatePanel3.Update(); UpdatePanelAtivados.Update(); } }
protected void btnModal_Command(object sender, CommandEventArgs e) { int ID = Convert.ToInt32(e.CommandArgument); Requerimento req = Requerimento_DB.Select(ID); if (req != null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); lblMsgAssunto.Text = req.Assunto; lblMsgProfessor.Text = req.Usuario; //lblMsgCategoria.Text = req.Categoria; lblMsgId.Text = req.CodigoReq.ToString(); switch (req.Status) { case 1: lblMsgStatus.Text = "Aberto"; mdlHeader.Attributes["style"] = "background-color: #960d10;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; subMenu.Visible = true; btnFinaliza.Visible = true; break; case 2: lblMsgStatus.Text = "Em Andamento"; mdlHeader.Attributes["style"] = "background-color: #f9ae0e;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; subMenu.Visible = true; btnFinaliza.Visible = true; break; case 3: lblMsgStatus.Text = "Finalizado"; mdlHeader.Attributes["style"] = "background-color: #0D9643;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);;"; txtResponder.Attributes["style"] = "background-color: #ccc"; txtResponder.ReadOnly = true; subMenu.Visible = false; btnNovaMsg.Visible = false; btnFinaliza.Visible = false; break; } if ((req.Categoria == "Alteração de notas") && (req.Status != 3)) { subMenu.Attributes["style"] = "height: 84px"; btnLibera.Visible = true; } else { subMenu.Attributes["style"] = "height: 42px"; btnLibera.Visible = false; } if (req.Status == 3) { } else { //txtResponder.Attributes["style"] = "background-color: #fff"; //txtResponder.ReadOnly = false; //btnNovaMsg.Visible = true; } abrirMensagens(req.CodigoReq); CarregarGridAtivos(); UpdatePanel3.Update(); } }
//Método para confirmar a inserção de uma nova Requerimento protected void btnCriarNovoTicket_Click(object sender, EventArgs e) { txtAssunto.Style.Clear(); if (!String.IsNullOrEmpty(txtAssunto.Text) && !String.IsNullOrEmpty(txtCategoria.Text) && !String.IsNullOrEmpty(txtaMsg.Value) && !txtCategoria.SelectedValue.Equals("Selecione")) { string prof = Session["nome"].ToString(); string[] nomeProf = prof.Split(' '); string usuario = nomeProf[0] + " " + nomeProf[nomeProf.Length - 1]; string matricula = Session["matricula"].ToString(); string conteudo = txtaMsg.Value; int grupo = Convert.ToInt32(ddlGrupo.SelectedValue); txtResponder.Text = ""; string assunto = txtAssunto.Text; string categoria = txtCategoria.SelectedItem.Text; Requerimento req = new Requerimento(matricula, assunto, categoria, usuario); if (txtCategoria.SelectedValue.Equals("1")) { // se o requerimento for para alteração de nota, já manda o código do grupo req = new Requerimento(matricula, grupo, assunto, categoria, usuario); } if (Requerimento_DB.Insert(req) == 0) { lblMsg.Text = "<span class='glyphicon glyphicon-ok-circle'></span>   Solicitação enviada com sucesso."; lblMsg.Style.Add("color", "green"); gdvRequerimentoAberto.EditIndex = -1; CarregarGridAtivos(); UpdatePanelAtivados.Update(); req = Requerimento_DB.SelectLast(); int cod = req.CodigoReq; Mensagem men = new Mensagem(cod, matricula, conteudo, usuario); if (Mensagem_DB.Insert(men) == 0) { Requerimento_DB.UpdateTime(cod); abrirMensagens(cod); } else { lblMsg.Text = "Erro ao enviar mensagem"; } txtaMsg.Value = ""; ScriptManager.RegisterStartupScript(this, this.GetType(), "FechaModalDepoisdeCriar", "fechaModalClick();", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true); lblMsgAssunto.Text = req.Assunto; lblMsgProfessor.Text = req.Usuario; //lblMsgCategoria.Text = req.Categoria; lblMsgId.Text = req.CodigoReq.ToString(); abrirMensagens(req.CodigoReq); lblMsgStatus.Text = "Aberto"; mdlHeader.Attributes["style"] = "background-color: #960d10;color: #fff; border-bottom: none; height: 54px; position: absolute; z-index: 999; width: 100%; box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.26);"; UpdatePanel3.Update(); } else { lblMsg.Text = "Erro ao enviar solicitação!"; } } }