Example #1
0
        protected void lkDenuncias_Click(object sender, EventArgs e)
        {
            LinkButton drp = (LinkButton)sender;

            GridViewRow gv = (GridViewRow)drp.NamingContainer;

            int index = gv.RowIndex;

            LinkButton lkDenuncias = (LinkButton)gvEquipList.Rows[index].FindControl("lkDenuncias");

            id_equip.Value             = gvEquipList.Rows[index].Cells[0].Text;
            btSimDenu.CausesValidation = true;
            rfvProb.Enabled            = true;
            MPE_Denu.Show();
        }
Example #2
0
        protected void lkDenu_Click(object sender, EventArgs e)
        {
            LinkButton drp = (LinkButton)sender;

            GridViewRow gv = (GridViewRow)drp.NamingContainer;

            int index = gv.RowIndex;

            LinkButton lkDenu = (LinkButton)gvReqList.Rows[index].FindControl("lkDenu");

            Requisicoes req = RequisicoesDAO.GetRequisicaoByID(Convert.ToInt32(gvReqList.Rows[index].Cells[0].Text));

            id_equip.Value             = req.id_equip.ToString();
            btSimDenu.CausesValidation = true;
            rfvProb.Enabled            = true;
            MPE_Denu.Show();
        }
Example #3
0
        protected void btSimDenu_Click(object sender, EventArgs e)
        {
            User user = UserDAO.GetUserByEmail(Session["email"].ToString());

            Models.Denuncias denu = new Models.Denuncias()
            {
                id_equip   = Convert.ToInt32(id_equip.Value),
                prioridade = 'N',
                estado     = 'V',
                id_user    = user.id_User,
                problema   = tbxProb.Text
            };
            int returncode = DenunciasDAO.InsertDenu(denu);

            MPE_Denu.Hide();
            if (returncode == -1)
            {
                String str = "<script>alertify.error('Inserção feita sem sucesso!');</script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", str, false);
                lbErro.Text = "Ja existe uma denuncia com este problema neste equipamento que ainda não se encontra resolvida.";
                MPE_Erro.Show();
            }
            else
            {
                if (fluFoto.HasFile == true)
                {
                    Equip  equip = EquipDAO.GetEquipByID(denu.id_equip);
                    String path  = equip.descri + "_" + DateTime.Now.ToString("MM-dd-yyyy") + ".jpg";
                    fluFoto.PostedFile.SaveAs(Server.MapPath("~/Content/Imagens/Denuncias/") + path);
                }
                else
                {
                    imgFoto.ImageUrl = "../../Content/Imagens/ImgNotFound.png";
                }

                String str = "<script>alertify.success('Inserção feita com sucesso!');</script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", str, false);
            }

            btSimDenu.CausesValidation = false;
            rfvProb.Enabled            = false;
            DataBindGridDenu();
        }