コード例 #1
0
        public bool userLogin([FromBody] UserCredentials logindetails)
        {
            var loginData            = logindetails;
            AccountManagement logobj = new AccountManagement();

            return(logobj.UserLogging(loginData));
        }
コード例 #2
0
        private void LoadTransactionDetails()
        {
            string accountToProcess = Request.QueryString["account_no"];

            dataClasses.transactionDetail[] transactionDetails = new AccountManagement().getAllTransactionsDetails("", accountToProcess);
            DataTable dataTableWithTransactionDetails          = new DataTable();

            dataTableWithTransactionDetails.Columns.Add("transaction_id");
            dataTableWithTransactionDetails.Columns.Add("transaction_date");
            dataTableWithTransactionDetails.Columns.Add("description");
            dataTableWithTransactionDetails.Columns.Add("transaction_mode");
            dataTableWithTransactionDetails.Columns.Add("transaction_amount");
            foreach (dataClasses.transactionDetail objTransactionDetails in transactionDetails)
            {
                //string accountBalanceAndCurrency = objUserAccount.accountBalance.ToString() + " " + objUserAccount.accountCurrency;
                dataTableWithTransactionDetails.Rows.Add(new object[5] {
                    objTransactionDetails.transactionID,
                    objTransactionDetails.transactionDate,
                    objTransactionDetails.transactionDescription,
                    objTransactionDetails.transactionMode,
                    objTransactionDetails.transactionAmount
                });
            }
            dg_AccountBal.DataSource = dataTableWithTransactionDetails;
            dg_AccountBal.DataBind();
        }
コード例 #3
0
        public ActionResult ChangePassword(ChangePasswordModel model)
        {
            if (ModelState.IsValid)
            {
                // ChangePassword will throw an exception rather
                // than return false in certain failure scenarios.
                bool changePasswordSucceeded;
                try
                {
                    var account = new AccountManagement();
                    changePasswordSucceeded = account.ChangePasswordForUser(User.Identity.Name, model.OldPassword, model.NewPassword);
                }
                catch (Exception)
                {
                    changePasswordSucceeded = false;
                }

                if (changePasswordSucceeded)
                {
                    return(RedirectToAction("ChangePasswordSuccess"));
                }
                else
                {
                    ModelState.AddModelError("", "The current password is incorrect or the new password is invalid.");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
コード例 #4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID != 1)
            {
                return;
            }

            string email = AccountManagement.GetEMail(m_Account);

            if (email == null)
            {
                email = "-null-";
            }

            AuthKey ak = AccountManagement.MakeKey(m_Account, AuthType.EMail, null);

            m_Mobile.SendMessage("An e-mail has been dispatched to {0} with detailed instructions on how to finalize your request.", email);
            m_Mobile.SendMessage("Your request will expire in {0} hours.", AuthKey.KeyExpire.Hours);

            //MailMessage mm = new MailMessage( "UOGamers Account Manager <*****@*****.**>", email );
            MailMessage mm = new MailMessage();

            mm.From    = "UOGamers Account Manager <*****@*****.**>";
            mm.To      = email;
            mm.Subject = "UOGamers Account Management";
            mm.Body    = String.Format(
                "{0},\n\tYou have requested to release this e-mail address from your account. To finalize this request, you must enter the following string (while in game) exactly as it appears.\n\n[auth {1}\n\nThis key will expire at {2}. If you have any questions, comments, suggestions, or require assistance, please do not hesitate to page or visit our forums at http://www.uogamers.com/forum\n\n\tThank you,\n\t\tThe UOGamers Administration Team\n\t\thttp://www.uogamers.com\n\n\nThis message is not spam. This request was initiated by {3}. If you feel you received this message in error, please disregard it.", m_Mobile.Name, ak.Key, ak.Expiration, state.ToString());

            Email.AsyncSend(mm);
        }
コード例 #5
0
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                var account = new AccountManagement();
                if (account.ValidateUser(model.UserName, model.Password))
                {
                    //migrate cart if exists
                    _cartService.StartCart(this.HttpContext).MigrateCart(model.UserName);

                    account.Authorize(model.UserName, model.RememberMe);
                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                        !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "The user name or password provided is incorrect.");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
コード例 #6
0
        // GET: api/Account/5
        public IHttpActionResult Get(int id)
        {
            try
            {
                var accMng = new AccountManagement();

                var account = new Account
                {
                    AccountId = id
                };

                account = accMng.RetrieveById(account);

                apiResponse = new ApiResponse();

                apiResponse.Data = account;


                return(Ok(apiResponse));
            }
            catch (BusinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "--" + bex.AppMessage.Message)));
            }
        }
