protected void btnfileupload_Click(object sender, EventArgs e)
        {
            if (fileImage.HasFile)
            {
                System.IO.Stream fs = fileImage.PostedFile.InputStream;
                System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
                Byte[] bytesPhoto = br.ReadBytes((Int32)fs.Length);
                string base64String = Convert.ToBase64String(bytesPhoto, 0, bytesPhoto.Length);
                imgPhoto.ImageUrl = "data:image/png;base64," + base64String;
                imgPhoto.Visible = true;
                string fileName = fileImage.PostedFile.FileName;
                fileImage.SaveAs(Server.MapPath("~/Images/" + fileName));
                using (var db = new BadCostumesEntities ())
                {
                    var newCostume = new Costume();
                    newCostume.Participant = Request.QueryString["Participant"]; //this has to be the id
                    newCostume.ParticipantId = Convert.ToInt32( Request.QueryString["Participant"]); //this has to be the id
                    newCostume.Image = fileName;
                    newCostume.Votes = "1";
                    db.Costumes.Add(newCostume);
                    db.SaveChanges();
                }
                string gotourl = string.Format("~/SiteParticipant.aspx?Participant={0}", Request.QueryString["Participant"]);
                Response.Redirect(gotourl);

            }
        }
 protected void btnfileupload_Click(object sender, EventArgs e)
 {
     if (fileImage.HasFile)
     {
         System.IO.Stream       fs = fileImage.PostedFile.InputStream;
         System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
         Byte[] bytesPhoto         = br.ReadBytes((Int32)fs.Length);
         string base64String       = Convert.ToBase64String(bytesPhoto, 0, bytesPhoto.Length);
         imgPhoto.ImageUrl = "data:image/png;base64," + base64String;
         imgPhoto.Visible  = true;
         string fileName = fileImage.PostedFile.FileName;
         fileImage.SaveAs(Server.MapPath("~/Images/" + fileName));
         using (var db = new BadCostumesEntities())
         {
             var newCostume = new Costume();
             newCostume.Participant   = Request.QueryString["Participant"];                  //this has to be the id
             newCostume.ParticipantId = Convert.ToInt32(Request.QueryString["Participant"]); //this has to be the id
             newCostume.Image         = fileName;
             newCostume.Votes         = "1";
             db.Costumes.Add(newCostume);
             db.SaveChanges();
         }
         string gotourl = string.Format("~/SiteParticipant.aspx?Participant={0}", Request.QueryString["Participant"]);
         Response.Redirect(gotourl);
     }
 }
