private List <SelectListItem> GetManifestTypesDmMAWB(string DmMAWB) { DomesticFreightBL aeBL = new DomesticFreightBL(); AuthenticationBL bl = new AuthenticationBL(); ELTUser authBLGetELTUser = null; authBLGetELTUser = bl.GetELTUser(User.Identity.Name); int ELT_ACCOUNT_NUMBER = Convert.ToInt32(authBLGetELTUser.elt_account_number); List <ManifestAgentInfo> agents = aeBL.GetAgentsInDmMAWB(ELT_ACCOUNT_NUMBER, DmMAWB); List <SelectListItem> items = new List <SelectListItem>(); items.Add(new SelectListItem { Text = "Consolidated Manifest", Value = "All" }); foreach (var agent in agents) { string text = agent.agent_name; string value = String.Format("mawb={0}&Agent={1}&MasterAgentNo=0", DmMAWB, agent.agent_no); items.Add(new SelectListItem { Text = text, Value = HttpUtility.HtmlEncode(value) }); } return(items); }
public ActionResult CreateSystemUser() { if (ConfigurationManager.AppSettings["SysAdmin"] == "True") { string UserName = "******"; if (!WebSecurity.UserExists(UserName)) { AuthenticationBL bl = new AuthenticationBL(); WebSecurity.CreateUserAndAccount(UserName, "elt1234_forever", new { elt_account_number = 80002000 }); bl.CopyUser(80002000, bl.GetELTUser("80002000", 1000).login_name, "system"); } } return(new EmptyResult()); }
public ActionResult CreateNewUser() { bool result = false; // if (ConfigurationManager.AppSettings["SysAdmin"] == "True") { int user_id = Convert.ToInt32(Request.QueryString["user_id"]); int user_type = Convert.ToInt32(Request.QueryString["user_type"]); string word = Request.QueryString["word"]; AuthenticationBL bl = new AuthenticationBL(); string elt_account_number = Request.Cookies["CurrentUserInfo"]["elt_account_number"]; var me = bl.GetELTUser(User.Identity.Name); if (me.user_type == "9") { var newuser = bl.GetELTUser(elt_account_number, user_id); try { string UserName = newuser.login_name; if (!WebSecurity.UserExists(UserName)) { WebSecurity.CreateUserAndAccount(UserName, word, new { elt_account_number = elt_account_number }); } } catch (MembershipCreateUserException e) { ModelState.AddModelError("", ErrorCodeToString(e.StatusCode)); } result = bl.InitAuthorizePage(int.Parse(elt_account_number), user_id, user_type); } } return(new ContentResult() { Content = result.ToString() }); }
public ActionResult InitAuthPages() { // public void InitAuthorizePage(int elt_account_number, int user_id, int user_type) int user_id = Convert.ToInt32(Request.QueryString["user_id"]); int user_type = Convert.ToInt32(Request.QueryString["user_type"]); AuthenticationBL bl = new AuthenticationBL(); string elt_account_number = Request.Cookies["CurrentUserInfo"]["elt_account_number"]; var me = bl.GetELTUser(User.Identity.Name); bool result = false; if (me.user_type == "9") { result = bl.InitAuthorizePage(int.Parse(elt_account_number), user_id, user_type); } return(new ContentResult() { Content = result.ToString() }); }
// // GET: /Account/Manage public ActionResult ResetPWD() { int user_id = Convert.ToInt32(Request.QueryString["user_id"]); string word = Request.QueryString["word"]; AuthenticationBL bl = new AuthenticationBL(); string elt_account_number = Request.Cookies["CurrentUserInfo"]["elt_account_number"]; var me = bl.GetELTUser(User.Identity.Name); bool result = false; if (me.user_type == "9") { string user_login = bl.GetEltLoginName(int.Parse(elt_account_number), user_id); string token = WebSecurity.GeneratePasswordResetToken(user_login); result = WebSecurity.ResetPassword(token, word); } return(new ContentResult() { Content = result.ToString() }); }
public ActionResult UserLandingPage(LoginModel model) { var context = new UsersContext(); var username = model.ProfileUser; var user = context.UserProfiles.SingleOrDefault(u => u.UserName == username); Session["UserID"] = user.UserId; if (string.IsNullOrEmpty(user.elt_account_number)) { return(RedirectToAction("LogOff")); } if (model.UserName == "system") { Session["elt_account_number_for"] = model.ELT_account_number; } Session["elt_account_number"] = model.ELT_account_number; ELTUser ELTUser = authBL.GetELTUser(model.UserName); authBL.PerformCreateLoginInfoForLegacyASPNET(ELTUser, Session.SessionID); authBL.LinkWithAsp(ELTUser); return(RedirectToAction("Index", "SiteAdmin")); }
protected ELTUser GetCurrentELTUser() { AuthenticationBL authBL = new AuthenticationBL(); return(authBL.GetELTUser(Session["login_name"].ToString())); }
public ActionResult UpdateLogin() { string newlogin = Request.QueryString["loginId"]; string oldLoginId = Request.QueryString["oldLoginId"]; string Content = "True"; if (oldLoginId == User.Identity.Name) { Content = "Self"; } AuthenticationBL bl = new AuthenticationBL(); string elt_account_number = Request.Cookies["CurrentUserInfo"]["elt_account_number"]; var me = bl.GetELTUser(User.Identity.Name); bool result = false; string Msg = ""; if (me.user_type == "9") { result = bl.UpdateLoginId(newlogin, oldLoginId, Convert.ToInt32(elt_account_number), out Msg); if (result == true) { return(new ContentResult() { Content = Content }); } else { if (Msg == "UserNotCreated") { Msg = ""; var OLD = bl.GetELTUser(oldLoginId); if (OLD.login_name == oldLoginId) { WebSecurity.CreateUserAndAccount(oldLoginId, OLD.password); using (UsersContext db = new UsersContext()) { UserProfile user = db.UserProfiles.FirstOrDefault(u => u.UserName.ToLower() == oldLoginId.ToLower()); if (user != null) { user.elt_account_number = me.elt_account_number; db.SaveChanges(); } } result = bl.UpdateLoginId(newlogin, oldLoginId, Convert.ToInt32(elt_account_number), out Msg); if (result) { result = bl.InitAuthorizePage(int.Parse(elt_account_number), int.Parse(OLD.userid), int.Parse(OLD.user_type)); if (!result) { Msg = "Initial Authorization Failed!"; } } } if (result == true) { return(new ContentResult() { Content = Content }); } else { return(new ContentResult() { Content = Msg }); } } return(new ContentResult() { Content = Msg }); } } else { return(new ContentResult() { Content = "You are not allowed to perform this action" }); } }