Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            clProblem teste2 = new clProblem();
            teste2.UserProblem(2);

            string user = Request.Form["usuario"];
            string password = Request.Form["senha"];
            string recoveryemail = Request.QueryString["email"];

            #region // Verifica Email
            if (recoveryemail != null)
            {
                clUsers ReturnEmail = new clUsers();
                string passwordrecovered = ReturnEmail.EmailRecovery(recoveryemail);

                if (passwordrecovered != null)
                {

                    Response.Write(" FAZER O envio da " + passwordrecovered + " Para o email " + recoveryemail);
                }
                else
                {
                    Response.Write(passwordrecovered);
                }

            }

            #endregion

            // Loga com os dados do banco
            #region // Login
            if (Page.IsPostBack)
            {

                clUsers Validation = new clUsers();
                bool LoginValidation = Validation.LoginValidation(user, password);

                if (LoginValidation == true)
                {

                    //Cria Cookie

                    HttpCookie CookieLogon = new HttpCookie("cokieusuario");
                    CookieLogon.Value = user;
                    CookieLogon.Expires = DateTime.Now.AddDays(1);
                    Response.Cookies.Add(CookieLogon);

                    //Cria Sessão

                    Session["NomeUsuario"] = user;
                    Response.Redirect("fixcity.aspx");

                }

                else
                {
                    Response.Write("Falha no login");
                }

            }
            #endregion
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {   
            //Botoes da Pagina
            btnResolvido.Click += BtnResolvido_Click;
            btnNaoResolvido.Click += BtnNaoResolvido_Click;







            //Verifica o usuario loga e sua permissão
            string Login = Session["NomeUsuario"] == null ? "" : Session["NomeUsuario"].ToString();
            clUsers User = new clUsers();
            User.UserReturn(Login);
            int codRole = User.pcodRoles;

            //clPermissions Verifypermission = new clPermissions();
            // bool permission = Verifypermission.VerifyPermission(codRole, (int)Permissions.Full);


            if (codRole == 2 || codRole == 1)
            {

                string Usuario;
                Usuario = Session["NomeUsuario"] == null ? "" : Session["NomeUsuario"].ToString();
                Usuario = (string)Session["NomeUsuario"] + "";
                if (Usuario.Length > 0)
                {

                    //Motras os problemas na tela principal
                    clProblem busca = new clProblem();
                    busca.ReturnProblem(30);
                    string labeldescricao = busca.pDescription;
                    int labelnome = busca.pcodSubCategory;
                    DateTime labeldata = busca.pDate;
                    string imagemfoto = busca.pPhoto;
                    

                    LDescription.Text = labeldescricao;
                    LName.Text = Convert.ToString(labelnome);
                    LDate.Text = Convert.ToString(labeldata);
                    IPhoto.ImageUrl = imagemfoto;
                    


                    LDescription2.Text = labeldescricao;
                    LName2.Text = Convert.ToString(labelnome);
                    LDate2.Text = Convert.ToString(labeldata);
                    IPhoto2.ImageUrl = imagemfoto;




                    LabelNome.Text = User.pName;
                    LabelNome.Visible = true;
<<<<<<< HEAD
                    busca.MarkSolved(21);
                    busca.MarkSolved(22);

=======
                   // busca.MarkSolved(21);
                  
>>>>>>> fe2fae13f23d6ccc85627a76be66a646fe8fa74d

                }
                else
                {
                    Response.Redirect("login.aspx");

                }
            }
            else
            {
                Response.Write("VOCÊ NÃO POSSUI PERMISSAO PARA ACESSAR");
                Response.Redirect("login.aspx");

            }
            string destroy = Request.Form["logout"];

            if (destroy != null)
            {

                Session.Abandon();
                Response.Redirect("login.aspx");

            }

        }
Example #3
0
        protected void LabelEstado_Load(object sender, EventArgs e)
        {
            clProblem busca = new clProblem();
            

            if (busca.pSolved == 1)
            {
                LabelEstado.Text = "Encerrado";
            }
            else { LabelEstado.Text = "Em aberto"; }

        }
Example #4
0
        private void BtnResolvido_Click(object sender, EventArgs e)
        {
            string Login = Session["NomeUsuario"] == null ? "" : Session["NomeUsuario"].ToString();
            clUsers User = new clUsers();
            User.UserReturn(Login);
            int CodUser = User.pcodUser;

            clProblem myproblems = new clProblem();
             myproblems.UserProblem(CodUser);

            if (myproblems.pSolved == 0)
            {
                
                LName.Text = Convert.ToString(myproblems.pDescription);
                LDate.Text = Convert.ToString(myproblems.pDate);
                IPhoto.ImageUrl = myproblems.pPhoto;
                
            }



        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Verifica se o usuario tem permissão de abrir reclamações
            string Login = Session["NomeUsuario"] == null ? "" : Session["NomeUsuario"].ToString();
            clPermissions UserPermission = new clPermissions();
            UserPermission.VerifyPermission(Login);
            int codRole = UserPermission.pPermission;
            int codUser = UserPermission.pcodUser;

            if (codRole == 2 || codRole == 1)
            {
                int OptionSubcategory = Convert.ToInt32(Request.Form["ticket[subcategory_id]"]);
                string Description = Request.Form["ticket[description]"];
                string Photo = "/img/"+Request.Form["File1"];
                string Address = Request.Form["address"];

                if (IsPostBack)
                {
                    if (File1.PostedFile.ContentLength < 4388608)
                    {

                     if ((File1.PostedFile.ContentType == "image/jpeg" ||  File1.PostedFile.ContentType == "image/png" ||  File1.PostedFile.ContentType == "image/jpg"))
                        {
                            foreach (string f in Request.Files.AllKeys)
                            {
                                HttpPostedFile file = Request.Files[f];
                                file.SaveAs(Server.MapPath("img/" + file.GetHashCode() + file.FileName));
                                Photo = "img/" + file.GetHashCode() + file.FileName;
                            }
                        } else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('File should be an image: jpeg or png')", true);
                        }

                    } else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('File is too big')", true);
                    }

                    clProblem InsertProblem = new clProblem();
                    DateTime Date = DateTime.Now;

                    if(Description == "" || Address == "" || OptionSubcategory.ToString() == "")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('Missing some parameters')", true);
                    }
                    else
                    {
                        InsertProblem.InsertProblem(Description, Address, Photo, OptionSubcategory, 1, 0, Date, codUser);

                    }

                }

            }
            else
            {
                Response.Redirect("login.aspx");

            }
        }