コード例 #1
0
ファイル: PawnPayment.cs プロジェクト: njmube/PawnPOS
        public void AddPaymentToTransaction()
        {
            DataManager dataManager = new DataManager(connectionString);
            string transactionID = TransIDTextBox.Text;
            string paymentDate = DateTime.Today.ToShortDateString();
            double paymentAmount = Convert.ToDouble(PaymentTextBox.Text);
            double newPrincipal;
            if (currentPrincipal == 0)
            {
                newPrincipal = principal - paymentAmount;
            }
            else
            {
                newPrincipal = currentPrincipal - paymentAmount;
            }

            dataManager.InsertNewPayment(transactionID, paymentDate, paymentAmount.ToString(), newPrincipal.ToString());

            if (newPrincipal == 0)
            {
                dataManager.UpdatePawnToClosed(transactionID);
            }
        }