コード例 #1
0
        public ActionResult Login(MS_UserAccount_Request req)
        {
            MS_UserAccount_Response res = new MS_UserAccount_Response();

            try
            {
                if (ModelState.IsValid)
                {
                    res = BL.LoginAuthentication(req);

                    bool   Authententication = Convert.ToBoolean(res.Authentication);
                    string ResponseMessage   = res.ResponseMessage.ToString();

                    if (Authententication)
                    {
                        Session["UserName"] = res.UserName.ToString();
                        Session["UserID"]   = res.UserID_PK.ToString();
                        ViewBag.ReturnUrl   = Url.Action("Index", "Home");
                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        ViewBag.ErrorLog = ResponseMessage;
                        return(View("Index"));
                    }
                }
            }
            catch (Exception ex)
            {
                MS_ActivityLog param = new MS_ActivityLog
                {
                    ActionName     = ControllerContext.RouteData.Values["action"].ToString(),
                    UserID_FK      = res.UserID_PK.HasValue ? res.UserID_PK : 0,
                    ControllerName = ControllerContext.RouteData.Values["controller"].ToString(),
                    Description    = ex.Message.ToString(),
                    ActivityDate   = DateTime.Now
                };
                bool RetVal = Act.ActivityLog(param);
            }

            return(View());
        }