本文整理汇总了C#中Bobs.Usr.Url方法的典型用法代码示例。如果您正苦于以下问题:C# Usr.Url方法的具体用法?C# Usr.Url怎么用?C# Usr.Url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bobs.Usr
的用法示例。
在下文中一共展示了Usr.Url方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
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());
}
示例2: GetMoreInfoHtml
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>");
//.........这里部分代码省略.........
示例3: SendEmailToNotifyThePersonWhoWasSpotted
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();
}
示例4: Invite
//.........这里部分代码省略.........
}
}
//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;
}
示例5: DeleteAllUsr
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
smComp.Send();
return DeleteReturnStatus.FailPromoter;
}
//.........这里部分代码省略.........
示例6: UploadFile
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 = "[email protected]";
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;
}
示例7: DeleteAllUsr
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
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 = "[email protected]";
smDonated.Send();
return DeleteReturnStatus.FailPromoter;
}
if (this.TotalPhotos > 5)
{
//.........这里部分代码省略.........
示例8: CreateNewBuddy
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);
}
}
}
示例9: InvitePrivate
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>"[email protected]"</b> has "+this.TotalMembers.ToString("#,##0")[email protected]" 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>");
[email protected]"
"[email protected]"
<i style=""font-size:18px;""><b>""</b>"[email protected]"<b>""</b></i>
"[email protected]"
<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>" [email protected]"</b>:</p>
<p>
<i>"[email protected]"</i>
</p>
"+members+ @"
<p align=""center"" style=""margin:10px 0px 8px 0px;"">
<a href=""[LOGIN("+this.UrlApp("join")[email protected]")]"" 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();
}
示例10: InviteReject
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;
}
}