private static void UploadImages(List <FileInfo> imageFileInfos, PhotoSet gallery, string mimeType) { Log.Debug("New images to upload count[{ImagesCount}]", imageFileInfos.Count()); foreach (var imageFileInfo in imageFileInfos) { Log.Debug("Attempting to upload file[{ImagePath}]", imageFileInfo.Name); if (!gallery.Photos.Any(photos => imageFileInfo.Name == photos.FileName)) { var photoId = UploadProc(imageFileInfo, gallery, mimeType); if (!string.IsNullOrEmpty(Settings.Default.ZenfolioCollectionID)) { _client.CollectionAddPhoto(Convert.ToInt64(Settings.Default.ZenfolioCollectionID), Convert.ToInt64(photoId)); Log.Information("Added PhotoId[{PhotoId} into CollectionId(CollectionId)]", photoId, Settings.Default.ZenfolioCollectionID); } var galleryPhotos = gallery.Photos.ToList(); galleryPhotos.Add(new Photo { FileName = imageFileInfo.Name }); gallery.Photos = galleryPhotos.ToArray(); Log.Information("Uploaded file[{ImageFileName}] successfully", imageFileInfo.Name); } else { Log.Debug("File[{FileName}] already uploaded", imageFileInfo.Name); } } }
private void ForceOpenScrollView(PhotoSet set) { if (ScrollViewIsVisible) { ShowScrollView(); } }
/// <summary> /// Called when user selects a tree node in the tree view. /// Checks selected node type and enables appropriate UI elements. /// </summary> /// <param name="sender">Event sender (treeview)</param> /// <param name="e">Event arguments</param> private void OnGroupsSelect(object sender, TreeViewEventArgs e) { // Check node type and enable/disable appropriate UI NodeType nt = (NodeType)e.Node.ImageIndex; switch (nt) { case NodeType.Gallery: _btnOk.Enabled = true; _btnNewGroup.Enabled = false; _btnNewGallery.Enabled = false; SelectedGallery = e.Node.Tag as PhotoSet; break; case NodeType.Root: case NodeType.Group: _btnOk.Enabled = false; _btnNewGroup.Enabled = true; _btnNewGallery.Enabled = true; break; default: _btnOk.Enabled = false; _btnNewGroup.Enabled = false; _btnNewGallery.Enabled = false; break; } }
void SetActivePhotos(PhotoSet activeSet) { List <LayoutElement> les = sv.content.GetComponent <VerticalLayoutGroup>().GetComponentsInChildren <LayoutElement>().ToList(); foreach (LayoutElement le in les) { Destroy(le.gameObject); } GameObject shareImagePrefab = Resources.Load <GameObject>("Prefabs/SeniorCall/ShareImage"); foreach (Sprite image in activeSet.Photos) { GameObject go = GameObject.Instantiate <GameObject>(shareImagePrefab, sv.content.transform); go.GetComponent <RectTransform>().localScale = Vector3.one; //Resources.Load<Sprite>("Textures/picture" + (i + 1).ToString()); //go.GetComponent<Image>().sprite = Resources.Load<Sprite>("Textures/picture" + (i).ToString()); go.GetComponent <Image>().sprite = image; Vector2 sides = go.GetComponent <Image>().sprite.rect.size; float x = sides.x; float y = sides.y; Debug.Log(y / x * 160); go.GetComponent <RectTransform>().sizeDelta = new Vector2(160, (y / x) * 160); } }
/// <summary> /// Builds upload url /// </summary> /// <returns>Url to use for image upload.</returns> private static string BuildUrl(FileInfo fileInfo, PhotoSet gallery) { // append query parameters that describe the file being uploaded // to the base upload URL return(String.Format("{0}?filename={1}", gallery.UploadUrl, HttpUtility.UrlEncode(fileInfo.Name))); }
/// <summary> /// Creates TreeNode representing Group element. /// </summary> /// <param name="element">Group element to wrap.</param> /// <returns>Constructed tree node.</returns> private TreeNode CreateGroupNode(GroupElement element) { TreeNode ret = new TreeNode(element.Title); ret.Tag = element; if (element is Group) { Group group = element as Group; ret.ImageIndex = (int)NodeType.Group; // Process elements recursively if (group.Elements != null) { foreach (GroupElement child in group.Elements) { ret.Nodes.Add(CreateGroupNode(child)); } } } else { //It's a photoset PhotoSet ps = element as PhotoSet; ret.ImageIndex = ps.Type == PhotoSetType.Gallery ? (int)NodeType.Gallery : (int)NodeType.Collection; } ret.SelectedImageIndex = ret.ImageIndex; return(ret); }
// Use this for initialization void Start() { PhotoController.GetInstance().OnActiveSetChanged += PhotoSetChanged; sv = this.GetComponent <ScrollRect>(); PhotoSet set = PhotoController.GetInstance().ActiveSet; SetActivePhotos(set); }
public static ObservableCollection <Photo> GetPhotos(PhotoSet photoSet) { switch (photoSet.Title) { //Query group for PhotoSets } return(null); }
protected void Page_Load(object sender, EventArgs e) { for (DateTime d = new DateTime(2006, 07, 31); d < new DateTime(2006, 10, 01); d = d.AddDays(7)) { Table t = new Table(); t.BorderWidth = new Unit(1); t.BorderColor = System.Drawing.Color.Black; t.Style.Add("margin-bottom", "5px"); Output("Week " + d.ToString("ddd dd-MM") + " to " + d.AddDays(6).ToString("ddd dd-MM"), "", t); if (true) { Output("New group members", Log.GetSum(Log.Items.CaptionGroupJoin, d, d.AddDays(7)).ToString("#,##0"), t); } if (true) { Query q = new Query(); q.Columns = new ColumnSet(); q.ReturnCountOnly = true; if (Vars.CaptionIsBrand) { q.QueryCondition = new And( new Q(Photo.Columns.ParentDateTime, QueryOperator.GreaterThanOrEqualTo, d), new Q(Photo.Columns.ParentDateTime, QueryOperator.LessThan, d.AddDays(7)), new Q(EventBrand.Columns.BrandK, Vars.CaptionBrandK)); q.TableElement = new Join.Series(Photo.Columns.GalleryK, Gallery.Columns.K, Gallery.Columns.EventK, Event.Columns.K, EventBrand.Columns.EventK); } else { q.QueryCondition = new And( new Q(Photo.Columns.ParentDateTime, QueryOperator.GreaterThanOrEqualTo, d), new Q(Photo.Columns.ParentDateTime, QueryOperator.LessThan, d.AddDays(7)), new Q(GroupEvent.Columns.GroupK, Vars.CompetitionGroupK)); q.TableElement = new Join.Series(Photo.Columns.GalleryK, Gallery.Columns.K, Gallery.Columns.EventK, Event.Columns.K, GroupEvent.Columns.EventK); } PhotoSet ps = new PhotoSet(q); Output("Photos uploaded", ps.Count.ToString("#,##0"), t); } //Output("Competition entries", Log.GetSum(Log.Items.CaptionsAdded, d, d.AddDays(7)).ToString("#,##0"), t); //Output("Banner impressions", BannerStat.GetHits(3913, d, d.AddDays(7)).ToString("#,##0"), t); //Output("Banner clicks", BannerStat.GetClicks(3913, d, d.AddDays(7)).ToString("#,##0"), t); MainDiv.Controls.Add(t); } }
public Sprite GetPhoto(string setName, string photoName) { PhotoSet set = photoLibrary.PhotoSets.FirstOrDefault(x => x.Name.ToLower() == setName.ToLower()); if (null != set) { return(set.Photos.FirstOrDefault(y => y.name.ToLower() == photoName.ToLower())); } return(null); }
static void Main(string[] args) { TurbineEncoder Encoder = new TurbineEncoder(); Console.WriteLine("Main..."); // if (Vars.DevEnv) // VideoTest("c:\\vidtest\\sw4a.mov", Guid.NewGuid()); // for (int i = 0; i < 100; i++) // { // VideoTest("c:\\vidtest\\test.3gp", Guid.NewGuid()); // } // return; Query q = new Query(); q.QueryCondition = new Q(Photo.Columns.K, 3460180); //Broken 04/10/2006: //3353642 //3623970 //q.QueryCondition = new Q(Photo.Columns.ProcessingAttempts, QueryOperator.GreaterThan, 1); // q.QueryCondition = new And( // new Q(Photo.Columns.ProcessingAttempts, QueryOperator.GreaterThan, 1), // new Q(Photo.Columns.VideoFileExtention, QueryOperator.NotEqualTo, "3gp")); // q.QueryCondition = new Or( // new Q(Photo.Columns.K, 2450665), // new Q(Photo.Columns.K, 2450649)); PhotoSet ps = new PhotoSet(q); //for (int i = 0; i < 100; i++) while (true) { foreach (Photo p in ps) { EncoderBase.ProcessPhoto(Encoder, p, false, new EncoderBase.StatusDelegate(ConsoleWriteLine), 8); } } return; }
private void Page_Load(object sender, System.EventArgs e) { int usrK = ContainerPage.Url["UsrK"]; Query q = new Query(); q.TopRecords = 50; q.OrderBy = new OrderBy(new OrderBy(Photo.Columns.WeightedSexyRating, OrderBy.OrderDirection.Descending), new OrderBy(Photo.Columns.WeightedCoolRating, OrderBy.OrderDirection.Descending)); q.TableElement = Photo.UsrMeJoin; q.QueryCondition = new And(new Q(Usr.Columns.K, usrK), Photo.EnabledQueryCondition); PhotoSet ps = new PhotoSet(q); PhotosDataList.DataSource = ps; PhotosDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/DatePhotoList.ascx"); PhotosDataList.DataBind(); }
public override PhotoSet VisitPhotoSetAfter(PhotoSet photoSet, AnalyzerExecutionContext executionContext) { if (_currentFolderDuplicates.Count() == photoSet.Photos.Count()) { executionContext.Activities.Add(new ResolveDuplicatePhotoSetActivity(photoSet, _currentFolderDuplicates)); } else { executionContext.Activities.AddRange(_currentFolderDuplicates); } _currentFolderDuplicates = null; return photoSet; }
/// <summary> /// Creates form instance. /// </summary> /// <param name="client">Zenfolio client to use for operations.</param> /// <param name="gallery">Destination gallery for uploading.</param> /// <param name="filePath">Path of the image to be uploaded.</param> /// <param name="mimeType">MIME type of the image.</param> public UploadDialog( ZenfolioClient client, PhotoSet gallery, string filePath, string mimeType ) { _client = client; _gallery = gallery; _fileInfo = new FileInfo(filePath); _totalChunks = (int)_fileInfo.Length / 1024; _mimeType = mimeType; InitializeComponent(); }
private void OnPhotoContextWord(List <string> contextWords) { bool setChanged = false; foreach (PhotoSet set in photoLibrary.PhotoSets) { if (set.Name.ToLower() == contextWords[0]) { ActiveSet = set; setChanged = true; break; } } if (null != OnActiveSetChanged && setChanged) { OnActiveSetChanged(ActiveSet); } }
void Bind() { if (CurrentGallery != null) { Query q = new Query(); q.Columns = Templates.Photos.Admin.Columns; q.QueryCondition = new And( new Q(Photo.Columns.GalleryK, CurrentGallery.K), new Q(Photo.Columns.Status, Photo.StatusEnum.Moderate)); PhotoSet ps = new PhotoSet(q); ArrayList al = new ArrayList(); foreach (Photo p in ps) al.Add(p.K); this.ViewState["Photos"] = al; PhotoDataList.DataSource = ps; PhotoDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/Admin.ascx"); PhotoDataList.DataBind(); PhotosPanel.Visible = ps.Count > 0; Query tsq = new Query(); tsq.QueryCondition = new Q(Gallery.Columns.K, CurrentGallery.K); GallerySet gs = new GallerySet(tsq); GalleriesDataGrid.DataSource = gs; GalleriesDataGrid.DataBind(); } else { Gallery g = GetNextGallery(); if (g != null) Response.Redirect(g.UrlApp("moderate")); else { DonePanel.Visible = true; InfoPanel.Visible = false; } PhotosPanel.Visible = false; } }
/// <summary> /// Called when user presses "Make New Gallery" button. /// Creates new gallery under selected Group. /// </summary> /// <param name="sender">Event sender (button)</param> /// <param name="e">Event arguments</param> private void OnNewGallery(object sender, EventArgs e) { // Extract current context TreeNode currentNode = _tvGroups.SelectedNode; Group parent = (Group)currentNode.Tag; PhotoSetUpdater updater = new PhotoSetUpdater(); updater.Title = "New Gallery"; // Create gallery PhotoSet newGallery = _client.CreatePhotoSet(parent.Id, PhotoSetType.Gallery, updater); // Attach new gallery to the tree and start edit TreeNode newNode = CreateGroupNode(newGallery); currentNode.Nodes.Add(newNode); currentNode.Expand(); newNode.BeginEdit(); }
protected void Page_Load(object sender, EventArgs e) { Query q = new Query(); q.Columns = Templates.Photos.TopPhoto.Columns; q.QueryCondition = new Q(Photo.Columns.PhotoOfWeek, true); q.OrderBy = new OrderBy(Photo.Columns.PhotoOfWeekDateTime, OrderBy.OrderDirection.Descending); q.TopRecords = 8; PhotoSet ps = new PhotoSet(q); if (ps.Count != 8) { if (Holder != null) Holder.Visible = false; } else { PhotoOfWeekAllDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/TopPhoto.ascx"); PhotoOfWeekAllDataList.DataSource = ps; PhotoOfWeekAllDataList.DataBind(); } }
/// <summary> /// Deletes the Photo set. /// </summary> /// <param name="id">The identifier.</param> /// <returns></returns> /// 创建人:李允智 /// 创建时间:2016/1/14 /// 描述:删除照片 public string DelPhotoSet(int id) { using (LuckyDrawEntities entitys = new LuckyDrawEntities()) { try { List <Models.PhotoSet> list = entitys.PhotoSets.Where(a => a.id == id).ToList(); if (list.Count > 0) { PhotoSet ss = list[0]; entitys.PhotoSets.Remove(ss); entitys.SaveChanges(); } } catch (Exception) { return(JsonHelper.GetJson("false")); } return(JsonHelper.GetJson("true")); } }
protected void Page_Init(object sender, EventArgs e) { string tag = ContainerPage.Url[0].Raw; Visit.Current.IsFromExternal = true; Visit.Current.ExternalTag = tag; Visit.Current.Update(); // try // { Query q = new Query(); q.QueryCondition = new And(new Q(Photo.Columns.PhotoOfWeek, true), new Q(Photo.Columns.PhotoOfWeekDateTime, QueryOperator.GreaterThan, DateTime.Now.AddDays(-30))); //q.QueryCondition = new Q(Photo.Columns.PhotoOfWeek, true); q.TopRecords = 1; q.OrderBy = new OrderBy(OrderBy.OrderDirection.Random); PhotoSet ps = new PhotoSet(q); Response.Redirect(ps[0].Url()); // } // catch // { // Response.Redirect("/"); // } }
private static List <FileInfo> GetNewImageFileInfos(PhotoSet gallery, string[] imagePaths) { var imageFileInfos = new List <FileInfo>(); foreach (var imagePath in imagePaths) { if (IsFileLocked(imagePath)) { Log.Debug("File [{FilePath}] is locked so it's being ignored", imagePath); } else { var imageFileinfo = new FileInfo(imagePath); if (!gallery.Photos.Any(p => p.FileName == imageFileinfo.Name)) { imageFileInfos.Add(imageFileinfo); } } } return(imageFileInfos); }
private void Page_Load(object sender, System.EventArgs e) { Query q = new Query(); q.NoLock = true; q.TableElement = Photo.UsrFavouritesJoin; q.QueryCondition = new And( Photo.EnabledQueryCondition, new Q(Photo.Columns.UsrK, CurrentUsr.K), new Q(UsrPhotoFavourite.Columns.UsrK, CurrentUsr.K) ); q.OrderBy = Photo.DateTimeOrder(OrderBy.OrderDirection.Descending); q.TopRecords = 5; PhotoSet ps = new PhotoSet(q); if (ps.Count > 0) { PhotosDataList.Visible = true; PhotosDataList.DataSource = ps; PhotosDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/IconRollover.ascx"); PhotosDataList.DataBind(); } else PhotosDataList.Visible = false; }
public Container VisitContainer(Container container) { var idx = 0; var photoSets = new PhotoSet[container.PhotoSets.Count()]; foreach (var visitor in Visitors) { container = visitor.VisitContainerBefore(container); } foreach (var photoSet in container.PhotoSets) { photoSets[idx++] = VisitPhotoSet(photoSet); } container = container.WithPhotoSets(photoSets); foreach (var visitor in Visitors) { container = visitor.VisitContainerAfter(container); } return container; }
public PhotoSet VisitPhotoSet(PhotoSet photoSet) { var idx = 0; var photos = new Photo[photoSet.Photos.Count()]; foreach (var visitor in Visitors) { photoSet = visitor.VisitPhotoSetBefore(photoSet); } foreach (var photo in photoSet.Photos) { photos[idx++] = VisitPhoto(photo); } photoSet = photoSet.WithPhotos(photos); foreach (var visitor in Visitors) { photoSet = visitor.VisitPhotoSetAfter(photoSet); } return photoSet; }
private void Page_Load(object sender, System.EventArgs e) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "Tip", "mig_hand();", true); if (CurrentGallery.LivePhotos > 0) { OrderBy ob = Photo.DateTimeOrder(OrderBy.OrderDirection.Ascending); // if (ContainerPage.Url["Order"].Equals("Rating")) // ob = Photo.RateOrder; Query q = new Query(); q.NoLock = true; q.TableElement = Templates.Photos.QuickBrowserPhotoList.PerformJoins(new TableElement(TablesEnum.Photo)); q.Columns = Templates.Photos.QuickBrowserPhotoList.Columns; q.QueryCondition = new And(new Q(Photo.Columns.GalleryK, CurrentGallery.K), Photo.EnabledQueryCondition); q.OrderBy = ob; PhotoSet ps = new PhotoSet(q); PhotosDataList.DataSource = ps; PhotosDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/QuickBrowserPhotoList.ascx"); PhotosDataList.DataBind(); } this.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Bobs.Log.Increment(Model.Entities.Log.Items.WhosGoingOutPage); if (Visit.HasCurrent && !Visit.Current.IsCrawler) Bobs.Log.Increment(Model.Entities.Log.Items.WhosGoingOutPageNoCrawlers); if (SexTypeFromUrl != SexType.NoneSpecified && LocationTypeFromUrl != LocationType.NoneSpecified) { UsrEventAttendedSet ueas = get(false); if (ueas.Count <= 1) ueas = get(true); if (ueas.Count > 1) { int tries = 0; int index = ContainerPage.Random.Next(ueas.Count); Usr newU = ueas[index].Usr; while (CurrentUsr != null && newU.K == CurrentUsr.K && tries < 10) { index = ContainerPage.Random.Next(ueas.Count); newU = ueas[index].Usr; tries++; } Next.HRef = GetUrl(SexTypeFromUrl, LocationTypeFromUrl, newU.K); //"/pages/out/" + (ContainerPage.Url[0] == "boys" ? "boys" : "girls") + "/" + newU.K.ToString(); if (CurrentUsr == null) Response.Redirect(Next.HRef); } } else { TopP.Visible = false; TopPChoose.Visible = true; } if (CurrentUsr != null) { string mainPicPath = ""; List<Photo> photos = new List<Photo>(); List<int> photoKs = new List<int>(); bool hasPic = false; if (CurrentUsr.HasPicNotFacebook) { hasPic = true; mainPicPath = CurrentUsr.PicPath; photos.Add(CurrentUsr.PicPhoto); photoKs.Add(CurrentUsr.PicPhotoK); } { Query q = new Query(); q.TableElement = new Join(Photo.UsrMeJoin, UsrPhotoFavourite.Columns.PhotoK, Photo.Columns.K); if (photoKs.Count > 0) { q.QueryCondition = new And(new Q(Photo.Columns.MediaType, Photo.MediaTypes.Image), new Q(Usr.Columns.K, CurrentUsr.K), new Q(UsrPhotoFavourite.Columns.UsrK, CurrentUsr.K), new NotQ(new InListQ(Photo.Columns.K, photoKs))); } else { q.QueryCondition = new And(new Q(Photo.Columns.MediaType, Photo.MediaTypes.Image), new Q(Usr.Columns.K, CurrentUsr.K), new Q(UsrPhotoFavourite.Columns.UsrK, CurrentUsr.K)); } q.OrderBy = Photo.DateTimeOrder(OrderBy.OrderDirection.Descending); q.TopRecords = 5; q.CacheDuration = new TimeSpan(1, 0, 0); PhotoSet ps = new PhotoSet(q); foreach (Photo p in ps) { if (photos.Count == 0) mainPicPath = p.IconPath; photos.Add(p); photoKs.Add(p.K); } } if (photos.Count < 5) { Query q = new Query(); q.TableElement = Photo.UsrMeJoin; if (photoKs.Count > 0) { q.QueryCondition = new And(new Q(Photo.Columns.MediaType, Photo.MediaTypes.Image), new Q(Usr.Columns.K, CurrentUsr.K), new NotQ(new InListQ(Photo.Columns.K, photoKs))); } else { q.QueryCondition = new And(new Q(Photo.Columns.MediaType, Photo.MediaTypes.Image), new Q(Usr.Columns.K, CurrentUsr.K)); } q.OrderBy = Photo.DateTimeOrder(OrderBy.OrderDirection.Descending); q.TopRecords = 5; q.CacheDuration = new TimeSpan(1, 0, 0); PhotoSet ps = new PhotoSet(q); foreach (Photo p in ps) { if (photos.Count == 0) mainPicPath = p.IconPath; photos.Add(p); photoKs.Add(p.K); } } if (photos.Count == 0) { WebHolder.Visible = false; Thumb1.Visible = false; Thumb2.Visible = false; Thumb3.Visible = false; Thumb4.Visible = false; Thumb5.Visible = false; } else { Thumb1.Src = mainPicPath; Web.Src = photos[0].WebPath; Web.Width = photos[0].WebWidth; Web.Height = photos[0].WebHeight; Link.HRef = photos[0].Url(); Thumb1.Attributes["onmouseover"] = "change('" + photos[0].WebPath + "', " + photos[0].WebWidth + ", " + photos[0].WebHeight + ", '" + photos[0].Url() + "');"; Thumb1.Attributes["onclick"] = "change('" + photos[0].WebPath + "', " + photos[0].WebWidth + ", " + photos[0].WebHeight + ", '" + photos[0].Url() + "');"; if (photos.Count > 1) { Thumb2.Src = photos[1].IconPath; Thumb2.Attributes["onmouseover"] = "change('" + photos[1].WebPath + "', " + photos[1].WebWidth + ", " + photos[1].WebHeight + ", '" + photos[1].Url() + "');"; Thumb2.Attributes["onclick"] = "change('" + photos[1].WebPath + "', " + photos[1].WebWidth + ", " + photos[1].WebHeight + ", '" + photos[1].Url() + "');"; if (photos.Count > 2) { Thumb3.Src = photos[2].IconPath; Thumb3.Attributes["onmouseover"] = "change('" + photos[2].WebPath + "', " + photos[2].WebWidth + ", " + photos[2].WebHeight + ", '" + photos[2].Url() + "');"; Thumb3.Attributes["onclick"] = "change('" + photos[2].WebPath + "', " + photos[2].WebWidth + ", " + photos[2].WebHeight + ", '" + photos[2].Url() + "');"; if (photos.Count > 3) { Thumb4.Src = photos[3].IconPath; Thumb4.Attributes["onmouseover"] = "change('" + photos[3].WebPath + "', " + photos[3].WebWidth + ", " + photos[3].WebHeight + ", '" + photos[3].Url() + "');"; Thumb4.Attributes["onclick"] = "change('" + photos[3].WebPath + "', " + photos[3].WebWidth + ", " + photos[3].WebHeight + ", '" + photos[3].Url() + "');"; if (photos.Count > 4) { Thumb5.Src = photos[4].IconPath; Thumb5.Attributes["onmouseover"] = "change('" + photos[4].WebPath + "', " + photos[4].WebWidth + ", " + photos[4].WebHeight + ", '" + photos[4].Url() + "');"; Thumb5.Attributes["onclick"] = "change('" + photos[4].WebPath + "', " + photos[4].WebWidth + ", " + photos[4].WebHeight + ", '" + photos[4].Url() + "');"; } else { Thumb5.Visible = false; } } else { Thumb4.Visible = false; Thumb5.Visible = false; } } else { Thumb3.Visible = false; Thumb4.Visible = false; Thumb5.Visible = false; } } else { Thumb2.Visible = false; Thumb3.Visible = false; Thumb4.Visible = false; Thumb5.Visible = false; } } BottomPara.InnerHtml = "Showing "; BottomPara.InnerHtml += SexTypeFromUrl == SexType.Girls ? "girls " : ""; BottomPara.InnerHtml += SexTypeFromUrl == SexType.Boys ? "boys " : ""; BottomPara.InnerHtml += SexTypeFromUrl == SexType.All || SexTypeFromUrl == SexType.NoneSpecified ? "girls and boys " : ""; BottomPara.InnerHtml += " going out "; BottomPara.InnerHtml += LocationTypeFromUrl == LocationType.Country ? ("in " + CountryFromUrl.FriendlyName + ".") : ""; BottomPara.InnerHtml += LocationTypeFromUrl == LocationType.Worldwide || LocationTypeFromUrl == LocationType.NoneSpecified ? "worldwide." : ""; BottomPara.InnerHtml += " Click for: "; BottomPara.InnerHtml += SexTypeFromUrl == SexType.Girls ? "" : ("<a href=\"" + GetUrl(SexType.Girls, LocationTypeFromUrl, 0) + "\">girls</a>, "); BottomPara.InnerHtml += SexTypeFromUrl == SexType.Boys ? "" : ("<a href=\"" + GetUrl(SexType.Boys, LocationTypeFromUrl, 0) + "\">boys</a>, "); BottomPara.InnerHtml += SexTypeFromUrl == SexType.All || SexTypeFromUrl == SexType.NoneSpecified ? "" : ("<a href=\"" + GetUrl(SexType.All, LocationTypeFromUrl, 0) + "\">girls and boys</a>, "); BottomPara.InnerHtml += LocationTypeFromUrl == LocationType.Country ? "" : ("<a href=\"" + GetUrl(SexTypeFromUrl, LocationType.Country, 0) + "\">going out in " + HomeCountryFromVisitor.FriendlyName + "</a>."); BottomPara.InnerHtml += LocationTypeFromUrl == LocationType.Worldwide || LocationTypeFromUrl == LocationType.NoneSpecified ? "" : ("going out <a href=\"" + GetUrl(SexTypeFromUrl, LocationType.Worldwide, 0) + "\">worldwide</a>."); PlaceHolder para = photos.Count > 0 ? Para : ParaTop; { Query q = new Query(); q.TableElement = Event.UsrAttendedJoin; q.QueryCondition = new And( new Q(Usr.Columns.K, CurrentUsr.K), Event.FutureEventsQueryCondition); q.OrderBy = Event.FutureEventOrder; q.Columns = new ColumnSet(UsrEventAttended.Columns.EventK); q.CacheDuration = new TimeSpan(1, 0, 0); UsrEventAttendedSet ueas = new UsrEventAttendedSet(q); if (ueas.Count > 0) { UsrEventAttended uea = ueas[0]; Event ev = uea.Event; para.Controls.Add( new LiteralControl( "<p" + (photos.Count > 0 ? " style=\"margin-top:15px;\"" : "") + "><center>" + CurrentUsr.Link() + " is going to " + ev.FriendlyHtml(true, true, true, true, false) + (photos.Count == 0 ? ", but has no photos." : "") + "</center></p>" ) ); } else { para.Controls.Add( new LiteralControl( "<p" + (photos.Count > 0 ? " style=\"margin-top:15px;\"" : "") + "><center>" + CurrentUsr.Link() + " isn't going out soon" + (photos.Count == 0 ? ", and has no photos." : "") + "</center></p>" ) ); } para.Controls.Add( new LiteralControl( "<p><center>Want to say hi? <a href=\"" + CurrentUsr.Url() + "#PrivateMessage\">Send " + CurrentUsr.NickName + " a private message.</a></center></p>") ); } } else { WebHolder.Visible = false; Thumb2.Visible = false; Thumb1.Visible = false; Thumb3.Visible = false; } }
public PhotoSet PhotosMe(ColumnSet cs, int topRecords) { if (photosMe == null) { Query q = new Query(); q.QueryCondition = new Q(Usr.Columns.K, this.K); q.TableElement = Photo.UsrMeJoin; q.OrderBy = Photo.DateTimeOrder(OrderBy.OrderDirection.Descending); if (cs != null) q.Columns = cs; if (topRecords > 0) q.TopRecords = topRecords; photosMe = new PhotoSet(q); } return photosMe; }
public void UpdateTotalPhotos(Transaction transaction) { Query q = new Query(); q.QueryCondition = new And(new Q(Photo.Columns.UsrK, this.K), Photo.EnabledQueryCondition); q.ReturnCountOnly = true; PhotoSet ps = new PhotoSet(q); this.TotalPhotoUploads = ps.Count; this.Update(transaction); }
private void GroupPhoto_Load(object sender, System.EventArgs e) { bool competitionGroup = Vars.IsCompetitionGroupActive(CurrentGroup.K); Query q = new Query(); q.Columns = Templates.GroupPhotos.Icon.Columns; q.TableElement = new Bobs.Join( new TableElement(TablesEnum.Photo), new TableElement(TablesEnum.GroupPhoto), QueryJoinType.Inner, new And( new Q(Photo.Columns.K, GroupPhoto.Columns.PhotoK, true), new Q(GroupPhoto.Columns.GroupK, CurrentGroup.K), new Q(GroupPhoto.Columns.ShowOnFrontPage, true), competitionGroup ? new Q(Photo.Columns.IsInCaptionCompetition, false) : new Q(true))); q.OrderBy = new OrderBy(GroupPhoto.Columns.DateTime, OrderBy.OrderDirection.Descending); q.TopRecords = competitionGroup ? 4 : 8; PhotoSet ps = new PhotoSet(q); if (ps.Count == 0) { GroupPhotoPanel.Visible = false; if (CurrentGroupUsr != null && CurrentGroupUsr.Moderator) GroupPhotoModPanelPanel.Visible = true; } else { GroupPhotoDataList.ItemTemplate = this.LoadTemplate("/Templates/GroupPhotos/Icon.ascx"); GroupPhotoDataList.DataSource = ps; GroupPhotoDataList.DataBind(); GroupPhotoArchiveLinkP.Visible = ps.Count == q.TopRecords; } }
public string InsertPhotoSet(string name, string path, int x, int y, int x2, int y2) { Bitmap bm = new Bitmap(System.Web.HttpContext.Current.Server.MapPath(path)); Bitmap bmpOut = new Bitmap((x2 - x), (y2 - y), PixelFormat.Format24bppRgb); Graphics g = Graphics.FromImage(bmpOut); g.DrawImage(bm, new Rectangle(0, 0, (x2 - x), (y2 - y)), new Rectangle(x, y, (x2 - x), (y2 - y)), GraphicsUnit.Pixel); Random rnd = new Random(); int num = rnd.Next(5000, 1000000); string newpath = "/Data/" + num.ToString() + ".jpg"; bmpOut.Save(System.Web.HttpContext.Current.Server.MapPath(newpath)); g.Dispose(); using (LuckyDrawEntities entitys = new LuckyDrawEntities()) { try { PhotoSet ss = new PhotoSet(); ss.name = name; ss.url = newpath; entitys.PhotoSets.Add(ss); entitys.SaveChanges(); } catch (Exception) { return(JsonHelper.GetJson("false")); } return(JsonHelper.GetJson("true")); } //HttpFileCollection files = System.Web.HttpContext.Current.Request.Files; //if (files.Count > 0) //{ // Random rnd = new Random(); // string path = ""; // HttpPostedFile file = files[0]; // if (file.ContentLength > 0) // { // string fileName = file.FileName; // string extension = Path.GetExtension(fileName); // int num = rnd.Next(5000, 1000000); // path = "/Data/" + num.ToString() + extension; // file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path)); // } // using (LuckyDrawEntities entitys = new LuckyDrawEntities()) // { // try // { // PhotoSet ss = new PhotoSet(); // ss.name = name; // ss.url = path; // entitys.PhotoSets.Add(ss); // entitys.SaveChanges(); // } // catch (Exception) // { // return JsonHelper.GetJson("false"); // } // return JsonHelper.GetJson("true"); // } //} //else //{ // return JsonHelper.GetJson("false"); //} }
/// <summary> /// Uploading procedure /// </summary> public static string UploadProc(FileInfo imageFile, PhotoSet gallery, string mimeType) { // Upload the data BinaryReader fileReader = null; Stream requestStream = null; try { HttpWebRequest req = (HttpWebRequest)WebRequest.Create(BuildUrl(imageFile, gallery)); req.AllowWriteStreamBuffering = false; req.Method = "POST"; // put correct user token in request headers req.Headers.Add("X-Zenfolio-Token", _client.Token); req.ContentType = mimeType; req.ContentLength = imageFile.Length; // Prepare to read the file and push it into request stream fileReader = new BinaryReader(new FileStream(imageFile.FullName, FileMode.Open)); requestStream = req.GetRequestStream(); // Create a buffer for image data const int bufSize = 1024; byte[] buffer = new byte[bufSize]; int chunkLength = 0; // Transfer data while ((chunkLength = fileReader.Read(buffer, 0, bufSize)) > 0) { requestStream.Write(buffer, 0, chunkLength); //Enter sleep state for Thread.Interrupt() to work //result.AsyncWaitHandle.WaitOne(); //requestStream.EndWrite(result); //Notify UI //this.Invoke(new MethodInvoker(this.OnProgress)); } // Read image ID from the response WebResponse response = req.GetResponse(); TextReader responseReader = new StreamReader(response.GetResponseStream()); string imageId = responseReader.ReadToEnd(); return(imageId); //TODO load photo and construct url for View button //_client.LoadPhoto(id); // Inform UI that upload finished //this.Invoke(new MethodInvoker(this.OnComplete)); } catch (Exception) { throw; } finally { fileReader.Close(); requestStream.Close(); } }
public void EditArticlePanel_Load(object o, System.EventArgs e) { if (ContainerPage.Url["Mode"].Equals("Edit")) { if ((CurrentArticle != null && !Usr.Current.CanEdit(CurrentArticle)) || (CurrentPara != null && !Usr.Current.CanEdit(CurrentPara.Article))) { ChangePanel(CantEditPanel); return; } EditArticleAdminTab.Visible = Usr.Current.IsAdmin; EditArticleAdminPanel.Visible = Usr.Current.IsAdmin; if (Usr.Current.IsAdmin) { EditArticleStatusDisplay.Visible = CurrentArticle.Status == Model.Entities.Article.StatusEnum.Enabled; if (CurrentArticle.Status == Model.Entities.Article.StatusEnum.Enabled) { EditArticleStatusDisplay.InnerHtml = "Article enabled " + CurrentArticle.EnabledDateTime.ToString() + " by " + CurrentArticle.EnabledUsr.Link(); } } EditArticleContentTab.HRef = CurrentArticle.UrlEdit("tab", "content"); EditArticleTitleTab.HRef = CurrentArticle.UrlEdit("tab", "title"); EditArticleLinkTab.HRef = CurrentArticle.UrlEdit("tab", "link"); EditArticleIconTab.HRef = CurrentArticle.UrlEdit("tab", "icon"); EditArticlePhotosTab.HRef = CurrentArticle.UrlEdit("tab", "photos"); EditArticleAdminTab.HRef = CurrentArticle.UrlEdit("tab", "admin"); if (ContainerPage.Url["Tab"].Equals("Content") || ContainerPage.Url["Tab"].IsNull) { BindBodyPageRepeater(); ChangePanel(EditArticleBodyPanel); EditArticleContentTab.Attributes["class"] = "TabbedHeading Selected"; } else if (ContainerPage.Url["Tab"].Equals("Title")) { ChangePanel(EditArticleTitleSummaryPanel); EditArticleTitleTab.Attributes["class"] = "TabbedHeading Selected"; } else if (ContainerPage.Url["Tab"].Equals("Link")) { ChangePanel(EditArticleSubjectMatterPanel); EditArticleLinkTab.Attributes["class"] = "TabbedHeading Selected"; } else if (ContainerPage.Url["Tab"].Equals("Icon")) { EditArticlePicture.InputObject = CurrentArticle; if (!Page.IsPostBack) EditArticlePicture.InitPic(); ChangePanel(EditArticlePicturePanel); EditArticleIconTab.Attributes["class"] = "TabbedHeading Selected"; } else if (ContainerPage.Url["Tab"].Equals("Photos") || ContainerPage.Url["Photos"] == 1) { #region Photo upload panel EditArticlePhotoUploadLink.HRef = "/pages/galleries/add/articlek-" + CurrentArticle.K.ToString(); EditArticlePhotoEditLink.HRef = "/pages/galleries/add/articlek-" + CurrentArticle.K.ToString(); PhotoSet ps = new PhotoSet(new Query(new Q(Photo.Columns.ArticleK, CurrentArticle.K), Photo.DateTimeOrder(OrderBy.OrderDirection.Ascending))); if (ps.Count == 0) EditArticlePhotoNoPhotosPanel.Visible = false; else { EditArticlePhotoNoPhotosPanel.Visible = true; EditArticlePhotoGalleryDataList.DataSource = ps; EditArticlePhotoGalleryDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/MyArticlesUpload.ascx"); EditArticlePhotoGalleryDataList.DataBind(); } #endregion ChangePanel(EditArticlePhotoUploadPanel); EditArticlePhotosTab.Attributes["class"] = "TabbedHeading Selected"; } else if (ContainerPage.Url["Tab"].Equals("Admin") && Usr.Current.IsAdmin) { ChangePanel(EditArticleAdminPanel); EditArticleAdminTab.Attributes["class"] = "TabbedHeading Selected"; } EditArticleIndexPublishPanel.Visible = CurrentArticle.Status.Equals(Article.StatusEnum.New) && !CurrentArticle.Pic.Equals(Guid.Empty); EditArticleIndexToDoPanel.Visible = CurrentArticle.Status.Equals(Article.StatusEnum.New) && CurrentArticle.Pic.Equals(Guid.Empty); EditArticleIndexPanelPreviewAnchor.HRef = CurrentArticle.Url(); EditArticleIndexPanelArticleNameLabel.Text = CurrentArticle.Name; if (!Page.IsPostBack) { EditArticleTitleTextBox.Text = CurrentArticle.Title; EditArticleSummaryTextBox.Text = CurrentArticle.Summary; if (CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Event)) { EditArticleScopeEvent.Checked = true; updateEditArticleScope(); EditArticleScopeMultiPicker.Event = CurrentArticle.ParentEvent; } else if (CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Venue)) { EditArticleScopeVenue.Checked = true; updateEditArticleScope(); EditArticleScopeMultiPicker.Venue = CurrentArticle.ParentVenue; } else if (CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Place)) { EditArticleScopePlace.Checked = true; updateEditArticleScope(); EditArticleScopeMultiPicker.Place = CurrentArticle.ParentPlace; } else if (CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Country)) { EditArticleScopeCountry.Checked = true; updateEditArticleScope(); EditArticleScopeMultiPicker.Country = CurrentArticle.ParentCountry; } else { EditArticleScopeGeneral.Checked = true; updateEditArticleScope(); } EditArticleRelevanceEvent.Checked = CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Event) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Venue) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Place) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Country) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.None); EditArticleRelevanceVenue.Checked = CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Venue) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Place) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Country) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.None); EditArticleRelevancePlace.Checked = CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Place) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Country) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.None); EditArticleRelevanceCountry.Checked = CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.Country) || CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.None); EditArticleRelevanceCountry.Checked = CurrentArticle.ParentObjectType.Equals(Model.Entities.ObjectType.None); if (Usr.Current.IsAdmin) { EditArticleAdminStatusDrop.SelectedValue = ((int)CurrentArticle.Status).ToString(); EditArticleRelevanceGeneral.Checked = CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Worldwide; EditArticleRelevanceCountry.Checked = CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Worldwide || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Country; EditArticleRelevancePlace.Checked = CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Worldwide || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Country || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Place; EditArticleRelevanceVenue.Checked = CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Worldwide || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Country || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Place || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Venue; EditArticleRelevanceEvent.Checked = CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Worldwide || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Country || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Place || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Venue || CurrentArticle.Relevance == Model.Entities.Article.RelevanceEnum.Event; EditArticleRelevanceCountry.Visible = CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Country || CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Place || CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Venue || CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Event; EditArticleRelevancePlace.Visible = CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Place || CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Venue || CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Event; EditArticleRelevanceVenue.Visible = CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Venue || CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Event; EditArticleRelevanceEvent.Visible = CurrentArticle.ParentObjectType == Model.Entities.ObjectType.Event; EditArticleRelevanceGeneral.Enabled = CurrentArticle.ParentObjectType != Model.Entities.ObjectType.None; EditArticleRelevanceCountry.Enabled = CurrentArticle.ParentObjectType != Model.Entities.ObjectType.Country; EditArticleRelevancePlace.Enabled = CurrentArticle.ParentObjectType != Model.Entities.ObjectType.Place; EditArticleRelevanceVenue.Enabled = CurrentArticle.ParentObjectType != Model.Entities.ObjectType.Venue; EditArticleRelevanceEvent.Enabled = CurrentArticle.ParentObjectType != Model.Entities.ObjectType.Event; EditArticleMixmag.Checked = CurrentArticle.IsMixmagNews; EditArticleExtended.Checked = CurrentArticle.IsExtendedDisplay; for ( int i = 0; i < MixmagSectionsListBox.Rows; i++ ) { MixmagSectionsListBox.Items[i].Selected = CurrentArticle.MixmagIsSection(i); } EditArticleRelevanceFrontPageAboveFold.Checked = CurrentArticle.ShowAboveFoldOnFrontPage; } this.DataBind(); if (ContainerPage.Url["ParaK"].IsInt) { Para p = new Para(ContainerPage.Url["ParaK"]); ChangePanel(EditArticleBodyPanel); ContainerPage.AnchorSkip("ArticlePage" + p.Page.ToString()); } } } }
public void UpdateNextPreviousCache() { Query q = new Query(); q.QueryCondition = new And( Photo.EnabledQueryCondition, new Q(Photo.Columns.GalleryK, this.GalleryK) ); q.OrderBy = Photo.DateTimeOrder(OrderBy.OrderDirection.Ascending); q.NoLock = true; q.Columns = new ColumnSet(Photo.Columns.K, Photo.Columns.Icon, Photo.Columns.ContentDisabled); PhotoSet ps = new PhotoSet(q); int currentIndex = 0; for (int i = 0; i < ps.Count; i++) { if (ps[i].K == this.K) { currentIndex = i; break; } } for (int offset = 1; offset <= 3; offset++) { if (currentIndex - offset < 0) { if (ps.Count + currentIndex - offset >= ps.Count || ps.Count + currentIndex - offset < 0) this.SetNextPrevCache(0, offset, false); else this.SetNextPrevCache(ps[ps.Count + currentIndex - offset].K, offset, false); } else this.SetNextPrevCache(ps[currentIndex - offset].K, offset, false); if (currentIndex + offset >= ps.Count) { if (offset - ps.Count + currentIndex >= ps.Count || offset - ps.Count + currentIndex < 0) this.SetNextPrevCache(0, offset, true); else this.SetNextPrevCache(ps[offset - ps.Count + currentIndex].K, offset, true); } else this.SetNextPrevCache(ps[currentIndex + offset].K, offset, true); } this.Update(); }
public void UpdateStats(Transaction transaction, bool update) { Query qAll = new Query(); qAll.QueryCondition=new And(new Q(Photo.Columns.GalleryK,K),new Q(Photo.Columns.Status, QueryOperator.NotEqualTo, Photo.StatusEnum.Processing)); qAll.ReturnCountOnly=true; PhotoSet psAll = new PhotoSet(qAll); this.TotalPhotos = psAll.Count; Query qEnabled = new Query(); qEnabled.QueryCondition=new And(new Q(Photo.Columns.GalleryK,K),Photo.EnabledQueryCondition); qEnabled.ReturnCountOnly=true; PhotoSet psEnabled = new PhotoSet(qEnabled); this.LivePhotos = psEnabled.Count; if (this.TotalPhotos > this.LivePhotos) this.ModeratorUsrK = Usr.GetPhotoModeratorUsrK(); if (update) this.Update(transaction); }
public void DeleteAll(Transaction transaction) { if (!this.Bob.DbRecordExists) return; PhotoSet ps = new PhotoSet(new Query(new Q(Photo.Columns.GalleryK,this.K))); foreach (Photo p in ps) p.DeleteAll(transaction); this.Delete(transaction); }
public void UpdatePhotoOrder(Transaction transaction) { Query q = new Query(); q.QueryCondition=new And( Photo.EnabledQueryCondition, new Q(Photo.Columns.GalleryK,this.K) ); q.OrderBy=Photo.DateTimeOrder(OrderBy.OrderDirection.Ascending); q.NoLock=true; q.Columns=new ColumnSet( Photo.Columns.K, Photo.Columns.ContentDisabled, Photo.Columns.NextPhoto1K, Photo.Columns.NextPhoto2K, Photo.Columns.NextPhoto3K, Photo.Columns.PreviousPhoto1K, Photo.Columns.PreviousPhoto2K, Photo.Columns.PreviousPhoto3K, Photo.Columns.GalleryTimeOrder ); PhotoSet ps = new PhotoSet(q); #region declare backup vars for compare before update int bN1K = 0; int bN2K = 0; int bN3K = 0; int bP1K = 0; int bP2K = 0; int bP3K = 0; Guid bN1I = Guid.Empty; Guid bN2I = Guid.Empty; Guid bN3I = Guid.Empty; Guid bP1I = Guid.Empty; Guid bP2I = Guid.Empty; Guid bP3I = Guid.Empty; int bO = 0; #endregion for(int currentIndex=0;currentIndex<ps.Count;currentIndex++) { #region store backup vals for compare before update bN1K = ps[currentIndex].NextPhoto1K; bN2K = ps[currentIndex].NextPhoto2K; bN3K = ps[currentIndex].NextPhoto3K; bP1K = ps[currentIndex].PreviousPhoto1K; bP2K = ps[currentIndex].PreviousPhoto2K; bP3K = ps[currentIndex].PreviousPhoto3K; bO = ps[currentIndex].GalleryTimeOrder; #endregion ps[currentIndex].GalleryTimeOrder=currentIndex; for (int offset=1; offset<=3; offset++) { if (currentIndex-offset<0) { if (ps.Count+currentIndex-offset>=ps.Count || ps.Count+currentIndex-offset<0) ps[currentIndex].SetNextPrevCache(0,offset,false); else ps[currentIndex].SetNextPrevCache(ps[ps.Count+currentIndex-offset].K,offset,false); } else ps[currentIndex].SetNextPrevCache(ps[currentIndex-offset].K,offset,false); if (currentIndex+offset>=ps.Count) { if (offset-ps.Count+currentIndex>=ps.Count || offset-ps.Count+currentIndex<0) ps[currentIndex].SetNextPrevCache(0,offset,true); else ps[currentIndex].SetNextPrevCache(ps[offset-ps.Count+currentIndex].K,offset,true); } else ps[currentIndex].SetNextPrevCache(ps[currentIndex+offset].K,offset,true); } #region compare, then update if changed if ( bN1K == 0 || bN1K != ps[currentIndex].NextPhoto1K || bN2K == 0 || bN2K != ps[currentIndex].NextPhoto2K || bN3K == 0 || bN3K != ps[currentIndex].NextPhoto3K || bP1K == 0 || bP1K != ps[currentIndex].PreviousPhoto1K || bP2K == 0 || bP2K != ps[currentIndex].PreviousPhoto2K || bP3K == 0 || bP3K != ps[currentIndex].PreviousPhoto3K || bO == 0 || bO != ps[currentIndex].GalleryTimeOrder) { ps[currentIndex].Update(transaction); } #endregion } }
public int GetTotalPhotosIncludingProcessing() { Query q = new Query(); q.ReturnCountOnly = true; q.QueryCondition = new Q(Photo.Columns.GalleryK, this.K); PhotoSet ps = new PhotoSet(q); return ps.Count; }
public void PhotosMe_Load(object o, System.EventArgs e) { if (ThisUsr != null && !ThisUsr.IsSkeleton) { Query q = new Query(); q.TableElement = Templates.Photos.Default.PerformJoins(Photo.UsrMeJoin); q.Columns = Templates.Photos.Default.Columns; q.NoLock = true; q.QueryCondition = new And( Photo.EnabledQueryCondition, new Q(UsrPhotoMe.Columns.UsrK, UsrK) ); q.TopRecords = 6; q.OrderBy = Photo.DateTimeOrder(OrderBy.OrderDirection.Descending); PhotoSet ps = new PhotoSet(q); PhotosMeShowAllLinkPanel.Visible = ps.Count == 6; if (ps.Count > 0) { PhotosMePanel.Visible = true; PhotosMeDataList.DataSource = ps; PhotosMeDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/Default.ascx"); PhotosMeDataList.DataBind(); } else PhotosMePanel.Visible = false; } }
/// <summary> /// Called before a photo set's content is iterated. /// </summary> /// <param name="photoSet"></param> /// <param name="executionContext"></param> /// <returns></returns> public virtual PhotoSet VisitPhotoSetBefore(PhotoSet photoSet, AnalyzerExecutionContext executionContext) { return photoSet; }
static void Main(string[] args) { Log.Logger = new LoggerConfiguration() .ReadFrom.AppSettings() .CreateLogger(); try { Log.Verbose("Main() Started"); Log.Debug("args[{Args}]", JsonConvert.SerializeObject(args)); Log.Information("----------- Application Started ----------- "); string mimeType = "image/jpeg"; bool loggedin = false; long galleryID = 0; string galleryName = ""; _client = new ZenfolioClient(); while (!loggedin) { Log.Debug("Attempting to log in as [{Login}]", Settings.Default.ZenfolioUserName); loggedin = _client.Login(Settings.Default.ZenfolioUserName, Settings.Default.ZenfolioPassword); } //Load more detailed projection of selected gallery PhotoSet gallery = new PhotoSet(); if (!string.IsNullOrEmpty(Settings.Default.ZenfolioGalleryID)) { gallery = _client.LoadPhotoSet(Convert.ToInt64(Settings.Default.ZenfolioGalleryID), InformatonLevel.Level1, true); galleryID = gallery.Id; galleryName = gallery.Title; } else { BrowseDialog dlgBrowse = new BrowseDialog(_client); DialogResult dlgResult = dlgBrowse.ShowDialog(); galleryID = dlgBrowse.SelectedGallery.Id; galleryName = dlgBrowse.SelectedGallery.Title; gallery = _client.LoadPhotoSet(galleryID, InformatonLevel.Level1, true); Log.Information("Loaded Gallery [{Title}]", galleryName); } Log.Debug("Found images [{ImageCount}] in Zenfolio GalleryID[{GalleryID}]", gallery.PhotoCount, gallery.Id); var previousImageCount = 0; while (true) { try { var imageFolderPath = Settings.Default.ImageFolderPath + $"//{galleryName}"; if (!Directory.Exists(imageFolderPath)) { Directory.CreateDirectory(imageFolderPath); } var imagePaths = Directory.GetFiles(imageFolderPath); if (imagePaths.Count() > previousImageCount) { Log.Debug("Found images [{ImagesCount}] in directory[{Directory}]", imagePaths.Length, imageFolderPath); var newImageFileInfos = GetNewImageFileInfos(gallery, imagePaths); if (newImageFileInfos.Count() > 0) { UploadImages(newImageFileInfos, gallery, mimeType); newImageFileInfos = GetNewImageFileInfos(gallery, imagePaths); previousImageCount = imagePaths.Count(); } } Thread.Sleep(Settings.Default.WaitTimeInSec * 1000); } catch (Exception ex) { Log.Error(ex, ex.Message); Thread.Sleep(Settings.Default.WaitTimeInSec * 1000); } } } catch (Exception e) { Log.Error(e, e.Message); } finally { Log.CloseAndFlush(); } }
public void DeleteAll(Transaction transaction) { if (!this.Bob.DbRecordExists) return; this.ContentDisabled = false; this.Update(transaction); try { UsrSet usPhotoPic = new UsrSet(new Query(new Q(Usr.Columns.PicPhotoK, this.K))); foreach (Usr u in usPhotoPic) { try { Guid picToDelete = u.Pic; u.Pic = Guid.Empty; u.PicPhotoK = 0; u.PicState = ""; u.Update(transaction); Storage.RemoveFromStore(Storage.Stores.Pix, picToDelete, "jpg"); } catch { } } } catch { } try { if (this.Gallery.MainPhotoK == this.K) { Query q = new Query(); q.QueryCondition = new And( new Q(Photo.Columns.GalleryK, this.GalleryK), Photo.EnabledQueryCondition ); q.OrderBy = new OrderBy(Photo.Columns.DateTime); q.Columns = new ColumnSet(Photo.Columns.K, Photo.Columns.Status); PhotoSet psMain = new PhotoSet(q); int firstDisabled = 0; foreach (Photo p in psMain) { if (p.K != this.K) { if (p.Status == StatusEnum.Enabled) { this.Gallery.MainPhotoK = p.K; break; } else if (firstDisabled == 0) firstDisabled = p.K; } } if (firstDisabled > 0) this.Gallery.MainPhotoK = firstDisabled; this.Gallery.Update(transaction); //PhotoSet psMain = new PhotoSet( // new Query( // new And( // new Q(Photo.Columns.K, QueryOperator.NotEqualTo, this.K), // new Q(Photo.Columns.GalleryK, this.GalleryK), // Photo.EnabledQueryCondition), // new OrderBy(Photo.Columns.DateTime), // 1 // ) // ); //if (psMain.Count > 0) //{ // this.Gallery.MainPhotoK = psMain[0].K; //} //else //{ // PhotoSet psMain1 = new PhotoSet( // new Query( // new And( // new Q(Photo.Columns.K, QueryOperator.NotEqualTo, this.K), // new Q(Photo.Columns.GalleryK, this.GalleryK) // ), // new OrderBy(Photo.Columns.DateTime), // 1 // ) // ); // if (psMain1.Count > 0) // { // this.Gallery.MainPhotoK = psMain1[0].K; // } // else // { // this.Gallery.MainPhotoK = 0; // } //} //this.Gallery.Update(transaction); } } catch { } try { Delete UsrPhotoFavouriteDelete = new Delete( TablesEnum.UsrPhotoFavourite, new Q(UsrPhotoFavourite.Columns.PhotoK, this.K) ); UsrPhotoFavouriteDelete.Run(transaction); } catch { } try { Delete UsrPhotoMeDelete = new Delete( TablesEnum.UsrPhotoMe, new Q(UsrPhotoMe.Columns.PhotoK, this.K) ); UsrPhotoMeDelete.Run(transaction); } catch { } try { Delete CommentAlertDelete = new Delete( TablesEnum.CommentAlert, new And( new Q(CommentAlert.Columns.ParentObjectK, this.K), new Q(CommentAlert.Columns.ParentObjectType, Model.Entities.ObjectType.Photo) ) ); CommentAlertDelete.Run(transaction); } catch { } try { if (this.ThreadK.HasValue && this.ThreadK.Value > 0) this.Thread.DeleteAll(transaction); } catch { } try { ThreadSet ts = new ThreadSet(new Query(new Q(Thread.Columns.PhotoK, this.K))); foreach (Thread t in ts) { t.DeleteAll(transaction); } } catch { } try { Delete PhotoReviewDelete = new Delete( TablesEnum.PhotoReview, new Q(PhotoReview.Columns.PhotoK, this.K) ); PhotoReviewDelete.Run(transaction); } catch { } try { ParaSet ps = new ParaSet(new Query(new Q(Para.Columns.PhotoK, this.K))); foreach (Para p in ps) { if (p.Type.Equals(Para.TypeEnum.Photo)) p.DeleteAll(transaction); else { Guid oldPic = p.Pic; p.Pic = Guid.Empty; p.PhotoK = 0; p.Update(transaction); if (oldPic != Guid.Empty) Storage.RemoveFromStore(Storage.Stores.Pix, oldPic, "jpg"); } } } catch { } try { foreach (var tagPhoto in this.ChildTagPhotos()) { foreach (var tagPhotoHistory in tagPhoto.ChildTagPhotoHistorys()) { tagPhotoHistory.Delete(transaction); } tagPhoto.Delete(transaction); } } catch { } Guid uploadTemporary = this.UploadTemporary; string uploadTemporaryExtention = this.UploadTemporaryExtention; Guid master = this.Master; Guid web = this.Web; Guid thumb = this.Thumb; Guid icon = this.Icon; bool isVideo = this.MediaType == MediaTypes.Video; Guid videoMaster = this.VideoMaster; string videoFileExtention = this.VideoFileExtention; Guid videoMed = this.VideoMed; bool hasCrop = this.HasCrop; Guid crop = this.HasCrop ? this.Crop : Guid.Empty; try { this.Delete(transaction); } catch { } try { Storage.RemoveFromStore(Storage.Stores.Temporary, uploadTemporary, uploadTemporaryExtention); Storage.RemoveFromStore(Storage.Stores.Master, master, "jpg"); Storage.RemoveFromStore(Storage.Stores.Pix, web, "jpg"); Storage.RemoveFromStore(Storage.Stores.Pix, thumb, "jpg"); Storage.RemoveFromStore(Storage.Stores.Pix, icon, "jpg"); if (isVideo) { Storage.RemoveFromStore(Storage.Stores.Master, videoMaster, videoFileExtention); Storage.RemoveFromStore(Storage.Stores.Pix, videoMed, "flv"); } if (hasCrop) Storage.RemoveFromStore(Storage.Stores.Pix, crop, "jpg"); } catch { } try { this.Usr.UpdateTotalPhotos(transaction); } catch { } try { this.Gallery.UpdateStats(transaction, true); } catch { } try { this.Gallery.UpdatePhotoOrder(transaction); } catch { } try { if (this.Event != null) this.Event.UpdateTotalPhotos(transaction); } catch { } }
public void Initialize() { SpeechController.GetInstance().OnContextSpeechDetected += OnPhotoContextWord; photoLibrary = Instantiate <GameObject>(Resources.Load <GameObject>("prefabs/PhotoLibrary")).GetComponent <PhotoLibrary>(); ActiveSet = photoLibrary.PhotoSets[0]; }
public void StripAll() { Query qUsrEventGuestlist = new Query(); qUsrEventGuestlist.QueryCondition = new Q(UsrEventGuestlist.Columns.UsrK, this.K); UsrEventGuestlistSet uegs = new UsrEventGuestlistSet(qUsrEventGuestlist); foreach (UsrEventGuestlist ueg in uegs) { ueg.Delete(); ueg.Update(); ueg.Event.UpdateGuestlistCount(); } //UsrPlaceVisit Delete UsrPlaceVisitDelete = new Delete( TablesEnum.UsrPlaceVisit, new Q(UsrPlaceVisit.Columns.UsrK, this.K) ); UsrPlaceVisitDelete.Run(); //UsrEventAttended Delete UsrEventAttendedDelete = new Delete( TablesEnum.UsrEventAttended, new Q(UsrEventAttended.Columns.UsrK, this.K) ); UsrEventAttendedDelete.Run(); //UsrPhotoFavourite Delete UsrPhotoFavouriteDelete = new Delete( TablesEnum.UsrPhotoFavourite, new Q(UsrPhotoFavourite.Columns.UsrK, this.K) ); UsrPhotoFavouriteDelete.Run(); //UsrPhotoMe Delete UsrPhotoMeDelete = new Delete( TablesEnum.UsrPhotoMe, new Q(UsrPhotoMe.Columns.UsrK, this.K) ); UsrPhotoMeDelete.Run(); //UsrMusicTypeFavourite Delete UsrMusicTypeFavouriteDelete = new Delete( TablesEnum.UsrMusicTypeFavourite, new Q(UsrMusicTypeFavourite.Columns.UsrK, this.K) ); UsrMusicTypeFavouriteDelete.Run(); //Buddy / Buddy reverse; BuddySet bs = new BuddySet(new Query(new Or(new Q(Buddy.Columns.UsrK, this.K), new Q(Buddy.Columns.BuddyUsrK, this.K)))); foreach (Buddy b in bs) b.DeleteAll(null); //UsrDate Delete UsrDateDelete = new Delete( TablesEnum.UsrDate, new Or(new Q(UsrDate.Columns.UsrK, this.K), new Q(UsrDate.Columns.DateUsrK, this.K)) ); UsrDateDelete.Run(); //Owners - Event EventSet esOwner = new EventSet(new Query(new Q(Event.Columns.OwnerUsrK, this.K))); foreach (Event e in esOwner) { e.DeleteAllUsr(Usr.Current); //e.OwnerUsrK=4; //e.Update(); } BrandSet bsOwner = new BrandSet(new Query(new Q(Brand.Columns.OwnerUsrK, this.K))); foreach (Brand b in bsOwner) { b.DeleteAll(null); //b.OwnerUsrK=4; //b.Update(); } //Owners - Venue VenueSet vsOwner = new VenueSet(new Query(new Q(Venue.Columns.OwnerUsrK, this.K))); foreach (Venue v in vsOwner) { v.DeleteAllUsr(Usr.Current); //v.OwnerUsrK=4; //v.Update(); } //PhotoReview ??? PhotoReviewSet prs = new PhotoReviewSet(new Query(new Q(PhotoReview.Columns.UsrK, this.K))); foreach (PhotoReview pr in prs) { pr.Delete(); pr.Update(); pr.Photo.UpdateStats(null); } //Galleries GallerySet gs = new GallerySet(new Query(new Q(Gallery.Columns.OwnerUsrK, this.K))); foreach (Gallery g in gs) g.DeleteAll(null); //Photos PhotoSet ps = new PhotoSet(new Query(new Q(Photo.Columns.UsrK, this.K))); foreach (Photo p in ps) p.DeleteAll(null); //Aticles ArticleSet ars = new ArticleSet(new Query(new Q(Article.Columns.OwnerUsrK, this.K))); foreach (Article a in ars) a.DeleteAll(null); Guid oldPic = Pic; this.PicPhotoK = 0; this.PicState = ""; this.Pic = Guid.Empty; this.PicOriginal = Guid.Empty; //this.NickName=Usr.GetCompliantNickName("user-"+this.K.ToString()); this.PersonalStatement = ""; this.IsSingle = false; this.EnhancedSecurity = true; this.IsSpotter = false; Random r = new Random(); this.LoginString = Cambro.Misc.Utility.GenRandomText(6, r); this.SetPassword(Cambro.Misc.Utility.GenRandomText(10, r), false); int k = this.K; //Usr this.Update(); if (oldPic != Guid.Empty) Storage.RemoveFromStore(Storage.Stores.Pix, oldPic, "jpg"); }
private void PhotoSetChanged(PhotoSet activeSet) { SetActivePhotos(activeSet); }
public void DeleteAll(Transaction transaction) { if (!this.Bob.DbRecordExists) return; Query qUsrEventGuestlist = new Query(); qUsrEventGuestlist.QueryCondition = new Q(UsrEventGuestlist.Columns.UsrK, this.K); UsrEventGuestlistSet uegs = new UsrEventGuestlistSet(qUsrEventGuestlist); foreach (UsrEventGuestlist ueg in uegs) { ueg.Delete(transaction); ueg.Event.UpdateGuestlistCount(transaction); } //Promoters Query PromoterQ = new Query(); PromoterQ.TableElement = Promoter.UsrJoin; PromoterQ.QueryCondition = new Q(Usr.Columns.K, this.K); PromoterSet promoters = new PromoterSet(PromoterQ); Delete PromoterUsrDelete = new Delete( TablesEnum.PromoterUsr, new Q(PromoterUsr.Columns.UsrK, this.K) ); PromoterUsrDelete.CommandTimeout = 3600; PromoterUsrDelete.Run(transaction); foreach (Promoter p in promoters) { p.AdminUsrs = null; if (p.AdminUsrs.Count == 0) { p.DeleteAll(transaction); } else if (p.PrimaryUsrK == this.K) { p.PrimaryUsrK = p.AdminUsrs[0].K; p.Update(transaction); } } //UsrPlaceVisit Delete UsrPlaceVisitDelete = new Delete( TablesEnum.UsrPlaceVisit, new Q(UsrPlaceVisit.Columns.UsrK, this.K) ); UsrPlaceVisitDelete.CommandTimeout = 3600; UsrPlaceVisitDelete.Run(transaction); //UsrEventAttended Delete UsrEventAttendedDelete = new Delete( TablesEnum.UsrEventAttended, new Q(UsrEventAttended.Columns.UsrK, this.K) ); UsrEventAttendedDelete.CommandTimeout = 3600; UsrEventAttendedDelete.Run(transaction); //UsrPhotoFavourite Delete UsrPhotoFavouriteDelete = new Delete( TablesEnum.UsrPhotoFavourite, new Q(UsrPhotoFavourite.Columns.UsrK, this.K) ); UsrPhotoFavouriteDelete.CommandTimeout = 3600; UsrPhotoFavouriteDelete.Run(transaction); //UsrPhotoMe PhotoSet psMe = this.PhotosMe(new ColumnSet(Photo.Columns.K, Photo.Columns.EventK, Photo.Columns.FirstUsrK, Photo.Columns.UsrCount), 0); foreach (Photo p in psMe) { this.PhotoMe(p, false, transaction); } //UsrMusicTypeFavourite Delete UsrMusicTypeFavouriteDelete = new Delete( TablesEnum.UsrMusicTypeFavourite, new Q(UsrMusicTypeFavourite.Columns.UsrK, this.K) ); UsrMusicTypeFavouriteDelete.CommandTimeout = 3600; UsrMusicTypeFavouriteDelete.Run(transaction); //Buddy / Buddy reverse; BuddySet bs = new BuddySet(new Query(new Or(new Q(Buddy.Columns.UsrK, this.K), new Q(Buddy.Columns.BuddyUsrK, this.K)))); foreach (Buddy b in bs) b.DeleteAll(transaction); //ChatMessageFrom // Delete ChatMessageFromDelete = new Delete( // TablesEnum.ChatMessage, // new Q(ChatMessage.Columns.FromUsrK,this.K) // ); // ChatMessageFromDelete.Run(transaction); //ChatMessageTo // Delete ChatMessageToDelete = new Delete( // TablesEnum.ChatMessage, // new Q(ChatMessage.Columns.ToUsrK, this.K) // ); // ChatMessageToDelete.Run(transaction); //UsrDate Delete UsrDateDelete = new Delete( TablesEnum.UsrDate, new Or(new Q(UsrDate.Columns.UsrK, this.K), new Q(UsrDate.Columns.DateUsrK, this.K)) ); UsrDateDelete.CommandTimeout = 3600; UsrDateDelete.Run(transaction); //Owners - Event EventSet esOwner = new EventSet(new Query(new Q(Event.Columns.OwnerUsrK, this.K))); foreach (Event e in esOwner) { e.OwnerUsrK = 8; e.Update(transaction); } BrandSet bsOwner = new BrandSet(new Query(new Q(Brand.Columns.OwnerUsrK, this.K))); foreach (Brand b in bsOwner) { b.OwnerUsrK = 8; b.Update(transaction); } //Owners - Venue VenueSet vsOwner = new VenueSet(new Query(new Q(Venue.Columns.OwnerUsrK, this.K))); foreach (Venue v in vsOwner) { v.OwnerUsrK = 8; v.Update(transaction); } //Remove EnabledByUsrK in Photos that this usr has enabled PhotoSet pEnableds = new PhotoSet(new Query(new Q(Photo.Columns.EnabledByUsrK, this.K))); foreach (Photo p in pEnableds) { p.EnabledByUsrK = 0; p.Update(transaction); } //ThreadUsr Delete ThreadUsrDelete = new Delete( TablesEnum.ThreadUsr, new Or(new Q(ThreadUsr.Columns.UsrK, this.K), new Q(ThreadUsr.Columns.InvitingUsrK, this.K)) ); ThreadUsrDelete.CommandTimeout = 3600; ThreadUsrDelete.Run(transaction); //CommentAlert Delete CommentAlertDelete = new Delete( TablesEnum.CommentAlert, new Q(CommentAlert.Columns.UsrK, this.K) ); CommentAlertDelete.CommandTimeout = 3600; CommentAlertDelete.Run(transaction); //GroupUsr Delete GroupUsrDelete = new Delete( TablesEnum.GroupUsr, new Q(GroupUsr.Columns.UsrK, this.K) ); GroupUsrDelete.CommandTimeout = 3600; GroupUsrDelete.Run(transaction); //Threads? ThreadSet ts = new ThreadSet(new Query(new Q(Thread.Columns.UsrK, this.K))); foreach (Thread t in ts) t.DeleteAll(transaction); Bobs.Update uLastPostUsrK = new Bobs.Update(); uLastPostUsrK.Changes.Add(new Assign(Thread.Columns.LastPostUsrK, 0)); uLastPostUsrK.Table = TablesEnum.Thread; uLastPostUsrK.Where = new Q(Thread.Columns.LastPostUsrK, this.K); uLastPostUsrK.CommandTimeout = 3600; uLastPostUsrK.Run(transaction); Bobs.Update uFirstParticipantUsrK = new Bobs.Update(); uFirstParticipantUsrK.Changes.Add(new Assign(Thread.Columns.FirstParticipantUsrK, 0)); uFirstParticipantUsrK.Table = TablesEnum.Thread; uFirstParticipantUsrK.Where = new Q(Thread.Columns.FirstParticipantUsrK, this.K); uFirstParticipantUsrK.CommandTimeout = 3600; uFirstParticipantUsrK.Run(); //Comments? CommentSet cs = new CommentSet(new Query(new Q(Comment.Columns.UsrK, this.K))); foreach (Comment c in cs) c.DeleteAll(transaction); //PhotoReview ??? PhotoReviewSet prs = new PhotoReviewSet(new Query(new Q(PhotoReview.Columns.UsrK, this.K))); foreach (PhotoReview pr in prs) { pr.Delete(transaction); pr.Photo.UpdateStats(transaction); } //Galleries GallerySet gs = new GallerySet(new Query(new Q(Gallery.Columns.OwnerUsrK, this.K))); foreach (Gallery g in gs) g.DeleteAll(transaction); //Photos PhotoSet ps = new PhotoSet(new Query(new Q(Photo.Columns.UsrK, this.K))); foreach (Photo p in ps) p.DeleteAll(transaction); //Aticles ArticleSet ars = new ArticleSet(new Query(new Q(Article.Columns.OwnerUsrK, this.K))); foreach (Article a in ars) a.DeleteAll(transaction); int k = this.K; //Usr-AddedByUsrK UsrSet usrsAddedByUsr = new UsrSet(new Query(new Q(Usr.Columns.AddedByUsrK, this.K))); foreach (Usr u in usrsAddedByUsr) { u.AddedByUsrK = 0; u.Update(transaction); } Guid oldPic = this.Pic; //Usr this.Delete(transaction); if (oldPic != Guid.Empty) Storage.RemoveFromStore(Storage.Stores.Pix, oldPic, "jpg"); }
public static Photo GetLatestTopPhoto(bool useCache, bool setCacheIfEmpty) { if (useCache) { try { int k = Caching.Instances.Main.Get(new CacheKey(CacheKeyPrefix.LatestTopPhoto), () => 0); if (k > 0) { Photo p = new Photo(k); if (p.PhotoOfWeekUser) return p; } } catch { } } Query q = new Query(); q.TopRecords = 1; q.QueryCondition = new Q(Photo.Columns.PhotoOfWeekUser, true); q.OrderBy = new OrderBy(Photo.Columns.PhotoOfWeekUserDateTime, OrderBy.OrderDirection.Descending); PhotoSet ps = new PhotoSet(q); if (setCacheIfEmpty && ps.Count > 0) { Caching.Instances.Main.Set(new CacheKey(CacheKeyPrefix.LatestTopPhoto), ps[0].K.ToString()); } return ps.Count > 0 ? ps[0] : null; }
public void BindProcessing() { Query q = new Query(); q.Columns = Templates.Photos.AdminProcessing.Columns; q.QueryCondition = new And(new Q(Photo.Columns.GalleryK, CurrentGallery.K), new Q(Photo.Columns.Status, Photo.StatusEnum.Processing)); q.OrderBy = Photo.DateTimeOrder(OrderBy.OrderDirection.Ascending); PhotoSet ps = new PhotoSet(q); if (ps.Count == 0) PhotoProcessingPanel.Visible = false; else { PhotoProcessingPanel.Visible = true; PhotoProcessingDataList.Controls.Clear(); PhotoProcessingDataList.DataSource = ps; PhotoProcessingDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/AdminProcessing.ascx"); PhotoProcessingDataList.DataBind(); } }
public void BindModerate(ref string Ks) { Query q = new Query(); q.Columns = Templates.Photos.Admin.Columns; q.QueryCondition = new And(new Q(Photo.Columns.GalleryK, CurrentGallery.K), new Q(Photo.Columns.Status, Photo.StatusEnum.Moderate)); q.OrderBy = Photo.DateTimeOrder(OrderBy.OrderDirection.Ascending); PhotoSet ps = new PhotoSet(q); if (ps.Count == 0) PhotoModeratePanel.Visible = false; else { PhotoModeratePanel.Visible = true; PhotoModerateDataList.Controls.Clear(); PhotoModerateDataList.DataSource = ps; PhotoModerateDataList.ItemTemplate = this.LoadTemplate("/Templates/Photos/Admin.ascx"); PhotoModerateDataList.DataBind(); foreach (Photo p in ps) { Ks += (Ks == "" ? "" : ",") + p.K.ToString(); } } }
private void bindCaptionCompetitionPhotos() { CaptionCompetitionPanel.Visible = true; Query q = new Query(); q.Columns = Templates.GroupPhotos.CompetitionPhotoIcon.Columns; q.TableElement = new Bobs.Join( new TableElement(TablesEnum.Photo), new TableElement(TablesEnum.GroupPhoto), QueryJoinType.Inner, new And( new Q(Photo.Columns.K, GroupPhoto.Columns.PhotoK, true), new Q(GroupPhoto.Columns.GroupK, CurrentGroup.K), new Q(GroupPhoto.Columns.ShowOnFrontPage, true), new Q(Photo.Columns.IsInCaptionCompetition, true) )); q.OrderBy = new OrderBy(GroupPhoto.Columns.DateTime, OrderBy.OrderDirection.Descending); q.TopRecords = 4; PhotoSet ps = new PhotoSet(q); if (ps.Count == 0) { CaptionCompetitionPanel.Visible = false; } else { CaptionCompetitionPhotoDataList.ItemTemplate = this.LoadTemplate("/Templates/GroupPhotos/CompetitionPhotoIcon.ascx"); CaptionCompetitionPhotoDataList.DataSource = ps; CaptionCompetitionPhotoDataList.DataBind(); } }