public ActionResult DeleteConfirmed(int id)
        {
            PreparationType preparationType = _preparationTypeService.GetById(id);

            _preparationTypeService.Delete(preparationType);
            return(RedirectToAction("Index"));
        }
 public TransactionPreparation(Guid transactionId, TransactionType transactionType, PreparationType preparationType, decimal amount)
 {
     this.TransactionId = transactionId;
     this.TransactionType = transactionType;
     this.PreparationType = preparationType;
     this.Amount = amount;
 }
예제 #3
0
 public AddTransactionPreparationCommand(string accountId, string transactionId, TransactionType transactionType, PreparationType preparationType, double amount)
     : base(accountId)
 {
     TransactionId = transactionId;
     TransactionType = transactionType;
     PreparationType = preparationType;
     Amount = amount;
 }
예제 #4
0
 public AddTransactionPreparationCommand(string accountId, string transactionId, TransactionType transactionType, PreparationType preparationType, double amount)
     : base(accountId)
 {
     TransactionId   = transactionId;
     TransactionType = transactionType;
     PreparationType = preparationType;
     Amount          = amount;
 }
예제 #5
0
 public TransactionPreparation(string id, string accountId, TransactionType transactionType, PreparationType preparationType, double amount)
     : this(id)
 {
     AccountId       = accountId;
     PreparationType = preparationType;
     TransactionType = transactionType;
     Amount          = amount;
 }
 public ActionResult Edit([Bind(Include = "preparationTypeId,Name,Id")] PreparationType preparationType)
 {
     if (ModelState.IsValid)
     {
         _preparationTypeService.Update(preparationType);
         return(RedirectToAction("Index"));
     }
     return(View(preparationType));
 }
        // GET: PreparationType/Delete/5
        public ActionResult Delete(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PreparationType preparationType = _preparationTypeService.GetById(id);

            if (preparationType == null)
            {
                return(HttpNotFound());
            }
            return(View(preparationType));
        }
 public TransactionPreparation(string accountId, string transactionId, TransactionType transactionType, PreparationType preparationType, double amount)
 {
     if (transactionType == TransactionType.DepositTransaction && preparationType != PreparationType.CreditPreparation)
     {
         throw new MismatchTransactionPreparationException(transactionType, preparationType);
     }
     if (transactionType == TransactionType.WithdrawTransaction && preparationType != PreparationType.DebitPreparation)
     {
         throw new MismatchTransactionPreparationException(transactionType, preparationType);
     }
     AccountId = accountId;
     TransactionId = transactionId;
     TransactionType = transactionType;
     PreparationType = preparationType;
     Amount = amount;
 }
 public TransactionPreparation(string accountId, string transactionId, TransactionType transactionType, PreparationType preparationType, double amount)
 {
     if (transactionType == TransactionType.DepositTransaction && preparationType != PreparationType.CreditPreparation)
     {
         throw new MismatchTransactionPreparationException(transactionType, preparationType);
     }
     if (transactionType == TransactionType.WithdrawTransaction && preparationType != PreparationType.DebitPreparation)
     {
         throw new MismatchTransactionPreparationException(transactionType, preparationType);
     }
     AccountId       = accountId;
     TransactionId   = transactionId;
     TransactionType = transactionType;
     PreparationType = preparationType;
     Amount          = amount;
 }
예제 #10
0
        public AddTransactionPreparationCommand(string accountId, string transactionId, TransactionType transactionType, PreparationType preparationType, double amount)
            : base(accountId)
        {
            if (string.IsNullOrWhiteSpace(transactionId))
            {
                throw new ArgumentNullException(nameof(transactionId));
            }

            if (amount <= 0D)
            {
                throw new ArgumentOutOfRangeException(nameof(amount));
            }

            TransactionId   = transactionId;
            TransactionType = transactionType;
            PreparationType = preparationType;
            Amount          = amount;
        }
