protected void Page_Load(object sender, EventArgs e) { if (!Usr.Current.IsAdmin) throw new Exception(""); Usr u = new Usr(ContainerPage.Url["UsrK"]); u.DeleteProfilePic(); Mailer sm = new Mailer(); sm.UsrRecipient = u; sm.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; sm.Body = "<p>Your profile photo has been deleted</p>"; sm.Body += "<p>This could have been for one of several reasons:</p>"; sm.Body += "<ul>"; sm.Body += "<li>Profile pictures <b>MUST BE OF YOUR FACE</b>.</li>"; sm.Body += "<li>Profile pictures must show your face clearly - make sure you <b>ZOOM IN</b>.</li>"; sm.Body += "<li>The face must match your sex"; if (u.IsMale || u.IsFemale) sm.Body += " (you currently have <b>" + (u.IsMale ? "MALE" : "FEMALE") + "</b> selected as your sex)"; sm.Body += " - see the <a href=\"[LOGIN(/pages/mydetails)]\">My details</a> page to change your selected sex.</li>"; sm.Body += "</ul>"; sm.Body += "<p>You can create a new profile picture on the <a href=\"[LOGIN(/pages/mypicture)]\">Create my picture</a> page.</p>"; sm.Subject = "Your DontStayIn profile photo has been deleted"; sm.RedirectUrl = "/pages/mypicture"; sm.Send(); Response.Redirect(u.Url()); }
public string GetMoreInfoHtml() { StringBuilder sb = new StringBuilder(); if (RoomType == RoomType.Normal && ObjectType == Model.Entities.ObjectType.None) { sb.Append("<p>This is the general chat room.</p>"); } else if (RoomType == RoomType.PrivateChat) { if (Usr.Current == null || (Usr.Current.K != this.ObjectK && Usr.Current.K != this.SecondObjectK)) sb.Append("<p>This is a private chat room.</p>"); else { Usr otherUsr = new Usr(Usr.Current.K == this.ObjectK ? this.SecondObjectK : this.ObjectK); sb.Append("<p>This is a private chat room between you and "); otherUsr.LinkAppend(sb, false); sb.Append("</p>"); if (otherUsr.HasPic) { sb.Append("<p>"); { sb.Append("<a"); sb.AppendAttribute("href", otherUsr.Url()); sb.Append(">"); { sb.Append("<img"); sb.AppendAttribute("src", Storage.Path(otherUsr.Pic)); sb.AppendAttribute("class", "BorderBlack All"); sb.AppendAttribute("width", "100"); sb.AppendAttribute("height", "100"); sb.Append(otherUsr.RolloverNoPic); sb.Append(">"); } sb.Append("</a>"); } sb.Append("</p>"); } } } else if (RoomType == RoomType.Normal) { sb.Append("<p>"); //sb.Append(string.Format("This is {0} chat room.", this.ObjectType.ToString().PrefixWithAOrAn(false))); string s = ""; switch (ObjectType) { case Model.Entities.ObjectType.Country: { s = "This is a country chat room."; break; } case Model.Entities.ObjectType.Place: { s = "This is a place chat room."; break; } case Model.Entities.ObjectType.Venue: { s = "This is a venue chat room."; break; } case Model.Entities.ObjectType.Event: { s = "This is an event chat room."; break; } case Model.Entities.ObjectType.Article: { s = "This is an article chat room. All chat in this room will be posted as comments in the main article topic."; break; } case Model.Entities.ObjectType.Group: { s = "This is a group chat room."; break; } case Model.Entities.ObjectType.Photo: { s = "This is a photo chat room. All chat in this room will be posted as comments in the main photo topic."; break; } case Model.Entities.ObjectType.Thread: { s = "This is a topic chat room. All chat in this room will be posted as comments in the topic."; break; } default: { s = ""; break; } } sb.Append(s); sb.Append("</p>"); if ((this.ObjectBob is IPic && ((IPic)ObjectBob).HasPic) || ObjectType == Model.Entities.ObjectType.Photo) { sb.Append("<p>"); if (this.ObjectBob is IPage) { sb.Append("<a"); sb.AppendAttribute("href", ((IPage)ObjectBob).Url()); sb.Append(">"); } { sb.Append("<img"); if (ObjectType == Model.Entities.ObjectType.Photo) sb.AppendAttribute("src", Storage.Path(((Photo)ObjectBob).Icon)); else sb.AppendAttribute("src", Storage.Path(((IPic)ObjectBob).Pic)); sb.AppendAttribute("class", "BorderBlack All"); sb.AppendAttribute("width", "100"); sb.AppendAttribute("height", "100"); sb.Append(">"); } if (this.ObjectBob is IPage) { sb.Append("</a>"); } sb.Append("</p>"); } if (ObjectBob is IPage && ObjectBob is IReadableReference) { sb.Append("<p>"); { sb.Append("<a"); sb.AppendAttribute("href", ((IPage)ObjectBob).Url()); sb.Append(">"); sb.Append(((IReadableReference)ObjectBob).ReadableReference); sb.Append("</a>"); } sb.Append("</p>"); } } else { //sb.Append("<p>No info available. This is " + RoomType.ToString().PrefixWithAOrAn(false) + " room.</p>"); sb.Append("<p>"); string s = ""; switch (RoomType) { case RoomType.BuddyAlerts: { s = "This is the buddy alerts room. Alerts from your buddies get posted here."; break; } case RoomType.InboxUpdates: { s = "This is the inbox updates room. New comments in topics you are watching get posted here."; break; } case RoomType.Laughs: { s = "This is the laughs room. You'll get an alert here whenever anyone clicks the laugh button."; break; } case RoomType.NewPhotosAll: { s = "This is a photos room. As new photos and videos get uploaded to the site, they appear in here."; break; } case RoomType.NewPhotosBuddies: { s = "This is a photos room. As your buddies upload photos and videos, they appear in here."; break; } case RoomType.NewPhotosProSpotters: { s = "This is a photos room. As pro spotters upload photos and videos, they appear in here."; break; } case RoomType.NewPhotosSpotters: { s = "This is a photos room. As spotters upload photos and videos, they appear in here."; break; } case RoomType.NewVideosAll: { s = "This is a videos room. As new videos get uploaded to the site, they appear in here."; break; } case RoomType.Orphans: { s = "This is the orphans room. Messages that we can't find rooms for get posted here. It's just for debugging."; break; } case RoomType.PrivateChatRequestsBuddies: { s = "This is a private chat requests room. When one of your buddies tries to private chat with you, an alert is sent here."; break; } case RoomType.PrivateChatRequestsStrangers: { s = "This is a private chat requests room. When someone not on you buddy list are tries to private chat with you, an alert is sent here."; break; } case RoomType.PrivateChatRequests: { s = "This is a private chat requests room. When someone tries to private chat with you, an alert is sent here."; break; } case RoomType.RandomChat: { s = "This is the random chat room. All comments posted in public topics create an alert in here ."; break; } case RoomType.SystemMessages: { s = "This is the system messages room. It's just for testing."; break; } default: { s = ""; break; } } sb.Append(s); sb.Append("</p>"); } //if (!IsReadOnly && !IsDefaultRoom) //{ // Query q = new Query(); // q.TableElement = new Join(Usr.Columns.K, RoomPin.Columns.UsrK); // q.QueryCondition = new And( // new Q(RoomPin.Columns.RoomGuid, this.Guid), // new Q(RoomPin.Columns.Pinned, true)); // q.OrderBy = new OrderBy(Usr.Columns.DateTimeLastPageRequest, OrderBy.OrderDirection.Descending); // q.Columns = Usr.LinkColumns; // UsrSet us = new UsrSet(q); // if (us.Count > 0) // { // sb.Append(string.Format("<p>{0} {1} {2} this room pinned:</p>", us.Count.ToString("#,##0"), us.Count == 1 ? "person" : "people", us.Count == 1 ? "has" : "have")); // sb.Append("<p class=\"CleanLinks\">"); // int count = 0; // foreach (Usr u in us) // { // string shading = u.LoggedInNow ? "selected-onyellow" : "shaded40-onyellow"; // sb.Append(count == 0 ? "" : "<br />"); // sb.Append(u.LoggedInNow ? "" : "<small>"); // u.LinkAppend(sb, false); // sb.Append(u.LoggedInNow ? "" : "</small>"); // u.PresenceIconAppend(sb, shading); // if (Usr.Current != null && u.K != Usr.Current.K) // { // RoomSpec c = new RoomSpec(u.K, Usr.Current.K); // c.PinHtmlAppend(sb, shading); // } // count++; // if (count > 100) // { // break; // } // } // sb.Append("</p>"); // if (count > 100) // sb.Append("<p><small>(only showing 100 people)</small></p>"); // } //} //else if (!IsReadOnly && IsDefaultRoom) //{ // sb.Append("<p>This is a default room - everybody has it pinned.</p>"); //} return sb.ToString(); }
private void SendEmailToNotifyThePersonWhoWasSpotted(Photo photo, Usr currentUsr) { Mailer sm = new Mailer(); sm.RedirectUrl = photo.Url(); sm.Subject = "You've been spotted!"; string intro = "A friend of yours"; if (currentUsr != null) intro = "Your buddy, <a href=\"[LOGIN(" + currentUsr.Url() + ")]\">" + currentUsr.NickNameSafe + "</a>"; sm.Body = "<p>" + intro + " has spotted you in a photo, shown below:</p>" + "<p align=\"center\"><a href=\"[LOGIN(" + photo.Url() + ")]\"><img src=\"" + photo.WebPath + "\" height=\"" + photo.WebHeight + "\" width=\"" + photo.WebWidth + "\" class=\"BorderBlack All\" border=\"0\"></a></p>" + "<p>If you're not in this photo, please click the link below to log in, and click the <b>Remove me from this photo</b> " + "button under the photo.</p>"; sm.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; sm.UsrRecipient = this; sm.To = this.Email; sm.Send(); }
public int Invite( List<int> inviteKs, Usr invitingUsr, DateTime inviteDateTime, List<int> alertedUsrs, bool isNewThread, Comment postedComment, bool joinChatRoom) { IDiscussable Parent = this.ParentForumObject; Query qInvites = new Query(); List<Q> qList = new List<Q>(); qList.Add(new Q(false)); if (inviteKs != null && inviteKs.Count > 0) qList.Add(new InListQ(Usr.Columns.K, inviteKs)); qInvites.QueryCondition = new Or(qList.ToArray()); qInvites.Columns = new ColumnSet( Usr.EmailColumns, Usr.LinkColumns, Usr.Columns.IsLoggedOn, Usr.Columns.DateTimeLastPageRequest, Usr.Columns.AddedByGroupK); UsrSet usInvites = new UsrSet(qInvites); int count = 0; GroupUsr guInvitingUsr = null; if (this.GroupK > 0) guInvitingUsr = this.Group.GetGroupUsr(invitingUsr); List<int> addedThreadUsrsUsrKs = new List<int>(); foreach (Usr u in usInvites) { if (!alertedUsrs.Contains(u.K)) { try { ThreadUsr tuInvite = new ThreadUsr(this.K, u.K); } catch (Bobs.BobNotFound) { bool sendInviteAlerts = true; bool addThreadUsr = true; if (this.GroupK > 0) { GroupUsr gu = this.Group.GetGroupUsr(u); if (this.GroupPrivate || this.PrivateGroup) { //if this thread is private to the group or in a private group, there's a danger that we're //inviting someone to a thread that they can't see. Also - if the group is made public, many //threads may appear in peoples inboxes. This bit stops us sending these dodgy invites out... if (gu == null) { //if they don't have a GroupUsr record, lets send a group invite, but hold off on the thread alert sendInviteAlerts = false; this.Group.Invite(u, gu, invitingUsr, guInvitingUsr, "", false); } else if (gu.IsMember) { //if they are a member, we can send the thread invite } else if (gu.Status.Equals(GroupUsr.StatusEnum.Recommend) || gu.Status.Equals(GroupUsr.StatusEnum.RecommendRejected) || gu.Status.Equals(GroupUsr.StatusEnum.Request) || gu.Status.Equals(GroupUsr.StatusEnum.RequestRejected)) { //if we might be able to invite or join them to the group, we give it a try (the outcome will depend on some rather complex code) this.Group.Invite(u, gu, invitingUsr, guInvitingUsr, "", false); if (!gu.IsMember) { //if we didn't join them straight up, they still won't be able to see the thread, so we hold off on the thread alert email sendInviteAlerts = false; if (!gu.Status.Equals(GroupUsr.StatusEnum.Invite)) { //if we didn't join them straight up AND we didn't invite them, lets not bother inviting them to the thread addThreadUsr = false; } } } else { //ok so they have a GroupUsr, but they're not a member, and we can't invite or join them, so we're not going to bother inviting them to the thread addThreadUsr = false; } } } //We still add this user to the alertedusers list (even if !addThreadUsr) - this just makes sure we don't attempt to send them an invite a second time. alertedUsrs.Add(u.K); if (addThreadUsr) { ThreadUsr tu = this.GetThreadUsr(u); tu.ChangeStatus(ThreadUsr.StatusEnum.NewInvite, DateTime.Now, false, false); try { addedThreadUsrsUsrKs.Add(u.K); } catch { } tu.InvitingUsrK = invitingUsr.K; tu.StatusChangeObjectK = invitingUsr.K; tu.StatusChangeObjectType = Model.Entities.ObjectType.Usr; tu.Update(); count++; #region sendInviteAlerts if (sendInviteAlerts) { try { Mailer usrMail = new Mailer(); if (isNewThread && this.Private && this.ParentObjectType.Equals(Model.Entities.ObjectType.Photo)) { usrMail.Subject = invitingUsr.NickName + " sent you a photo"; usrMail.Body += "<h1>" + invitingUsr.NickName + " sent you a photo</h1>"; usrMail.Body += "<p align=\"center\"><a href=\"[LOGIN]\"><img border=\"0\" src=\"" + this.ParentPhoto.WebPath + "\" width=\"" + this.ParentPhoto.WebWidth + "\" height=\"" + this.ParentPhoto.WebHeight + "\" class=\"BorderBlack All\" /></a></p>"; } else if (isNewThread) { usrMail.Subject = invitingUsr.NickName + " posts: \"" + this.SubjectSnip(40) + "\""; usrMail.Body += "<h1>" + invitingUsr.NickName + " has posted a new topic</h1>"; } else { usrMail.Subject = invitingUsr.NickName + " invites you to: \"" + this.SubjectSnip(40) + "\""; usrMail.Body += "<h1>" + invitingUsr.NickName + " invites you to a topic</h1>"; } usrMail.Body += "<p>The subject is: \"" + this.Subject + "\"</p>"; usrMail.Body += "<p>To read " + invitingUsr.HisString(false) + " message, check out the <a href=\"[LOGIN]\">topic page</a>.</p>"; usrMail.Body += "<p>If you want to stop " + invitingUsr.HimString(false) + " inviting you to topics, click the <i>Stop " + invitingUsr.NickName + " inviting me to chat topics</i> button on <a href=\"[LOGIN(" + invitingUsr.Url() + ")]\">" + invitingUsr.HisString(false) + " profile page</a>.</p>"; usrMail.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; usrMail.RedirectUrl = this.UrlDiscussion(); usrMail.UsrRecipient = u; //usrMail.Bulk=usInvites.Count>5; usrMail.Bulk = false; // This is interesting... if people are invited by email, they should get the invite really... usrMail.Inbox = true; usrMail.Send(); } catch (Exception ex) { Global.Log("1d3726bf-0715-4404-9059-4e53ca9e3dc5", ex); } //try //{ // if (u.IsLoggedOn && u.DateTimeLastPageRequest > DateTime.Now.AddMinutes(-5)) // { // XmlDocument xmlDoc = new XmlDocument(); // XmlNode n = xmlDoc.CreateElement("privateMessageAlert"); // n.AddAttribute("nickName", invitingUsr.NickNameSafe); // n.AddAttribute("stmu", invitingUsr.StmuParams); // n.AddAttribute("usrK", invitingUsr.K.ToString()); // if (invitingUsr.HasPic) // n.AddAttribute("pic", invitingUsr.Pic.ToString()); // else // n.AddAttribute("pic", "0"); // n.AddAttribute("k", this.K.ToString()); // if (postedComment == null) // { // n.InnerText = this.Url(); // } // else // { // n.InnerText = postedComment.Url(this); // } // Chat.SendChatItem(ItemType.Invite, n, DateTime.Now.Ticks, u.K, Guid.NewGuid()); // } //} //catch (Exception ex) { Global.Log("2902fd82-e8a4-49c2-9e33-ccfca01ca1f9", ex); } } #endregion } } } } if (joinChatRoom) { Guid room = this.GetRoomSpec().Guid; Chat.JoinRoom(room, addedThreadUsrsUsrKs.ToArray()); } return count; }
public DeleteReturnStatus DeleteAllUsr(Usr u) { if (!u.IsSuper && u.K!=this.OwnerUsrK) return DeleteReturnStatus.FailNoPermission; if (this.PromoterK>0 && this.PromoterStatus.Equals(Venue.PromoterStatusEnum.Confirmed)) return DeleteReturnStatus.FailPromoter; if (this.TotalComments>10) { Mailer smComments = new Mailer(); smComments.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") attempted to delete venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; smComments.Body+="<p>This operation failed because "+this.Name+" has "+this.TotalComments+" comments.</p>"; smComments.Subject="Delete venue operation failed because too many comments in venue"; smComments.TemplateType=Mailer.TemplateTypes.AdminNote; smComments.To = "*****@*****.**"; smComments.Send(); return DeleteReturnStatus.FailComments; } if (this.Events.Count>3) { Mailer smEvents = new Mailer(); smEvents.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") attempted to delete venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; smEvents.Body+="<p>This operation failed because "+this.Name+" has "+this.Events.Count+" events.</p>"; smEvents.Subject="Delete venue operation failed because too many events"; smEvents.TemplateType=Mailer.TemplateTypes.AdminNote; smEvents.To = "*****@*****.**"; smEvents.Send(); return DeleteReturnStatus.FailEvents; } int totalPhotos = 0; foreach (Event ev in this.Events) { totalPhotos += ev.TotalPhotos; } if (totalPhotos>5) { Mailer smPhotos = new Mailer(); smPhotos.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") attempted to delete venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; smPhotos.Body+="<p>This operation failed because events at "+this.Name+" have "+totalPhotos+" photos.</p>"; smPhotos.Subject="Delete venue operation failed because too many photos in events"; smPhotos.TemplateType=Mailer.TemplateTypes.AdminNote; smPhotos.To = "*****@*****.**"; smPhotos.Send(); return DeleteReturnStatus.FailPhotos; } //banners? Query qBanners = new Query(); qBanners.TableElement=new Join(Banner.Columns.EventK, Event.Columns.K); qBanners.QueryCondition=new Q(Event.Columns.VenueK,this.K); qBanners.ReturnCountOnly=true; BannerSet bs = new BannerSet(qBanners); if (bs.Count>0) { Mailer smBanner = new Mailer(); smBanner.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") attempted to delete venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; smBanner.Body+="<p>This operation failed because "+this.Name+" has "+bs.Count+" banner"+(bs.Count==1?"":"s")+".</p>"; smBanner.Subject="Delete venue operation failed because venue has a banner"; smBanner.TemplateType=Mailer.TemplateTypes.AdminNote; smBanner.To = "*****@*****.**"; smBanner.Send(); return DeleteReturnStatus.FailPromoter; } //guestlists? Query qGuestlists = new Query(); qGuestlists.QueryCondition=new And(new Q(Event.Columns.HasGuestlist,true),new Q(Event.Columns.VenueK,this.K)); qGuestlists.ReturnCountOnly=true; EventSet es = new EventSet(qGuestlists); if (es.Count>0) { Mailer smGuestlist = new Mailer(); smGuestlist.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") attempted to delete venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; smGuestlist.Body+="<p>This operation failed because "+this.Name+" has "+es.Count+" guestlist"+(es.Count==1?"":"s")+".</p>"; smGuestlist.Subject="Delete venue operation failed because venue has a guestlist"; smGuestlist.TemplateType=Mailer.TemplateTypes.AdminNote; smGuestlist.To = "*****@*****.**"; smGuestlist.Send(); return DeleteReturnStatus.FailPromoter; } //competitions? Query qComp = new Query(); qComp.TableElement=new Join(Comp.Columns.EventK, Event.Columns.K); qComp.QueryCondition=new Q(Event.Columns.VenueK,this.K); qComp.ReturnCountOnly=true; CompSet cs = new CompSet(qComp); if (cs.Count>0) { Mailer smComp = new Mailer(); smComp.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") attempted to delete venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; smComp.Body+="<p>This operation failed because "+this.Name+" has "+cs.Count+" competition"+(cs.Count==1?"":"s")+".</p>"; smComp.Subject="Delete venue operation failed because venue has a competition"; smComp.TemplateType=Mailer.TemplateTypes.AdminNote; smComp.To = "*****@*****.**"; smComp.Send(); return DeleteReturnStatus.FailPromoter; } //dontations? Query qDonated = new Query(); qDonated.QueryCondition=new And(new Q(Event.Columns.VenueK,this.K),new Q(Event.Columns.Donated,true)); qDonated.ReturnCountOnly=true; EventSet esDon = new EventSet(qDonated); if (esDon.Count>0) { Mailer smDonate = new Mailer(); smDonate.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") attempted to delete venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; smDonate.Body+="<p>This operation failed because "+this.Name+" has "+esDon.Count+" events with donations.</p>"; smDonate.Subject="Delete venue operation failed because venue has an event donation"; smDonate.TemplateType=Mailer.TemplateTypes.AdminNote; smDonate.To = "*****@*****.**"; smDonate.Send(); return DeleteReturnStatus.FailPromoter; } //ticket runs? Query qTicketRuns = new Query(); qTicketRuns.QueryCondition = new Q(Event.Columns.VenueK, this.K); qTicketRuns.TableElement = new Join(Event.Columns.VenueK, Venue.Columns.K); qTicketRuns.ReturnCountOnly = true; EventSet esTix = new EventSet(qTicketRuns); if (esTix.Count > 0) { Mailer smDonate = new Mailer(); smDonate.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete venue " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smDonate.Body += "<p>This operation failed because " + this.Name + " has " + esTix.Count + " events with ticket runs.</p>"; smDonate.Subject = "Delete venue operation failed because venue has at least one event with a ticket run"; smDonate.TemplateType = Mailer.TemplateTypes.AdminNote; smDonate.To = "*****@*****.**"; smDonate.Send(); return DeleteReturnStatus.FailPromoter; } try { Bobs.Delete.DeleteAll(this); //Mailer smDone = new Mailer(); //smDone.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") deleted venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; //smDone.Subject="Venue "+this.K.ToString()+" deleted"; //smDone.TemplateType=Mailer.TemplateTypes.AdminNote; //smDone.To = "*****@*****.**"; //smDone.Send(); return DeleteReturnStatus.Success; } catch(Exception ex) { Mailer smException = new Mailer(); smException.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") attempted to delete venue "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; smException.Body+="<p>This operation failed because of an unhandled exception:</p><p>"+ex.ToString()+"</p>"; smException.Subject="Delete venue operation failed because of exception"; smException.TemplateType=Mailer.TemplateTypes.AdminNote; smException.To="*****@*****.**"; smException.Send(); return DeleteReturnStatus.FailException; } }
public static Misc UploadFile(HtmlInputFile inputFile, Usr uploadUsr, Promoter promoter, Banner banner, string folder, List<string> acceptedFileExtensions) { if (inputFile.PostedFile != null) { #region Upload file Misc m = new Misc(); m.UsrK = uploadUsr.K; if (promoter != null) m.PromoterK = promoter.K; m.DateTime = DateTime.Now; m.Folder = folder; m.Guid = Guid.NewGuid(); if (inputFile.PostedFile.FileName.IndexOf(".") == -1) m.Extention = ""; else m.Extention = inputFile.PostedFile.FileName.Substring(inputFile.PostedFile.FileName.LastIndexOf(".") + 1).ToLower(); if (m.Extention.Equals("jpeg") || m.Extention.Equals("jpe")) m.Extention = "jpg"; if (!acceptedFileExtensions.Contains(m.Extention)) { string listOfFileExtensions = ""; foreach(string s in acceptedFileExtensions) listOfFileExtensions += s + ", "; throw new DsiUserFriendlyException("You can only upload " + listOfFileExtensions.Substring(0, listOfFileExtensions.Length-2) + " files with this page."); } if (promoter != null && m.Extention.Equals("swf")) { if (m.Size <= 150 * 1024) m.NeedsAuth = true; } byte[] bytes = new byte[inputFile.PostedFile.InputStream.Length]; inputFile.PostedFile.InputStream.Read(bytes, 0, (int)inputFile.PostedFile.InputStream.Length); m.Size = inputFile.PostedFile.ContentLength; m.Name = inputFile.PostedFile.FileName.Substring(inputFile.PostedFile.FileName.LastIndexOf("\\") + 1); if (m.Extention.Equals("jpg") || m.Extention.Equals("gif") || m.Extention.Equals("png")) { using (System.Drawing.Image image = System.Drawing.Image.FromStream(new MemoryStream(bytes))) { m.Width = image.Width; m.Height = image.Height; } } m.Update(); try { Storage.AddToStore(bytes, Storage.Stores.Pix, m.Guid, m.Extention, m, ""); } catch (Exception ex) { m.Delete(); throw ex; } if (promoter != null) { if (promoter != null && m.NeedsAuth) { Mailer adminMail = new Mailer(); adminMail.Subject = "New files waiting to be approved!!! uploaded by" + uploadUsr.NickNameSafe; adminMail.To = "*****@*****.**"; adminMail.Body += "<p>New FILES uploaded by <a href=\"[LOGIN(" + uploadUsr.Url() + ")]\">" + uploadUsr.NickNameSafe + "</a></p>"; if (promoter != null) adminMail.Body += "<p>... for promoter <a href=\"[LOGIN(" + promoter.Url() + ")]\">" + promoter.Name + "</a></p>"; adminMail.Body += "<h2>Files:</h2>"; adminMail.Body += "<p><a href=\"" + m.Url() + "\">" + HttpUtility.HtmlEncode(m.Name) + "</a> - " + m.FileSizeString + "</p>"; adminMail.TemplateType = Mailer.TemplateTypes.AdminNote; adminMail.RedirectUrl = uploadUsr.Url(); adminMail.Send(); } } if (banner != null) banner.AssignMisc(m); return m; #endregion } else return null; }
public DeleteReturnStatus DeleteAllUsr(Usr u) { if (!u.IsSuper && u.K != this.OwnerUsrK) return DeleteReturnStatus.FailNoPermission; if (this.TotalComments > 10) { Mailer smComments = new Mailer(); smComments.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smComments.Body += "<p>This operation failed because " + this.Name + " has " + this.TotalComments + " comments.</p>"; smComments.Subject = "Delete event operation failed because too many comments in event"; smComments.TemplateType = Mailer.TemplateTypes.AdminNote; smComments.To = "*****@*****.**"; smComments.Send(); return DeleteReturnStatus.FailComments; } if (this.TotalPhotos > 5) { Mailer smPhotos = new Mailer(); smPhotos.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smPhotos.Body += "<p>This operation failed because " + this.Name + " has " + this.TotalPhotos + " photos.</p>"; smPhotos.Subject = "Delete event operation failed because too many photos in event"; smPhotos.TemplateType = Mailer.TemplateTypes.AdminNote; smPhotos.To = "*****@*****.**"; smPhotos.Send(); return DeleteReturnStatus.FailPhotos; } //banners? Query qBanners = new Query(); qBanners.QueryCondition = new Q(Banner.Columns.EventK, this.K); qBanners.ReturnCountOnly = true; BannerSet bs = new BannerSet(qBanners); if (bs.Count > 0) { Mailer smBanner = new Mailer(); smBanner.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smBanner.Body += "<p>This operation failed because " + this.Name + " has " + bs.Count + " banner" + (bs.Count == 1 ? "" : "s") + ".</p>"; smBanner.Subject = "Delete event operation failed because event has a banner"; smBanner.TemplateType = Mailer.TemplateTypes.AdminNote; smBanner.To = "*****@*****.**"; smBanner.Send(); return DeleteReturnStatus.FailPromoter; } //guestlists? if (this.HasGuestlist) { Mailer smGuestlists = new Mailer(); smGuestlists.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smGuestlists.Body += "<p>This operation failed because " + this.Name + " has a guestlist.</p>"; smGuestlists.Subject = "Delete event operation failed because event has a guestlist"; smGuestlists.TemplateType = Mailer.TemplateTypes.AdminNote; smGuestlists.To = "*****@*****.**"; smGuestlists.Send(); return DeleteReturnStatus.FailPromoter; } //competitions? Query qComp = new Query(); qComp.QueryCondition = new Q(Comp.Columns.EventK, this.K); qComp.ReturnCountOnly = true; CompSet cs = new CompSet(qComp); if (cs.Count > 0) { Mailer smComp = new Mailer(); smComp.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smComp.Body += "<p>This operation failed because " + this.Name + " has " + cs.Count + " competition" + (cs.Count == 1 ? "" : "s") + ".</p>"; smComp.Subject = "Delete event operation failed because event has a competition"; smComp.TemplateType = Mailer.TemplateTypes.AdminNote; smComp.To = "*****@*****.**"; smComp.Send(); return DeleteReturnStatus.FailPromoter; } //ticket runs? if (this.TicketRuns.Count > 0) { string ticketRuns = (this.TicketRuns.Count > 1 ? "ticket runs" : "a ticket run"); Mailer smTicketRuns = new Mailer(); smTicketRuns.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smTicketRuns.Body += "<p>This operation failed because " + this.Name + " has " + ticketRuns + ".</p>"; smTicketRuns.Subject = "Delete event operation failed because event has " + ticketRuns; smTicketRuns.TemplateType = Mailer.TemplateTypes.AdminNote; smTicketRuns.To = "*****@*****.**"; smTicketRuns.Send(); return DeleteReturnStatus.FailPromoter; } if (this.Donated) { Mailer smDonated = new Mailer(); smDonated.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smDonated.Body += "<p>This operation failed because the event has donated.</p>"; smDonated.Subject = "Delete event operation failed because event has a donation"; smDonated.TemplateType = Mailer.TemplateTypes.AdminNote; smDonated.To = "*****@*****.**"; smDonated.Send(); return DeleteReturnStatus.FailPromoter; } if (this.TotalPhotos > 5) { Mailer smPhotos = new Mailer(); smPhotos.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smPhotos.Body += "<p>This operation failed because " + this.Name + " has " + this.TotalPhotos + " photos.</p>"; smPhotos.Subject = "Delete event operation failed because too many photos in event"; smPhotos.TemplateType = Mailer.TemplateTypes.AdminNote; smPhotos.To = "*****@*****.**"; smPhotos.Send(); return DeleteReturnStatus.FailPhotos; } try { Bobs.Delete.DeleteAll(this); //Mailer smDone = new Mailer(); //smDone.Body+="<p><a href=\"http://"+Vars.DomainName+u.Url()+"\">"+u.NickNameSafe+"</a> ("+u.Email+") deleted event "+this.K+" (<a href=\"http://"+Vars.DomainName+this.Url()+"\">"+this.FriendlyName+"</a>).</p>"; //smDone.Subject="Event "+this.K.ToString()+" deleted"; //smDone.TemplateType=Mailer.TemplateTypes.AdminNote; //smDone.To="*****@*****.**"; //smDone.Send(); return DeleteReturnStatus.Success; } catch (Exception ex) { Mailer smException = new Mailer(); smException.Body += "<p><a href=\"http://" + Vars.DomainName + u.Url() + "\">" + u.NickNameSafe + "</a> (" + u.Email + ") attempted to delete event " + this.K + " (<a href=\"http://" + Vars.DomainName + this.Url() + "\">" + this.FriendlyName + "</a>).</p>"; smException.Body += "<p>This operation failed because of an unhandled exception:</p><p>" + ex.ToString() + "</p>"; smException.Subject = "Delete event operation failed because of exception"; smException.TemplateType = Mailer.TemplateTypes.AdminNote; smException.To = "*****@*****.**"; smException.Send(); return DeleteReturnStatus.FailException; } }
public static void CreateNewBuddy(Usr u, Usr u1, bool meInit) { Query q = new Query(); q.QueryCondition = new And( new Q(FacebookPost.Columns.DateTime, QueryOperator.GreaterThan, System.DateTime.Now.AddDays(-1)), new Q(FacebookPost.Columns.FacebookUid, u.Facebook.Uid), new Q(FacebookPost.Columns.Type, TypeEnum.NewBuddy)); FacebookPostSet fps = new FacebookPostSet(q); if (fps.Count < 15) { Query q1 = new Query(); q1.QueryCondition = new And( new Q(FacebookPost.Columns.FacebookUid, u.Facebook.Uid), new Q(FacebookPost.Columns.DataInt, u1.K), new Q(FacebookPost.Columns.Type, TypeEnum.NewBuddy)); FacebookPostSet fps1 = new FacebookPostSet(q1); if (fps1.Count == 0) { FacebookPost fp = new FacebookPost(); fp.Hits = 0; fp.FacebookUid = u.Facebook.Uid; fp.DateTime = System.DateTime.Now; fp.Type = TypeEnum.NewBuddy; fp.Content = "UsrK=" + u1.K.ToString(); fp.DataInt = u1.K; fp.UsrK = u.K; fp.Update(); //send facebook message //http://developers.facebook.com/docs/reference/api/post Dictionary<string, object> par = new Dictionary<string, object>(); if (u1.HasPicNotFacebook) { par["picture"] = u1.PicPath; } par["link"] = "http://" + Vars.DomainName + u1.Url() + "?fbpk=" + fp.K.ToString(); par["name"] = u1.NickName; par["caption"] = "Don't Stay In"; par["description"] = ""; u.Facebook.PutWallPost(meInit ? ("I just added " + u1.NickName + " as a buddy.") : (u1.NickName + " just added me as a buddy."), par); } } }
private void InvitePrivate(Usr InvitedUsr, GroupUsr InvitedGroupUsr, Usr InvitingUsr, GroupUsr InvitingGroupUsr, string InviteMessage) { string inviteMessageStripped = Cambro.Web.Helpers.Strip(InviteMessage,true,true,false,true); if (InvitedGroupUsr==null) { InvitedGroupUsr = new GroupUsr(); InvitedGroupUsr.UsrK = InvitedUsr.K; InvitedGroupUsr.GroupK = this.K; } InvitedGroupUsr.Status = GroupUsr.StatusEnum.Invite; InvitedGroupUsr.StatusChangeDateTime = DateTime.Now; InvitedGroupUsr.StatusChangeUsrK = InvitingUsr.K; if (InvitedGroupUsr.InviteUsrK==0) { InvitedGroupUsr.InviteUsrK = InvitingUsr.K; InvitedGroupUsr.InviteMessage = inviteMessageStripped; } else if (InvitedGroupUsr.InviteUsrK != InvitingUsr.K) { //already had an inviting usr InvitingUsr = InvitedGroupUsr.InviteUsr; InvitingGroupUsr = GetGroupUsr(InvitingUsr); InviteMessage = InvitedGroupUsr.InviteMessage; inviteMessageStripped = Cambro.Web.Helpers.Strip(InviteMessage, true, true, false, true); } if (InvitedUsr.AddedByGroupK!=this.K) { string messageString = ""; if (InviteMessage.Length>0) messageString = "</p><p>"+InvitedGroupUsr.InviteUsr.LinkEmail()+" left you this messsage:</p><p><b>"+inviteMessageStripped+"</b></p><p>"; Mailer sm = new Mailer(); sm.UsrRecipient = InvitedUsr; sm.RedirectUrl = this.Url(); sm.Subject = InvitingUsr.NickName + @" has invited you to " + (InvitingGroupUsr!=null && InvitingGroupUsr.Moderator ? InvitingUsr.HisString(false) : "a") + @" group: " + this.FriendlyName; string pic = "<p>"; string picEnd = "</p>"; if (InvitingUsr.HasPic) { pic = @"<table cellspacing=""0"" cellpadding=""0"" border=""0"" style=""margin:10px 5px 5px 1px;""><tr><td valign=""top"" style=""padding:0px 10px 0px 0px;"">"; pic += "<a href=\"[LOGIN(" + InvitingUsr.Url() + ")]\"><img src=\"" + InvitingUsr.PicPath + "\" class=\"BorderBlack All\" width=\"100\" height=\"100\" vspace=\"3\" border=\"0\"></a></td><td valign=\"top\">"; picEnd = "</td></tr></table>"; } string members = ""; if (this.TotalMembers>5) { Query q = new Query(); q.TableElement = Usr.GroupJoin; q.QueryCondition = new And(new Q(Group.Columns.K, this.K), new Q(Usr.Columns.Pic,QueryOperator.NotEqualTo,Guid.Empty)); q.TopRecords=5; q.OrderBy=new OrderBy(OrderBy.OrderDirection.Random); q.Columns=Usr.LinkColumns; UsrSet us = new UsrSet(q); if (us.Count==5) { members = @"<p><b>"+this.FriendlyName+@"</b> has "+this.TotalMembers.ToString("#,##0")+@" members. Here's a few of them:</p>"; members += @"<table cellspacing=""4"" cellpadding=""4"" border=""0"" width=""100%""><tr>"; foreach (Usr uPic in us) { members += "<td width=\"20%\" valign=\"top\"><center><a href=\"[LOGIN(" + uPic.Url() + ")]\"><img src=\"" + uPic.PicPath + "\" width=\"75\" height=\"75\" style=\"margin:0px 0px 5px 0px;\" class=\"BorderBlack All\"><br>" + Cambro.Misc.Utility.Snip(uPic.NickName, 12) + "</a></center></td>"; } members += @"</tr></table>"; } } string inviteMessage = ""; if (Cambro.Web.Helpers.Strip(InviteMessage,true,true,true,true).Length==0) inviteMessage = "Hi!"; else inviteMessage = Cambro.Web.Helpers.Strip(InviteMessage,true,true,false,true).Replace("\n","<br>"); sm.Body=@" "+pic+@" <i style=""font-size:18px;""><b>""</b>"+inviteMessage+@"<b>""</b></i> "+picEnd+@" <p>" + InvitingUsr.LinkEmail() + @" has invited you to " + (InvitingGroupUsr != null && InvitingGroupUsr.Moderator ? InvitingUsr.HisString(false) : "a") + @" group! You can use this to keep in contact with your friends. Here's a quick description of <b>" +this.FriendlyName+@"</b>:</p> <p> <i>"+this.Description+@"</i> </p> "+members+ @" <p align=""center"" style=""margin:10px 0px 8px 0px;""> <a href=""[LOGIN("+this.UrlApp("join")+@")]"" style=""font-size:18px;font-weight:bold;"">Join the group</a> | <a href=""[LOGIN]"" style=""font-size:18px;font-weight:bold;"">decline the invite</a> </p> "; sm.Send(); } InvitedGroupUsr.Update(); }
public Return InviteReject(Usr TargetUsr, GroupUsr TargetGroupUsr) { Return r = new Return(); if (this.Restriction.Equals(Group.RestrictionEnum.Custom)) { r.Success=false; r.MessageHtml="The "+this.FriendlyName+" group is a special group - the membership "+ "is automatically controlled. You can't decline an invite to this group."; return r; } if (TargetGroupUsr==null) { r.Success=false; r.MessageHtml="You haven't been invited to the "+this.FriendlyName+" group!"; return r; } else if (TargetGroupUsr.Status.Equals(GroupUsr.StatusEnum.Invite)) { TargetGroupUsr.Status = GroupUsr.StatusEnum.InviteRejected; TargetGroupUsr.StatusChangeDateTime = DateTime.Now; TargetGroupUsr.StatusChangeUsrK = TargetUsr.K; GroupUsr gu = this.GetGroupUsr(TargetGroupUsr.InviteUsr); if (gu.MemberAdminNewUserEmails) { Mailer m = new Mailer(); m.UsrRecipient = TargetGroupUsr.InviteUsr; m.Subject = "Your invitation for " + TargetUsr.NickName + " to join the " + this.FriendlyName + " group has been rejected."; m.Body = "<p>Your invitation for " + TargetUsr.LinkEmail() + " to join the " + this.FriendlyName + " group has been rejected. " + TargetUsr.LinkEmail() + " did not want to join the group.</p>"; m.RedirectUrl = TargetUsr.Url(); m.Send(); } TargetGroupUsr.Update(); r.Success=true; return r; } else { r.Success=false; r.MessageHtml="You haven't been invited to the "+this.FriendlyName+" group!"; return r; } }