Esempio n. 1
0
 private void Approve(string entry)
 {
     try
     {
         bool publish;
         publish = btnApprove.Text.Equals("Approve") ? true : false;
         if (publish)
         {
             if (PhotoGallery.ChangeStatus(Convert.ToInt32(entry), "P"))
             {
                 lblMessage.Text = "The content was succesfully published.";
             }
             else
             {
                 lblMessage.Text = "There was problem publishing the content.";
             }
         }
         else
         {
             if (PhotoGallery.ChangeStatus(Convert.ToInt32(entry), "X"))
             {
                 lblMessage.Text = "The content was succesfully Suspended.";
             }
             else
             {
                 lblMessage.Text = "There was problem Suspending the content.";
             }
         }
     }
     catch { }
 }
Esempio n. 2
0
        public static void Seed(DataContext context)
        {
            var mainGallery = context.PhotoGalleries
                              .Where(x => x.Name == "Main")
                              .Include(x => x.PhotoGalleryDigitalAssets)
                              .Include("PhotoGalleryDigitalAssets.DigitalAsset")
                              .FirstOrDefault();

            if (mainGallery == null)
            {
                mainGallery = new PhotoGallery()
                {
                    Name = "Main"
                };
                context.PhotoGalleries.Add(mainGallery);
            }

            mainGallery.PhotoGalleryDigitalAssets.Clear();
            foreach (var digitalAsset in context.DigitalAssets)
            {
                if (digitalAsset.FileName.Contains("gallery_main_"))
                {
                    mainGallery.PhotoGalleryDigitalAssets.Add(
                        new PhotoGalleryDigitalAsset()
                    {
                        DigitalAsset = digitalAsset
                    });
                }
            }

            context.SaveChanges();
        }
Esempio n. 3
0
        public ActionResult EditPhotoGallery(PhotoGallery galley, HttpPostedFileBase image)
        {
            if (ModelState.IsValid)
            {
                if (image != null && image.ContentLength > 0)
                {
                    var imgName = Path.GetFileName(image.FileName);
                    var path    = Path.Combine(Server.MapPath("~/Content/Gallery/"), System.IO.Path.GetFileName(image.FileName));
                    image.SaveAs(path);
                    galley.Photo = "~/Content/Gallery/" + imgName;
                    _repository.SavePhoto(galley);
                }
                else if (galley.PhotoID != 0)
                {
                    galley = _repository.PhotoGalleries.FirstOrDefault(f => f.PhotoID == galley.PhotoID);

                    string fullPath = Request.MapPath(galley.Photo); //delete from server
                    if (System.IO.File.Exists(fullPath))
                    {
                        System.IO.File.Delete(fullPath);
                    }
                    _repository.DeletePhoto(galley);
                }
            }
            return(RedirectToAction("EditPhotoGallery", "Admin"));
        }
Esempio n. 4
0
 public static void RefreshBigPhotoPrefix(PhotoGallery __instance, ref int ____activeThumbnailIndex, ref int __state)
 {
     __state = ____activeThumbnailIndex;
     if (____activeThumbnailIndex % 4 >= 1)
     {
         ____activeThumbnailIndex -= ____activeThumbnailIndex % 4;
     }
 }
 public IActionResult Update([FromBody] PhotoGallery data)
 {
     if (service.Get(x => x.Id == data.Id) != null)
     {
         data.isActive = true;
         return(Ok(service.Update(data)));
     }
     return(NotFound());
 }
    public static string GetPhotoGalleryByItemFieldId(string itemName, string itemFieldName, long itemId, string instanceName)
    {
        var instance = new CustomerFramework {
            Name = instanceName
        };

        instance.LoadConfig();
        return(PhotoGallery.JsonList(PhotoGallery.GetByItemFieldId(itemName, itemFieldName, itemId, instance.Config.ConnectionString)));
    }
Esempio n. 7
0
 /// <summary>
 /// Update
 /// </summary>
 /// <param name="photoGallery"></param>
 public void Update(PhotoGallery photoGallery)
 {
     if (photoGallery == null)
     {
         throw new ArgumentNullException(nameof(photoGallery));
     }
     _photoGalleryRepository.Update(photoGallery);
     _eventPublisher.EntityUpdated(photoGallery);
 }
