Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("all.aspx");
            }
            geocacheId = Request.QueryString["id"];

            geocache = GeocacheDb.retrieveGeocache(geocacheId);
            username = GeocacheDb.retrieveUsername(geocache.iduser);
            geocacheNameLabel.DataBind();
            usernameLabel.DataBind();
            geocacheDateCreatedLabel.DataBind();
            geocacheImage.DataBind();
            geocacheDescriptionTextBox.DataBind();

            bool geocacheReportStatus = GeocacheDb.retrieveGeocacheReportStatus(geocacheId);

            if (geocacheReportStatus == true)
            {
                reportButton.Enabled = false;
                reportButton.Text    = "Reported";
            }
            else
            {
            }

            SqlDataSource_Find.SelectCommand = "SELECT find.findId, find.findName, find.findDescription, find.findImage, find.findDateCreated, `user`.username, find.findStatus, COUNT(findReport.findId) AS noOfReport, (SELECT COUNT(*) FROM findReport WHERE findReport.findId = find.findId AND findReport.iduser = @iduser) AS reportStatus FROM find INNER JOIN `user` ON find.idUser = `user`.iduser LEFT JOIN findReport ON find.findId = findReport.findId WHERE find.geocacheId = @geocacheId GROUP BY find.findId;";
            SqlDataSource_Find.SelectParameters.Add("@geocacheId", geocacheId);
            SqlDataSource_Find.SelectParameters.Add("@iduser", iduser.ToString());
        }
Example #2
0
        protected void submitButton_Click(object sender, EventArgs e)
        {
            if (!(GeocacheDb.verifyCode(verificationCodeTextBox.Text, geocacheId)))
            {
                //validation error
            }
            else
            {
                if (findImageFileUpload.HasFile)
                {
                    try
                    {
                        string imageName = Guid.NewGuid().ToString().Substring(0, 8);
                        findImage = imageName + ".bmp";
                        System.Drawing.Bitmap bmpPostedImage = new System.Drawing.Bitmap(findImageFileUpload.PostedFile.InputStream);
                        bmpPostedImage.Save(Server.MapPath(@"uploads/") + imageName + ".bmp");
                    }
                    catch (Exception ex)
                    {
                        // StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
                    }
                }

                findName        = findNameTextBox.Text;
                findDescription = findDescriptionTextBox.Text;
                findDateCreated = DateTime.Now;
                findStatus      = "live";
                GeocacheDb.createFind(findName, findDescription, findImage, findDateCreated, findStatus, geocacheId);

                Response.Redirect("view.aspx?id=" + geocacheId);
            }
        }
Example #3
0
        protected void createButton_Click(object sender, EventArgs e)
        {
            if (imageFileUpload.HasFile)
            {
                try
                {
                    string imageName = Guid.NewGuid().ToString().Substring(0, 8);
                    geocacheImage = imageName + ".bmp";
                    System.Drawing.Bitmap bmpPostedImage = new System.Drawing.Bitmap(imageFileUpload.PostedFile.InputStream);
                    bmpPostedImage.Save(Server.MapPath(@"uploads/") + imageName + ".bmp");

                    //bmpPostedImage.Save(Server.MapPath(@"uploads/") + imageName + ".bmp");
                    //Stegano encryptStegano = new Stegano();
                    //encryptStegano.HideMessage(geocacheImage, geocacheImage, iduser);
                }
                catch (Exception ex)
                {
                    // StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
                }
            }

            geocacheName        = nameTextBox.Text;
            geocacheDescription = descriptionTextBox.Text;
            geocacheDifficulty  = Convert.ToInt32(difficultyLabel.Text);
            geocacheLatitude    = latitudeTextBox.Text;
            geocacheLongitude   = longitudeTextBox.Text;
            //geocacheImage = "/image.jpeg";
            geocacheDateCreated    = DateTime.Now;
            geocacheVerificationId = verificationCodeLabel.Text;
            geocacheStatus         = "pending";
            GeocacheDb.createGeocache(geocacheName, geocacheDescription, geocacheDifficulty, geocacheLatitude, geocacheLongitude, geocacheImage,
                                      geocacheDateCreated, geocacheVerificationId, geocacheStatus);

            Response.Redirect("all.aspx");
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] == null)
            {
                Response.Redirect("all.aspx");
            }
            geocacheId = Request.QueryString["id"];

            geocache = GeocacheDb.retrieveGeocache(geocacheId);

            if (!Page.IsPostBack)
            {
                nameTextBox.Text                     = geocache.geocacheName;
                descriptionTextBox.Text              = geocache.geocacheDescription;
                latitudeTextBox.Text                 = geocache.geocacheLatitude;
                longitudeTextBox.Text                = geocache.geocacheLongitude;
                verificationCodeLabel.Text           = geocache.geocacheVerificationId;
                difficultyDropDownList.SelectedValue = geocache.geocacheDifficulty.ToString();
            }
        }
Example #5
0
        //protected string getGeocacheName()
        //{
        //    return geocache.geocacheName;
        //}

        //protected string getGeocacheDescription()
        //{
        //    return geocache.geocacheDescription;
        //}

        //protected string getGeocacheLatitude()
        //{
        //    return geocache.geocacheLatitude;
        //}

        //protected string getGeocacheLongitude()
        //{
        //    return geocache.geocacheLongitude;
        //}

        //protected string getGeocacheVerificationId()
        //{
        //    return geocache.geocacheVerificationId;
        //}

        protected void updateButton_Click(object sender, EventArgs e)
        {
            string geocacheImage = "";

            if (imageFileUpload.HasFile)
            {
                try
                {
                    if (imageFileUpload.PostedFile.ContentType == "image/jpeg")
                    {
                        if (imageFileUpload.PostedFile.ContentLength < 10485760)
                        {
                            geocacheImage = Guid.NewGuid().ToString().Substring(0, 8) + System.IO.Path.GetExtension(imageFileUpload.PostedFile.FileName);
                            //string filename = Path.GetFileName(imageFileUpload.FileName);
                            imageFileUpload.PostedFile.SaveAs(Server.MapPath("uploads/") + geocacheImage);
                        }
                        else
                        {
                            //StatusLabel.Text = "Upload status: The file has to be less than 100 kb!";
                        }
                    }
                    else
                    {
                        //StatusLabel.Text = "Upload status: Only JPEG files are accepted!";
                    }
                }
                catch (Exception ex)
                {
                    // StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
                }
            }
            else
            {
                geocacheImage = geocache.geocacheImage;
            }


            GeocacheDb.updateGeocache(geocacheId, nameTextBox.Text, descriptionTextBox.Text, Convert.ToInt32(difficultyDropDownList.SelectedValue),
                                      latitudeTextBox.Text, longitudeTextBox.Text, geocacheImage);
            Response.Redirect("view.aspx?id=" + geocacheId);
        }
Example #6
0
 protected void reportButton_Click(object sender, EventArgs e)
 {
     GeocacheDb.createGeocacheReport(geocacheId);
     reportButton.Enabled = false;
     reportButton.Text    = "Reported";
 }
Example #7
0
        protected void reportFindButton_Click(object sender, EventArgs e)
        {
            Button b = (Button)sender;

            GeocacheDb.createFindReport(b.CommandArgument);
        }