public void UpdateUser(ref QI_USER_REC userRec) { using (SqlConnection awareDbConn = m_SqlHelpers.GetDbConnection(m_AwareDbConnString)) { HAR_StringEncrypter encrypter = new HAR_StringEncrypter(); string sqlText = "usp_UpdateUser"; SqlCommand sqlCmd = new SqlCommand(sqlText, awareDbConn); sqlCmd.CommandType = System.Data.CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@UserName", userRec.UserName); sqlCmd.Parameters.AddWithValue("@FacilityId", userRec.FacilityId); sqlCmd.Parameters.AddWithValue("@VerifyCode", encrypter.EncryptString(userRec.VerifyCode)); sqlCmd.Parameters.AddWithValue("@UserId", userRec.UserID); sqlCmd.ExecuteNonQuery(); awareDbConn.Close(); } }
public Guid AddUser(string UserName, Guid FacilityId, string verifyCode) { Guid guid = new Guid(); using (SqlConnection awareDbConn = m_SqlHelpers.GetDbConnection(m_AwareDbConnString)) { HAR_StringEncrypter encrypter = new HAR_StringEncrypter(); string sqlText = "usp_AddUser"; SqlCommand sqlCmd = new SqlCommand(sqlText, awareDbConn); sqlCmd.CommandType = System.Data.CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@UserName", UserName); sqlCmd.Parameters.AddWithValue("@FacilityId", FacilityId); sqlCmd.Parameters.AddWithValue("@VerifyCode", encrypter.EncryptString(verifyCode)); sqlCmd.ExecuteNonQuery(); awareDbConn.Close(); if (true == DoesUserExist(UserName, FacilityId)) { guid = GetUsersId(UserName, FacilityId); } } return(guid); }
private bool ValidateAVCodes() { bool isValid = false; HAR_StringEncrypter encrypter = new HAR_StringEncrypter(); AwareAppSettings appSettings = new AwareAppSettings(); AwareHelpers awHelpers = new AwareHelpers(appSettings.GetAwareDbConnectionString); if (true == awHelpers.AwareSecurity.VerifyUserCredentials(tboxUserName.Text, encrypter.EncryptString(tboxPassword.Text))) { isValid = true; } return(isValid); }