Exemplo n.º 1
0
        public override void OnOpening()
        {
            AddinContext.ExcelApp.SheetChangeEvent += (a, e) => Ribbon.Invalidate();

            content = new ListItems();
            content.Add(new SingleItem {
                Label    = "First Item",
                SuperTip = "The first Item",
                Image    = ResizeImage.Resize(Properties.Resources.one, 16, 16)
            });
            content.Add(new SingleItem {
                Label    = "Second Item",
                SuperTip = "The second Item",
                Image    = ResizeImage.Resize(Properties.Resources.two, 16, 16)
            });
            content.Add(new SingleItem {
                Label    = "Third Item",
                SuperTip = "The third Item",
                Image    = ResizeImage.Resize(Properties.Resources.three, 16, 16)
            });
            content.Add(new SingleItem {
                Label    = "Fourth Item",
                SuperTip = "The fourth Item",
                Image    = ResizeImage.Resize(Properties.Resources.four, 16, 16)
            });
            content.Add(new SingleItem {
                Label    = "Fifth Item",
                SuperTip = "The fifth Item",
                Image    = ResizeImage.Resize(Properties.Resources.five, 16, 16)
            });

            GallerySelectedIndex = 0;

            this.CreateRibbonCommand(_commands);
        }
Exemplo n.º 2
0
        public ActionResult UrunDuzenle(UrunViewModel uvm, HttpPostedFileBase file)
        {
            var filename = ImageNameGenerator.ProfilFotoIsmiUret(file);
            var path     = "null";

            uvm.Fotograf = filename;
            UrunYonetici uy = new UrunYonetici();
            BusinessLayerResult <Urun> res = new BusinessLayerResult <Urun>();

            if (file != null)
            {
                //filename = Path.GetFileName(file[0].FileName);
                path = Path.Combine(Server.MapPath("~/Content/Image/Urun"), filename);
                Image imgnew = ResizeImage.Resize(Image.FromStream(file.InputStream), 0, 473); //son eklediğim alan
                //file[0].SaveAs(path);
                imgnew.Save(path);
            }
            if (res.Errors.Count > 0)
            {
                res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                return(View(uvm));
            }
            if (ModelState.IsValid)
            {
                Urun             urnyeni = uy.Find(x => x.ilanId == uvm.IlanId);
                RenkYonetici     ry      = new RenkYonetici();
                SehirYonetici    sy      = new SehirYonetici();
                KategoriYonetici ky      = new KategoriYonetici();
                if (uvm.takasdegeri == "UYGUN")
                {
                    uvm.Takas = true;
                }
                else
                {
                    uvm.Takas = false;
                }
                //Burayı düzelt...
                urnyeni.ilanId         = uvm.IlanId;
                urnyeni.urunBaslik     = uvm.UrunBaslik;
                urnyeni.urunFiyati     = uvm.UrunFiyat;
                urnyeni.renkId         = ry.Find(x => x.renkAdi == uvm.UrunRenkAdi).renkId;
                urnyeni.urunKonum      = uvm.UrunKonum;
                urnyeni.ilPlaka        = sy.Find(x => x.ilAdi == uvm.SehirAlani).ilPlaka;
                urnyeni.kategoriId     = ky.Find(x => x.kategoriAdi == uvm.KategoriAdi).kategoriId;
                urnyeni.takasyapilirmi = uvm.Takas;
                urnyeni.durumu         = uvm.durumu;
                urnyeni.urunAciklama   = uvm.UrunAciklama;
                urnyeni.halasatilikmi  = true;
                urnyeni.kullaniciId    = App.Common.GetCurrentUsernameId();
                //urnyeni.satistarihsaat = DateTime.Now; //Ürün güncellendiği zaman yükleme tarihi aynı kalsın
                if (file != null)
                {
                    urnyeni.urunFotosu = filename;
                }

                uy.Update(urnyeni);
                return(RedirectToAction("Sattiklarim", "Profil"));
            }
            return(View(uvm));
        }
