Пример #1
0
        public ActionResult DeleteNews(string actiondelete)
        {
            if (Session["Quantri-website-Quantrivien"] == null)
            {
                Response.Redirect("/");
            }
            _9d_new item = accountContext._9d_news.Where(c => c.news_id == Convert.ToInt32(actiondelete)).FirstOrDefault();

            item.delete_flag = true;
            try
            {
                accountContext.SubmitChanges();
            }
            catch (Exception)
            {
                throw;
            }
            return(RedirectToAction("Newsmanager", "Home"));
        }
Пример #2
0
        public ActionResult Signup(FormCollection collection)
        {
            string username  = collection["name"].ToString();
            string password  = collection["password"].ToString();
            string passwordx = collection["passwordx"].ToString();
            string email     = collection["email"].ToString();
            string telephone = collection["sodienthoai"].ToString();
            string sex       = collection["option"].ToString();
            string address   = collection["address"].ToString();

            if (username.Trim() == string.Empty || password.Trim() == string.Empty || telephone.Trim() == string.Empty || passwordx.Trim() == string.Empty || email.Trim() == string.Empty || address.Trim() == string.Empty)
            {
                TempData["errorsignup"] = "Vui lòng nhập đầy đủ thông tin đăng ký, password phải lớn hơn 6 ký tự.";
                return(RedirectToAction("Signup", "Account"));
            }

            if (username.Trim().Length < 5)
            {
                TempData["errorsignup"] = "Vui lòng nhập tài khoản đăng nhập phải lớn hơn 6 kí tự.";
                return(RedirectToAction("Signup", "Account"));
            }


            if (password.Trim().Length < 5)
            {
                TempData["errorsignup"] = "Vui lòng nhập password phải lớn hơn 6 kí tự.";
                return(RedirectToAction("Signup", "Account"));
            }
            if (password != passwordx)
            {
                TempData["errorsignup"] = "Vui lòng nhập mật khẩu và xác nhận mật khẩu phải trùng nhau.";
                return(RedirectToAction("Signup", "Account"));
            }

            if (!isMemberExist(username))
            {
                Tbl_Member_Password adduser = new Tbl_Member_Password();
                adduser.userid       = username;
                adduser.userpassword = Common.GetMD5(password);

                AccountContent.Tbl_Member_Passwords.InsertOnSubmit(adduser);
                try
                {
                    AccountContent.SubmitChanges();
                }
                catch (Exception)
                {
                    TempData["errorsignup"] = "Có lỗi sảy ra vui lòng đăng ký lại.";
                    return(RedirectToAction("Signup", "Account"));
                }

                _9d_user user = new _9d_user();
                user.user_name    = username.Trim();
                user.password     = Common.GetMD5(password);
                user.email        = email.Trim();
                user.created_at   = DateTime.Now;
                user.telephone    = telephone;
                user.balance      = 0;
                user.address      = address.Trim();
                user.created_by   = "Admin";
                user.delete_flag  = false;
                user.isActivate   = true;
                user.ActivateCode = "FSGJTB45BDERT";
                user.level        = 1;
                user.totalpost    = 0;
                AccountContent._9d_users.InsertOnSubmit(user);
                try
                {
                    AccountContent.SubmitChanges();
                    string a = "";
                }
                catch (Exception)
                {
                    return(RedirectToAction("Signup", "Account"));
                }

                TempData["errorlogin"]      = null;
                TempData["registerSuccess"] = "Đăng ký thành công, bạn hãy đăng nhập để vào trang chủ tham gia các sự kiện đặc biệt.";
                return(RedirectToAction("Index", "Account"));
            }
            else
            {
                TempData["errorsignup"] = "Tài khoản đã tồn tại, vui lòng đăng ký tài khoản mới.";
                return(RedirectToAction("Signup", "Account"));
            }
        }