Esempio n. 8
0
        public virtual IActionResult GalleryDelete(int?id)
        {
            PhotoGallery result = _photoGalleryRepository.GetById(id);

            if (result.Id > 0)
            {
                _photoGalleryRepository.Delete(result);
            }

            return(new NullJsonResult());
        }
Esempio n. 9
0
        public MainWindow()
        {
            NavigatorViewModel nav = new NavigatorViewModel();

            PhotoGallery gallery = PhotoGallery.LoadGallery("gallery.xml");

            nav.NewPage(new GalleryViewModel(nav, gallery));
            DataContext = nav;

            InitializeComponent();
        }
    internal override void Awake()
    {
        base.Awake();
        currentGallery     = Instantiate(photoGallery_prefab, transform);
        _starPointsHandler = FindObjectOfType <StarPoints_Handler>();

        _currentActivity = LookForCurrentActivity();
        FillFields();

        _save_Btt.onClick.AddListener(SaveData);
    }
Esempio n. 11
0
 public void SavePhoto(PhotoGallery photo)
 {
     if (photo.PhotoID == 0)
     {
         context.PhotoGalleries.Add(photo);
     }
     else
     {
         context.Entry(photo).State = EntityState.Modified; // Indicating that the record is changed
     }
     context.SaveChanges();
 }