コード例 #7
0
        public ActionResult Index(int?page, string searchKey, string keyType)
        {
            int pageSize = 3;

            if (string.IsNullOrEmpty(searchKey))
            {
                var data              = (_accountData == null || _accountData.Count == 0) ? ReadExcelData() : _accountData;
                int pageNumber        = (page ?? 1);
                var accountManagement = new AccountManagement()
                {
                    AccountManagementModel = data.ToPagedList(pageNumber, pageSize),
                };
                return(View(accountManagement));
            }
            else
            {
                var accountData = new List <AccountManagementViewModel>();
                ViewBag.CurrentFilter = searchKey;
                int pageNumber;
                GetAccounts(searchKey, keyType, page, out accountData, out pageSize, out pageNumber);
                var accountManagement = new AccountManagement()
                {
                    AccountManagementModel = accountData.ToPagedList(pageNumber, pageSize),
                    IsAccount     = (keyType == "Account") ? true : false,
                    IsBAName      = (keyType == "BAName") ? true : false,
                    IsCustomer    = (keyType == "Customer") ? true : false,
                    IsProjectName = (keyType == "ProjectName") ? true : false,
                    IsTechStack   = (keyType == "TechStack") ? true : false,
                    SearchKey     = searchKey
                };
                return(View(accountManagement));
            }
        }
コード例 #8
0
        public ActionResult LogOff()
        {
            var account = new AccountManagement();

            account.SignOff();

            return(RedirectToAction("Index", "Home"));
        }
コード例 #9
0
        protected void AddPasswordsBtn_Click(object sender, EventArgs e)
        {
            CSV newUsers = new CSV(NewUsersUpload.FileContent);

            AccountManagement.GeneratePasswords(ref newUsers);
            newUsers.Save(Server.MapPath("~/Temp/newUsersPwd.csv"));
            Response.Redirect("~/Temp/newUsersPwd.csv");
        }
コード例 #10
0
        private void Button_Account_Login(object sender, RoutedEventArgs e)
        {
            var am = new AccountManagement();

            am.Show();
            am.Topmost = true;
            am.Topmost = false;
        }
コード例 #11
0
        public void DoesUserExists_RightInput_ExpectDarthMaul()
        {
            ConnectionString = "Insert connection string here.";
            var user           = APICollector.ParseUserAsync("Darth Maul");
            var expectedResult = AccountManagement.Exists(user);

            Assert.True(expectedResult);
        }
コード例 #12
0
        public ActionResult Index()
        {
            _context2 = new ApplicationDbContext();
            var UserRoles  = _context2.Database.SqlQuery <AMLViewModel>(AccountManagement.GetUserList());
            var Conversion = UserRoles.ToList();

            return(View(Conversion));
        }
コード例 #13
0
        public void Test_GetBanTimeoutDuration_IsValidDuration(int failsCount, int expectedDurationToShow)
        {
            var valueToTest = failsCount;

            var result = AccountManagement.GetBanTimeoutDuration(valueToTest);

            Assert.AreEqual(expectedDurationToShow, result);
        }
コード例 #14
0
 public ProjectController()
 {
     this.pm        = new ProjectManagement();
     this.cm        = new CompentenceManagement();
     this.categoryM = new CategoryManagement();
     this.tk        = new TaskManagement();
     this.am        = new AccountManagement();
 }
コード例 #15
0
ファイル: AccountController.cs プロジェクト: 008PM/MyMusixAPI
        public bool AddUser([FromBody] RegisterRequest userDetailsRequest)
        {
            var RegistrationData = userDetailsRequest;

            AccountManagement regobj = new AccountManagement();


            return(regobj.UserRegistration(RegistrationData));
        }
