当前位置: 首页>>代码示例>>C#>>正文


C# Account.SetTag方法代码示例

本文整理汇总了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;
		}
开发者ID:romeov007,项目名称:imagine-uo,代码行数:12,代码来源:BaseHouse.cs

示例2: SetSubscriptionStatus

		public static void SetSubscriptionStatus( Account acc, DateTime started, TimeSpan duration )
		{
			acc.SetTag( "DonationStart", started.ToString() );
			acc.SetTag( "DonationDuration", duration.ToString() );
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:5,代码来源:DonationSystem.cs

示例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;
				}
			}
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:72,代码来源:DonationSystem.cs

示例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;
                }
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:63,代码来源:DonationSystem.cs


注:本文中的Server.Accounting.Account.SetTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。