本文整理汇总了C#中Bobs.Usr类的典型用法代码示例。如果您正苦于以下问题:C# Usr类的具体用法?C# Usr怎么用?C# Usr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Usr类属于Bobs命名空间,在下文中一共展示了Usr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestThatNamespaceCacheKeysAreInvalidatedBySqlCommands
public void TestThatNamespaceCacheKeysAreInvalidatedBySqlCommands()
{
Caching.Instances.Main.FlushAll();
Usr u1 = new Usr()
{
NickName= Guid.NewGuid().ToString(),
Email = Guid.NewGuid().ToString()
};
u1.Update();
Usr u2 = new Usr()
{
NickName = Guid.NewGuid().ToString(),
Email = Guid.NewGuid().ToString()
};
u1.Update();
u2.Update();
Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
Banner b = new Banner() { UsrK = u1.K };
b.Update();
Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
Assert.IsNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
b.UsrK= u2.K;
b.Update();
Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u1.K)));
Assert.IsNotNull(Caching.Instances.Main.Get(Caching.CacheKeys.Usr.Banners(u2.K)));
}
示例2: AddAsBuddy
public void AddAsBuddy(Usr currentUsr, List<int> buddyUsrKs)
{
foreach (int buddyUsrK in buddyUsrKs)
{
currentUsr.AddBuddy(new Usr(buddyUsrK), Usr.AddBuddySource.BuddyImporter, Buddy.BuddyFindingMethod.EmailAddress, null);
}
}
示例3: uiLookupUserButton_Click
void uiLookupUserButton_Click(object sender, EventArgs e)
{
//string PromoterRefNumeric = rNumbers.Replace(PromoterRef.Text.Trim(), "");
//try
//{
Usr u = new Usr(int.Parse(this.uiUserAutoComplete.Value));
if (u.IsPromoter)
{
Response.Redirect(u.UrlApp("promoters"));
}
else
{
this.uiUserIsNotPromoterPanel.Visible = true;
}
//else if (u.IsSkeleton)
//{
// NoPromoterAccounts.Visible = false;
// NotFoundLabel.Visible = true;
//}
//else
//{
// NotFoundLabel.Visible = false;
// NoPromoterAccounts.InnerHtml = u.Link() + " is not in any promoter accounts";
// NoPromoterAccounts.Visible = true;
//}
//}
//catch
//{
// NoPromoterAccounts.Visible = false;
// NotFoundLabel.Visible = true;
//}
}
示例4: 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());
}
示例5: DaveIgnore
public void DaveIgnore(object o, System.EventArgs e)
{
Usr Dave = new Usr(4);
Cambro.Web.Helpers.WriteAlertHeader();
Cambro.Web.Helpers.WriteAlert("Selecting...", 1);
Query q = new Query();
if (Vars.DevEnv)
q.TopRecords = 50;
PromoterSet bs = new PromoterSet(q);
for (int count = 0; count < bs.Count; count++)
{
Promoter p = bs[count];
// Do work here!
try
{
Thread t = new Thread(p.QuestionsThreadK);
ThreadUsr tu = t.GetThreadUsr(Dave);
tu.ChangeStatus(ThreadUsr.StatusEnum.Ignore, DateTime.Now, true, true);
if (count % 100 == 0)
Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count + " - " + p.UrlName, 2);
}
catch
{
Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count + " - EXCEPTION! " + p.UrlName, 3);
}
bs.Kill(count);
}
Cambro.Web.Helpers.WriteAlert("Done!", 4);
Cambro.Web.Helpers.WriteAlertFooter("/admin/promoterpm");
}
示例6: InviteContacts
public void InviteContacts(Usr currentUsr, List<Contact> contacts)
{
foreach (Contact c in contacts)
{
Usr u = Usr.GetOrCreateSkeletonUser(currentUsr, c.Email, "", null, "", true, true);
currentUsr.AddBuddy(u, true, true, Usr.AddBuddySource.BuddyImporter, Buddy.BuddyFindingMethod.EmailAddress, c.Name);
}
}
示例7: AddUsr
public void AddUsr(Usr u)
{
if (u != null)
{
Items.Add(new ListItem(u.NickName, u.K.ToString()));
ItemsPlain.Add(new ListItem(u.NickName, u.K + "$" + u.Pic.ToString().ToUpper()));
}
}
示例8: AddTag
public static Tag AddTag(string tagText, Tagging.ITaggable objectToTag, Usr usrAddingTag)
{
try
{
Transaction t = new Transaction();
try
{
Tag tag = Tag.GetTag(tagText);
if (tag.Blocked)
{
throw new InvalidTagException();
}
TagPhoto tagPhoto = TagPhoto.GetTagPhoto(tag.K, objectToTag.K);
TagPhotoHistory.TagPhotoHistoryAction action = TagPhotoHistory.TagPhotoHistoryAction.Created;
if (tagPhoto == null)
{
tagPhoto = new TagPhoto()
{
TagK = tag.K,
PhotoK = objectToTag.K,
Disabled = false
};
tagPhoto.Update(t);
action = TagPhotoHistory.TagPhotoHistoryAction.Created;
}
if (tagPhoto.Disabled)
{
if (!usrAddingTag.IsJunior)
{
throw new Exception("You do not have rights to re-enable that tag");
}
tagPhoto.Disabled = false;
tagPhoto.Update(t);
action = TagPhotoHistory.TagPhotoHistoryAction.Enabled;
}
TagPhotoHistory history = new TagPhotoHistory()
{
DateTime = DateTime.Now,
Action = action,
UsrK = usrAddingTag.K,
TagPhotoK = tagPhoto.K
};
history.Update(t);
t.Commit();
return tag;
}
catch (Exception ex)
{
t.Rollback();
throw ex;
}
}
catch (InvalidTagException)
{
return null;
}
}
示例9: GetUsrPhotosPagedDataService
public static IPagedDataService<Photo> GetUsrPhotosPagedDataService(Usr usr)
{
var orderBy = new []
{
new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.DateTime, OrderBy.OrderDirection.Descending),
new KeyValuePair<object, OrderBy.OrderDirection>(Photo.Columns.K, OrderBy.OrderDirection.Descending)
};
return usr.ChildFavouritePhotos(orderBy);
}
示例10: TestDeletesRemoveBobsFromCache
public void TestDeletesRemoveBobsFromCache()
{
Usr usr = new Usr();
usr.Update();
UsrTableDef def = new UsrTableDef();
Caching.Instances.Main.Set(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey), Guid.NewGuid().ToString());
Assert.IsNotNull(Caching.Instances.Main.Get(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey)));
usr.Delete();
Assert.IsNull(Caching.Instances.Main.Get(new Caching.CacheKeys.BobCacheKey("Usr", usr.K, def.TableCacheKey)));
}
示例11: DeleteNow
public void DeleteNow(object o, System.EventArgs e)
{
Usr c = new Usr(int.Parse(ObjectKTextBox.Text));
if (!c.Banned)
throw new DsiUserFriendlyException("User should be banned first!");
c.StripAll();
DoneLabel.Visible = true;
}
示例12: Delete_RemoveUsr1ThenLoadUsr1_BobNotFoundThrown
public void Delete_RemoveUsr1ThenLoadUsr1_BobNotFoundThrown()
{
SetupCacheForTesting();
Usr usr = new Usr();
usr.Update();
int k = usr.K;
usr.Delete();
usr = new Usr(k);
}
示例13: Change
protected void Change(object sender, EventArgs e)
{
Usr u = new Usr(int.Parse(UsrK.Text));
if (!u.IsAdmin)
{
u.SetPassword(UsrPassword.Text, true);
OutLabel.Text = "Done.";
}
else
OutLabel.Text = "Can't change an admin password on this page.";
}
示例14: DeleteNow
public void DeleteNow(object o, System.EventArgs e)
{
if (ObjectTypeDropDown.SelectedValue.Equals("Photo"))
{
Photo c = new Photo(int.Parse(ObjectKTextBox.Text));
SendEmail(c);
Delete.DeleteAll(c);
}
else if (ObjectTypeDropDown.SelectedValue.Equals("Gallery"))
{
Gallery c = new Gallery(int.Parse(ObjectKTextBox.Text));
SendEmail(c);
Delete.DeleteAll(c);
}
else if (ObjectTypeDropDown.SelectedValue.Equals("Venue"))
{
Venue c = new Venue(int.Parse(ObjectKTextBox.Text));
SendEmail(c);
Delete.DeleteAll(c);
}
else if (ObjectTypeDropDown.SelectedValue.Equals("Event"))
{
Event c = new Event(int.Parse(ObjectKTextBox.Text));
SendEmail(c);
Delete.DeleteAll(c);
}
else if (ObjectTypeDropDown.SelectedValue.Equals("Comment"))
{
Comment c = new Comment(int.Parse(ObjectKTextBox.Text));
SendEmail(c);
Delete.DeleteAll(c);
}
else if (ObjectTypeDropDown.SelectedValue.Equals("Thread"))
{
Thread c = new Thread(int.Parse(ObjectKTextBox.Text));
SendEmail(c);
Delete.DeleteAll(c);
}
else if (ObjectTypeDropDown.SelectedValue.Equals("Usr"))
{
Usr c = new Usr(int.Parse(ObjectKTextBox.Text));
SendEmail(c);
Delete.DeleteAll(c);
}
else if (ObjectTypeDropDown.SelectedValue.Equals("Article"))
{
Article c = new Article(int.Parse(ObjectKTextBox.Text));
SendEmail(c);
Delete.DeleteAll(c);
}
DoneLabel.Visible = true;
}
示例15: MakePayment
public void MakePayment(List<InvoiceDataHolder> invoices, decimal amount, Usr usr, int promoterK, int actionUsrK, string cardFullName, string cardAddressStreet, string cardAddressArea, string cardAddressTown, string cardAddressCounty, int cardAddressCountryK, string cardAddressPostCode, string cardAddressCountry, string cardNumber, DateTime cardExpiryDate, string cardCV2, Transfer.FraudCheckEnum fraudCheckEnum, bool saveCard, Guid duplicateGuid, DateTime cardStartDate, string cardIssueNumber)
{
this.amount = Math.Round(amount, 2);
if (this.amount <= 0)
{
throw new Exception("Cannot make a payment for " + this.amount.ToString("c") + ". It must be a positive amount.");
}
else
{
this.cardNumber = cardNumber.Trim().Replace(" ", "");
this.cardAddressCountry = cardAddressCountry.Trim();
this.fraudCheckEnum = fraudCheckEnum;
this.invoiceDataHolders = invoices;
this.transfer.Guid = Guid.NewGuid();
this.transfer.DuplicateGuid = duplicateGuid;
this.transfer.Amount = this.amount;
this.transfer.Type = Transfer.TransferTypes.Payment;
this.transfer.Method = Transfer.Methods.Card;
this.transfer.Company = Model.Entities.Transfer.CompanyEnum.DH;
this.transfer.CardAddress1 = cardAddressStreet.Trim();
this.transfer.CardAddressArea = cardAddressArea;
this.transfer.CardAddressCounty = cardAddressCounty;
this.transfer.CardAddressTown = cardAddressTown;
this.transfer.CardAddressCountryK = cardAddressCountryK;
this.transfer.CardPostcode = cardAddressPostCode.Trim();
this.transfer.CardName = cardFullName.Trim();
this.transfer.CardCV2 = cardCV2.Trim();
this.transfer.CardExpires = cardExpiryDate;
this.transfer.CardStart = cardStartDate;
if (cardIssueNumber.Length > 0)
this.transfer.CardIssue = Convert.ToInt32(cardIssueNumber);
this.transfer.SetUsrAndActionUsr(usr);
this.transfer.DateTimeCreated = DateTime.Now;
this.transfer.PromoterK = promoterK;
this.usr = usr;
this.transfer.StoreCardEndAndHashAndCardType(this.cardNumber);
ValidateMinimumDetails();
try
{
response = secVpnService.validateCardFull(
userName,
password,
transfer.Guid.ToString(), // DSI created SecPay Transaction Id "tran0001"
ipAddress, // Credit Card user IP address "127.0.0.1"
cardFullName, // User Name "Mr Cardholder"
cardNumber, // User card number "4444333322221111"