コード例 #1
0
            public ActionResult Activate()
            {
            ViewBag.Title = "Активация счета. Автоматическая торговля на рынке форекс. Скачать советник бессплатно.";
            ViewData["emailValidator"] = @"/^(([^<>()[\]\\.,;:\s@\""]+(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/";

            if (!User.Identity.IsAuthenticated)
                return View("Index");

            var un = HttpContext.User.Identity.Name;
            var uID = UsersManager.GetUserIDByName(un);
            var accounts = AccountsManagement.GetAccountsOfUser(uID);

            foreach (var userAccount in accounts)
            {
                userAccount.StatusDescription = userAccount.Active ? "Активен"
                    : "В обработке";
            }

            var model = new ActivateAccountModel();
            model.BrokerID = 4;

            model.Accounts = accounts;
            return View(model);
            }
コード例 #2
0
            //[ValidateAntiForgeryToken(Salt = "Activate")]
            public ActionResult Activate(ActivateAccountModel model)
            {
            model.BrokerID = 4;
            ViewBag.Title = "Активация счета. Автоматическая торговля на рынке форекс. Скачать советник бессплатно.";
            AddEmailValidator();
            if (!User.Identity.IsAuthenticated)
                return View("Index");

            var un = HttpContext.User.Identity.Name;
            var uID = UsersManager.GetUserIDByName(un);
            if (ModelState.IsValid)
            {
                var accs = AccountsManagement.GetAccountsOfUser(uID);
                bool notNeededAddtion = accs.FindAll(a => a.AccountNumber == model.AccountNumber).Count > 0;
                ModelState.Clear();
                var accounts = AccountsManagement.GetAccountsOfUser(uID);
                if (!notNeededAddtion)
                {
                    var brokers = BrokersManagement.GetBrokers();
                    string brokerName = brokers.Where(b => b.ID == model.BrokerID).First().BrokerName;
                    AccountsManagement.CreateAccount(model.AccountNumber, uID, model.BrokerID);
                    accounts = AccountsManagement.GetAccountsOfUser(uID);
                    var userMail = Membership.GetUser(User.Identity.Name).Email;
                    SendActivatedMail(model.AccountNumber.ToString(), userMail, brokerName);
                }

                foreach (var userAccount in accounts)
                {
                    userAccount.StatusDescription = userAccount.Active
                                                        ? "Активен"
                                                        : "В обработке";
                }

                model = new ActivateAccountModel();
                model.Accounts = accounts;
            }
            return View(model);
            }
コード例 #3
0
            public ActionResult Withdraw()
            {
            AddEmailValidator();
            if (!User.Identity.IsAuthenticated)
                return View("Index");
            ViewBag.Title = "Снять средства";
            ViewData["PartnerCode"] = UsersManager.GetIdAsPartner(User.Identity.Name);

            var un = HttpContext.User.Identity.Name;
            var uID = UsersManager.GetUserIDByName(un);
            var accounts = AccountsManagement.GetAccountsOfUser(uID);

            foreach (var userAccount in accounts)
            {
                userAccount.StatusDescription = userAccount.Active ? "Активен"
                    : "В обработке";
            }

            var model = new ActivateAccountModel();
            model.BrokerID = 4;

            model.Accounts = accounts;
            //return View(model);
            return View();
            }