public void Init() { _OAuthToken = (string)_JsonHandler.Read("config.json", true)?["OAuthToken"] ?? string.Empty; if (string.IsNullOrEmpty(_OAuthToken) && !_OAuthToken.ToLower().Contains("oauth")) { MessageBoxResult MessageResult = MessageBox.Show("You must provide an OAuth token!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error); if (MessageResult == MessageBoxResult.OK) { Environment.Exit(0); } return; } GetUsername(); if (string.IsNullOrEmpty(Username)) { return; } UserData = GetUserData(Username).ToString(); ReadUserData = new JsonHandler()?.Read(UserData.ToString(), false) ?? JObject.Parse("{ }"); GetUserId(); if (string.IsNullOrEmpty(UserID)) { return; } bHasInitRun = true; }
public async Task <ActionResult> Search(UserSearchViewModel user) { HttpClient client = _api.Initial(); var res = await client.GetAsync("api/users/user/" + user.Username); _logger.LogInformation("SEARCHHHHHH: " + user.Username); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; UserData user_ = JsonConvert.DeserializeObject <List <UserData> >(result).FirstOrDefault(); _logger.LogInformation("GETTTTT: " + result.ToString()); if (user_ != null) { _logger.LogInformation("GETTTTT: " + user_.ToString()); if (HttpContext.Session.GetString("isAdmin").Equals("False")) { if (!HttpContext.Session.GetString("Department").Equals(user_.Department)) { ModelState.AddModelError("Username", "No Users Found. Please try another username search."); _logger.LogInformation("User Found but in Different Department!"); return(View()); } } return(RedirectToAction("Details", new { id = user_.UserId })); } else { ModelState.AddModelError("Username", "No Users Found. Please try another username search."); _logger.LogInformation("UserNOTFounnd"); return(View()); } } return(View("Index")); }
private bool IsValidValue(Vector2 value, string valueName, float?minValue = null, float?maxValue = null) { if (!MathUtils.IsValid(value) || (minValue.HasValue && (value.X < minValue.Value || value.Y < minValue.Value)) || (maxValue.HasValue && (value.X > maxValue.Value || value.Y > maxValue))) { string userData = UserData == null ? "null" : UserData.ToString(); string errorMsg = "Attempted to apply invalid " + valueName + " to a physics body (userdata: " + userData + "), value: " + value; if (GameMain.NetworkMember != null) { errorMsg += GameMain.NetworkMember.IsClient ? " Playing as a client." : " Hosting a server."; } errorMsg += "\n" + Environment.StackTrace; if (GameSettings.VerboseLogging) { DebugConsole.ThrowError(errorMsg); } GameAnalyticsManager.AddErrorEventOnce( "PhysicsBody.SetPosition:InvalidPosition" + userData, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); return(false); } return(true); }
public override string ToString() { if (UserData != null) { return(UserData.ToString()); } return(base.ToString()); }
public override string ToString() { StringBuilder sb = new StringBuilder("User("); sb.Append("UserData: "); sb.Append(UserData == null ? "<null>" : UserData.ToString()); sb.Append(",GroupData: "); sb.Append(GroupData == null ? "<null>" : GroupData.ToString()); sb.Append(")"); return(sb.ToString()); }
public void InitSubmit() { MyUserData.Class = InitClass.text; MyUserData.Name = InitName.text; MyUserData.No = InitNo.text; MyUserData.Sex = InitSex.text; FindObjectOfType <DataSendServer>().AddNewUserData(MyUserData); init = true; AllUserData.Add(MyUserData); Debug.Log(MyUserData.ToString()); Save(); SceneManager.LoadScene(SceneManager.GetActiveScene().name); }
private void OnAuthorsDelete(object sender, EventArgs e) { if (this._lvAuthors.SelectedItems.Count == 1) { UserData userData = this._lvAuthors.SelectedItems[0].Tag as UserData; if (MessageBox.Show(userData.ToString(), "Delete user?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { this._users.Remove(userData); this.UpdateListView(); this.StoreUsersToXml(); } } }
/// <summary> /// Gets the UserData string if present. /// </summary> /// <returns>The UserData string.</returns> public override string ToString() { if (UserData != null) { var ret = UserData.ToString(); #if TEST_MSAGL // if(DebugId!=null) // ret+= " "+DebugId.ToString(); #endif return(ret); } return(base.ToString()); }
public void ServerWrite(IWriteMessage msg, Client c, object[] extraData = null) { float MaxVel = NetConfig.MaxPhysicsBodyVelocity; float MaxAngularVel = NetConfig.MaxPhysicsBodyAngularVelocity; msg.Write(SimPosition.X); msg.Write(SimPosition.Y); #if DEBUG if (Math.Abs(FarseerBody.LinearVelocity.X) > MaxVel || Math.Abs(FarseerBody.LinearVelocity.Y) > MaxVel) { DebugConsole.ThrowError($"Entity velocity out of range ({(UserData?.ToString() ?? "null")}, {FarseerBody.LinearVelocity})"); } #endif msg.Write(FarseerBody.Awake); msg.Write(FarseerBody.FixedRotation); if (!FarseerBody.FixedRotation) { msg.WriteRangedSingle(MathUtils.WrapAngleTwoPi(FarseerBody.Rotation), 0.0f, MathHelper.TwoPi, 8); } if (FarseerBody.Awake) { FarseerBody.Enabled = true; FarseerBody.LinearVelocity = new Vector2( MathHelper.Clamp(FarseerBody.LinearVelocity.X, -MaxVel, MaxVel), MathHelper.Clamp(FarseerBody.LinearVelocity.Y, -MaxVel, MaxVel)); msg.WriteRangedSingle(FarseerBody.LinearVelocity.X, -MaxVel, MaxVel, 12); msg.WriteRangedSingle(FarseerBody.LinearVelocity.Y, -MaxVel, MaxVel, 12); if (!FarseerBody.FixedRotation) { FarseerBody.AngularVelocity = MathHelper.Clamp(FarseerBody.AngularVelocity, -MaxAngularVel, MaxAngularVel); msg.WriteRangedSingle(FarseerBody.AngularVelocity, -MaxAngularVel, MaxAngularVel, 8); } } msg.WritePadBits(); }
/// <summary> /// 消息控件构造器 /// </summary> /// <param name="message">消息</param> /// <param name="we">是否为本地消息</param> /// <param name="width">容器宽度</param> /// <param name="showtime">是否显示时间</param> /// <param name="data">绑定的用户</param> /// <param name="scroll">绑定的父级滚动条</param> public MS_Label(bool we, bool inPub, UserData data, SkinVScrollBar bar) { this.user = data; this.inPub = inPub; this.We = we; this.scroll = bar; InitializeComponent(); this.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left; CheckForIllegalCrossThreadCalls = false; SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true); this.lb_nowTime.Location = new Point(0, 0); this.lb_Name.Location = new Point(this.HeadImage.Width + 22, 12); this.lb_Name.Visible = !we; this.lb_Name.TextAlign = ContentAlignment.MiddleLeft; //设置头像 this.HeadImage.BackgroundImage = we ? KeyData.StaticInfo.MyUser.HeadImage : this.user.HeadImage; //设置昵称 this.lb_Name.Text = data.ToString(); //设置时间显示标签 this.lb_nowTime.Text = "——(" + DateTime.Now.ToShortTimeString() + ")——"; }
public bool IsValidValue(float value, string valueName, float?minValue = null, float?maxValue = null) { if (!MathUtils.IsValid(value) || (minValue.HasValue && value < minValue.Value) || (maxValue.HasValue && value > maxValue.Value)) { string userData = UserData == null ? "null" : UserData.ToString(); string errorMsg = "Attempted to apply invalid " + valueName + " to a physics body (userdata: " + userData + "), value: " + value + "\n" + Environment.StackTrace; if (GameSettings.VerboseLogging) { DebugConsole.ThrowError(errorMsg); } GameAnalyticsManager.AddErrorEventOnce( "PhysicsBody.SetPosition:InvalidPosition" + userData, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg); return(false); } return(true); }
/// <summary> /// to string! /// </summary> /// <returns></returns> public override string ToString() { return(UserData != null?UserData.ToString() : base.ToString()); }
public async Task <ActionResult> Login(UserLoginViewModel user) { HttpClient client = _api.Initial(); if (user != null) { var res = await client.GetAsync("api/users/user/" + user.Username + "/" + user.Password); _logger.LogInformation("GETTTTT: " + res.ToString()); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; UserData user_ = JsonConvert.DeserializeObject <UserData>(result); _logger.LogInformation("GETTTTT: " + result.ToString()); _logger.LogInformation("GETTTTT: " + user_.ToString()); if (user_.Username != "NA") { HttpContext.Session.SetString("UserId", user_.UserId.ToString()); HttpContext.Session.SetString("Username", user_.Username.ToString()); HttpContext.Session.SetString("Department", user_.Department.ToString()); HttpContext.Session.SetString("isAdmin", user_.isAdmin.ToString()); HttpContext.Session.SetString("isDepartmentAdmin", user_.isDepartmentAdmin.ToString()); _logger.LogInformation("User Found"); _logger.LogInformation(user_.Username.ToString()); // Create Session var dateTime = DateTime.Now; var log = new UserLog { UserId = user_.UserId, LoginTime = dateTime.AddTicks(-(dateTime.Ticks % TimeSpan.TicksPerSecond)), LogoutTime = dateTime.AddTicks(-(dateTime.Ticks % TimeSpan.TicksPerSecond)), Status = "online", LeaveDay = false, Holiday = false }; var postresult = client.PostAsJsonAsync <UserLog>("api/userlogs/open", log).Result; if (postresult.IsSuccessStatusCode) { return(RedirectToAction("LoggedIn")); } else { _logger.LogInformation("Session Could not be created"); return(View()); } } else { ModelState.AddModelError("Password", "Invalid login attempt."); _logger.LogInformation("UserNOTFounnd"); return(View()); } } return(View()); } else { return(View()); } }
public IActionResult TestUIHelperSubmit(UserData userData) { _logger.LogCritical(userData.ToString()); return(RedirectToAction(nameof(TestUIHelper))); }
//// decoding //public static string Decrypt(string strData) //{ // return Encoding.UTF8.GetString(Decrypt(Convert.FromBase64String(strData))); // // reference https://msdn.microsoft.com/en-us/library/system.convert.frombase64string(v=vs.110).aspx //} //// encrypt //public static byte[] Encrypt(byte[] strData) //{ // PasswordDeriveBytes passbytes = // new PasswordDeriveBytes(Global.strPermutation, // new byte[] { Global.bytePermutation1, // Global.bytePermutation2, // Global.bytePermutation3, // Global.bytePermutation4 // }); // MemoryStream memstream = new MemoryStream(); // Aes aes = new AesManaged(); // aes.Key = passbytes.GetBytes(aes.KeySize / 8); // aes.IV = passbytes.GetBytes(aes.BlockSize / 8); // CryptoStream cryptostream = new CryptoStream(memstream, // aes.CreateEncryptor(), CryptoStreamMode.Write); // cryptostream.Write(strData, 0, strData.Length); // cryptostream.Close(); // return memstream.ToArray(); //} //// decrypt //public static byte[] Decrypt(byte[] strData) //{ // PasswordDeriveBytes passbytes = // new PasswordDeriveBytes(Global.strPermutation, // new byte[] { Global.bytePermutation1, // Global.bytePermutation2, // Global.bytePermutation3, // Global.bytePermutation4 // }); // MemoryStream memstream = new MemoryStream(); // Aes aes = new AesManaged(); // aes.Key = passbytes.GetBytes(aes.KeySize / 8); // aes.IV = passbytes.GetBytes(aes.BlockSize / 8); // CryptoStream cryptostream = new CryptoStream(memstream, // aes.CreateDecryptor(), CryptoStreamMode.Write); // cryptostream.Write(strData, 0, strData.Length); // cryptostream.Close(); // return memstream.ToArray(); //} protected void btnLogin_Click(object sender, System.EventArgs e) { string inputString = "Password" + DateTime.Now; SHA256 sha256 = SHA256Managed.Create(); byte[] bytes = Encoding.UTF8.GetBytes(inputString); byte[] hash = sha256.ComputeHash(bytes); string str = GetStringFromHash(hash); User objUser = new User(); DataTable dtbAuthentication; int intUserID, intUserTypeID, intOrganisationID, intLoginFailCount; string strOrgLog; string strUserName = txtUserName.Text; bool blnAdvancedReporting; try { //dtbAuthentication = objUser.Login(strUserName,Request.Url.Host); dtbAuthentication = objUser.Login(strUserName, "demo.saltcompliance.com"); //dtbAuthentication = objUser.Login(strUserName, "arabbank.saltcompliance.com"); //Test Code //string encPass = Encrypt(txtPassword.Text.ToString().Trim()); //string decPass = Decrypt(txtPassword.Text.ToString().Trim()); //End test coded //1. User name doesn't exist if (dtbAuthentication.Rows.Count == 0) { lblErrorMessage.Text = ResourceManager.GetString("Message.LoginFailure"); this.lblErrorMessage.CssClass = "WarningMessageLoginPage"; } // Password Lockout - Check login attempts by UserID and if greater than 3 then // inform user that they have been locked out //1.1. User has unsucessfully attempted to login three times else if ((int.Parse(dtbAuthentication.Rows[0]["LoginFailCount"].ToString()) >= 3)) { lblErrorMessage.Text = ResourceManager.GetString("Message.PasswordLockout"); this.lblErrorMessage.CssClass = "WarningMessageLoginPage"; } //2. Password is not correct else if (dtbAuthentication.Rows[0]["Password"].ToString() != txtPassword.Text) { lblErrorMessage.Text = ResourceManager.GetString("Message.LoginFailure"); this.lblErrorMessage.CssClass = "WarningMessageLoginPage"; //Password Lockout - increment login attempts for the UserID (but only if not SaltAdmin) if (((UserType)int.Parse(dtbAuthentication.Rows[0]["UserTypeID"].ToString()) != UserType.SaltAdmin) && (bool.Parse(dtbAuthentication.Rows[0]["PasswordLockout"].ToString()) == true)) { intUserID = (int)dtbAuthentication.Rows[0]["UserID"]; intLoginFailCount = int.Parse(dtbAuthentication.Rows[0]["LoginFailCount"].ToString()); intLoginFailCount++; objUser.UpdateLoginAttempts(intUserID, intLoginFailCount); } } //3. The user is has a status of inactive. else if (!(bool)dtbAuthentication.Rows[0]["Active"]) { lblErrorMessage.Text = ResourceManager.GetString("Message.LoginFailure2"); this.lblErrorMessage.CssClass = "WarningMessageLoginPage"; } else { intUserID = (int)dtbAuthentication.Rows[0]["UserID"]; intUserTypeID = (int)dtbAuthentication.Rows[0]["UserTypeID"]; // Password login successful - reset the login attempts for the // UserID back to 0 intLoginFailCount = 0; objUser.UpdateLoginAttempts(intUserID, intLoginFailCount); if (dtbAuthentication.Rows[0]["OrganisationID"] == DBNull.Value) { // The person must be a salt admin so just select the first organisation by default Organisation objOrganisation = new Organisation(); // Data table to hold the organisation details. DataTable dtbOrganisationDetails; // Get a list of all organisations dtbOrganisationDetails = objOrganisation.GetOrganisationList(); if (dtbOrganisationDetails.Rows.Count > 0) { intOrganisationID = (int)dtbOrganisationDetails.Rows[0]["OrganisationID"]; } else { intOrganisationID = 0; } } else { intOrganisationID = (int)dtbAuthentication.Rows[0]["OrganisationID"]; } objUser.LogLogin(intUserID); strOrgLog = dtbAuthentication.Rows[0]["Logo"].ToString(); if ((UserType)intUserTypeID == UserType.SaltAdmin) { blnAdvancedReporting = true; } else { blnAdvancedReporting = (bool)dtbAuthentication.Rows[0]["AdvancedReporting"]; } UserData objUserData = new UserData((UserType)intUserTypeID, intOrganisationID, strOrgLog, blnAdvancedReporting); WebSecurity.SetAuthData(intUserID.ToString(), objUserData.ToString()); if (Request.Url.Host.ToLower().Equals("127.0.0.2")) { Response.Redirect("https://127.0.0.2/Default.aspx"); } else { //Response.Redirect("http://"+Request.Url.Host+"/Default.aspx"); Response.Redirect("http://" + Request.Url.Authority + "/Default.aspx");//Modified by Joseph for local testing //Response.Redirect("http://localhost:51864/Default.aspx");//Modified by Joseph for local testing } //FormsAuthentication.RedirectFromLoginPage(strUserName, true); } } catch { string connectionString = ConfigurationSettings.AppSettings["RptConnectionString"] + "password="******"password"] + ";"; dtbAuthentication = objUser.Login228(strUserName, Request.Url.Host, connectionString); //dtbAuthentication = objUser.Login(strUserName, "demo.saltcompliance.com"); if (dtbAuthentication.Rows[0]["Password"].ToString() != txtPassword.Text) { lblErrorMessage.Text = ResourceManager.GetString("Message.LoginFailure"); this.lblErrorMessage.CssClass = "WarningMessageLoginPage"; } else { intUserID = (int)dtbAuthentication.Rows[0]["UserID"]; intUserTypeID = (int)dtbAuthentication.Rows[0]["UserTypeID"]; // Password login successful - reset the login attempts for the // UserID back to 0 intLoginFailCount = 0; if (dtbAuthentication.Rows[0]["OrganisationID"] == DBNull.Value) { // The person must be a salt admin so just select the first organisation by default Organisation objOrganisation = new Organisation(); // Data table to hold the organisation details. DataTable dtbOrganisationDetails; // Get a list of all organisations dtbOrganisationDetails = objOrganisation.GetOrganisationList228(connectionString); if (dtbOrganisationDetails.Rows.Count > 0) { intOrganisationID = (int)dtbOrganisationDetails.Rows[0]["OrganisationID"]; } else { intOrganisationID = 0; } } else { intOrganisationID = (int)dtbAuthentication.Rows[0]["OrganisationID"]; } objUser.LogLogin(intUserID); strOrgLog = dtbAuthentication.Rows[0]["Logo"].ToString(); if ((UserType)intUserTypeID == UserType.SaltAdmin) { blnAdvancedReporting = true; } else { blnAdvancedReporting = (bool)dtbAuthentication.Rows[0]["AdvancedReporting"]; } UserData objUserData = new UserData((UserType)intUserTypeID, intOrganisationID, strOrgLog, blnAdvancedReporting); WebSecurity.SetAuthData(intUserID.ToString(), objUserData.ToString()); if (Request.Url.Host.ToLower().Equals("127.0.0.2")) { Response.Redirect("https://127.0.0.2/Default.aspx"); } else { //Response.Redirect("http://"+Request.Url.Host+"/Default.aspx"); Response.Redirect("http://" + Request.Url.Authority + "/Default.aspx");//Modified by Joseph for local testing //Response.Redirect("http://localhost:51864/Default.aspx");//Modified by Joseph for local testing } //FormsAuthentication.RedirectFromLoginPage(strUserName, true); } } }
/// <summary> /// /// </summary> /// <returns></returns> public override string ToString() { return(UserData == null ? "null" : UserData.ToString()); }
private static void Set(UserData key, Type type) { var record = ""; object value = null;// = PlayerPrefs.GetFloat var oldKey = OldKey (key); var newKey = key.ToString (); record += "Updating <color=orange>'" + oldKey + "'</color> to <color=green>'" + newKey + "'</color>: "; if (PlayerPrefs.HasKey (oldKey)) { switch (type) { case Type.Float: value = PlayerPrefs.GetFloat (oldKey); break; case Type.Int: value = PlayerPrefs.GetInt (oldKey); break; case Type.String: value = PlayerPrefs.GetString (oldKey); break; default: throw new UnityException (record + "\n <color=red>FAILED: Could not be updated! </color>"); } PlayerPrefs.SetString (newKey, value.ToString ()); if (oldKey != newKey) { PlayerPrefs.DeleteKey (oldKey); record += "\n Deleting old key"; } else { record += "\n No need to delete old key"; } record += "\n<color=green>SUCCESS</color>"; } else { record += "\n<color=blue>Not updating: </color> Old Key does not exist."; } if (Bugger.WillLog(RMXTests.Patches,record)) Debug.Log (Bugger.Last); }
public static void Login(User user, int timeout = 60*24*15) { var now = DateTime.Now; var expire = now.AddMinutes(timeout); var userData = new UserData { ID = user.ID }; var ticket = new FormsAuthenticationTicket(1, user.ID.ToString(), now, expire, true, userData.ToString()); var cookie = new HttpCookie(CookieKey); cookie.Value = FormsAuthentication.Encrypt(ticket); cookie.HttpOnly = true; cookie.Expires = expire; HttpContext.Current.Response.Cookies.Add(cookie); }
//private string c_strPermissionError="An illegal action was performed or your role has been changed. You have been logged out of [APPNAME]."; //private string c_strLoginDetailsError="The login details you have entered are not correct."; //private string c_strInactiveError="Your login was not successful. Please see your Organisation Administrator."; /// <summary> /// Page load event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, System.EventArgs e) { litLogin.Text = ResourceManager.GetString("pagTitle"); txtUserName.Focus(); Organisation getorgdetails = new Organisation(); string strlnk = Request.Url.Authority.ToString(); DataTable dtorgdetails = getorgdetails.GetOrganisationwithDomainName(Request.Url.Authority.ToString()); //DataTable dtorgdetails = getorgdetails.GetOrganisationwithDomainName("demo.saltcompliance.com"); if (dtorgdetails.Rows.Count > 0) { if (dtorgdetails.Rows[0]["EnableUniqueURL"].ToString() == "True") { urlRequest.Visible = true; } else { urlRequest.Visible = false; } } if (!Page.IsPostBack) { string strRedirectUrl; strRedirectUrl = Request.QueryString["ReturnUrl"]; if (strRedirectUrl != null && strRedirectUrl.ToLower() != "/default.aspx") { //this.lblErrorMessage.Text =String.Format(ResourceManager.GetString("Message.Permission"), ApplicationSettings.AppName);//c_strPermissionError.Replace("[APPNAME]",ApplicationSettings.AppName); //this.lblErrorMessage.CssClass = "WarningMessageLoginPage";49182643 } string AutoLoginUserID, AutoLoginEncPass; AutoLoginUserID = Request.QueryString["AutoLgnUSID"]; AutoLoginEncPass = Request.QueryString["AutoLgnPass"]; if (AutoLoginUserID != null && AutoLoginEncPass != null) { User objUser = new User(); DataTable dtbAuthentication1; DataTable dtbAuthentication; int intUserID = 0; if (Request.QueryString["AutoLgnUSID"] != null) { intUserID = int.Parse(Request.QueryString["AutoLgnUSID"].ToString()); } string strPassword = Request.QueryString["AutoLgnPass"]; dtbAuthentication = objUser.GetUser(intUserID); dtbAuthentication1 = objUser.Login(dtbAuthentication.Rows[0]["UserName"].ToString(), Request.Url.Host); if (dtbAuthentication.Rows.Count > 0) { txtUserName.Text = dtbAuthentication.Rows[0]["UserName"].ToString(); txtUserName.ReadOnly = true; if (dtbAuthentication.Rows[0]["EncryptPassword"].ToString() == strPassword && bool.Parse(dtbAuthentication.Rows[0]["AccessStatus"].ToString()) == false) { objUser.UpdatePassword(intUserID, dtbAuthentication.Rows[0]["Password"].ToString(), strPassword); bool blnAdvancedReporting; string strOrgLog; string strUserName = dtbAuthentication.Rows[0]["UserName"].ToString(); int intUserTypeID, intOrganisationID, intLoginFailCount; intUserID = (int)dtbAuthentication.Rows[0]["UserID"]; intUserTypeID = (int)dtbAuthentication.Rows[0]["UserTypeID"]; // Password login successful - reset the login attempts for the // UserID back to 0 intLoginFailCount = 0; objUser.UpdateLoginAttempts(intUserID, intLoginFailCount); if (dtbAuthentication.Rows[0]["OrganisationID"] == DBNull.Value) { // The person must be a salt admin so just select the first organisation by default Organisation objOrganisation = new Organisation(); // Data table to hold the organisation details. DataTable dtbOrganisationDetails; // Get a list of all organisations dtbOrganisationDetails = objOrganisation.GetOrganisationList(); if (dtbOrganisationDetails.Rows.Count > 0) { intOrganisationID = (int)dtbOrganisationDetails.Rows[0]["OrganisationID"]; } else { intOrganisationID = 0; } } else { intOrganisationID = (int)dtbAuthentication.Rows[0]["OrganisationID"]; } objUser.LogLogin(intUserID); strOrgLog = dtbAuthentication1.Rows[0]["Logo"].ToString(); if ((UserType)intUserTypeID == UserType.SaltAdmin) { blnAdvancedReporting = true; } else { blnAdvancedReporting = (bool)dtbAuthentication1.Rows[0]["AdvancedReporting"]; } UserData objUserData = new UserData((UserType)intUserTypeID, intOrganisationID, strOrgLog, blnAdvancedReporting); WebSecurity.SetAuthData(intUserID.ToString(), objUserData.ToString()); if (Request.Url.Host.ToLower().Equals("127.0.0.2")) { Response.Redirect("https://127.0.0.2/Default.aspx"); } else { //Response.Redirect("http://"+Request.Url.Host+"/Default.aspx"); Response.Redirect("http://" + Request.Url.Authority + "/Default.aspx");//Modified by Joseph for local testing //Response.Redirect("http://localhost:51864/Default.aspx");//Modified by Joseph for local testing } } else { lblErrorMessage.Text = "Url already used!!"; lblErrorMessage.ForeColor = System.Drawing.Color.Red; } } } } }
public string ToJSON() { return(string.Format(formatJSON, ListenId, LastListen.ToFileTimeUtc(), UserData.ToString(), PublicKey.ToString())); }