private void SetupBankViews(View parent)
        {
            var banksSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank);
            var banksBranchSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank_branch);

            var banks = bankRepository.GetAll().ToList();
            var bankNames = banks.Select(b => b.Name).ToList();
            var banksAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item, bankNames);
            banksSpinner.Adapter = banksAdapter;

            var bankBranchesAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item);
            banksBranchSpinner.Adapter = bankBranchesAdapter;

            banksSpinner.ItemSelected += delegate
            {
                this.bank = banks[banksSpinner.SelectedItemPosition];

                var bankBranchNames = bank.Branches.Select(b => b.Name).ToList();
                bankBranchesAdapter.Clear();
                bankBranchesAdapter.AddAll(bankBranchNames);

                banksBranchSpinner.ItemSelected += delegate
                {
                    this.bankBranch = bank.Branches[banksBranchSpinner.SelectedItemPosition];
                };
            };

            bank = banks.First();
            bankBranch = bank.Branches.First();
        }
 protected OrderSaleContextBuilder(Outlet outlet, CostCentre costCentre, User user, Sale sale, Bank bank, BankBranch bankBranch)
 {
     Outlet = outlet;
     CostCentre = costCentre;
     User = user;
     Sale = sale;
     Bank = bank;
     BankBranch = bankBranch;
 }
 public void Save(BankViewModel bankViewModel)
 {
     Bank bank = new Bank(bankViewModel.Id)
     {
         Name=bankViewModel.Name,
         Code=bankViewModel.Code,
         Description=bankViewModel.Description,
     };
     _bankRepository.Save(bank);
 }
 public BankViewModel Map(Bank bank)
 {
     return new BankViewModel
     {
       Id=bank.Id,
       Name=bank.Name,
       Code=bank.Code,
       Description=bank.Description,
       IsActive = bank._Status == EntityStatus.Active ? true : false,
     };
 }
 public virtual OrderSaleContextBuilder WithChequePayment(decimal amount, Bank bank, BankBranch bankBranch,  string chequeNumber = "12345678")
 {
     Sale.AddChequePayment(chequeNumber, amount, bank, bankBranch, DateTime.Now);
     return this;
 }
        private void ClearViewModel()
        {
            Name = "";
            Code = "";
            IdNo = "";
            PinNo = "";
            MobileNumber = "";
            AccountName = "";
            AccountNumber = "";
            Description = "";
            SelectedGender = Gender.Unknown;
            SelectedBankOne = new Bank(Guid.NewGuid()) { Name = "--Select Bank--" };
            SelectedBankBranch = new BankBranch(Guid.NewGuid()) { Name = "--Select Bank Branch--" };

            PhysicalAddress = "";
            PostalAddress = "";
            Email = "";
            PhoneNumber = "";
            BusinessNumber = "";
            FaxNumber = "";

        }
 private static void AssertBank(Bank bank, Bank createdBank)
 {
     Assert.IsNotNull(createdBank);
     Assert.AreEqual(createdBank.Code, bank.Code);
     Assert.AreEqual(createdBank.Name, bank.Name);
     Assert.AreEqual(createdBank.Description, bank.Description);
     Assert.AreEqual(createdBank._Status, bank._Status);
     Trace.WriteLine(string.Format("Bank GetById[{0}], Name[{1}]", createdBank.Id, createdBank.Name));
 }
        private void LoadBanks()
        {
            using (StructureMap.IContainer cont = NestedContainer)
            {
                SelectedBank = new Bank(Guid.Empty) { Name = "Select Bank" };
                BanksList.Clear();
                var banks = Using<IBankRepository>(cont).GetAll().ToList();
                banks.ForEach(n => BanksList.Add(n));

            }
        }
 private void CreateBank(string name)
 {
     var bank = new Bank(Guid.NewGuid());
     bank.Code = name;
     bank.Name = name;
     bank.Description = name;
     _bankRepository.Save(bank);
 }
        public void AddPaymentInfo(decimal cashAmnt, decimal creditAmnt, decimal mMoneyAmnt, decimal chequeAmnt,
                                   decimal amountPaid, string mMoneyReferenceNo, string chequeNo, decimal grossAmount,
                                   decimal change, Bank bank, BankBranch bBranch, string mMoneyOption,
                                   bool mMoneyIsApproved, Guid mMoneyTransactionRefId, string mMoneyAccountId,
                                   string mMoneySubscriberId, string mMoneyTillNumber, string currency,
                                   PaymentNotificationResponse paymentNotif,
                                   PaymentResponse paymentResponse)
        {
            using (StructureMap.IContainer cont = NestedContainer)
            {
                CashAmount = cashAmnt - change;
                bankBranch = bBranch;
                TotalGross = grossAmount + AmountPaid;

                CreditAmount = creditAmnt;
                MMoneyAmount = mMoneyAmnt;
                ChequeAmount = chequeAmnt;
                MMoneyRefNo = mMoneyReferenceNo;
                ChequeNo = chequeNo + " - " + (bank != null ? bank.Name : "");
                AmountPaid = amountPaid + AmountPaid;
                MMoneyOption = mMoneyOption;

                string desc = "";
              
                #region Cash

                if (cashAmnt > 0)
                {
                    var existing = PaymentInfoList.FirstOrDefault(n => n.PaymentModeUsed == PaymentMode.Cash && n.IsNew);
                    if (existing == null)
                    {
                        existing = new PaymentInfo
                                       {
                                           Id = Guid.NewGuid(),
                                           Amount = cashAmnt - change, //??
                                           PaymentModeUsed = PaymentMode.Cash,
                                           IsNew = true,
                                           IsConfirmed = true,
                                           PaymentRefId = "Cash",
                                           MMoneyPaymentType = "",
                                           PaymentTypeDisplayer = "Cash",
                                           Description = "", 
                                       };
                        PaymentInfoList.Add(existing);
                    }
                    else
                        existing.Amount += cashAmnt;

                    desc = GetLocalText("sl.payment.notifitcation.desc.inpaymentof") /*"In payment of" */
                           + " " + currency + " " + existing.Amount + ".";
                    existing.Description = desc;
                }

                #endregion

                #region Cheq

                if (chequeAmnt > 0)
                {
                    var existing =
                        PaymentInfoList.FirstOrDefault(n => n.PaymentModeUsed == PaymentMode.Cheque && n.IsNew);
                    if (existing == null)
                    {
                        existing = new PaymentInfo
                                       {
                                           Id = Guid.NewGuid(),
                                           Amount = chequeAmnt,
                                           PaymentModeUsed = PaymentMode.Cheque,
                                           PaymentRefId = chequeNo + " - " + (bank != null ? bank.Name : ""),
                                           IsNew = true,
                                           IsConfirmed = true,
                                           MMoneyPaymentType = "",
                                           PaymentTypeDisplayer =
                                               "Cheque " + chequeNo + " - " + (bank != null ? bank.Name : ""),
                                           Description = ""
                                       };
                        PaymentInfoList.Add(existing);
                    }
                    else
                        existing.Amount += chequeAmnt;

                    desc = GetLocalText("sl.payment.notifitcation.desc.inpaymentof") /*"I payment of"*/
                           + " " + currency + " " + existing.Amount + " "
                           + GetLocalText("sl.payment.notifitcation.desc.tobank") /*"to bank"*/
                           + " " + (bank != null ? bank.Name : "") + " "
                           + GetLocalText("sl.payment.notifitcation.desc.chequenumber") /*"cheque number"*/
                           + " " + chequeNo + ".";
                    existing.Description = desc;
                }

                #endregion

                #region M-Money

                if (mMoneyAmnt > 0)
                {
                    if (mMoneyTransactionRefId == Guid.Empty)
                        throw new Exception("Transaction reference id not set.\nAddPaymentInfo()");

                    //cn: Add or replace a notification.
                    var existingNotif = _paymentNotifs.FirstOrDefault(n => n.Id == paymentNotif.Id);
                    if (existingNotif != null)
                        _paymentNotifs.Remove(existingNotif);

                    if (paymentNotif != null)
                        _paymentNotifs.Add(paymentNotif);

                    var mmPayment = new PaymentInfo
                                        {
                                            Id = mMoneyTransactionRefId,
                                            Amount = mMoneyAmnt,
                                            PaymentModeUsed = PaymentMode.MMoney,
                                            MMoneyPaymentType = mMoneyOption,
                                            IsNew = true,
                                            IsConfirmed = mMoneyIsApproved,
                                            PaymentRefId = mMoneyReferenceNo,
                                            PaymentTypeDisplayer = mMoneyOption,
                                            Description = desc
                                        };
                    PaymentInfoList.Add(mmPayment);

                    if (mmPayment.IsConfirmed)
                        desc = MMoneyDescription(mmPayment.Amount, currency, mMoneySubscriberId, mMoneyAccountId,
                                                 mMoneyTillNumber, MMoneyRefNo);
                    else
                        desc = paymentResponse.LongDescription != ""
                                   ? paymentResponse.LongDescription
                                   : paymentResponse.ShortDescription;

                    mmPayment.Description = desc;
                }

                #endregion

                #region Credit

                var credit = PaymentInfoList.FirstOrDefault(n => n.PaymentModeUsed == PaymentMode.Credit && n.IsNew);
                if (credit == null)
                {
                    credit = new PaymentInfo
                                 {
                                     Id = Guid.NewGuid(),
                                     Amount = creditAmnt,
                                     PaymentModeUsed = PaymentMode.Credit,
                                     IsNew = true,
                                     IsConfirmed = true,
                                     MMoneyPaymentType = "",
                                     PaymentRefId = "",
                                     PaymentTypeDisplayer = "Credit"
                                 };

                    PaymentInfoList.Add(credit);
                }
                else
                    credit.Amount = creditAmnt;

                if (credit.Amount == 0)
                    PaymentInfoList.Remove(credit);

                #endregion

                RecalcAmountPaid();
                CanSaveToContinue = false;
            }
        }
        protected Guid AddBank(string name, string desc, string code)
        {
            Bank bank = new Bank(Guid.NewGuid())

            {
                Name = name,
                Description = desc,
                Code = code
                
            };
            bank._SetStatus(EntityStatus.Active);
            return _bankRepository.Save(bank );
        }
 private ValidationResultInfo Validate(Bank bank)
 {
     return _bankRepository.Validate(bank);
 }
        private Bank Map(BankImport bankImport)
        {
            var exists = Queryable.FirstOrDefault(_context.tblBank, p => p.Code == bankImport.Code);

            Guid id = exists != null ? exists.Id : Guid.NewGuid();

            var bank = new Bank(id);
            bank.Name = bankImport.Name;
            bank.Code = bankImport.Code;
            bank.Description = bankImport.Description;

            return bank;
        }
 public SaleAndContextBuilder(Outlet outlet, CostCentre costCentre, User user, Sale sale, Bank bank, BankBranch bankBranch)
     : base(outlet, costCentre, user, sale, bank, bankBranch)
 {
 }
        private void ClearViewModel()
        {
            AccountFullName = "";
            AccountName = "";
            AccountNumber = "";
            PinNumber = "";
            CostCenterCode ="";

            SelectedBank = new Bank(Guid.Empty){Name="--Select Bank--"};
            SelectedBankBranch = new BankBranch(Guid.Empty) { Name = "--Select Bank Branch--" };
            SelectedCommoditySupplierType = CommoditySupplierType.Default;
            SelectedCommoditySupplierType = CommoditySupplierType.Individual;
            SelectedMaritalStatus = MaritalStatas.Default;
            SelectedMaritalStatus = MaritalStatas.Single;
            FarmCode = "";
            FarmName ="";
            Acerage = "";
            FarmRegistrationNo = "";
            FarmPhysicalAddress = "";
            FarmDescription = "";

            Surname = "";
            FirstName = "";
            MiddleName = "";
            OwnerCode = "";
            IdNumber = "";
            PinNumber = "";
            PhysicalAddress = "";
            PostalAddress = "";
            Email = "";
            PhoneNumber = "";
            BusinessNumber = "";
            FaxNumber = "";
            OfficeNumber = "";
            Description = "";
            DateOfBirth = DateTime.Now;

            AssignedCentresList.Clear();
            SupplierIsEnabled = true;
            SelectedCommodityOwnerType = new CommodityOwnerType(Guid.Empty){Name="--Select Commodity Type--"};
        }
 public BankDTO Map(Bank bank)
 {
     if (bank  == null) return null;
     return Mapper.Map<Bank, BankDTO>(bank);
 }