Example #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     PictureID   = (Request.QueryString["Picture"]);
     Participant = Convert.ToInt32(Request.QueryString["Participant"]);
     using (var db = new BadCostumesEntities())
     {
         var profiledata = db.Participants.Find(Participant);
         ImageThisGuy.ImageUrl    = "~/Images/" + profiledata.Image;
         Image_Indignity.ImageUrl = PictureID;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            PictureID = ( Request.QueryString["Picture"]);
            Participant = Convert.ToInt32(Request.QueryString["Participant"]);
            using (var db = new BadCostumesEntities())
            {

                var profiledata = db.Participants.Find(Participant);
                ImageThisGuy.ImageUrl = "~/Images/" + profiledata.Image;
                Image_Indignity.ImageUrl = PictureID;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //the query string will give us the participant
            int theparticipant = GetParticipant();
            //ie jzf
            //must set the image and the motivation
            List<Image> OurImages = new List<Image>();
            OurImages.Add(Image2);
            OurImages.Add(Image3);
            OurImages.Add(Image4);
            OurImages.Add(Image5);
            OurImages.Add(Image6);

            List<Label> OurVotes = new List<Label>();
            OurVotes.Add(Label2);
            OurVotes.Add(Label3);
            OurVotes.Add(Label4);
            OurVotes.Add(Label5);
            OurVotes.Add(Label6);

            using (var db = new BadCostumesEntities())
            {

                var profiledata = db.Participants.Find(theparticipant);
                TextBox1.Text = profiledata.Motivation;
                Image1.ImageUrl = "~/Images/" + profiledata.Image;
                var pCostumes = (from p in db.Costumes
                                 where p.ParticipantId == theparticipant
                                 orderby p.Votes descending
                                   select p).Take(5);

                int x = 0;
                if (null != pCostumes)
                {
                    foreach (var p in pCostumes)
                    {
                        OurImages[x].ImageUrl = "~/Images/" + p.Image;
                        OurVotes[x].Text = p.Votes;
                        x++;
                    }

                }
                else
                {

                }

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //the query string will give us the participant
            int theparticipant = GetParticipant();
            //ie jzf
            //must set the image and the motivation
            List <Image> OurImages = new List <Image>();

            OurImages.Add(Image2);
            OurImages.Add(Image3);
            OurImages.Add(Image4);
            OurImages.Add(Image5);
            OurImages.Add(Image6);

            List <Label> OurVotes = new List <Label>();

            OurVotes.Add(Label2);
            OurVotes.Add(Label3);
            OurVotes.Add(Label4);
            OurVotes.Add(Label5);
            OurVotes.Add(Label6);

            using (var db = new BadCostumesEntities())
            {
                var profiledata = db.Participants.Find(theparticipant);
                TextBox1.Text   = profiledata.Motivation;
                Image1.ImageUrl = "~/Images/" + profiledata.Image;
                var pCostumes = (from p in db.Costumes
                                 where p.ParticipantId == theparticipant
                                 orderby p.Votes descending
                                 select p).Take(5);


                int x = 0;
                if (null != pCostumes)
                {
                    foreach (var p in pCostumes)
                    {
                        OurImages[x].ImageUrl = "~/Images/" + p.Image;
                        OurVotes[x].Text      = p.Votes;
                        x++;
                    }
                }
                else
                {
                }
            }
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     //query for the user. use js
     using (var db = new BadCostumesEntities())
     {
         var profiledata = (from p in db.Participants
                            where p.LastName == TextBoxLastName.Text
                            select p).FirstOrDefault();
         if (null == profiledata)
         {
             Label1.Visible = true;
         }
         else
         {
             string gotourl = string.Format("~/SiteParticipant.aspx?Participant={0}", profiledata.Id);
             Response.Redirect(gotourl);
         }
     }
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            //need to get the photo that they want to use, maybe from facebook?
            //now we write the profile
            //the fb id
            //the charity
            //why they are doing this
            try
            {
                using (var db = new BadCostumesEntities())
                {
                    var NewGuy = new Participant();
                    NewGuy.FirstName = TextBoxFirstName.Text;
                    NewGuy.LastName = TextBoxLastName.Text;
                    NewGuy.Motivation = TextBoxMotiviation.Text;
                    NewGuy.Charity = TextBoxCharity.Text;

                    System.IO.Stream fs = fileImage.PostedFile.InputStream;
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
                    Byte[] bytesPhoto = br.ReadBytes((Int32)fs.Length);
                    string base64String = Convert.ToBase64String(bytesPhoto, 0, bytesPhoto.Length);
                    imgPhoto.ImageUrl = "data:image/png;base64," + base64String;
                    imgPhoto.Visible = true;
                    string fileName = fileImage.PostedFile.FileName;
                    fileImage.SaveAs(Server.MapPath("~/Images/" + fileName));

                    NewGuy.Image = fileName;

                    db.Participants.Add(NewGuy);
                    db.SaveChanges();

                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                return;
            }

            //go to say thank you!
            Response.Redirect("~/Default.aspx");
        }
Example #9
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //need to get the photo that they want to use, maybe from facebook?
            //now we write the profile
            //the fb id
            //the charity
            //why they are doing this
            try
            {
                using (var db = new BadCostumesEntities())
                {
                    var NewGuy = new Participant();
                    NewGuy.FirstName  = TextBoxFirstName.Text;
                    NewGuy.LastName   = TextBoxLastName.Text;
                    NewGuy.Motivation = TextBoxMotiviation.Text;
                    NewGuy.Charity    = TextBoxCharity.Text;


                    System.IO.Stream       fs = fileImage.PostedFile.InputStream;
                    System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
                    Byte[] bytesPhoto         = br.ReadBytes((Int32)fs.Length);
                    string base64String       = Convert.ToBase64String(bytesPhoto, 0, bytesPhoto.Length);
                    imgPhoto.ImageUrl = "data:image/png;base64," + base64String;
                    imgPhoto.Visible  = true;
                    string fileName = fileImage.PostedFile.FileName;
                    fileImage.SaveAs(Server.MapPath("~/Images/" + fileName));

                    NewGuy.Image = fileName;

                    db.Participants.Add(NewGuy);
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                return;
            }

            //go to say thank you!
            Response.Redirect("~/Default.aspx");
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            //query for the user. use js
            using (var db = new BadCostumesEntities())
            {
                var profiledata = (from p in db.Participants
                                   where p.LastName == TextBoxLastName.Text
                                   select p).FirstOrDefault();
                if (null == profiledata)
                {
                    Label1.Visible = true;
                }
                else
                {
                    string gotourl = string.Format("~/SiteParticipant.aspx?Participant={0}",profiledata.Id);
                    Response.Redirect(gotourl);
                }

            }
        }