public UserProps MakeLoginByUserID(string UserID) { UserProps userProps = new UserProps(); ETEMModel.Models.User currentUser = AdminClientRef.GetUserByUserID(UserID); if (currentUser != null) { userProps.Roles = AdminClientRef.GetAllRolesByUser(currentUser.idUser.ToString(), null, null); for (int i = 0; i < userProps.Roles.Count; i++) { List <int> currentRolePermmitedActionsIds = AdminClientRef. GetAllPermittedActionsByRole(userProps.Roles[i].idRole.ToString(), null, null) .Select(r => r.idPermittedAction).ToList(); for (int j = 0; j < currentRolePermmitedActionsIds.Count; j++) { bool isDuplicate = userProps.ListUserPermittedActionsID.Any(p => p == currentRolePermmitedActionsIds[j]); if (!isDuplicate) { userProps.ListUserPermittedActionsID.Add(currentRolePermmitedActionsIds[j]); } } } //userProps.ListUserPermittedActionsID = AdminClientRef.getallp userProps.IdUser = currentUser.idUser.ToString(); userProps.UserName = currentUser.UserName; Person person = this.AdminClientRef.GetPersonByPersonID(currentUser.idPerson.ToString()); userProps.PersonNamePlusTitle = person.FullNamePlusTitle; userProps.PersonNameNoTitle = person.FullName; userProps.PersonNameAndFamily = person.FullNameTwo; userProps.PersonTwoNamePlusTitle = person.TwoNamesPlusTitle; userProps.PersonID = person.idPerson.ToString(); userProps.SessionID = this.Session.SessionID; userProps.IPAddress = Request.UserHostAddress; userProps.LoginDateTime = DateTime.Now; this.Session.Timeout = Convert.ToInt32(BasicPage.GetValueFromWebConfig("SessionTimeOut")); userProps.idStudent = Constants.INVALID_ID; userProps.IsCheckDomain = currentUser.idCheckDomain == GetKeyValueByIntCode("YES_NO", "Yes").idKeyValue; userProps.IsKilled = false; this.Session.Add(ETEMModel.Helpers.Constants.SESSION_USER_PROPERTIES, userProps); this.Session.Timeout = Int32.Parse(GetSettingByCode(ETEMEnums.AppSettings.WebSessionTimeOut).SettingValue); Dictionary <string, HttpSessionState> sessionData = (Dictionary <string, HttpSessionState>)Application[Constants.APPLICATION_ALL_SESSIONS]; if (sessionData.Keys.Contains(HttpContext.Current.Session.SessionID)) { sessionData.Remove(HttpContext.Current.Session.SessionID); sessionData.Add(HttpContext.Current.Session.SessionID, HttpContext.Current.Session); } } return(userProps); }
public void InitForDynamicLoad(BasicPage _OwnerPage) { this.ownerPage = _OwnerPage; this.AdminClientRef = new Administration(); this.CommonClientRef = new Common(); this.CurrentEntityMasterID = Constants.INVALID_ID_STRING; AjaxControlToolkit.ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "IsNumeric", BaseHelper.JS_SCRIPT_IS_NUMERIC, false); }
protected override void OnInit(EventArgs e) { base.OnInit(e); this.ownerPage = this.Page as BasicPage; this.AdminClientRef = new Administration(); this.CommonClientRef = new Common(); this.CostCalculationRef = new CostCalculationRef(); this.CurrentEntityMasterID = Constants.INVALID_ID_STRING; AjaxControlToolkit.ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "IsNumeric", BaseHelper.JS_SCRIPT_IS_NUMERIC, false); }