public ActionResult Profile()
        {
            string IdLogin = User.Identity.Name;
            var check = StoreDb.Webmasters.Single(m=>m.Username == IdLogin);
            int accType = int.Parse(check.AccountType.ToString());

            var country = StoreDb.Parameters.Single(s=>s.Name == "Country");

            if (accType == 0) // personal account
            {
                RegisterModel model = new RegisterModel() { 
                UserName = check.Username,
                FirstName = check.FirstName,
                LastName = check.LastName,
                Email = check.Email,
                Phone = check.Phone,
                City = check.City,
                ATM = check.ATM,
                Bank = check.Bank,
                Address1 = check.Address1,
                Address2 = check.Address2,
                State = check.State,
                Country = country.Value,
                ZipCode = check.ZipCode,
                AccountType =accType,
             };
             TransactionLogViewModel.AddLog(IdLogin + " view the profile!", DateTime.Now);
             ViewData["Country"] = country.Value;

            return View(model);
            }
            else { // bussiness account

                RegisterModel model = new RegisterModel()
                {
                    UserName = check.Username,
                    FirstName = check.CompanyName,
                    CompanyName = check.CompanyName,
                    TaxCode = check.TaxCode,
                    AccountType = accType,
                    Email = check.Email,
                    Phone = check.Phone,
                    City = check.City,
                    ATM = check.ATM,
                    Bank = check.Bank,
                    Address1 = check.Address1,
                    Address2 = check.Address2,
                    ZipCode = check.ZipCode,
                    State = check.State,
                    Country = country.Value

                };
                TransactionLogViewModel.AddLog(IdLogin + " view the profile!", DateTime.Now);
                ViewData["Country"] = country.Value;

                return View(model);
            }

            //return View();
        }
        public ActionResult userdetail(string id)
        {
            var check = db.Webmasters.Single(m => m.Username == id);
            int accType = int.Parse(check.AccountType.ToString());

            if (accType == 0) // personal account
            {
                RegisterModel model = new RegisterModel()
                {
                    UserName = check.Username,
                  //  Name = check.Name,
                    Email = check.Email,
                    Phone = check.Phone,
                    City = check.City,
                    ATM = check.ATM,
                    Bank = check.Bank,
                  //  Street = check.Street,
                  //  Ward = check.Ward,
                    AccountType = accType,
                };
                TransactionLogViewModel.AddLog(User.Identity.Name + " has just viewed details of Webmaster: "+id, DateTime.Now);
                return View(model);
            }
            else
            { // bussiness account

                RegisterModel model = new RegisterModel()
                {
                    UserName = check.Username,
                //    Name = check.CompanyName,
                    CompanyName = check.CompanyName,
                    TaxCode = check.TaxCode,
                    AccountType = accType,
                    Email = check.Email,
                    Phone = check.Phone,
                    City = check.City,
                    ATM = check.ATM,
                    Bank = check.Bank,
               //     Street = check.Street,
              //      Ward = check.Ward,
                };
                TransactionLogViewModel.AddLog(User.Identity.Name + " has just viewed details of Webmaster: " + id, DateTime.Now);
                return View(model);
            }




            
        }
        public ActionResult bRegister(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                string HashPassword = MPHash.GetPassWordMD5Hash(model.Password);
                //hash password

                // Attempt to register the user
                MembershipCreateStatus createStatus = MembershipService.bCreateUser(model.CompanyName, model.UserName, HashPassword, model.Email, model.TaxCode, model.Phone);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    // FormsService.SignIn(model.UserName, false /* createPersistentCookie */);
                    var check = StoreDb.Webmasters.Single(m => m.Username == model.UserName && m.Email == model.Email && m.Status == 0);
                    string hash = check.VerifyCode;

                    string emailContent = "Welcome to Money Pacific!!!<br/><br/>";
                    emailContent += "You've just open account with Money Pacific! <br/><br/>";
                    emailContent += "<b>UserName: </b>" + model.UserName + "<br/>";
                    emailContent += "<b>Password: </b> Your password as you register.<br/><br/>";
                    emailContent += "To active your account, Please click on the link below:<br/><br/>";
                    emailContent += ConfigurationManager.AppSettings["URL"] + "/Account/Active/" + hash + "<br/><br/>";

                    string from = ConfigurationManager.AppSettings["MailSender"].ToString();

                    MPMail.SendMail(from, model.Email, "", "", "Money Pacific - Active Your Account!", emailContent);

                    TransactionLogViewModel.AddLog(model.FirstName +" "+ model.LastName + "has just registered as Webmaster with the email " + model.Email, DateTime.Now);

                    return RedirectToAction("RegisterSuccess");
                }
                else
                {
                    ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            ViewData["PasswordLength"] = MembershipService.MinPasswordLength;
            return View(model);
        }
        public ActionResult Profile()
        {
            string IdLogin = User.Identity.Name;
            var check = StoreDb.Webmasters.Single(m=>m.Username == IdLogin);
            int accType = int.Parse(check.AccountType.ToString());

            if (accType == 0) // personal account
            {
                RegisterModel model = new RegisterModel() { 
                UserName = check.Username,
                Name = check.Name,
                Email = check.Email,
                Phone = check.Phone,
                City = check.City,
                ATM = check.ATM,
                Bank = check.Bank,
                Street = check.Street,
                Ward = check.Ward,
                AccountType =accType,
             };

                return View(model);
            }
            else { // bussiness account

                RegisterModel model = new RegisterModel()
                {
                    UserName = check.Username,
                    Name = check.CompanyName,
                    CompanyName = check.CompanyName,
                    TaxCode = check.TaxCode,
                    AccountType = accType,
                    Email = check.Email,
                    Phone = check.Phone,
                    City = check.City,
                    ATM = check.ATM,
                    Bank = check.Bank,
                    Street = check.Street,
                    Ward = check.Ward,
                };

                return View(model);
            }

            //return View();
        }