Exemplo n.º 3
0
 public override void OnOpening()
 {
     content = new ListItems();
     content.Add(new SingleItem
     {
         Label = "First Item"
         ,
         SuperTip = "The First Item"
         ,
         Image = ResizeImage.Resize(Properties.Resources.one, 16, 16)
     });
     content.Add(new SingleItem
     {
         Label = "Second Item"
         ,
         SuperTip = "The Second Item"
         ,
         Image = ResizeImage.Resize(Properties.Resources.two, 16, 16)
     });
     content.Add(new SingleItem
     {
         Label = "Third Item"
         ,
         SuperTip = "The Third Item"
         ,
         Image = ResizeImage.Resize(Properties.Resources.three, 16, 16)
     });
 }
        public ActionResult Hesabim(KullaniciViewModel kvm, List <HttpPostedFileBase> file)
        {
            var filename = ImageNameGenerator.ProfilFotoIsmiUret(file[0]);
            var path     = "null";

            kvm.fotograf = filename;
            KullaniciYönetici ky   = new KullaniciYönetici();
            Kullanici         klnc = Session["giris"] as Kullanici;
            BusinessLayerResult <Kullanici> res = new BusinessLayerResult <Kullanici>();

            if (klnc != null)
            {
                kvm.KullaniciId = klnc.kullaniciId;
            }
            res = ky.KullaniciGuncelle(kvm, file[0]);
            if (file[0] != null)
            {
                //filename = Path.GetFileName(file[0].FileName);
                path = Path.Combine(Server.MapPath("~/Content/Image/Profil"), filename);
                Image imgnew = ResizeImage.Resize(Image.FromStream(file[0].InputStream), 0, 473);  //son eklediğim alan

                //file[0].SaveAs(path);
                imgnew.Save(path);
            }
            if (res.Errors.Count > 0)
            {
                res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
                return(View(kvm));
            }
            if (file != null && file.Count > 1)
            {
                for (int i = 1; i <= file.Count - 1; i++)
                {
                    if (file != null && file[i].ContentLength > 0)
                    {
                        filename     = Path.GetFileName(file[i].FileName);
                        path         = Path.Combine(Server.MapPath("~/Content/Image/Profil"), filename);
                        kvm.fotograf = file[i].FileName;
                        KullaniciYönetici ky1 = new KullaniciYönetici();
                        BusinessLayerResult <KullaniciFoto> res1 = ky1.KullaniciFotosuYukle(kvm.Username, file[i]);
                        file[i].SaveAs(path);
                    }
                }
            }
            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 5
0
 public ActionResult Yukle(UrunViewModel model, List <HttpPostedFileBase> file)
 {
     if (model.takasdegeri == "0")
     {
         model.Takas = false;
     }
     if (model.takasdegeri == "1")
     {
         model.Takas = true;
     }
     if (model.durumdegeri == "0")
     {
         model.durumu = false;
     }
     if (model.durumdegeri == "1")
     {
         model.durumu = true;
     }
     if (ModelState.IsValid && file.Count > 0)
     {
         UrunYonetici uy       = new UrunYonetici();
         var          filename = ImageNameGenerator.UrunFotoIsmiUret(file[0]);
         //filename += Path.GetExtension(file[0].FileName);
         model.Fotograf = filename;
         var path = "null";
         BusinessLayerResult <Urun> res = new BusinessLayerResult <Urun>();
         res = uy.UrunKayit(model, file[0]);
         if (file[0] != null)
         {
             //filename = Path.GetFileName(file[0].FileName);
             path = Path.Combine(Server.MapPath("~/Content/Image/Urun"), filename);
             Image imgnew = ResizeImage.Resize(Image.FromStream(file[0].InputStream), 0, 473); //son eklediğim alan
             //file[0].SaveAs(path);
             imgnew.Save(path);
         }
         if (res.Errors.Count > 0)
         {
             res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));
             return(View(model));
         }
         if (file != null && file.Count > 1)
         {
             for (int i = 1; i <= file.Count - 1; i++)
             {
                 if (file != null && file[i].ContentLength > 0)
                 {
                     filename = ImageNameGenerator.UrunFotoIsmiUret(file[i]);
                     //filename = Path.GetFileName(file[i].FileName);
                     model.Fotograf = filename;
                     path           = Path.Combine(Server.MapPath("~/Content/Image/Urun"), filename);
                     UrunYonetici uy1 = new UrunYonetici();
                     BusinessLayerResult <UrunFoto> res1 = uy1.UrunFotosuYukle(model.UrunBaslik, file[i]);
                     Image imgnew = ResizeImage.Resize(Image.FromStream(file[i].InputStream), 0, 473); //son eklediğim alan
                     imgnew.Save(path);
                 }
             }
         }
         Session["urun"] = res.Result;
         return(RedirectToAction("Index", "Home"));
     }
     return(View(model));
     //return RedirectToAction("Index","Home");
 }