예제 #11
0
  public static AKRESULT PrepareGameSyncs(PreparationType in_PreparationType, AkGroupType in_eGameSyncType, string in_pszGroupName, string [] in_ppszGameSyncName, uint in_uNumGameSyncs, AkCallbackManager.BankCallback in_pfnBankCallback, object in_pCookie) {
			
		//Find the required size
		int size = 0;
		foreach(string s in in_ppszGameSyncName)
			size += s.Length + 1;
				
		int sizeofChar = 2;	//Unicode
		IntPtr pMem = Marshal.AllocHGlobal(size * sizeofChar);
		
		//Write the length of array
		Marshal.WriteInt16(pMem, (short)in_ppszGameSyncName.Length);
		IntPtr pCurrent = (IntPtr)(pMem.ToInt64() + sizeofChar);
		
		//Copy the strings one after the other.
		foreach(string s in in_ppszGameSyncName)
		{
			Marshal.Copy(s.ToCharArray(), 0, pCurrent, s.Length);
			pCurrent = (IntPtr)(pCurrent.ToInt64() + sizeofChar * s.Length);
			Marshal.WriteInt16(pCurrent, 0);	//Null-terminated string
			pCurrent = (IntPtr)(pCurrent.ToInt64() + sizeofChar);
		}		
		
		in_pCookie = new AkCallbackManager.BankCallbackPackage(in_pfnBankCallback, in_pCookie);
    try {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareGameSyncs__SWIG_2((int)in_PreparationType, (int)in_eGameSyncType, in_pszGroupName, pMem, in_uNumGameSyncs, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode());

      return ret;
    } finally {
	Marshal.FreeHGlobal(pMem);
    }
  }
예제 #12
0
  public static AKRESULT PrepareGameSyncs(PreparationType in_PreparationType, AkGroupType in_eGameSyncType, uint in_GroupID, uint[] in_paGameSyncID, uint in_uNumGameSyncs) {
    AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareGameSyncs__SWIG_1((int)in_PreparationType, (int)in_eGameSyncType, in_GroupID, in_paGameSyncID, in_uNumGameSyncs);

    return ret;
  }
예제 #13
0
  public static AKRESULT PrepareEvent(PreparationType in_PreparationType, uint[] in_pEventID, uint in_uNumEvent, AkCallbackManager.BankCallback in_pfnBankCallback, object in_pCookie) {
		in_pCookie = new AkCallbackManager.BankCallbackPackage(in_pfnBankCallback, in_pCookie);
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareEvent__SWIG_3((int)in_PreparationType, in_pEventID, in_uNumEvent, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode());

      return ret;
    }
  }
예제 #14
0
  public static AKRESULT PrepareEvent(PreparationType in_PreparationType, uint[] in_pEventID, uint in_uNumEvent) {
    AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareEvent__SWIG_1((int)in_PreparationType, in_pEventID, in_uNumEvent);

    return ret;
  }
예제 #15
0
  public static AKRESULT PrepareEvent(PreparationType in_PreparationType, string [] in_ppszString, uint in_uNumEvent) {
			
		//Find the required size
		int size = 0;
		foreach(string s in in_ppszString)
			size += s.Length + 1;
				
		int sizeofChar = 2;	//Unicode
		IntPtr pMem = Marshal.AllocHGlobal(size * sizeofChar);
		
		//Write the length of array
		Marshal.WriteInt16(pMem, (short)in_ppszString.Length);
		IntPtr pCurrent = (IntPtr)(pMem.ToInt64() + sizeofChar);
		
		//Copy the strings one after the other.
		foreach(string s in in_ppszString)
		{
			Marshal.Copy(s.ToCharArray(), 0, pCurrent, s.Length);
			pCurrent = (IntPtr)(pCurrent.ToInt64() + sizeofChar * s.Length);
			Marshal.WriteInt16(pCurrent, 0);	//Null-terminated string
			pCurrent = (IntPtr)(pCurrent.ToInt64() + sizeofChar);
		}		
		
    try {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareEvent__SWIG_0((int)in_PreparationType, pMem, in_uNumEvent);

      return ret;
    } finally {
	Marshal.FreeHGlobal(pMem);
    }
  }
예제 #16
0
  public static AKRESULT PrepareBank(PreparationType in_PreparationType, uint in_bankID, AkCallbackManager.BankCallback in_pfnBankCallback, object in_pCookie, AkBankContent in_uFlags) {
		in_pCookie = new AkCallbackManager.BankCallbackPackage(in_pfnBankCallback, in_pCookie);
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareBank__SWIG_10((int)in_PreparationType, in_bankID, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode(), (int)in_uFlags);

      return ret;
    }
  }