Пример #3
0
        public ActionResult Usermanager(FormCollection collection)
        {
            if (Session["Quantri-website-Quantrivien"] == null)
            {
                Response.Redirect("/");
            }
            if (collection["warning"].ToString() == "")
            {
                TempData["erroruser"]   = "******";
                TempData["successuser"] = null;
                ViewBag.UserList        = accountContext._9d_users.Where(c => c.user_id == 0).ToList();
                return(View());
            }

            if (Convert.ToInt32(collection["usertype"].ToString()) == 2)
            {
                using (var db = new DataAccountContentDataContext())
                {
                    db._9d_users
                    .Where(x => x.telephone == collection["userid"].ToString())
                    .ToList()
                    .ForEach(a =>
                    {
                        a.status  = true;
                        a.message = collection["warning"].ToString();
                    });

                    try
                    {
                        db.SubmitChanges();
                        TempData["erroruser"]   = null;
                        TempData["successuser"] = "******";
                        if (Convert.ToInt32(collection["usertype"].ToString()) == 1)
                        {
                            ViewBag.UserList = accountContext._9d_users.Where(c => c.user_name == collection["usertype"].ToString()).ToList();
                            return(View());
                        }
                        else if (Convert.ToInt32(collection["usertype"].ToString()) == 2)
                        {
                            ViewBag.UserList = accountContext._9d_users.Where(c => c.telephone == collection["userid"].ToString()).ToList();
                        }
                        return(View());
                    }
                    catch (Exception)
                    {
                        TempData["erroruser"]   = "******";
                        TempData["successuser"] = null;
                        if (Convert.ToInt32(collection["usertype"].ToString()) == 1)
                        {
                            ViewBag.UserList = accountContext._9d_users.Where(c => c.user_name == collection["usertype"].ToString()).ToList();
                            return(View());
                        }
                        else if (Convert.ToInt32(collection["usertype"].ToString()) == 2)
                        {
                            ViewBag.UserList = accountContext._9d_users.Where(c => c.telephone == collection["userid"].ToString()).ToList();
                        }
                        return(View());
                    }
                }
            }
            else
            {
                _9d_user us = accountContext._9d_users.Where(c => c.user_name == collection["userid"].ToString()).FirstOrDefault();
                us.status  = true;
                us.message = collection["warning"].ToString();
                try
                {
                    accountContext.SubmitChanges();
                    TempData["erroruser"]   = null;
                    TempData["successuser"] = "******";
                    if (Convert.ToInt32(collection["usertype"].ToString()) == 1)
                    {
                        ViewBag.UserList = accountContext._9d_users.Where(c => c.user_name == collection["usertype"].ToString()).ToList();
                        return(View());
                    }
                    else if (Convert.ToInt32(collection["usertype"].ToString()) == 2)
                    {
                        ViewBag.UserList = accountContext._9d_users.Where(c => c.telephone == collection["userid"].ToString()).ToList();
                    }
                    return(View());
                }
                catch (Exception)
                {
                    TempData["erroruser"]   = "******";
                    TempData["successuser"] = null;
                    if (Convert.ToInt32(collection["usertype"].ToString()) == 1)
                    {
                        ViewBag.UserList = accountContext._9d_users.Where(c => c.user_name == collection["usertype"].ToString()).ToList();
                        return(View());
                    }
                    else if (Convert.ToInt32(collection["usertype"].ToString()) == 2)
                    {
                        ViewBag.UserList = accountContext._9d_users.Where(c => c.telephone == collection["userid"].ToString()).ToList();
                    }
                    return(View());
                }
            }
        }
Пример #4
0
        public ActionResult Napthe(FormCollection collection)
        {
            if (Session["login"] == null)
            {
                HttpContext.Application["_controler"] = "Service";
                HttpContext.Application["_action"]    = "Napthe";
                return(RedirectToAction("Index", "Account"));
                //return RedirectToAction("Index", HttpContext.Application["_controler"] as string);
            }

            if (collection["seri"].ToString() == "" || collection["pin"].ToString() == "")
            {
                TempData["errorcard"]   = "Vui lòng nhập đầy đủ thông tin thẻ cào.";
                TempData["successcard"] = null;
                _9d_percen p = accountContext._9d_percens.FirstOrDefault();
                TempData["status"] = p.status;
                return(View());
            }

            try
            {
                _9d_percen p = accountContext._9d_percens.FirstOrDefault();
                TempData["status"] = p.status;

                RequestInfo info = new RequestInfo();
                info.Merchant_id       = "36680";
                info.Merchant_acount   = "*****@*****.**";
                info.Merchant_password = "******";

                //Nhà mạng
                info.CardType = collection["MovieType"].ToString();
                info.Pincard  = collection["pin"].ToString();

                //Mã đơn hàng
                info.Refcode    = (new Random().Next(0, 10000)).ToString();
                info.SerialCard = collection["seri"].ToString();

                ResponseInfo resutl = NLCardLib.CardChage(info);

                if (resutl.Errorcode.Equals("00"))
                {
                    _9d_user user     = accountContext._9d_users.Where(c => c.user_name == Session["login"].ToString() && c.delete_flag == false).FirstOrDefault();
                    int      coutncar = (Convert.ToInt32(resutl.Card_amount) * p.percen) / 100;
                    user.balance = user.balance + coutncar;
                    accountContext.SubmitChanges();

                    User_History addhistory = new User_History();
                    addhistory.user_name = Session["login"].ToString();
                    addhistory.time_into = DateTime.Now;
                    addhistory.car_info  = coutncar.ToString();
                    addhistory.car_type  = collection["MovieType"].ToString();
                    accountContext.User_Histories.InsertOnSubmit(addhistory);
                    accountContext.SubmitChanges();
                    _9d_user u = common.getUserInfo(Session["login"].ToString());
                    ViewBag.balance = u != null?u.balance.ToString() : "0";

                    TempData["errorcard"]   = null;
                    TempData["successcard"] = "Chúc mừng, bạn đã nạp thành công thẻ mệnh giá " + coutncar.ToString() + ".";
                }
                else
                {
                    TempData["errorcard"]   = resutl.Message.ToString();
                    TempData["successcard"] = null;
                }

                return(View());
            }
            catch (Exception)
            {
                throw;
            }
        }