internal static bool AddNew(Transaction entity)
 {
     MoneyPacificBlackBoxDataContext db = Connection.Instance;
     db.Transactions.InsertOnSubmit(entity);
     db.SubmitChanges();
     return true;
 }
Exemplo n.º 2
0
        internal bool CheckIsPossible(string codeNumber)
        {
            Transaction newTransaction = new Transaction();
            
            bool result = GeneratorPacificCode.Generator.isPossibleCode(codeNumber);

            newTransaction.Origine = "Check Possible";
            newTransaction.Comment = "Check Possible: " + codeNumber;
            newTransaction.IsSuccessful = result;

            this._transactionBUS.AddNew(newTransaction);
            return result;
        }
Exemplo n.º 3
0
        internal PacificCode GetNewPacificCode(int amount)
        {
            
            Transaction newTransaction = new Transaction();            
            PacificCode pacificCode = this._pacificCodeBUS.GetNewPacificCode(amount);

            // Lấy thông tin Transaction
            newTransaction.Amount = pacificCode.ActualAmount;
            newTransaction.CreateDate = pacificCode.CreateDate;
            newTransaction.Origine = "BuyMP";
            newTransaction.PacificCodeId = pacificCode.Id;            
            newTransaction.Comment = string.Format("Buy: {0}", pacificCode.ActualAmount);
            newTransaction.IsSuccessful = true; 
            // Luôn luôn cho phép tạo thành công...

            // Lưu
            this._transactionBUS.AddNew(newTransaction);

            // Trả kết quả
            return pacificCode;
        }
Exemplo n.º 4
0
        internal PacificCodeViewModel[] GetArrayPacificCodeViewModel(string[] arrPartCodeNumber)
        {
            PacificCodeViewModel[] arrResult;

            arrResult = PacificCodeBUS.GetArray(arrPartCodeNumber);


            Transaction newTransaction = new Transaction();
            // BEGIN --            
            newTransaction.Origine = "GetArrayPacificCodeViewModel";
            newTransaction.Comment = string.Format("Get PacificCodeViewModel: array");
            // END --
            // this._transactionBUS.AddNew(newTransaction);

            return arrResult;
            
        }
Exemplo n.º 5
0
        internal PacificCodeViewModel GetPacificCodeViewModel(string partCodeNumber)
        {
            Transaction newTransaction = new Transaction();
            PacificCodeViewModel model = new PacificCodeViewModel();
            PacificCode pacificCode = PacificCodeBUS.GetObject(partCodeNumber);

            if (pacificCode != null)
            {
                model.SetAttritebuteValue(pacificCode);

                // BEGIN --            
                newTransaction.Origine = "GetPacificCodeViewModel";
                newTransaction.Comment = string.Format("Get PacificCodeViewModel: {0}"
                    , partCodeNumber);
                // END --

                // Hien tai chưa can luu Transaction loại này
                // this._transactionBUS.AddNew(newTransaction);

                return model;
            }
            
            return null;
        }
Exemplo n.º 6
0
        internal bool CheckIsExistPartCodeNumber(string partCodeNumber)
        {
            Transaction newTransaction = new Transaction();
            bool result = PacificCodeBUS.IsExistPartCodeNumber(partCodeNumber);

            // BEGIN --            
            newTransaction.Origine = "Check Exist Part";
            newTransaction.Comment = string.Format("Check Exist Part: {0}"
                , partCodeNumber);
            // END --

            // Hien tai chưa can luu Transaction loại này
            // this._transactionBUS.AddNew(newTransaction);

            return result;
        }
Exemplo n.º 7
0
        internal string ChangeCode(string codeNumber)
        {
            Transaction newTransaction = new Transaction();
            string newCodeNumber = this._pacificCodeBUS.ChangeCode(codeNumber);

            // BEGIN --            
            newTransaction.Origine = "ChangeCode";
            newTransaction.Comment = string.Format("ChangeCode: {0} to {1}"
                , codeNumber
                , newCodeNumber);
            // END --

            // Hien tai chưa can luu Transaction loại này
            this._transactionBUS.AddNew(newTransaction);
            return newCodeNumber;
        }
