public MS_UserAccount_Response LoginAuthentication(MS_UserAccount_Request req) { MS_UserAccount_Response retVal = new MS_UserAccount_Response(); try { retVal = DAL.LoginAuthentication(req); } catch (Exception ex) { retVal = null; throw ex; } finally { } return(retVal); }
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()); }
public MS_UserAccount_Response LoginAuthentication(MS_UserAccount_Request req) { MS_UserAccount_Response RetVal = new MS_UserAccount_Response(); try { DataTable dt = DBtran.DbToDataTable("[dbo].[USP_LOGIN_AUTHENTICATION]", new { UserName = req.UserName, Password = req.Password }, true); foreach (DataRow row in dt.Rows) { RetVal.UserID_PK = string.IsNullOrEmpty(row["UserID_PK"].ToString()) ? 0 : Convert.ToInt32(row["UserID_PK"]); RetVal.UserName = string.IsNullOrEmpty(row["UserName"].ToString()) ? "" : row["UserName"].ToString(); RetVal.Password = string.IsNullOrEmpty(row["Password"].ToString()) ? "" : row["Password"].ToString(); RetVal.IsActive = string.IsNullOrEmpty(row["IsActive"].ToString()) ? true : Convert.ToBoolean(row["IsActive"]); RetVal.IsDelete = string.IsNullOrEmpty(row["IsDelete"].ToString()) ? true : Convert.ToBoolean(row["IsDelete"]); RetVal.CreatedBy = string.IsNullOrEmpty(row["CreatedBy"].ToString()) ? "" : row["CreatedBy"].ToString(); RetVal.CreatedDate = string.IsNullOrEmpty(row["CreatedDate"].ToString()) ? DateTime.Now : Convert.ToDateTime(row["CreatedDate"]); RetVal.ModifiedBy = string.IsNullOrEmpty(row["ModifiedBy"].ToString()) ? "" : row["ModifiedBy"].ToString(); RetVal.ModifiedDate = string.IsNullOrEmpty(row["ModifiedDate"].ToString()) ? DateTime.Now : Convert.ToDateTime(row["ModifiedDate"]); RetVal.Authentication = string.IsNullOrEmpty(row["Authentication"].ToString()) ? true : Convert.ToBoolean(row["Authentication"]); RetVal.ResponseMessage = string.IsNullOrEmpty(row["ResponseMessage"].ToString()) ? "" : (row["ResponseMessage"].ToString()); } } catch (Exception ex) { RetVal = null; throw ex; } finally { } return(RetVal); }