Exemple #1
0
        private void GetPayTypeInfo()
        {
            switch (payTypeId)
            {
            case 2:
                collectionLineDetail = new TrnCollectionLine
                {
                    PayTypeId   = objPayType.Id,
                    Amount      = objPayType.TenderAmount,
                    CheckNumber = txtCheckNumber.Text,
                    CheckDate   = dtpCheckDate.Value.Date,
                    CheckBank   = txtCheckBank.Text,
                    AccountId   = objPayType.AccountId,
                };
                tenderForm.trnListCollectionLines.Add(collectionLineDetail);
                break;

            case 3:
                collectionLineDetail = new TrnCollectionLine
                {
                    PayTypeId = objPayType.Id,
                    Amount    = objPayType.TenderAmount,
                    CreditCardVerificationCode = txtApprovalCode.Text,
                    CreditCardNumber           = txtCreditCardNumbera.Text,
                    CreditCardType             = cboCreditCardType.Text,
                    CreditCardBank             = txtCreditCardBank.Text,
                    CreditCardReferenceNumber  = txtReferenceCode.Text,
                    CreditCardHolderName       = txtCreditCardHolder.Text,
                    CreditCardExpiry           = txtCreditCardExpiry.Text,
                    AccountId = objPayType.AccountId
                };
                tenderForm.trnListCollectionLines.Add(collectionLineDetail);
                break;

            case 4:
                collectionLineDetail = new TrnCollectionLine
                {
                    PayTypeId             = objPayType.Id,
                    Amount                = objPayType.TenderAmount,
                    GiftCertificateNumber = txtGiftCertificateNumber.Text,
                    AccountId             = objPayType.AccountId
                };
                tenderForm.trnListCollectionLines.Add(collectionLineDetail);
                break;

            case 7:
                collectionLineDetail = new TrnCollectionLine
                {
                    PayTypeId = objPayType.Id,
                    Amount    = objPayType.TenderAmount,
                    StockInId = Convert.ToInt32(cboReturnStockInNumber.SelectedValue),
                    AccountId = objPayType.AccountId
                };
                tenderForm.trnListCollectionLines.Add(collectionLineDetail);
                break;

            case 8:
                collectionLineDetail = new TrnCollectionLine
                {
                    PayTypeId        = objPayType.Id,
                    Amount           = objPayType.TenderAmount,
                    OtherInformation = txtOtherPayTypeInfo.Text,
                    AccountId        = objPayType.AccountId
                };
                tenderForm.trnListCollectionLines.Add(collectionLineDetail);
                break;

            case 10:
                collectionLineDetail = new TrnCollectionLine
                {
                    PayTypeId        = objPayType.Id,
                    Amount           = objPayType.TenderAmount,
                    OtherInformation = txtOtherPayTypeInfo.Text,
                    AccountId        = objPayType.AccountId
                };
                tenderForm.trnListCollectionLines.Add(collectionLineDetail);
                break;

            case 12:
                collectionLineDetail = new TrnCollectionLine
                {
                    PayTypeId        = objPayType.Id,
                    Amount           = objPayType.TenderAmount,
                    OtherInformation = txtOtherPayTypeInfo.Text,
                    AccountId        = objPayType.AccountId
                };
                tenderForm.trnListCollectionLines.Add(collectionLineDetail);
                break;

            default:
                break;
            }
        }
Exemple #2
0
        private void dgvTender_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row          = dgvTender.Rows[e.RowIndex];
            decimal         tenderAmount = 0;

            if (dgvTender.CurrentCell.RowIndex == 0)
            {
                if (trnListCollectionLines.Count == 0)
                {
                    tenderAmount = Convert.ToDecimal(row.Cells[4].Value);

                    payType = new MstPayType
                    {
                        Id        = Convert.ToInt32(row.Cells[0].Value),
                        PayType   = row.Cells[1].Value.ToString(),
                        AccountId = Convert.ToInt32(row.Cells[2].Value)
                    };

                    collectionLine = new TrnCollectionLine
                    {
                        Amount    = tenderAmount,
                        PayTypeId = payType.Id,
                        AccountId = payType.AccountId
                    };

                    trnListCollectionLines.Add(collectionLine);
                }
                else
                {
                    var currentCash = trnListCollectionLines.Single(d => d.PayTypeId == 1);
                    trnListCollectionLines.Remove(currentCash);

                    tenderAmount = Convert.ToDecimal(row.Cells[4].Value);

                    payType = new MstPayType
                    {
                        Id        = Convert.ToInt32(row.Cells[0].Value),
                        PayType   = row.Cells[1].Value.ToString(),
                        AccountId = Convert.ToInt32(row.Cells[2].Value)
                    };

                    collectionLine = new TrnCollectionLine
                    {
                        Amount    = tenderAmount,
                        PayTypeId = payType.Id,
                        AccountId = payType.AccountId
                    };

                    trnListCollectionLines.Add(collectionLine);
                }
            }
            else
            {
                payType = new MstPayType
                {
                    Id           = Convert.ToInt32(row.Cells[0].Value),
                    PayType      = row.Cells[1].Value.ToString(),
                    AccountId    = Convert.ToInt32(row.Cells[2].Value),
                    TenderAmount = Convert.ToDecimal(row.Cells[4].Value)
                };

                CollectionPayTypeInformationForm payTypeForm = new CollectionPayTypeInformationForm(this, payType);
                payTypeForm.ShowDialog();
            }
            GetTenderTotalAmount();
        }