Exemplo n.º 1
0
        public IMoney GetMoneyToDisplay(MoneyType form)
        {
            if (this.moneyObjects == null)
            {
                this.moneyObjects = new Dictionary<MoneyType, IMoney>();
            }

            if (this.moneyObjects.ContainsKey(form))
            {
                return this.moneyObjects[form];
            }

            switch (form)
            {
                case MoneyType.Metalic:
                    this.moneyObjects.Add(form, new MetalicMoney());
                    this.ObjectCount++;
                    break;
                case MoneyType.Paper:
                    this.moneyObjects.Add(form, new PaperMoney());
                    this.ObjectCount++;
                    break;
                default:
                    throw new ArgumentException("Unsupported money type");
            }

            return this.moneyObjects[form];
        }
Exemplo n.º 2
0
 public MoneyFlowUnit(int AccID, double Count, int CategoryID, string UserComment, DateTime Date, MoneyType type)
 {
     _Account_Id = AccID;
     _Count = Count;
     _Category = CategoryID;
     _Comment = UserComment;
     _Date = Date;
     _type = type;
 }
Exemplo n.º 3
0
Arquivo: Money.cs Projeto: jpx/blazera
 static double GetBaseValue(MoneyType moneyType)
 {
     switch (moneyType)
     {
         case MoneyType.Copper: return BASE_VALUE * COPPER_BASE_VALUE;
         case MoneyType.Silver: return BASE_VALUE * SILVER_BASE_VALUE;
         case MoneyType.Gold: return BASE_VALUE * GOLD_BASE_VALUE;
         case MoneyType.Platinum: return BASE_VALUE * PLATINUM_BASE_VALUE;
         case MoneyType.Diamond: return BASE_VALUE * DIAMOND_BASE_VALUE;
         case MoneyType.Chrona: return BASE_VALUE * CHRONA_BASE_VALUE;
         default: return BASE_VALUE;
     }
 }
Exemplo n.º 4
0
 //para biriminleri arasında convert işlemlerimizi bu metod vasıtasıyla
 //yapacağız. Sadece çevirmek istediğimiz para birimini hassasiyet bilgisini
 //veriyoruz.
 public Money ConvertToMoney(MoneyType type,int roundSensitive)
 {
     //eğer çevrilmesini istediğimiz tip ile aynı tip ise aynı tipi dönüyoruz.
     if (Enum.Equals(moneyType, type))
         return this;
     else
     {
         //Toplam TL tutar bulundu.
         decimal totalTlValue = this.amount * this.Rate;
         //istenen tipin rate değeri bulunmadı.
         decimal convertRateValue = GetMoneyRate(type);
         //istenen kur tipinden toplam amount miktarı hesaplandı.
         decimal convertAmount = Math.Round(totalTlValue / convertRateValue, roundSensitive);
         //yeni para birimi ve amounta göre paramız oluştuurlur.
         Money returnMoney = new Money(type,convertAmount);
         return returnMoney;
     }
 }
Exemplo n.º 5
0
 //yapıcı metodumuzda sadece para birimi ve miktarını alıyoruz.
 public Money(MoneyType type, decimal amount)
 {
     this.amount = amount;
     this.moneyType = type;
 }
Exemplo n.º 6
0
 //bu metodun sanki ilgili günün rate bilgilerini
 //döndüğünü düşünüyoruz
 private decimal GetMoneyRate(MoneyType type)
 {
     //burada paranın kur bilgilerinin alındığını düşünüelim.
     decimal rate = 0;
     switch (type)
     {
         case MoneyType.TL:
             rate = 1M;
             break;
         case MoneyType.Dollar:
             rate = 2.35M;
             break;
         case MoneyType.Euro:
             rate = 2.95M;
             break;
         case MoneyType.GBP:
             rate = 3.35M;
             break;
         case MoneyType.JPY:
             rate = 0.55M;
             break;
         default:
             rate = 1M;
             break;
     }
     return rate;
 }
Exemplo n.º 7
0
Arquivo: Money.cs Projeto: jpx/blazera
 public static ItemPrice ConvertPriceTo(MoneyType moneyType, ItemPrice itemPrice)
 {
     return new ItemPrice(itemPrice.Value * (GetBaseValue(itemPrice.MoneyType) / GetBaseValue(moneyType)));
 }
Exemplo n.º 8
0
 public Account(MoneyType type)
 {
     Id      = Guid.NewGuid().ToString();
     Balance = 0;
     Type    = type;
 }
Exemplo n.º 9
0
 public MoneyItemModel(string name, float weight, float value, float maxCondition, int maxQuantity, bool hidden, bool essential, string[] flags, ItemScriptNode scripts, string worldModel, MoneyType type) :
     base(name, weight, value, maxCondition, maxQuantity, hidden, essential, flags, scripts, worldModel)
 {
     Type      = type;
     Stackable = true;
 }