Exemplo n.º 6
0
    protected void SubmitImgBtn_Click(object sender, ImageClickEventArgs e)
    {
        //Make sure the file is not larger than 800KB (File extention validation is done by a regular expression validator on the client side)
        double size = BookImageFileUpL.FileContent.Length;

        if (size > 819200)
        {
            UploadReportLble.Text = "The file is too large, it must be under 800KB.";
        }
        else
        {
            if (BookImageFileUpL.HasFile == true)
            {
                //Start a new instance of the resize class /AppCode/
                ResizeImage resize = new ResizeImage();

                //Create and store an new GUID for a unique image name
                string guid = System.Guid.NewGuid().ToString() + ".jpg";

                // Specify the upload directory
                string directory = Server.MapPath("Resources/BookImages/");

                //Store the image from the uploadFile control into memory
                Bitmap image = new Bitmap(BookImageFileUpL.FileContent);

                //Resize the image(used from the ResizeImage class) and store the resized image in a new bitmap
                Bitmap resizedImage = resize.Resize(image, 105, 150);

                // Save the new graphic file to the server
                resizedImage.Save(directory + guid);

                //Dispose the BitMaps
                image.Dispose();
                resizedImage.Dispose();

                //Set the ImgURL of the sampleImg control to display the uploaded image
                ImageSampleImg.ImageUrl = "Resources/BookImages/" + guid;

                //Show the book details panel
                BookDetailsPnl.Visible = true;
                //Apply the appropriate values to the lables
                NameValueLble.Text   = BookNameTxtb.Text;
                AuthorValueLble.Text = AuthorTxtb.Text;
                GenreValueLble.Text  = GenreDdl.SelectedValue.ToString();

                //Open a new connection to the database and insert the information entered by the user
                UseDataBase usedb = new UseDataBase();
                usedb.ConnectDataBase();
                //Insert command
                usedb.ExecuteCommand("INSERT INTO [BookInformation] (BookName , BookAuthor, BookSummary, BookGenre, BookImageUrl , BookSubmiterId , BookAverageRating) VALUES ('" + BookNameTxtb.Text.Replace("'", "") + "','" + AuthorTxtb.Text.Replace("'", "") + "','" + BookSummaryTxtb.Text.Replace("'", "") + "','" + GenreDdl.SelectedValue.ToString() + "','/Resources/BookImages/" + guid + "','" + Request.Cookies["LoggedInCookie"]["UserId"] + "' , '0' )");
                //Close the connection to the database
                usedb.Close();

                //Open a new connection to the database
                UseDataBase getName = new UseDataBase();
                getName.ConnectDataBase();

                //Store the select result in a datareader
                SqlDataReader UserName = getName.ExecuteQuery("SELECT [UserName] FROM [UserInformation] WHERE [UserId] = '" + Request.Cookies["LoggedInCookie"]["UserId"] + "'");

                //Set the submitterValueLble text to display the users name
                while (UserName.Read())
                {
                    SubmitterValueLble.Text = UserName.GetString(0);
                }

                //Close the connection to the database/DataReader
                getName.Close();
                UserName.Close();

                //Report back to the user
                UploadReportLble.Text = "Submittion successful, Thank you!";
            }
        }
    }
        public bool OylamaEkle(Guid kullanici_id, string oylama_suresi, string oylama_tipi, bool paylasima_acikmi, bool profil_gorulsunmu, HttpFileCollectionBase files, string urun_1, string urun_2, string urun_3, string urun_aciklamasi_1_1, string urun_aciklamasi_1_2, string urun_aciklamasi_1_3, string urun_aciklamasi_2_1, string urun_aciklamasi_2_2, string urun_aciklamasi_2_3, string urun_aciklamasi_3_1, string urun_aciklamasi_3_2, string urun_aciklamasi_3_3)
        {
            try
            {
                Guid vote_id = Guid.NewGuid();

                Vote     vote  = new Vote();
                DateTime zaman = DateTime.Now;
                vote.StartTime = zaman;

                vote.id = vote_id;

                if (oylama_suresi == "15 dakika")
                {
                    vote.FinishTime = zaman.AddMinutes(15);
                }
                else if (oylama_suresi == "30 dakika")
                {
                    vote.FinishTime = zaman.AddMinutes(30);
                }
                else if (oylama_suresi == "1 saat")
                {
                    vote.FinishTime = zaman.AddHours(1);
                }
                else if (oylama_suresi == "2 saat")
                {
                    vote.FinishTime = zaman.AddHours(2);
                }
                else if (oylama_suresi == "3 saat")
                {
                    vote.FinishTime = zaman.AddHours(3);
                }
                else if (oylama_suresi == "1 gün")
                {
                    vote.FinishTime = zaman.AddDays(1);
                }
                else if (oylama_suresi == "2 gün")
                {
                    vote.FinishTime = zaman.AddDays(2);
                }
                else if (oylama_suresi == "3 gün")
                {
                    vote.FinishTime = zaman.AddDays(3);
                }


                if (oylama_tipi == "gizli")
                {
                    vote.TypeOfVote = "gizli";
                }
                else
                {
                    vote.TypeOfVote = "genel";
                }



                vote.User = unitOfWork.Repository <VotedressUser>().Find(x => x.id == kullanici_id);



                vote.VoteLink = Guid.NewGuid();

                unitOfWork.Repository <Vote>().Insert(vote);
                unitOfWork.SaveChanges();

                Guid oylama_id = vote_id;



                VoteImage vote_image;

                VoteProduct voteProduct1 = null;
                VoteProduct voteProduct2 = null;
                VoteProduct voteProduct3 = null;


                if (urun_1 != null)
                {
                    voteProduct1 = new VoteProduct()
                    {
                        Vote      = vote,
                        VoteCount = 0,
                        Product   = unitOfWork.Repository <Product>().Find(x => x.id == new Guid(urun_1))
                    };

                    unitOfWork.Repository <VoteProduct>().Insert(voteProduct1);
                }
                if (urun_2 != null)
                {
                    voteProduct2 = new VoteProduct()
                    {
                        Vote      = vote,
                        VoteCount = 0,
                        Product   = unitOfWork.Repository <Product>().Find(x => x.id == new Guid(urun_2))
                    };

                    unitOfWork.Repository <VoteProduct>().Insert(voteProduct2);
                }
                if (urun_3 != null)
                {
                    voteProduct3 = new VoteProduct()
                    {
                        Vote      = vote,
                        VoteCount = 0,
                        Product   = unitOfWork.Repository <Product>().Find(x => x.id == new Guid(urun_3))
                    };

                    unitOfWork.Repository <VoteProduct>().Insert(voteProduct3);
                }



                int i = 1;
                foreach (string name in files)
                {
                    var file = files[name];

                    if (file.ContentLength > 0)
                    {
                        vote_image = new VoteImage();

                        if (name == "urun_resim_1_1")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));

                            vote_image.VoteProduct = voteProduct1;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_1_1;
                        }
                        else if (name == "urun_resim_1_2")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));


                            vote_image.VoteProduct = voteProduct1;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_1_2;
                        }
                        else if (name == "urun_resim_1_3")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));

                            vote_image.VoteProduct = voteProduct1;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_1_3;
                        }
                        else if (name == "urun_resim_2_1")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));



                            vote_image.VoteProduct = voteProduct2;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_2_1;
                        }
                        else if (name == "urun_resim_2_2")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));


                            vote_image.VoteProduct = voteProduct2;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_2_2;
                        }
                        else if (name == "urun_resim_2_3")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));


                            vote_image.VoteProduct = voteProduct2;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_2_3;
                        }
                        else if (name == "urun_resim_3_1")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));

                            vote_image.VoteProduct = voteProduct3;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_3_1;
                        }
                        else if (name == "urun_resim_3_2")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));



                            vote_image.VoteProduct = voteProduct3;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_3_2;
                        }
                        else if (name == "urun_resim_3_3")
                        {
                            Image sourceimage            = Image.FromStream(file.InputStream);
                            Image boyutlandirilmis_resim = ResizeImage.Resize(sourceimage, 600, 600);

                            string imagePath = "/Content/img/" + kullanici_id + "_" + oylama_id + "_" + i + ".jpg";

                            boyutlandirilmis_resim.Save(HttpContext.Current.Server.MapPath(imagePath));



                            vote_image.VoteProduct = voteProduct3;
                            vote_image.ImagePath   = imagePath;
                            vote_image.ImageNo     = i;
                            vote_image.Aciklama    = urun_aciklamasi_3_3;
                        }

                        unitOfWork.Repository <VoteImage>().Insert(vote_image);

                        i++;
                    }
                }

                unitOfWork.SaveChanges();
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(true);
        }