コード例 #1
0
        public JsonResult AddInvestor(FrontInvestorModel investor, FrontInvestorContactModel investorContact, List <FrontInvestorBankAccountModel> InvestorBank, bool SameBank)
        {
            if (SameBank)
            {
                var bank = InvestorBank.First();

                var repaymentsBank = new FrontInvestorBankAccountModel {
                    IsActive          = true,
                    AccountType       = (int)I_InvestorAccountTypeEnum.Repayments,
                    BankAccountName   = bank.BankAccountName,
                    BankAccountNumber = bank.BankAccountNumber,
                    BankSortCode      = bank.BankSortCode
                };

                InvestorBank.Add(repaymentsBank);
            }

            var result = this.serviceClient.Instance.CreateInvestor(this.context.UserId,
                                                                    new Ezbob.Backend.Models.Investor.InvestorModel {
                InvestorType = new Ezbob.Backend.Models.Investor.InvestorTypeModel {
                    InvestorTypeID = investor.InvestorType
                },
                Name = investor.CompanyName,
                FundingLimitForNotification = investor.FundingLimitForNotification,
                MonthlyFundingCapital       = investor.MonthlyFundingCapital,
                FundsTransferDate           = investor.FundsTransferDate
            },
                                                                    new[] {
                new Ezbob.Backend.Models.Investor.InvestorContactModel {
                    Comment      = investorContact.Comment,
                    Email        = investorContact.ContactEmail,
                    IsPrimary    = true,
                    LastName     = investorContact.ContactLastName,
                    PersonalName = investorContact.ContactPersonalName,
                    Mobile       = investorContact.ContactMobile,
                    OfficePhone  = investorContact.ContactOfficeNumber,
                    Role         = investorContact.Role,
                }
            },
                                                                    InvestorBank.Select(x => new Ezbob.Backend.Models.Investor.InvestorBankAccountModel {
                BankAccountName   = x.BankAccountName,
                BankAccountNumber = x.BankAccountNumber,
                BankCode          = x.BankSortCode,
                AccountType       = new InvestorAccountTypeModel {
                    InvestorAccountTypeID = x.AccountType
                }
            }).ToArray());

            return(Json(new {
                success = true,
                InvestorID = result.Value,
                investor,
                investorContact,
                InvestorBank,
                SameBank
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult ManageInvestorDetails(int InvestorID, FrontInvestorModel investorDetails)
        {
            DateTime now = DateTime.UtcNow;

            Log.Debug("investor funding limit string " + investorDetails.FundingLimitForNotification);
            var result = this.serviceClient.Instance.ManageInvestorDetails(this.context.UserId,
                                                                           new Ezbob.Backend.Models.Investor.InvestorModel {
                InvestorID = InvestorID,
                IsActive   = investorDetails.IsActive,
                Name       = investorDetails.CompanyName,
                FundingLimitForNotification = investorDetails.FundingLimitForNotification,
                InvestorType = new Ezbob.Backend.Models.Investor.InvestorTypeModel {
                    InvestorTypeID = investorDetails.InvestorType
                },
                Timestamp = now,
                Contacts  = null,
                Banks     = null
            });

            return(Json(new { InvestorID, investorDetails, success = result.Value }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public InvestorModel Build(Ezbob.Backend.Models.Investor.InvestorModel investor)
        {
            var model = new InvestorModel {
                InvestorID      = investor.InvestorID,
                IsActive        = investor.IsActive,
                CompanyName     = investor.Name,
                InvestorType    = investor.InvestorType.InvestorTypeID,
                InvestorTypeStr = investor.InvestorType.Name,
                Timestamp       = investor.Timestamp,
                Contacts        = investor.Contacts.Select(x => new InvestorContactModel {
                    IsActive            = x.IsActive,
                    IsPrimary           = x.IsPrimary,
                    IsGettingAlerts     = x.IsGettingAlerts,
                    IsGettingReports    = x.IsGettingReports,
                    Role                = x.Role,
                    InvestorContactID   = x.InvestorContactID,
                    Comment             = x.Comment,
                    ContactPersonalName = x.PersonalName,
                    ContactEmail        = x.Email,
                    ContactLastName     = x.LastName,
                    ContactMobile       = x.Mobile,
                    ContactOfficeNumber = x.OfficePhone,
                    TimeStamp           = x.Timestamp
                }),
                Banks = investor.Banks.Select(x => new InvestorBankAccountModel {
                    IsActive = x.IsActive,
                    InvestorBankAccountID = x.InvestorBankAccountID,
                    BankAccountNumber     = x.BankAccountNumber,
                    BankAccountName       = x.BankAccountName,
                    AccountType           = x.AccountType.InvestorAccountTypeID,
                    AccountTypeStr        = x.AccountType.Name,
                    BankSortCode          = x.BankCode,
                    TimeStamp             = x.Timestamp
                })
            };

            return(model);
        }