private void SendActivativeMail(Account acc, string matkhau, string ngaySinh)
        {
            webservice.SendEmail ws = new webservice.SendEmail();

            string path = Url.AbsoluteAction("Activate", "Account") + "/" + MD5Helper.EncryptBase64("" + acc.OID, true);
            StringBuilder str = new StringBuilder()
                .Append("Xin chào " + acc.email + "<br />")
                .Append("Chúc mừng Bạn đã đăng ký thành công tài khoản tại ThuongNghiep.vn<br />")
                .Append("Vui lòng kích hoạt tài khoản để được sử dụng các dịch vụ từ ThuongNghiep.vn, bằng cách nhấn vào đường dẫn dưới đây:<br /><br />")
                .Append("<a href=\"" + path + "\">" + path + "</a><br /><br />")
                .Append("Tên truy cập: " + acc.email + "<br />")
                .Append("Mật khẩu : " + matkhau + "<br />")
                .Append("Ngày sinh: " + ngaySinh + "<br />")
                .Append("Bạn nên lưu lại email này để tham khảo khi cần.<br />")
                .Append("Cảm ơn Bạn đã tham gia sử dụng website của Chúng tôi!<br />")
                .Append("Trân trọng,<br />")
                .Append("Ban Quản trị<br />")
                .Append("ThuongNghiep.vn<br />");

            //MailHelper.SendMailMessage("*****@*****.**",
            //    acc.email,
            //    null, null,
            //    "Kich hoạt tài khoản thuongnghiep.com",
            //    str.ToString());

                ws.SendMail("*****@*****.**",
                acc.email,
                null, null,
                "Kich hoạt tài khoản thuongnghiep.com",
                str.ToString());
        }
        public ActionResult ChangePass()
        {
            Session.Add("ActiveClass", "AccountChangePass");
            ViewData["AccountDetails"] = true;

            if (Session["ID"] != null)
            {
                int id = (int)Session["ID"];
                Account acc = new Account();
                return View(acc);
            }
            else
            {
                return RedirectToAction("Logon", "Account");
            }
        }
        public ActionResult Register(FormCollection collection)
        {
            ViewData["main"] = "MainRegister";
            Account accCheck = accountRes.GetByEmail(collection["email"]);
            var acc = new Account();
                if (collection["email"] != collection["emailConfirm"]) {
                    ModelState.AddModelError("", "Emai xác nhận không trùng với email.");

                }
                if (collection["matkhau"] != collection["matkhauConfirm"])
                {
                    ModelState.AddModelError("", "Mật khẩu xác nhận không trùng với mật khẩu.");

                }
                if (TryUpdateModel(acc) && accCheck ==null)
                {
                    acc.matkhau = MD5Helper.Encrypt(acc.matkhau, true);
                    acc.status = 0;
                    acc.CreatedDate = DateTime.Now;
                    accountRes.Add(acc);

                    accountRes.Save();

                    SendActivativeMail(acc, collection["matkhau"], collection["ngaySinh"]);

                    return RedirectToAction("RegisterSuccessActive", new { email = acc.email });
                }
                if (accCheck != null)
                {
                 ModelState.AddModelError("", "Email này đã tồn tại trong hệ thống");
                }
                return View();
        }
        public ActionResult Register(FormCollection collection)
        {
            var acc = new Account();
                if (TryUpdateModel(acc))
                {
                    acc.matkhau = MD5Helper.Encrypt(acc.matkhau, true);
                    accountRes.Add(acc);

                    accountRes.Save();

                    SendActivativeMail(acc);

                    return RedirectToAction("RegisterSuccess", new {email= acc.email });
                }
                // Attempt to register the user
                /*var acc = new Account();
                var test = acc.captchaValue;
                acc.email = collection["email"];
                acc.username = "";
                acc.matkhau = collection["matkhau"];

                acc.ngaySinh = DateTime.Now;
                acc.gioiTinh = Boolean.Parse(collection["gioiTinh"]);
                acc.hoTen = collection["hoTen"];
                accountRes.Add(acc);
                accountRes.Save();

                return RedirectToAction("Index", "Home");*/

            // If we got this far, something failed, redisplay form
            return View();
        }
        private void SendActivativeMail(Account acc)
        {
            string path = Url.AbsoluteAction("Activate","Account") + "/"+MD5Helper.Encrypt(""+acc.OID, true);
            StringBuilder str = new StringBuilder()
                .Append("Chào bạn,<br />")
                .Append("Bạn hoặc ai đó đã sử dụng email này để đăng ký tài khoản tại website ThuongNghiep.com<br />")
                .Append("Để kết thúc quá trình đăng ký, vui lòng bấm vào liên kết dưới đây:<br />")
                .Append(path + "<br />");

            MailHelper.SendMailMessage("*****@*****.**",
                acc.email,
                null, null,
                "Kich hoạt tài khoản thuongnghiep.com",
                str.ToString());
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Accounts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToAccounts(Account account)
 {
     base.AddObject("Accounts", account);
 }
 /// <summary>
 /// Create a new Account object.
 /// </summary>
 /// <param name="oID">Initial value of the OID property.</param>
 /// <param name="hoTen">Initial value of the hoTen property.</param>
 /// <param name="ngaySinh">Initial value of the ngaySinh property.</param>
 /// <param name="gioiTinh">Initial value of the gioiTinh property.</param>
 /// <param name="matkhau">Initial value of the matkhau property.</param>
 /// <param name="email">Initial value of the email property.</param>
 /// <param name="username">Initial value of the username property.</param>
 public static Account CreateAccount(global::System.Int32 oID, global::System.String hoTen, global::System.DateTime ngaySinh, global::System.Boolean gioiTinh, global::System.String matkhau, global::System.String email, global::System.String username)
 {
     Account account = new Account();
     account.OID = oID;
     account.hoTen = hoTen;
     account.ngaySinh = ngaySinh;
     account.gioiTinh = gioiTinh;
     account.matkhau = matkhau;
     account.email = email;
     account.username = username;
     return account;
 }
Beispiel #8
0
 public void Delete(Account dm)
 {
     en.DeleteObject(dm);
 }
Beispiel #9
0
 public void Add(Account dm)
 {
     //dm.OID = en.Accounts.Count() + 1;
     en.AddObject("Account", dm);
 }
        public ActionResult Register(FormCollection collection)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                var acc = new Account();
                acc.email = collection["email"];
                acc.username = collection["username"];
                acc.matkhau = collection["matkhau"];

                acc.ngaySinh = DateTime.Now;
                acc.gioiTinh = Boolean.Parse(collection["gioiTinh"]);
                acc.hoTen = collection["hoTen"];
                accountRes.Add(acc);
                accountRes.Save();
                return RedirectToAction("Index", "Home");
            }

            // If we got this far, something failed, redisplay form
            return View();
        }
Beispiel #11
0
 public IQueryable<Histories> FindAll(Account acc, string type,
     DateTime fromDate, DateTime toDate)
 {
     return from h in en.Histories
             where h.Account_ID == acc.OID
             && h.Type == type
             && h.CreatedDate >= fromDate
             && h.CreatedDate <= toDate
             orderby h.CreatedDate descending
             select h;
 }
Beispiel #12
0
 public IQueryable<Histories> FindByUser(Account acc)
 {
     return from history in en.Histories
            where history.Account_ID == acc.OID
            orderby history.CreatedDate descending
            select history;
 }