Esempio n. 12
0
        public frmAlbumEdit(AlbumIcon albumToEdit, PhotoGallery parentPhotoGallery)
        {
            InitializeComponent();
            album = albumToEdit;

            this.txtTitle.Text       = this.Text = album.Title;
            this.txtAuthor.Text      = album.AlbumObject.vauthor;
            this.txtDescription.Text = album.AlbumObject.vdescribe;
            this.pbMainPhoto.Image   = album.MainImage;

            parentGallery = parentPhotoGallery;
        }
        // POST: odata/PhotoGalleries
        public async Task <IHttpActionResult> Post(PhotoGallery photoGallery)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PhotoGalleries.Add(photoGallery);
            await db.SaveChangesAsync();

            return(Created(photoGallery));
        }
        public HttpResponseMessage CropAndSaveImage(string moduleName, string fileName, int x, int y, int w, int h)
        {
            StpaulsEntities db = new StpaulsEntities();
            //Create the Directory.
            string path = HttpContext.Current.Server.MapPath("~/Uploads/" + moduleName + "/");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            //Save the Files.
            foreach (string key in HttpContext.Current.Request.Files)
            {
                HttpPostedFile postedFile = HttpContext.Current.Request.Files[key];
                postedFile.SaveAs(path + fileName);

                string filePath     = Path.Combine(HttpContext.Current.Server.MapPath("~/Uploads/" + moduleName), fileName);
                string cropFileName = "";
                string cropFilePath = "";
                if (File.Exists(filePath))
                {
                    System.Drawing.Image orgImg   = System.Drawing.Image.FromFile(filePath);
                    Rectangle            CropArea = new Rectangle(x, y, w, h);
                    try
                    {
                        Bitmap bitMap = new Bitmap(CropArea.Width, CropArea.Height);
                        using (Graphics g = Graphics.FromImage(bitMap))
                        {
                            g.DrawImage(orgImg, new Rectangle(0, 0, bitMap.Width, bitMap.Height), CropArea, GraphicsUnit.Pixel);
                        }
                        cropFileName = "crop_" + fileName;
                        cropFilePath = Path.Combine(HttpContext.Current.Server.MapPath("~/Uploads/" + moduleName), cropFileName);
                        bitMap.Save(cropFilePath);

                        PhotoGallery photoGallery = new PhotoGallery();
                        photoGallery.PhotoPath  = @"~/ Uploads /" + moduleName + "/" + cropFileName;
                        photoGallery.Active     = 1;
                        photoGallery.UploadDate = DateTime.Now;
                        photoGallery.AlbumId    = 1;
                        db.PhotoGalleries.Add(photoGallery);
                        db.SaveChangesAsync();
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                }
            }

            //Send OK Response to Client.
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Esempio n. 15
0
        public frmPhotoEdit(PhotoIcon photoToEdit, PhotoGallery parentGallery)
        {
            InitializeComponent();

            this.photo = photoToEdit;
            this.parentPhotoGallery = parentGallery;

            this.txtTitle.Text       = photoToEdit.PhotoObject.vtitle;
            this.txtDescription.Text = photoToEdit.PhotoObject.vdescription;
            this.txtAuthor.Text      = photoToEdit.PhotoObject.vauthor;
            this.pbPhoto.Image       = photoToEdit.PhotoObject.vimageobject;
        }
Esempio n. 16
0
    protected void PhotosRepeater_ItemCreated(object sender, RepeaterItemEventArgs e)
    {
        ThumbUrl = PhotoGallery.GetThumbUrl(galleryFolder, e.Item.DataItem.ToString());
        ImageUrl = PhotoGallery.GetImageUrl(galleryFolder, e.Item.DataItem.ToString());

        if ((e.Item.ItemIndex + 1) % 4 == 0)
        {
            MarginRight = "";
        }
        else
        {
            MarginRight = "margin-right: 8px; ";
        }
    }
        // DELETE: odata/PhotoGalleries(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] short key)
        {
            PhotoGallery photoGallery = await db.PhotoGalleries.FindAsync(key);

            if (photoGallery == null)
            {
                return(NotFound());
            }

            db.PhotoGalleries.Remove(photoGallery);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public HttpResponseMessage something()
        {
            string imageName       = "";
            var    httpRequest     = HttpContext.Current.Request;
            var    postedFile      = httpRequest.Files["Image"];
            var    postedFileBytes = Convert.FromBase64String(postedFile.ToString());

            //if (postedFile...Contains(","))
            //{
            //    theFile.FileAsBase64 = theFile.FileAsBase64.Substring(theFile.FileAsBase64.IndexOf(",") + 1);
            //}
            imageName = new string(Path.GetFileNameWithoutExtension(postedFile.FileName).Take(10).ToArray()).Replace(" ", "-");
            imageName = imageName + DateTime.Now.ToString("yymmssfff") + Path.GetExtension(postedFile.FileName);

            var filePath = HttpContext.Current.Server.MapPath("~/Uploads/Images/" + imageName);

            using (var fs = new FileStream(filePath, FileMode.CreateNew))
            {
                fs.Write(postedFileBytes, 0, postedFileBytes.Length);
            }

            //postedFileBytes.SaveAs(filePath);
            ////IImageData imageData ;
            //dynamic obj = Request.Content.ReadAsAsync<JObject>();
            //var y = obj.Result;
            StpaulsEntities db = new StpaulsEntities();
            //byte[] bytes = Encoding.ASCII.GetBytes(y.filebytes.Value);
            ////string path = @"~/Uploads/Stpauls/" + y.album.Value + "/" + y.filename.Value + ".png";
            //string path = @"D:\projects\stpauls\Uploads\" + y.album.Value + "\\" + y.filename.Value;
            ////Image image;
            ////using (MemoryStream ms = new MemoryStream(bytes))
            ////{
            ////    image = Image.FromStream(ms);
            ////}

            ////image.Save(path, System.Drawing.Imaging.ImageFormat.Png);
            //File.WriteAllBytes(path, bytes);

            PhotoGallery photoGallery = new PhotoGallery();

            photoGallery.PhotoPath  = "/Uploads/Images/" + imageName;
            photoGallery.Active     = 1;
            photoGallery.UploadDate = DateTime.Now;
            photoGallery.AlbumId    = Convert.ToInt16(httpRequest["album"]);// y.album.Value;
            db.PhotoGalleries.Add(photoGallery);
            db.SaveChangesAsync();

            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Esempio n. 19
0
 public IActionResult GalleryCreate(PhotoGalleryModel model)
 {
     if (!string.IsNullOrEmpty(model.Name))
     {
         PhotoGallery result = new PhotoGallery
         {
             Name         = model.Name,
             Id           = model.Id,
             Published    = model.Published,
             DisplayOrder = model.DisplayOrder
         };
         _photoGalleryRepository.Insert(result);
     }
     return(new NullJsonResult());
 }
Esempio n. 20
0
    private void Delete(string entry)
    {
        if (entry == "")
        {
            lblMessage.Text = "Select a Title.";
            return;
        }

        if (PhotoGallery.Delete(Convert.ToInt32(entry)))
        {
            lblMessage.Text = "The content was succesfully Deleted.";
        }
        else
        {
            lblMessage.Text = "There was problem Deleting the content.";
        }
    }
Esempio n. 21
0
        public static void RefreshBigPhotoPostfix(PhotoGallery __instance, ref int ____activeThumbnailIndex, ref tk2dSpriteCollectionData ____activeSpriteCollection, int __state)
        {
            ____activeThumbnailIndex = __state;
            __instance.bigPhoto.RemoveAllChildren();
            if (__state % 4 == 3)
            {
                SpriteObject spr = GameUtil.ImageFileToSprite(GirlNames[__state / 4] + ".png", GirlNames[__state / 4]);

                if (spr != null)
                {
                    __instance.bigPhoto.AddChild(spr);

                    SpriteObject updatedSprite = __instance.bigPhoto.GetChildren(true)[__instance.bigPhoto.GetChildren().Length - 1] as SpriteObject;
                    updatedSprite.SetLocalPosition(0, 0);
                    updatedSprite.SetOwnChildIndex(3);
                }
            }
        }
Esempio n. 22
0
 /// <summary>
 /// Reset status
 /// </summary>
 public void Reset()
 {
     Title.Clear();
     DocumentText.Name          = DocumentText.Content = "";
     CreditText.AuthorName      = CreditText.AuthorText = "";
     CreditText.CityName        = CreditText.CityText = "";
     CreditText.DisplayDateName = CreditText.DisplayDateText = "";
     ImageOnlySet.Name          = ImageOnlySet.Content = "";
     Bullet.Clear();
     PhotoRelated.Clear();
     ReaderHelp.Clear();
     NewsGrouper.Clear();
     CartoonGrouper.Clear();
     PhotoGallery.Clear();
     PhotoFooterGallery.Clean();
     status       = -1;
     templateType = TemplateTypeCode.OLD_DOC_TEMPLATE_TYPE_UNASSIGNED;
     UrlUsed      = "";
 }
Esempio n. 23
0
        public virtual IActionResult Edit(int id)
        {
            PhotoGallery galery = _photoGalleryRepository.GetById(id);

            if (galery == null)
            {
                return(RedirectToAction("List"));
            }
            PhotoGalleryModel model = new PhotoGalleryModel
            {
                Id        = galery.Id,
                Name      = galery.Name,
                Published = galery.Published,
            };

            model.GalleryPictureSearchModel.GaleriId = galery.Id;
            model.GalleryPictureSearchModel.SetGridPageSize();
            return(View(model));
        }
Esempio n. 24
0
        public virtual IActionResult GalleryEdit(PhotoGalleryModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(new DataSourceResult {
                    Errors = ModelState.SerializeErrors()
                }));
            }
            PhotoGallery result = _photoGalleryRepository.GetById(model.Id);

            if (result == null)
            {
                return(new NullJsonResult());
            }
            result.Name         = model.Name;
            result.DisplayOrder = model.DisplayOrder;
            result.Published    = model.Published;
            _photoGalleryRepository.Update(result);
            return(new NullJsonResult());
        }
Esempio n. 25
0
        public virtual IActionResult GaleriPictureAdd(int pictureId, int displayOrder,
                                                      string overrideAltAttribute, string overrideTitleAttribute, string url, int galeriId)
        {
            if (pictureId == 0)
            {
                throw new ArgumentException();
            }

            PhotoGallery galeri = _photoGalleryRepository.GetById(galeriId)
                                  ?? throw new ArgumentException("No product found with the specified id");
            IOrderedQueryable <PhotoGalleryMapping> query = from pg in _photoGalleryMapRepository.Table
                                                            where pg.GalleryId == galeriId
                                                            orderby pg.DisplayOrder, pg.Id
            select pg;

            if (query.Any(p => p.PictureId == pictureId))
            {
                return(Json(new { Result = false }));
            }
            Picture picture = _pictureService.GetPictureById(pictureId)
                              ?? throw new ArgumentNullException("No Picture found with th spec id");

            _pictureService.UpdatePicture(picture.Id,
                                          _pictureService.LoadPictureBinary(picture),
                                          picture.MimeType,
                                          picture.SeoFilename,
                                          overrideAltAttribute,
                                          overrideTitleAttribute
                                          );
            _pictureService.SetSeoFilename(picture.Id, _pictureService.GetPictureSeName(galeri.Name));
            _photoGalleryMapRepository.Insert(new PhotoGalleryMapping
            {
                GalleryId    = galeriId,
                DisplayOrder = displayOrder,
                PictureId    = pictureId,
                Url          = url
            });

            return(Json(new { Result = true }));
        }
Esempio n. 26
0
        public ActionResult Index()
        {
            var folders = System.IO.Directory.EnumerateDirectories(previewDir);

            var galleries = folders
                            .Select(fn => PhotoGallery.Create(fn))
                            .Where(g => g != null)
                            .OrderByDescending(g => g.OccurredOn);

            //foreach (var b in galleries)
            //{
            //    string dirName = dir + @"\" + b.OccurredOnForLink + " " + b.Title;
            //    if (Directory.Exists(dirName))
            //    {
            //        b.FirstFileName = Path.GetFileName(Directory.GetFiles(dirName).FirstOrDefault());
            //    }
            //}

            ViewBag.Response = galleries;


            //string dirName = "\\\\gd-urengoy\\ГДУ\\Фотогалерея";
            //if (Directory.Exists(dirName))
            //{
            //    string[] dirs = Directory.GetDirectories(dirName);
            //    ViewBag.Response = dirs;
            //}

            //var url = "http://www.ugp.ru/press/gallery/";
            //var web = new HtmlWeb();
            //var doc = web.Load(url);//, "GET", proxy, CredentialCache.DefaultNetworkCredentials);
            //var nodes = doc.DocumentNode.Descendants("div")
            //    .Select(y => y)
            //    .Where(x => x.Attributes["class"] != null && x.Attributes["class"].Value.Contains("photo_gallery_cont"))
            //    .ToList();
            //var resultString = nodes[0].InnerHtml.ToString().Replace("src=\"", "src=\"http://www.ugp.ru");
            //resultString = resultString.Replace("href=\"/press/gallery/", "href=\"/PhotoGallery/Album/");
            return(View());
        }
Esempio n. 27
0
    private void Save()
    {
        try
        {
            string id;
            Sanoy.AddisTower.BE.PhotoGallery photoGallary = new Sanoy.AddisTower.BE.PhotoGallery();
            photoGallary.Title         = txtTitle.Text;
            photoGallary.NormalPicture = txtPicName.Text;
            photoGallary.Thumbnails    = txtThumbnails.Text;
            photoGallary.Catagory      = int.Parse(ddlCatagory.SelectedValue);


            if (ddListOperation.SelectedValue == "-- Create New --")
            {
                photoGallary.Id      = Sanoy.AddisTower.DA.Utility.GetId("PhotoGallery", "Id");
                photoGallary.State   = Sanoy.AddisTower.BE.RowState.Added;
                photoGallary.Publish = "D";
            }
            else
            {
                photoGallary.Publish = Status;
                photoGallary.Id      = Id;
                photoGallary.State   = Sanoy.AddisTower.BE.RowState.Modified;
            }
            if (PhotoGallery.Save(photoGallary))
            {
                lblMessage.Text = "The content was succesfully saved.";
            }
            else
            {
                lblMessage.Text = "There was problem saving the content.";
            }

            Populate();
            clear();
        }
        catch { }
    }
        public PhotoGalleryAddOrUpdateResponseDto AddOrUpdate(PhotoGalleryAddOrUpdateRequestDto request)
        {
            var entity = GetAll()
                         .FirstOrDefault(x => x.Id == request.Id && x.IsDeleted == false);

            if (entity == null)
            {
                repository.Add(entity = new PhotoGallery());
            }
            entity.Name = request.Name;
            entity.PhotoGalleryDigitalAssets.Clear();

            foreach (var photo in request.Photos)
            {
                entity.PhotoGalleryDigitalAssets.Add(new PhotoGalleryDigitalAsset()
                {
                    DigitalAsset = uow.DigitalAssets.GetById(photo.Id)
                });
            }

            uow.SaveChanges();
            return(new PhotoGalleryAddOrUpdateResponseDto(entity));
        }
Esempio n. 29
0
        public virtual IActionResult GaleriPictureList(int id)
        {
            PhotoGallery galeri = _photoGalleryRepository.GetById(id);

            if (galeri == null)
            {
                throw new ArgumentException("No product picture found with the specified id");
            }
            IOrderedQueryable <PhotoGalleryMapping> query = from pg in _context.PhotoGalleryMappings
                                                            where pg.GalleryId == galeri.Id
                                                            orderby pg.DisplayOrder, pg.Id
            select pg;

            List <PhotoGalleryMapping> gridData = query.ToList();
            GalleryPictureListModel    model    = new GalleryPictureListModel
            {
                Data = gridData.Select(x =>
                {
                    GalleryPictureModel galeriPicturemodel = new GalleryPictureModel
                    {
                        Id           = x.Id,
                        DisplayOrder = x.DisplayOrder,
                        GaleriId     = x.GalleryId,
                        PictureId    = x.PictureId
                    };
                    Picture picture = _pictureService.GetPictureById(galeriPicturemodel.PictureId) ??
                                      throw new Exception("Resim Yok");
                    galeriPicturemodel.OverrideAltAttribute   = picture.AltAttribute;
                    galeriPicturemodel.OverrideTitleAttribute = picture.TitleAttribute;
                    galeriPicturemodel.PictureUrl             = _pictureService.GetPictureUrl(picture);
                    return(galeriPicturemodel);
                }),
                Total = query.Count()
            };

            return(Json(model));
        }
        // PUT: odata/PhotoGalleries(5)
        public async Task <IHttpActionResult> Put([FromODataUri] short key, Delta <PhotoGallery> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            PhotoGallery photoGallery = await db.PhotoGalleries.FindAsync(key);

            if (photoGallery == null)
            {
                return(NotFound());
            }

            patch.Put(photoGallery);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PhotoGalleryExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(photoGallery));
        }
 void Start()
 {
     viewGallery = panelViews.GetComponentInChildren<PhotoGallery>();
     ApartmentManager.instance.SelectedApartmentAction += HandleSelectedApartment;
 }
Esempio n. 32
0
 //public Image RectangularImage
 //{
 //    get
 //    {
 //        return new Image()
 //        {
 //            ImageSrc=strRectangularImage,
 //            ImageAlt=System.IO.Path.GetFileNameWithoutExtension(strRectangularImage)
 //        };
 //    }
 //}
 //public Image SquareImage
 //{
 //    get
 //    {
 //        return new Image()
 //        {
 //            ImageSrc = strSquareImage,
 //            ImageAlt = System.IO.Path.GetFileNameWithoutExtension(strSquareImage)
 //        };
 //    }
 //}
 //[XmlIgnore]
 //public string RelatedArticleIds { get; set; }
 //[XmlIgnore]
 //public string Tags { get; set; }
 //[XmlIgnore]
 //public string CopyrightText { get; set; }
 //[XmlIgnore]
 //public string strPhotoGalleryImages { get; set; }
 public Article()
 {
     PhotoGallery = new PhotoGallery();
 }
 /// <summary>
 /// Exports the image to the photo gallery.
 /// </summary>
 /// <param name='pictureId'>
 /// ID of the photo we wish to export
 /// </param>
 private void ExportImageToPhotoGallery(Guid pictureId)
 {
     var filenameResolver = this.CreateFilenameResolver(pictureId);
     var photoGallery = new PhotoGallery();
     photoGallery.SaveImage(filenameResolver.MasterImageFilename);
 }