/// <summary>
    /// To collect the money receipt
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (CheckSelectedGridRows())
        {
            customValidator.IsValid = false;
            ucMessageBoxForGrid.ShowMessage(ErrorMessages.NOROWSSELECTED);
            return;
        }

        if (Page.IsValid)
        {
            BatchTransferDTO batchTransferDTO = new BatchTransferDTO();
            batchTransferDTO.PaymentTransits = new List<PaymentTransitDTO>();

            //Iterate through the Products.Rows property
            foreach (GridViewRow row in grdPaymentTransit.Rows)
            {
                PaymentTransitDTO paymentTransitDTO = new PaymentTransitDTO();

                //Access the CheckBox
                CheckBox chkBox = (CheckBox)row.FindControl("chkItem");
                if (chkBox.Checked)
                {
                    paymentTransitDTO.PaymentTransit_CollectionId = Convert.ToInt32(grdPaymentTransit.DataKeys[row.RowIndex]["PC_Id"]);
                    paymentTransitDTO.PaymentTransit_CreatedBy = base.GetCurrentUserId();

                    batchTransferDTO.PaymentTransits.Add(paymentTransitDTO);
                }                
            }

            batchTransferDTO.BT_CreatedBy = GetCurrentUserId();
            batchTransferDTO.BT_CreatedDate = DateTime.Now;
            batchTransferDTO.BT_Status = (int)HelperClass.BatchStatus.PENDING;

            //Saves payment collection details in database
            ESalesUnityContainer.Container.Resolve<IPaymentService>().SendPaymentToHeadCashier(batchTransferDTO);

            ResetControls();

            //Shows message box to user
            ucMessageBoxForGrid.ShowMessage(Messages.PAYMENTSENTTOHEADCASHIER);

            ////Load payment transit details to show header values
            LoadPaymentTransitDetails();

            ////Load batch details for all transferred batches
            LoadBatchDetails();
        }
    }
예제 #2
0
        void IPaymentService.UpdateBatchDetails(BatchTransferDTO batchTransferDTO)
        {
            using (TransactionScope transactionScope = new TransactionScope())
            {
                batchtransfer batchTransferEntity = new batchtransfer();
                AutoMapper.Mapper.Map(batchTransferDTO, batchTransferEntity);

                base.BatchTransferRepository.Update(batchTransferEntity);

                foreach (PaymentTransitDTO item in batchTransferDTO.PaymentTransits)
                {
                    PaymentCollectionDTO paymentCollectionDTO = GetCollectionDetailsById(item.PaymentTransit_CollectionId);
                    paymentCollectionDTO.PC_Status = (int)Globals.CollectionStatus.ACCEPTEDBYCASHIER;
                    paymentCollectionDTO.PC_LastUpdateDate = DateTime.Now;

                    ////Instrument status and Instrument Realization date to be updated
                    ////in case payment mode is cheque
                    if (paymentCollectionDTO.PC_PaymentMode == (int)Globals.PaymentModes.CHEQUE)
                    {
                        paymentCollectionDTO.PC_InstrumentStatus = (int)Globals.InstrumentStatus.PENDING;
                        paymentCollectionDTO.PC_InstrumentRealizationDate = DateTime.Now;
                    }
                    else
                    {
                        paymentCollectionDTO.PC_InstrumentStatus = 0;
                    }

                    paymentcollection paymentcollectionEntity = new paymentcollection();
                    AutoMapper.Mapper.Map(paymentCollectionDTO, paymentcollectionEntity);

                    base.PaymentCollectionRepository.Update(paymentcollectionEntity);
                }
                transactionScope.Complete();
            }
        }
예제 #3
0
        void IPaymentService.SendPaymentToHeadCashier(BatchTransferDTO batchTransferDTO)
        {
            batchtransfer batchtransferEntity = new batchtransfer();
            AutoMapper.Mapper.Map(batchTransferDTO, batchtransferEntity);

            using (TransactionScope transactionScope = new TransactionScope())
            {
                base.BatchTransferRepository.Save(batchtransferEntity);

                foreach (PaymentTransitDTO item in batchTransferDTO.PaymentTransits)
                {
                    PaymentCollectionDTO paymentCollectionDTO = GetCollectionDetailsById(item.PaymentTransit_CollectionId);
                    paymentCollectionDTO.PC_Status = (int)Globals.CollectionStatus.SENTTOCASHIER;
                    paymentCollectionDTO.PC_LastUpdateDate = DateTime.Now;

                    paymentcollection paymentcollectionEntity = new paymentcollection();
                    AutoMapper.Mapper.Map(paymentCollectionDTO, paymentcollectionEntity);

                    base.PaymentCollectionRepository.Update(paymentcollectionEntity);
                }
                transactionScope.Complete();
            }
        }
예제 #4
0
 BatchTransferDTO IPaymentService.GetBatchByBatchId(int batchId)
 {
     BatchTransferDTO batchTransferDTO = new BatchTransferDTO();
     AutoMapper.Mapper.Map(base.BatchTransferRepository.GetSingle(item => item.BT_ID == batchId), batchTransferDTO);
     return batchTransferDTO;
 }