コード例 #16
0
        protected override void OnActionExecuting(ActionExecutingContext ctx)
        {
            base.OnActionExecuting(ctx);
            _cartService.StartCart(ctx.HttpContext);

            var account = new AccountManagement();

            ViewBag.UserRole = account.IsInRole(User.Identity.Name, "Customer") ? "Customer" : "none";
        }
コード例 #17
0
ファイル: AccountController.cs プロジェクト: 008PM/MyMusixAPI
        //------------------->>>To be changed soon<<-------------//
        public bool UserLogin([FromBody] LoginRequest logindetails)
        {
            var loginData = logindetails;

            AccountManagement logobj = new AccountManagement();


            return(logobj.UserLogging(loginData));
        }
コード例 #18
0
        public void Account_AddNewAdminUser_ValidData()
        {
            // creates a toggle for the given test, adds all log events under it
            test = extent.StartTest("Add Admin user using Valid Data");
            // Creating an instance
            AccountManagement obj = new AccountManagement();

            // method for adding admin user with valid data
            obj.AddAdminUser();
        }
コード例 #19
0
        public async Task <ActionResult <AccountManagement> > Update([FromBody] AccountManagement _AccountManagement)
        {
            AccountManagement _AccountManagementq = _AccountManagement;

            try
            {
                using (var transaction = _context.Database.BeginTransaction())
                {
                    try
                    {
                        _AccountManagementq = await(from c in _context.AccountManagement
                                                    .Where(q => q.AccountManagementId == _AccountManagement.AccountManagementId)
                                                    select c
                                                    ).FirstOrDefaultAsync();

                        _context.Entry(_AccountManagementq).CurrentValues.SetValues((_AccountManagement));

                        await _context.SaveChangesAsync();

                        BitacoraWrite _write = new BitacoraWrite(_context, new Bitacora
                        {
                            IdOperacion  = _AccountManagementq.AccountManagementId,
                            DocType      = "AccountManagement",
                            ClaseInicial =
                                Newtonsoft.Json.JsonConvert.SerializeObject(_AccountManagementq, new JsonSerializerSettings {
                                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                            }),
                            Accion              = "Actualizar",
                            FechaCreacion       = DateTime.Now,
                            FechaModificacion   = DateTime.Now,
                            UsuarioCreacion     = _AccountManagementq.UsuarioCreacion,
                            UsuarioModificacion = _AccountManagementq.UsuarioModificacion,
                            UsuarioEjecucion    = _AccountManagementq.UsuarioModificacion,
                        });

                        await _context.SaveChangesAsync();

                        transaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }

            return(await Task.Run(() => Ok(_AccountManagementq)));
        }
コード例 #20
0
        public ActionResult ChangePassword(FormCollection Fields)
        {
            //declare Form values
            string oldPassword    = Fields["oldPassword"];
            string newPassword    = Fields["newPassword"];
            string re_newPassword = Fields["re_newPassword"];
            string user           = (string)Session["username"];

            AccountManagement am = new AccountManagement();

            //check conditions to change password
            if (oldPassword == null || newPassword == null || re_newPassword == null)
            {
                return(View());
            }
            else if (oldPassword.Equals("") || newPassword.Equals("") || re_newPassword.Equals(""))
            {
                //send error message
                ModelState.AddModelError("", "Any fields can not be blank!!!!");
                return(View());
            }
            else if (!am.isOldPassword(user, oldPassword))
            {
                //send error message
                ModelState.AddModelError("", "The old password is not correct!!!!");
                return(View());
            }
            else if (!ValidationFormat.isPasswordFormat(newPassword))
            {
                //send error message
                ModelState.AddModelError("", "Password must be between 4 to 20 characters!!!!");
                return(View());
            }
            else
            {
                if (!newPassword.Equals(re_newPassword))
                {
                    //send error message
                    ModelState.AddModelError("", "Confirm password is not same with new password!!!!");
                    return(View());
                }
                else
                {
                    //send error message
                    //ModelState.AddModelError("", "Change successfull");
                    //return View();
                    //change password
                    am.ChangePassword(user, newPassword);
                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(View());
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: Fruity-Grebbles/webhost
 static void Main()
 {
     using (WebhostEntities db = new WebhostEntities())
     {
         foreach (Student student in db.Students.Where(s => s.isActive).ToList())
         {
             AccountManagement.VerifyADUserAccountDirectories(student.UserName);
         }
     }
     Console.WriteLine("Done!");
     Console.ReadKey();
 }
コード例 #22
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID != 1)
            {
                return;
            }

            TextRelay emailEntry   = info.GetTextEntry(0);
            TextRelay confirmEntry = info.GetTextEntry(1);

            string email   = (emailEntry == null ? null : emailEntry.Text.Trim());
            string confirm = (confirmEntry == null ? null : confirmEntry.Text.Trim());

            if (email == null || email.Length == 0)
            {
                m_Mobile.SendMessage("Registration cancelled.");
            }
            else if (email != confirm)
            {
                m_Mobile.SendMessage("You must confirm your e-mail address entry. Both fields must match exactly. Try again.");
                m_Mobile.SendGump(new LinkAddressGump(m_Mobile, m_Account));
            }

            /*else if ( !Email..IsValid( email ) )
             * {
             *      m_Mobile.SendMessage( "You have specified an invalid e-mail address. Verify the address and try again." );
             *      m_Mobile.SendGump( new LinkAddressGump( m_Mobile, m_Account ) );
             * }*/
            else
            {
                try
                {
                    AuthKey ak = AccountManagement.MakeKey(m_Account, AuthType.Register, email);
                    m_Mobile.SendMessage("An e-mail has been dispatched to {0} with detailed instructions on how to finalize your registration.", email);
                    m_Mobile.SendMessage("Your registration request will expire in {0} hours.", AuthKey.KeyExpire.Hours);

                    //MailMessage mm = new MailMessage( "UOGamers Account Manager <*****@*****.**>", email );
                    MailMessage mm = new MailMessage();
                    mm.From    = "UOGamers Account Manager <*****@*****.**>";
                    mm.To      = email;
                    mm.Subject = "UOGamers Account Management";
                    mm.Body    = String.Format(
                        "{0},\n\tThank you for registering this e-mail address with your UOGamers account. This will allow you to change your password (among other things) securely without Game Master assistance. To finalize your registration, you must enter the following string (while in game) exactly as it appears.\n\n[auth {1}\n\nThis key will expire at {2}. If you have any questions, comments, suggestions, or require assistance, please do not hesitate to page or visit our forums at http://www.uogamers.com/forum\n\n\tThank you,\n\t\tThe UOGamers Administration Team\n\t\thttp://www.uogamers.com\n\n\nThis message is not spam. This registration request was initiated by {3}. If you feel you received this message in error, please disregard it.", m_Mobile.Name, ak.Key, ak.Expiration, state.ToString());

                    Email.AsyncSend(mm);
                }
                catch
                {
                    m_Mobile.SendMessage("There was an error, please try again in a few hours.");
                }
            }
        }
コード例 #23
0
ファイル: UserRepository.cs プロジェクト: rgavrilov/thcard
 public void SaveUser(AccountManagement.User user)
 {
     Contract.Requires(user != null && !user.Id.IsNew);
     using (var db = new THCard()) {
         using (var transaction = new TransactionScope()) {
             User dbUser = db.Users.Find(user.Id.ToGuid());
             dbUser.FirstName = user.FullName.FirstName.ToString();
             dbUser.MiddleName = user.FullName.MiddleName.ToString();
             dbUser.LastName = user.FullName.FamilyName.ToString();
             db.SaveChanges();
             transaction.Complete();
         }
     }
 }
コード例 #24
0
ファイル: UserRepository.cs プロジェクト: rgavrilov/thcard
 public void CreateUser(AccountManagement.User user)
 {
     Contract.Requires(user != null && user.Id.IsNew);
     using (var db = new THCard()) {
         using (var transaction = new TransactionScope()) {
             var dbUser = new User();
             dbUser.FirstName = user.FullName.FirstName.ToString();
             dbUser.MiddleName = user.FullName.MiddleName.ToString();
             dbUser.LastName = user.FullName.FamilyName.ToString();
             db.Users.Add(dbUser);
             db.SaveChanges();
             transaction.Complete();
             user.Id = new UserId(dbUser.UserId);
         }
     }
 }
コード例 #25
0
 private void GetAccounts()
 {
     dataClasses.userAccount[] userAccountDetails = new AccountManagement().getAllUserAccountDetails("",(string)Session["userID"].ToString());
     DataTable dataTableWithAccountDetails = new DataTable();
     dataTableWithAccountDetails.Columns.Add("account_no");
     dataTableWithAccountDetails.Columns.Add("branch");
     dataTableWithAccountDetails.Columns.Add("account_type");
     dataTableWithAccountDetails.Columns.Add("account_balance");
     foreach (dataClasses.userAccount objUserAccount in userAccountDetails)
     {
         string accountBalanceAndCurrency = objUserAccount.accountBalance.ToString() + " " + objUserAccount.accountCurrency;
         dataTableWithAccountDetails.Rows.Add(new object[4] {objUserAccount.accountID,objUserAccount.accountBranch,objUserAccount.accountType,accountBalanceAndCurrency});
     }
     dgAccountDetails.DataSource = dataTableWithAccountDetails;
     dgAccountDetails.DataBind();
 }
コード例 #26
0
        // PUT: api/Account/5
        public IHttpActionResult Put(Account account)
        {
            try
            {
                var accMng = new AccountManagement();

                accMng.Update(account);

                apiResponse.Message = "Account updated";

                return(Ok(apiResponse));
            }
            catch (BusinessException bex)
            {
                return(InternalServerError(new Exception(bex.ExceptionId + "--" + bex.AppMessage.Message)));
            }
        }
コード例 #27
0
        public async Task <IActionResult> GetSAccountManagementById(Int64 AccountManagementId)
        {
            AccountManagement Items = new AccountManagement();

            try
            {
                Items = await _context.AccountManagement.Where(q => q.AccountManagementId == AccountManagementId).FirstOrDefaultAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                return(BadRequest($"Ocurrio un error:{ex.Message}"));
            }


            return(await Task.Run(() => Ok(Items)));
        }
コード例 #28
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID != 1)
            {
                return;
            }

            TextRelay pwEntry      = info.GetTextEntry(0);
            TextRelay confirmEntry = info.GetTextEntry(1);

            string pw      = (pwEntry == null ? null : pwEntry.Text.Trim());
            string confirm = (confirmEntry == null ? null : confirmEntry.Text.Trim());

            if (pw == null || pw.Length == 0)
            {
                m_Mobile.SendMessage("Password change cancelled.");
            }
            else if (pw != confirm)
            {
                m_Mobile.SendMessage("You must confirm your password entry. Both fields must match exactly. Try again.");
                m_Mobile.SendGump(new ChangePasswordGump(m_Mobile, m_Account));
            }
            else
            {
                string email = AccountManagement.GetEMail(m_Account);
                if (email == null)
                {
                    email = "-null-";
                }

                AuthKey ak = AccountManagement.MakeKey(m_Account, AuthType.Password, pw);
                m_Mobile.SendMessage("An e-mail has been dispatched to {0} with detailed instructions on how to finalize your request.", email);
                m_Mobile.SendMessage("Your request will expire in {0} hours.", AuthKey.KeyExpire.Hours);

                //MailMessage mm = new MailMessage( "UOGamers Account Manager <*****@*****.**>", email );
                MailMessage mm = new MailMessage();
                mm.From    = "UOGamers Account Manager <*****@*****.**>";
                mm.To      = email;
                mm.Subject = "UOGamers Account Management";
                mm.Body    = String.Format(
                    "{0},\n\tYou have requested to change the password for account '{1}' to '{2}'. To finalize your request, you must enter the following string (while in game) exactly as it appears.\n\n[auth {3}\n\nThis key will expire at {4}. If you have any questions, comments, suggestions, or require assistance, please do not hesitate to page or visit our forums at http://www.uogamers.com/forum\n\n\tThank you,\n\t\tThe UOGamers Administration Team\n\t\thttp://www.uogamers.com\n\n\nThis message is not spam. This request was initiated by {5}. If you feel you received this message in error, please disregard it.", m_Mobile.Name, m_Account, pw, ak.Key, ak.Expiration, state.ToString());

                Email.AsyncSend(mm);
            }
        }
コード例 #29
0
        public ActionResult Details(ApplicationUser Incoming)
        {
            ModelState.Clear(); //To clear all of the warning messages.

            _context2 = new ApplicationDbContext();

            //var UserDetails = _context2.Users.SingleOrDefault(m => m.Id == Incoming.Id);

            var UserDetails = _context2.Database.SqlQuery <AMLViewModel>(AccountManagement.GetSingleUser(Incoming.Id));
            var Test        = UserDetails.ToList();

            if (UserDetails == null)
            {
                return(HttpNotFound());
            }

            return(View(UserDetails));
        }
コード例 #30
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID != 1)
            {
                return;
            }

            if (LogRequested[m_Account] != null)
            {
                m_Mobile.SendMessage("Sorry, you may only use this option once per day.");
                return;
            }

            string email = AccountManagement.GetEMail(m_Account);

            if (email == null)
            {
                email = "-null-";
            }

            m_Mobile.SendMessage("An e-mail has been dispatched to {0} with a listing of all IP addresses that have accessed this account.", email);

            StringBuilder sb = new StringBuilder(m_Account.LoginIPs.Length);

            for (int i = 0; i < m_Account.LoginIPs.Length; i++)
            {
                IPAddress ip = m_Account.LoginIPs[i];
                sb.Append(String.Format("- {0}\n", ip.ToString()));
            }

            //MailMessage mm = new MailMessage( "UOGamers Account Manager <*****@*****.**>", email );
            MailMessage mm = new MailMessage();

            mm.From    = "UOGamers Account Manager <*****@*****.**>";
            mm.To      = email;
            mm.Subject = "UOGamers Account Management";
            mm.Body    = String.Format(
                "{0},\n\tAs you requested, the following is a listing of all IP addresses that have accessed your account.\n\n{1}\n\nIf you have any questions, comments, suggestions, or require assistance, please do not hesitate to page or visit our forums at http://www.uogamers.com/forum\n\n\tThank you,\n\t\tThe UOGamers Administration Team\n\t\thttp://www.uogamers.com\n\n\nThis message is not spam. This request was initiated by {2}. If you feel you received this message in error, please disregard it.", m_Mobile.Name, sb.ToString(), state.ToString());

            Email.AsyncSend(mm);

            LogRequested[m_Account] = 1;
        }
