public ActionResult Index() { if (Session["UserName"] == null) { return(RedirectToAction("Index", "Login")); } try { if (ModelState.IsValid) { MS_Product_Request param = new MS_Product_Request(); List <MS_Product_Response> Product = GetProduct(param); ViewBag.VProducts = Product; } } catch (Exception ex) { int UserID = Convert.ToInt32(HttpContext.Session["UserID"].ToString()); MS_ActivityLog param = new MS_ActivityLog { ActionName = ControllerContext.RouteData.Values["action"].ToString(), UserID_FK = UserID, ControllerName = ControllerContext.RouteData.Values["controller"].ToString(), Description = ex.Message.ToString(), ActivityDate = DateTime.Now }; bool RetVal = Act.ActivityLog(param); } return(View()); }
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 bool ActivityLog(MS_ActivityLog param) { bool RetVal; using (TransactionScope transactionScope = new TransactionScope()) { List <SqlParameter> Parameter = new List <SqlParameter>(); //param //Parameter.Add(new SqlParameter() { ParameterName = "@pPostType", SqlDbType = SqlDbType.VarChar, Value = req.PostType.ToString() ?? "" }); Parameter.Add(new SqlParameter() { ParameterName = "@pActionName", SqlDbType = SqlDbType.VarChar, Value = param.ActionName ?? "" }); Parameter.Add(new SqlParameter() { ParameterName = "@pUserID", SqlDbType = SqlDbType.Int, Value = param.UserID_FK.HasValue ? param.UserID_FK : 0 }); Parameter.Add(new SqlParameter() { ParameterName = "@pController", SqlDbType = SqlDbType.VarChar, Value = param.ControllerName ?? "" }); Parameter.Add(new SqlParameter() { ParameterName = "@pDescription", SqlDbType = SqlDbType.VarChar, Value = param.Description ?? "" }); Parameter.Add(new SqlParameter() { ParameterName = "@pActivityDate", SqlDbType = SqlDbType.DateTime, Value = param.ActivityDate.HasValue ? param.ActivityDate : DateTime.Today }); DBtran.DbExecute("USP_POST_ACTIVITY_LOG", Parameter, true, out SqlParameterCollection outParameter); transactionScope.Complete(); RetVal = true; } return(RetVal); }
public ActionResult Register(MS_UserInfo_Request req) { try { if (ModelState.IsValid) { List <MS_UserInfo_Response> Cek = BL.RegistrasiCek(req); bool IsExists = Convert.ToBoolean(Cek.FirstOrDefault().ResponseAction); if (!IsExists) { bool Req = BL.RegisterNewAccount(req); return(RedirectToAction("Index")); } else { ViewBag.Error = Cek.FirstOrDefault().ResponseMessage.ToString(); ViewBag.Err = "Y"; return(View("Index")); } } } catch (Exception ex) { MS_ActivityLog param = new MS_ActivityLog { ActionName = ControllerContext.RouteData.Values["action"].ToString(), UserID_FK = 0, ControllerName = ControllerContext.RouteData.Values["controller"].ToString(), Description = ex.Message.ToString(), ActivityDate = DateTime.Now }; bool RetVal = Act.ActivityLog(param); } return(View()); }
public bool ActivityLog(MS_ActivityLog req) { bool Retval = DAL.ActivityLog(req); return(Retval); }