예제 #17
0
  public static AKRESULT PrepareBank(PreparationType in_PreparationType, string in_pszString, AkCallbackManager.BankCallback in_pfnBankCallback, object in_pCookie) {
		in_pCookie = new AkCallbackManager.BankCallbackPackage(in_pfnBankCallback, in_pCookie);
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareBank__SWIG_7((int)in_PreparationType, in_pszString, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode());

      return ret;
    }
  }
예제 #18
0
  public static AKRESULT PrepareBank(PreparationType in_PreparationType, uint in_bankID) {
    AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareBank__SWIG_5((int)in_PreparationType, in_bankID);

    return ret;
  }
예제 #19
0
  public static AKRESULT PrepareBank(PreparationType in_PreparationType, uint in_bankID, AkBankContent in_uFlags) {
    AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareBank__SWIG_4((int)in_PreparationType, in_bankID, (int)in_uFlags);

    return ret;
  }
예제 #20
0
  public static AKRESULT PrepareBank(PreparationType in_PreparationType, string in_pszString) {
    AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareBank__SWIG_1((int)in_PreparationType, in_pszString);

    return ret;
  }
예제 #21
0
  public static AKRESULT PrepareGameSyncs(PreparationType in_PreparationType, AkGroupType in_eGameSyncType, uint in_GroupID, uint[] in_paGameSyncID, uint in_uNumGameSyncs, AkCallbackManager.BankCallback in_pfnBankCallback, object in_pCookie) {
		in_pCookie = new AkCallbackManager.BankCallbackPackage(in_pfnBankCallback, in_pCookie);
    {
      AKRESULT ret = (AKRESULT)AkSoundEnginePINVOKE.CSharp_PrepareGameSyncs__SWIG_3((int)in_PreparationType, (int)in_eGameSyncType, in_GroupID, in_paGameSyncID, in_uNumGameSyncs, (IntPtr)0, (IntPtr)in_pCookie.GetHashCode());

      return ret;
    }
  }
 public MismatchTransactionPreparationException(TransactionType transactionType, PreparationType preparationType)
     : base(string.Format("Mismatch transaction type [{0}] and preparation type [{1}].", transactionType, preparationType))
 {
 }
예제 #23
0
        /// <summary>添加一笔预操作
        /// </summary>
        public void AddTransactionPreparation(string transactionId, TransactionType transactionType, PreparationType preparationType, double amount)
        {
            var availableBalance = GetAvailableBalance();

            if (preparationType == PreparationType.DebitPreparation && availableBalance < amount)
            {
                throw new InsufficientBalanceException(Id, transactionId, transactionType, amount, _balance, availableBalance);
            }

            ApplyEvent(new TransactionPreparationAddedEvent(new TransactionPreparation(Id, transactionId, transactionType, preparationType, amount)));
        }
예제 #24
0
        async Task <TaskMessage> IBankAccount.AddTransactionPreparation(Guid transactionId, TransactionType transactionType, PreparationType preparationType, decimal amount)
        {
            if (preparationType == PreparationType.DebitPreparation && this.GetAvailableBalance() < amount)
            {
                return(new ErrorMessage("balance not enough"));
            }

            var transferTransactionPreparationInfo = new TransactionPreparation(transactionId, transactionType, preparationType, amount);

            if (!this.State.TransactionPreparations.ContainsKey(transactionId))
            {
                await this.ApplyEvent(new TransactionPreparationAddedEvent(transferTransactionPreparationInfo));
            }

            return(SuccessMessage.Instance);
        }
        public MismatchTransactionPreparationException(TransactionType transactionType, PreparationType preparationType)
            : base(string.Format("Mismatch transaction type [{0}] and preparation type [{1}].", transactionType, preparationType))
        {

        }
예제 #26
0
 public TransactionPreparation(Guid transactionId, TransactionType transactionType, PreparationType preparationType, decimal amount)
 {
     this.TransactionId   = transactionId;
     this.TransactionType = transactionType;
     this.PreparationType = preparationType;
     this.Amount          = amount;
 }