コード例 #31
0
        private void GetAccounts()
        {
            dataClasses.userAccount[] userAccountDetails = new AccountManagement().getAllUserAccountDetails("", (string)Session["userID"].ToString());
            DataTable dataTableWithAccountDetails        = new DataTable();

            dataTableWithAccountDetails.Columns.Add("account_no");
            dataTableWithAccountDetails.Columns.Add("branch");
            dataTableWithAccountDetails.Columns.Add("account_type");
            dataTableWithAccountDetails.Columns.Add("account_balance");
            foreach (dataClasses.userAccount objUserAccount in userAccountDetails)
            {
                string accountBalanceAndCurrency = objUserAccount.accountBalance.ToString() + " " + objUserAccount.accountCurrency;
                dataTableWithAccountDetails.Rows.Add(new object[4] {
                    objUserAccount.accountID, objUserAccount.accountBranch, objUserAccount.accountType, accountBalanceAndCurrency
                });
            }
            dgAccountDetails.DataSource = dataTableWithAccountDetails;
            dgAccountDetails.DataBind();
        }
コード例 #32
0
        public void DisableAccount_IAmSheriff_ThrowsException()
        {
            Mock <IDatabaseContext> fakeContext = new Mock <IDatabaseContext>();
            var group = new AccountGroup
            {
                Id = 1
            };
            var me = new Person()
            {
            };
            var join = me.AddToGroup(group, 10);

            join.PermissionLevel = PermissionLevel.SuperAdmin;
            fakeContext.Setup(x => x.List <Person>()).Returns(new[] { me }.AsQueryable());
            var management = new AccountManagement(fakeContext.Object, me.Id);

            //this is to satisfy the idea that you have to demote yourself efore you can give up
            management.DisableMyAccount(1);
        }
