public SaveResult Create(InvestorAccounts investor, int userId, string userName)
        {
            if (CheckNameExt(investor.Username))
            {
                return(new SaveResult(false, "This username already exists!"));
            }

            int id = FiiiPayDB.InvestorAccountDb.InsertReturnIdentity(investor);

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create Investor " + id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);


            return(new SaveResult(true));
        }
Exemple #2
0
        public ActionResult SavePIN(int InvestorId, string newPIN)
        {
            InvestorAccountBLL ab       = new InvestorAccountBLL();
            InvestorAccounts   investor = FiiiPayDB.InvestorAccountDb.GetById(InvestorId);

            investor.PIN = PasswordHasher.HashPassword(newPIN);
            return(Json(ab.UpdatePIN(investor, UserId, UserName).toJson()));
        }
Exemple #3
0
        public ActionResult Deposit(string Type, int InvestorId, decimal Balance)
        {
            ViewBag.Type    = Type;
            ViewBag.Balance = Balance;
            InvestorAccounts investor = new InvestorAccounts();

            investor = FiiiPayDB.InvestorAccountDb.GetById(InvestorId);
            return(PartialView(investor));
        }
Exemple #4
0
        private SaveResult SaveCreate(InvestorAccounts oInvestor)
        {
            InvestorAccountBLL ab = new InvestorAccountBLL();

            oInvestor.RegistrationDate = DateTime.UtcNow;
            oInvestor.PIN      = PasswordHasher.HashPassword(oInvestor.PIN);
            oInvestor.Password = PasswordHasher.HashPassword(oInvestor.Password);
            oInvestor.Balance  = 0;
            return(ab.Create(oInvestor, UserId, UserName));
        }
Exemple #5
0
 public ActionResult Save(InvestorAccounts oInvestor)
 {
     if (oInvestor.Id > 0)//编辑
     {
         return(Json(SaveEdit(oInvestor).toJson()));
     }
     else//新增
     {
         return(Json(SaveCreate(oInvestor).toJson()));
     }
 }
Exemple #6
0
        private SaveResult SaveDeposit(InvestorWalletStatements oStatement)
        {
            InvestorAccounts investor = FiiiPayDB.InvestorAccountDb.GetById(oStatement.InvestorId);
            decimal          balance  = investor.Balance + oStatement.Amount;

            investor.Balance   = balance;
            oStatement.Balance = balance;

            InvestorWalletStatementBLL ab = new InvestorWalletStatementBLL();

            return(ab.Create(oStatement, investor, UserId, UserName));
        }
Exemple #7
0
        private SaveResult SaveWithhold(InvestorWalletStatements oStatement)
        {
            InvestorAccounts investor = FiiiPayDB.InvestorAccountDb.GetById(oStatement.InvestorId);
            decimal          balance  = investor.Balance - oStatement.Amount;

            if (balance < 0)
            {
                return(new SaveResult(false, "Amount cannot greater than balance"));
            }
            investor.Balance   = balance;
            oStatement.Balance = balance;

            InvestorWalletStatementBLL ab = new InvestorWalletStatementBLL();

            return(ab.Create(oStatement, investor, UserId, UserName));
        }
Exemple #8
0
        public SaveResult Create(InvestorWalletStatements statement, InvestorAccounts investor, int userId, string userName)
        {
            statement.Id = Guid.NewGuid();
            FiiiPayDB.InvestorAccountDb.Update(investor);
            int id = FiiiPayDB.InvestorWalletStatementDb.InsertReturnIdentity(statement);
            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Create";
            actionLog.Username   = userName;
            actionLog.LogContent = "Create InvestorWalletStatement " + id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);
            return(new SaveResult(true));
        }
        public SaveResult UpdatePIN(InvestorAccounts investor, int userId, string userName)
        {
            InvestorAccounts oldInvestor = FiiiPayDB.InvestorAccountDb.GetById(investor.Id);

            oldInvestor.PIN = investor.PIN;

            // Create ActionLog
            ActionLog actionLog = new ActionLog();

            actionLog.IPAddress  = GetClientIPAddress();
            actionLog.AccountId  = userId;
            actionLog.CreateTime = DateTime.UtcNow;
            actionLog.ModuleCode = typeof(AccountBLL).FullName + ".UpdatePIN";
            actionLog.Username   = userName;
            actionLog.LogContent = "Update Investor PIN " + investor.Id;
            ActionLogBLL ab = new ActionLogBLL();

            ab.Create(actionLog);

            return(new SaveResult(FiiiPayDB.InvestorAccountDb.Update(oldInvestor)));
        }
Exemple #10
0
        public ActionResult Edit(int InvestorId)
        {
            List <SelectListItem> statusList = new List <SelectListItem>();

            statusList.Add(new SelectListItem()
            {
                Text = "Active", Value = "1", Selected = true
            });
            statusList.Add(new SelectListItem()
            {
                Text = "Locked", Value = "0"
            });
            ViewBag.StatusList = statusList;

            InvestorAccounts investor = new InvestorAccounts();

            investor.Id = -1;
            if (InvestorId > 0)
            {
                investor = FiiiPayDB.InvestorAccountDb.GetById(InvestorId);
            }
            return(PartialView(investor));
        }
Exemple #11
0
        public ActionResult ResetPIN(int InvestorId)
        {
            InvestorAccounts investor = FiiiPayDB.InvestorAccountDb.GetById(InvestorId);

            return(PartialView(investor));
        }
Exemple #12
0
        private SaveResult SaveEdit(InvestorAccounts oInvestor)
        {
            InvestorAccountBLL ab = new InvestorAccountBLL();

            return(ab.Update(oInvestor, UserId, UserName));
        }
        public bool CheckNameExt(string userName)
        {
            InvestorAccounts account = FiiiPayDB.DB.Queryable <InvestorAccounts>().Where(t => t.Username == userName).First();

            return(account != null);
        }