本文整理汇总了C#中Server.Accounting.Account.SetTag方法的典型用法代码示例。如果您正苦于以下问题:C# Account.SetTag方法的具体用法?C# Account.SetTag怎么用?C# Account.SetTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Accounting.Account
的用法示例。
在下文中一共展示了Account.SetTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMaxHouses
public static int GetMaxHouses( Account a )
{
int houses = Convert.ToInt32( a.GetTag( "maxHouses" ) );
if ( houses < 1 )
{
houses = 1;
a.SetTag( "maxHouses", "1" );
}
return houses;
}
示例2: SetSubscriptionStatus
public static void SetSubscriptionStatus( Account acc, DateTime started, TimeSpan duration )
{
acc.SetTag( "DonationStart", started.ToString() );
acc.SetTag( "DonationDuration", duration.ToString() );
}
示例3: AddToSubscription
public static bool AddToSubscription( Account acc, TimeSpan duration )
{
DateTime DonationStart = DateTime.MinValue;
TimeSpan DonationDuration = TimeSpan.Zero;
try
{
DonationStart = DateTime.Parse( acc.GetTag( "DonationStart" ) );
DonationDuration = TimeSpan.Parse( acc.GetTag( "DonationDuration" ) );
}
catch
{
}
if (DonationStart == DateTime.MinValue && DonationDuration == TimeSpan.Zero)
{
try
{
acc.SetTag( "DonationStart", DateTime.Now.ToString() );
acc.SetTag( "DonationDuration", duration.ToString() );
//from.SendMessage("Your donation status has been updated.");
//this.Delete();
return true;
}
catch
{
//from.SendMessage("An error ocurred trying to update your donation status. Contact an Administrator.");
return false;
}
}
else if (DonationDuration == TimeSpan.MaxValue)
{
//already at max
//from.SendMessage("You are already at permanent membership status.");
return false;
}
else
{
//existing donation
try
{
//Avoid overflow
if (duration == TimeSpan.MaxValue)
DonationDuration = duration;
else
{
// Make sure that expired subscriptions don't cause people to get "negative time".
if(DonationStart + DonationDuration < DateTime.Now)
DonationDuration = (DateTime.Now - DonationStart) + duration;
else
DonationDuration += duration;
}
// Old stuff (next two lines) Should probably never be reintroduced - caleb
//if ( DonationStart + DonationDuration < DateTime.Now + duration )
// DonationDuration = DateTime.Now + duration - DonationStart;
acc.SetTag("DonationDuration", DonationDuration.ToString());
//from.SendMessage("Your donation status has been updated.");
//this.Delete();
return true;
}
catch
{
//from.SendMessage("An error ocurred trying to update your donation status. Contact an Administrator.");
return false;
}
}
}
示例4: AddToSubscription
public static bool AddToSubscription(Account acc, TimeSpan duration)
{
DateTime DonationStart = DateTime.MinValue;
TimeSpan DonationDuration = TimeSpan.Zero;
try
{
DonationStart = DateTime.Parse(acc.GetTag("DonationStart"));
DonationDuration = TimeSpan.Parse(acc.GetTag("DonationDuration"));
}
catch
{
}
if (DonationStart == DateTime.MinValue && DonationDuration == TimeSpan.Zero)
{
try
{
acc.SetTag("DonationStart", DateTime.Now.ToString());
acc.SetTag("DonationDuration", duration.ToString());
//from.SendMessage("Your donation status has been updated.");
//this.Delete();
return true;
}
catch
{
//from.SendMessage("An error ocurred trying to update your donation status. Contact an Administrator.");
return false;
}
}
else if (DonationDuration == TimeSpan.MaxValue)
{
//already at max
//from.SendMessage("You are already at permanent membership status.");
return false;
}
else
{
//existing donation
try
{
//Avoid overflow
if (duration == TimeSpan.MaxValue)
DonationDuration = duration;
else
DonationDuration += duration;
//if ( DonationStart + DonationDuration < DateTime.Now + duration )
// DonationDuration = DateTime.Now + duration - DonationStart;
acc.SetTag("DonationDuration", DonationDuration.ToString());
//from.SendMessage("Your donation status has been updated.");
//this.Delete();
return true;
}
catch
{
//from.SendMessage("An error ocurred trying to update your donation status. Contact an Administrator.");
return false;
}
}
}