예제 #1
0
        public ActionResult PaymentCollection(Code collect)
        {
            if (ModelState.IsValid)
            {
                EBSEntities db = new EBSEntities();

                var user = (from userlist in db.Codes
                            where userlist.C_ID == collect.C_ID && userlist.month == collect.month
                            select new
                {
                    userlist.coID,
                    userlist.C_ID
                }).ToList();

                if (user.FirstOrDefault() != null)
                {
                    //Session["UserName"] = user.FirstOrDefault().
                    //Session["UserID"] = user.FirstOrDefault().E_ID;
                    return(RedirectToAction("Details", "Codes", new { id = user.FirstOrDefault().coID }));
                }
                else
                {
                    ModelState.AddModelError("", "Invalid Client Unique Code!");
                }
            }
            return(View(collect));
        }
        public ActionResult Login(Company login)
        {
            if (ModelState.IsValid)
            {
                EBSEntities db = new EBSEntities();

                var user = (from userlist in db.Companies
                            where userlist.Email == login.Email && userlist.Password == login.Password
                            select new
                {
                    userlist.userID,
                    userlist.Email
                }).ToList();

                if (user.FirstOrDefault() != null)
                {
                    Session["UserName"] = user.FirstOrDefault().Email;
                    Session["UserID"]   = user.FirstOrDefault().userID;
                    return(Redirect("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Invalid login credentials.");
                }
            }
            return(View(login));
        }
예제 #3
0
        public ActionResult Login(Employee login)
        {
            if (ModelState.IsValid)
            {
                EBSEntities db = new EBSEntities();

                var user = (from userlist in db.Employees
                            where userlist.LastName == login.LastName && userlist.Password == login.Password
                            select new
                {
                    userlist.E_ID,
                    userlist.LastName
                }).ToList();

                if (user.FirstOrDefault() != null)
                {
                    Session["UserName"] = user.FirstOrDefault().LastName;
                    Session["UserID"]   = user.FirstOrDefault().E_ID;

                    return(RedirectToAction("Details", new { id = user.FirstOrDefault().E_ID }));
                }
                else
                {
                    ModelState.AddModelError("", "Invalid login credentials.");
                }
            }
            return(View(login));
        }