Exemplo n.º 8
0
        internal DateTime GetExpireDate(string partCodeNumber)
        {
            Transaction newTransaction = new Transaction();

            DateTime result = this._pacificCodeBUS.GetExpireDate(partCodeNumber);

            // Không nên lưu transaction loại này...
            // BEGIN --            
            newTransaction.Origine = "GetExpireDate";
            newTransaction.Comment = "Get ExpireDate(HeThong su dung): " + partCodeNumber;
            // END --

            this._transactionBUS.AddNew(newTransaction);
            return result;
        }
Exemplo n.º 9
0
        internal double GetInitialAmount(string partCodeNumber)
        {
            Transaction newTransaction = new Transaction();
            double result = this._pacificCodeBUS.GetInitialAmount(partCodeNumber);

            newTransaction.Origine = "GetInitialAmount";
            newTransaction.Comment = "Get Initial Amount: " + partCodeNumber;

            this._transactionBUS.AddNew(newTransaction);
            return result;
        }
Exemplo n.º 10
0
 internal PacificCode MakePayment(string codeNumber, int amount)
 {
     Transaction newTransaction = new Transaction();
     
     PacificCode pacificCode = this._pacificCodeBUS.MakePayment(codeNumber, amount);
     
     
     // BEGIN --            
     newTransaction.Origine = "MakePayment";
     newTransaction.PacificCodeId = pacificCode.Id;
     newTransaction.Comment = string.Format("Payment: {0} - {1}"
         ,codeNumber
         ,amount);
     newTransaction.IsSuccessful = true;
     // END --
     
     this._transactionBUS.AddNew(newTransaction);
     return pacificCode;
 }
Exemplo n.º 11
0
 internal static bool Update(Transaction entity)
 {
     // TODO:(không sử dụng)
     throw new NotImplementedException();
 }
		private void detach_Transactions(Transaction entity)
		{
			this.SendPropertyChanging();
			entity.PacificCode = null;
		}
 partial void DeleteTransaction(Transaction instance);
 partial void UpdateTransaction(Transaction instance);
 partial void InsertTransaction(Transaction instance);
Exemplo n.º 16
0
        internal double GetValue(string partCodeNumber)
        {
            Transaction newTransaction = new Transaction();
            
            double result = this._pacificCodeBUS.GetValue(partCodeNumber);
            
            // BEGIN --            
            newTransaction.Origine = "GetValue";
            newTransaction.Comment = "Check Value: " + partCodeNumber;
            // END --

            this._transactionBUS.AddNew(newTransaction); 
            return result;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Phương thức này chỉ dùng tạm thời
        /// Cần thiết kế theo cách sau:
        /// - thanh toán xong trả ra Id Transaction
        /// - có 1 phuong thuc khác, cho phép kiểm tra Id Transaction đó có 
        /// thành công hay không
        /// </summary>
        /// <param name="codeNumber">CodeNumber sẽ bị trừ tiền</param>
        /// <param name="partCodeNumber">CodeNumber nhận tiền</param>
        /// <param name="amount">Số tiền thanh toán</param>
        /// <returns></returns>
        internal bool Tranfer(string codeNumber, string partCodeNumber, int amount)
        {
            /// TODO:
            Transaction newTransaction = new Transaction();            
            bool result = this._pacificCodeBUS.Tranfer(codeNumber, partCodeNumber, amount);

            newTransaction.Origine = "Make Payment";            
            newTransaction.Comment = string.Format("Make payment: {0} to {1} with amount: {2}"
                , codeNumber
                , partCodeNumber
                , amount);
            newTransaction.IsSuccessful = result;
            this._transactionBUS.AddNew(newTransaction);
            
            return result;
        }
Exemplo n.º 18
0
 internal void AddNew(Transaction entity)
 {
     TransactionDAO.AddNew(entity);
 }