當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。