コード例 #33
0
ファイル: AccountRepository.cs プロジェクト: rgavrilov/thcard
 public void CreateAccount(AccountManagement.Account account, SaltedHash passwordHash, UserId userId)
 {
     Contract.Assert(account.AccountId.IsNew);
     using (var db = new THCard()) {
         using (var transaction = new TransactionScope()) {
             var dbAccount = new Account {
                 Username = account.Username.ToString(),
                 UserId = userId.ToGuid(),
                 AccountPassword = new AccountPassword {
                     PasswordHash = passwordHash.Hash,
                     Salt = passwordHash.Salt
                 }
             };
             db.Accounts.Add(dbAccount);
             db.SaveChanges();
             transaction.Complete();
             account.AccountId = new AccountId(dbAccount.AccountId);
         }
     }
 }
コード例 #34
0
        public ActionResult Login(Account model)
        {
            if (ModelState.IsValid)
            {
                AccountManagement am = new AccountManagement();
                //Check user enter username & password is correct or not
                int result = am.Login(model.ac_userName, Encryptor.SHA256_Encrypt(model.ac_pwd));

                //If is correct => get account and create session for that account
                if (result == 1)
                {
                    //Get the Account based on username has been inputted
                    var account = am.getAccountByID(model.ac_userName);

                    //Initialize User Management
                    UserManagement um = new UserManagement();
                    //Get User by Account ID
                    var user = um.getUserByAccountID(account.ac_id);
                    //Create Session to store username and ID of user
                    Session["username"]  = account.ac_userName;
                    Session["userLogin"] = user;

                    //Redirect to action "Index" on "AccountsControllers"
                    return(RedirectToAction("Index", "Home"));
                }
                else if (result == -1)  //Account is not exist
                {
                    ModelState.AddModelError("", "The username is not exist!!!");
                }
                else if (result == -2)  //Password is not correct
                {
                    ModelState.AddModelError("", "Password is not correct!!!");
                }
                else if (result == 0)    //Account has been banned
                {
                    ModelState.AddModelError("", "The username has been banned!!!");
                }
            }
            return(View("Index"));
        }
