public ActionResult Index(string errorCode = null) { FormsAuthenticationTicket ticket = null; try { // string LoginUserType = System.Web.HttpContext.Current.Session["LoginUserType"].ToString(); _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { ticket = FormsAuthentication.Decrypt(authCookie.Value); ViewBag.ProfilePicURL = _UserDetailsBusinessLogic.GetUserDetails(ticket.Name) .FirstOrDefault().ProfilePicURL; ViewBag.Username = ticket.Name; ViewBag.UserType = _UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim(); //Bind Error Code to ViewBag ViewBag.ErrorCode = errorCode; ViewBag.RedirectedUserId = "0"; return(View()); } else { this.HttpContext.Session["ErrorMsg"] = "LoginErr"; return(RedirectToAction("Index", "Login")); } } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); this.HttpContext.Session["ErrorMsg"] = "PageLoadError"; return(RedirectToAction("Index", "LoginError")); } }
private static int redirectedUserId = 0; //Variable to get when user Id is redirected from another page public ActionResult Index(string userId = null) { FormsAuthenticationTicket ticket = null; try { // string LoginUserType = System.Web.HttpContext.Current.Session["LoginUserType"].ToString(); _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); _EncryptionModule = new EncryptionModule(); HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { ticket = FormsAuthentication.Decrypt(authCookie.Value); ViewBag.Username = ticket.Name; ViewBag.UserType = _UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim(); ViewBag.RedirectedUserId = userId != null?_EncryptionModule.Decrypt(userId.ToString()) : "0"; redirectedUserId = userId != null?Convert.ToInt32(_EncryptionModule.Decrypt(userId.ToString())) : 0; //Initialize AWS Configurations => Required for image uploads InitAWSS3Configurations(); return(View()); } else { this.HttpContext.Session["ErrorMsg"] = "LoginErr"; return(RedirectToAction("Index", "Login")); } } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); this.HttpContext.Session["ErrorMsg"] = "PageLoadError"; return(RedirectToAction("Index", "LoginError")); } }
public ActionResult Index() { FormsAuthenticationTicket ticket = null; try { int userId = 0; _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { ticket = FormsAuthentication.Decrypt(authCookie.Value); userId = _UserDetailsBusinessLogic.GetUserID(ticket.Name); loggedUserType = _UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim(); } else { loggedUserType = System.Web.HttpContext.Current.Session["LoginUserType"].ToString().ToLower().Trim(); } //This will be used in the cshtml to check whether the user is actively logged in //and is of Administrator User Type ViewBag.UserId = userId; ViewBag.UserType = loggedUserType; ViewBag.RedirectedUserId = "0"; return(View()); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); this.HttpContext.Session["ErrorMsg"] = "PageLoadError"; return(RedirectToAction("Index", "LoginError")); } }
public JsonResult GetRedirectedUserDetails() { FormsAuthenticationTicket ticket = null; try { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { ticket = FormsAuthentication.Decrypt(authCookie.Value); if (redirectedUserId == 0) { var userDetails = _UserDetailsBusinessLogic.GetUserDetails(ticket.Name).ToArray(); return(Json(userDetails)); } else { var userDetails = _UserDetailsBusinessLogic.GetUserDetails(redirectedUserId).ToArray(); return(Json(userDetails)); } } else { return(Json(null)); } } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); return(Json(null)); } }
public JsonResult LoadUserGroups(int isActive) { //isActive=>Denotes which type of data to get(i.e,active,inactive or all) try { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; string userType = "N/A"; if (authCookie != null) { FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); userType = _UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim(); if (userType == "administrator") { var resultArr = _UserDetailsBusinessLogic.GetAllUserGroups(isActive); return(Json(resultArr)); } else { var resultArr = _UserDetailsBusinessLogic.GetAllUserGroupsForOtherUser(isActive); return(Json(resultArr)); } } else { var resultArr = _UserDetailsBusinessLogic.GetAllUserGroupsForOtherUser(isActive); return(Json(resultArr)); } } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, "UName", ex); return(Json(null)); } }
public void SetIPAddressDetails(UserSessionLog locationDetailsObj) { FormsAuthenticationTicket ticket = null; try { IPAddress = locationDetailsObj.IPAddress; countryCode = locationDetailsObj.CountryCode; country = locationDetailsObj.Country; city = locationDetailsObj.City; region = locationDetailsObj.Region; } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); } }
public JsonResult GetUserGroupNamesForAutoComplete(string userGroupName) { try { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); var resultArr = _UserDetailsBusinessLogic.GetUserGroupNamesForAutoComplete(userGroupName); return(Json(resultArr)); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, "UName", ex); return(Json(false)); } }
public JsonResult ChangeStatusForAllGroups(bool isActiveForAll) { try { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); bool isSuccess = false; isSuccess = _UserDetailsBusinessLogic.ChangeStatusForAllGroups(isActiveForAll); return(Json(isSuccess)); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, "UName", ex); return(Json(false)); } }
//Definition to Initialize AWS Configurations=>Required for image uploads public void InitAWSS3Configurations() { FormsAuthenticationTicket ticket = null; try { HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; ticket = FormsAuthentication.Decrypt(authCookie.Value); //Bucket configurations string AWSProfileName = System.Configuration.ConfigurationManager.AppSettings["AWSProfileName"]; string AWSAccessKey = System.Configuration.ConfigurationManager.AppSettings["AWSAccessKey"]; string AWSSecretKey = System.Configuration.ConfigurationManager.AppSettings["AWSSecretKey"]; string BucketName = System.Configuration.ConfigurationManager.AppSettings["BucketName"]; string BucketRegion = System.Configuration.ConfigurationManager.AppSettings["BucketRegion"]; string BucketStartURL = System.Configuration.ConfigurationManager.AppSettings["BucketStartURL"]; //File Upload Paths string UserProfileImagePath = System.Configuration.ConfigurationManager.AppSettings["UserProfileImagePath"]; string OtherUserProfileFilePath = System.Configuration.ConfigurationManager.AppSettings["OtherUserProfileFilePath"]; ViewBag.AWSProfileName = AWSProfileName; ViewBag.AWSAccessKey = AWSAccessKey; ViewBag.AWSSecretKey = AWSSecretKey; ViewBag.BucketName = BucketName; ViewBag.BucketRegion = BucketRegion; ViewBag.BucketStartURL = BucketStartURL; ViewBag.UserProfileImagePath = UserProfileImagePath; ViewBag.OtherUserProfileFilePath = OtherUserProfileFilePath; } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); } }
//Check whether username is existing public JsonResult IsUsernameExisting(string chkUserName) { FormsAuthenticationTicket ticket = null; try { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); bool isExisting = _UserDetailsBusinessLogic.IsUsernameExisting(chkUserName); return(Json(isExisting)); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); return(Json(false)); } }
//Delete selected errors public JsonResult DeleteSelectedErrorTraces(ErrorLogger[] errorTraceArr) { FormsAuthenticationTicket ticket = null; try { _RuntimeErrorTraceBusinessLogic = new RuntimeErrorTraceBusinessLogic(); var result = _RuntimeErrorTraceBusinessLogic.DeleteSelectedErrorTraces(errorTraceArr); return(Json(result)); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); return(Json(false)); } }
/****Adding New User****/ public JsonResult AddOrUpdateSystemUser(SystemUser systemUser) { FormsAuthenticationTicket ticket = null; try { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); bool isSuccess; int currentUserId = 0; //Getting current user.. HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { ticket = FormsAuthentication.Decrypt(authCookie.Value); currentUserId = _UserDetailsBusinessLogic.GetUserID(ticket.Name); } if (_UserDetailsBusinessLogic.IsUsernameExisting(systemUser.Username) == true && currentUserId != 0) { isSuccess = _UserDetailsBusinessLogic.UpdateSytemUser(systemUser, currentUserId); } else { isSuccess = _UserDetailsBusinessLogic.AddSystemUser(systemUser, currentUserId); } return(Json(isSuccess)); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); return(Json(false)); } }
public ActionResult Index() { try { HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie != null) { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); ViewBag.ProfilePicURL = _UserDetailsBusinessLogic.GetUserDetails(ticket.Name) .FirstOrDefault().ProfilePicURL; ViewBag.Username = ticket.Name; ViewBag.UserType = _UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim(); return(View()); } else { this.HttpContext.Session["ErrorMsg"] = "LoginErr"; return(RedirectToAction("Index", "Login")); } } catch (Exception ex) { currentFile = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, "UName", ex); this.HttpContext.Session["ErrorMsg"] = "PageLoadError"; return(RedirectToAction("Index", "LoginError")); } }
public JsonResult GetClientDetailsForCode(string ClientCode) { FormsAuthenticationTicket ticket = null; try { _ClientBusinessLogic = new ClientBusinessLogic(); HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; ticket = FormsAuthentication.Decrypt(authCookie.Value); var ClientArr = _ClientBusinessLogic.GetClientDetailsForCode(ClientCode); return(Json(ClientArr)); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); return(Json(null)); } }
public JsonResult GetExistingErrorListForParam(int domainId, int fieldId, int clientId) { FormsAuthenticationTicket ticket = null; try { _SearchSolutionBusinessLogic = new SearchSolutionBusinessLogic(); HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; ticket = FormsAuthentication.Decrypt(authCookie.Value); var retObj = _SearchSolutionBusinessLogic.GetExistingErrorListForParam(domainId, fieldId, clientId); return(Json(retObj)); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); return(Json(null)); } }
public JsonResult UpdateSearchFrequencyForError(string errorCode) { FormsAuthenticationTicket ticket = null; try { _ErrorFrequencyBusinessLogic = new ErrorFrequencyBusinessLogic(); HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; ticket = FormsAuthentication.Decrypt(authCookie.Value); bool retVal = _ErrorFrequencyBusinessLogic.UpdateSearchFrequencyForError(errorCode); return(Json(retVal)); } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, ticket == null ? "N/A" : ticket.Name, ex); return(Json(false)); } }
public ActionResult Index(string requestId = null) { FormsAuthenticationTicket ticket = null; try { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName]; ViewBag.RequestId = requestId; bool isSessionTicketDecryptable = true; if (authCookie != null) { try { ticket = FormsAuthentication.Decrypt(authCookie.Value); } catch (Exception ex) { isSessionTicketDecryptable = false; } if (isSessionTicketDecryptable == true) { ViewBag.ProfilePicURL = _UserDetailsBusinessLogic.GetUserDetails(ticket.Name) .FirstOrDefault().ProfilePicURL; ViewBag.Username = ticket.Name; ViewBag.UserType = _UserDetailsBusinessLogic.GetUserType(ticket.Name).ToLower().Trim(); return(View()); } else { return(RedirectToAction("Index", "Login", new RouteValueDictionary(new { id = "RedirectedLogin", userMsgRequestIdParam = requestId }))); } } else { if (requestId != null) { return(RedirectToAction("Index", "Login", new RouteValueDictionary(new { id = "RedirectedLogin", userMsgRequestIdParam = requestId }))); } else { this.HttpContext.Session["ErrorMsg"] = "LoginErr"; return(RedirectToAction("Index", "LoginError")); } } } catch (Exception ex) { currentFile = new System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(1); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, "UName", ex); this.HttpContext.Session["ErrorMsg"] = "PageLoadError"; return(RedirectToAction("Index", "LoginError")); } }
public ActionResult AuthenticatePasswordReset(ForgotPasswordViewModel model) { try { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); if ((model.Username != null && model.EMail != null)) { if (_UserDetailsBusinessLogic.IsExistingUserForPasswordRecovery(model.Username, model.EMail)) { bool isEmailServerWorking = TestConnection(smptpServerVal, sendPort); bool isEmailSent = false; if (isEmailServerWorking == true) { //delete all existing temperory passwords for this user _UserDetailsBusinessLogic.DeleteTemperoryPassword(model.Username); string tempPassword = _UserDetailsBusinessLogic.SaveTempPassword(model.Username); if (tempPassword != String.Empty) { _MailMessage = CommonCommunicationBusinessLogic.ConstructEmail(model.Username, model.EMail, tempPassword); isEmailSent = CommonCommunicationBusinessLogic.SendEmail(_MailMessage); } else { TempData["notice"] = "Oops!..The temperory password could not be generated.Please try again."; } } else { TempData["notice"] = "Oops!..Our Email servers seem to be not working at the moment." + Environment.NewLine + "Please send an email to [email protected] to get a temperory password."; } if (isEmailSent == true) { TempData["notice"] = null; TempData["success"] = "Password reset successful." + Environment.NewLine + "Please see your email inbox or spam folder to get the temperory password. "; } else { TempData["notice"] = "Oops!..Could not compelete password recovery process." + Environment.NewLine + "Please send an email stating your username to [email protected] to get a temperory password. "; } return(RedirectToAction("Index", "ForgotPassword")); } else { TempData["notice"] = "Oops!..This Username and EMail combination is not found in our system. "; return(RedirectToAction("Index", "ForgotPassword")); } } else { TempData["notice"] = "Username and EMail are required. "; return(RedirectToAction("Index", "ForgotPassword")); } } catch (Exception ex) { currentFile = this.ControllerContext.RouteData.Values["controller"].ToString(); // System.Diagnostics.StackTrace(true).GetFrame(0).GetFileName(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); methodName = sf.GetMethod().Name; ErrorLogHelper.UpdatingErrorLog(currentFile + "-" + methodName, "UName", ex); TempData["notice"] = "Oops!..An Error Occured. " + Environment.NewLine + "Please send an email stating your username and full name to " + networkCredentialUserName + " to get a temperory password."; return(RedirectToAction("Index", "ForgotPassword")); } }