Beispiel #17
0
 public bool CheckBankIsUsed(Bank bank, EntityStatus intendedStatus)
 {
     if(intendedStatus == EntityStatus.Inactive)
     {
         if (_ctx.tblBankBranch.Any(n => n.BankId == bank.Id && n.IM_Status == (int)EntityStatus.Active))
             return true;
     }
     else if(intendedStatus == EntityStatus.Deleted)
     {
         if (_ctx.tblBankBranch.Any(n => n.BankId == bank.Id &&
             (n.IM_Status == (int)EntityStatus.Active || n.IM_Status == (int)EntityStatus.Inactive)))
             return true;
     }
     return false;
 }
Beispiel #18
0
        public void AddChequePayment(string chequeNumber, decimal amount, Bank bank, BankBranch bankBranch, DateTime dueDate)
        {            
            var payment = new Payment(Id)
            {
                PaymentMode = PaymentMode.Cheque,
                PaymentReference = string.Format("{0} - {1} - {2}", chequeNumber, bank.Code, bankBranch.Code),
                Amount = amount,
                Bank = bank.Code, 
                BankBranch = bankBranch.Code,
                PaymentStatus = PaymentStatus.New,
                DueDate = dueDate
            };

            Payments.Add(payment);
        }
        public HttpResponseMessage BankAdd(BankItem bankItem)
        {
            var response = new ResponseBool { Success = false };
            try
            {
                var bank = new Bank(bankItem.MasterId)
                {
                    Name = bankItem.Name,
                    Code = bankItem.Code,
                    Description = bankItem.Code,
                };
                 _bankRepository.Save(bank).ToString();//return id
                response.Success = true;
            }
            catch (Exception ex)
            {
                _log.Error("Failed to add bank", ex);//return error message
            }
            return Request.CreateResponse(HttpStatusCode.OK, response);

        }