コード例 #35
0
 private void LoadTransactionDetails()
 {
     string accountToProcess = Request.QueryString["account_no"];
     dataClasses.transactionDetail[] transactionDetails = new AccountManagement().getAllTransactionsDetails("",accountToProcess);
     DataTable dataTableWithTransactionDetails = new DataTable();
     dataTableWithTransactionDetails.Columns.Add("transaction_id");
     dataTableWithTransactionDetails.Columns.Add("transaction_date");
     dataTableWithTransactionDetails.Columns.Add("description");
     dataTableWithTransactionDetails.Columns.Add("transaction_mode");
     dataTableWithTransactionDetails.Columns.Add("transaction_amount");
     foreach (dataClasses.transactionDetail objTransactionDetails in transactionDetails)
     {
         //string accountBalanceAndCurrency = objUserAccount.accountBalance.ToString() + " " + objUserAccount.accountCurrency;
         dataTableWithTransactionDetails.Rows.Add(new object[5] {   objTransactionDetails.transactionID,
                                                                    objTransactionDetails.transactionDate,
                                                                    objTransactionDetails.transactionDescription,
                                                                    objTransactionDetails.transactionMode,
                                                                    objTransactionDetails.transactionAmount});
     }
     dg_AccountBal.DataSource = dataTableWithTransactionDetails;
     dg_AccountBal.DataBind();
 }
コード例 #36
0
 public AuthenticatedLoginControlViewModel Authenticated(AccountManagement.Account account)
 {
     User user = _userRepository.GetUser(account.AccountId);
     var viewModel = new AuthenticatedLoginControlViewModel(user.FullName, _siteMap.GetLandingPage(account));
     return viewModel;
 }
コード例 #37
0
ファイル: AccountRepository.cs プロジェクト: rgavrilov/thcard
 public void SaveAccount(AccountManagement.Account account)
 {
     throw new NotImplementedException();
 }
コード例 #38
0
        public void shoot(AccountManagement.UserAccount user, GameWindow.GamePanel.Field field)
        {
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (DispatcherOperationCallback)delegate(object arg)
            {
                Log.Text += "shoot\n";
				LogScrollBar.ScrollToBottom();
                gameWindow.shoot(user, field);
                return null;
            }, null);
        }