public SetSecuritySettings() { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_SystemSetting_b3_Security_Set @MinPassword , @PrevPasswordReuse , @PasswordLockedAttmp, @NPasswordDaysExp , @MaximumMachineLoginLimit , @UsePasswordComplexity , @LogoutInactivity", sc)) { cmd.Parameters.AddWithValue("MinPassword", GetSecuritySettings.MinPasswordLength); cmd.Parameters.AddWithValue("PrevPasswordReuse", GetSecuritySettings.PrevPasswordReuseN); cmd.Parameters.AddWithValue("PasswordLockedAttmp", GetSecuritySettings.PrevPasswordLockoutAttempts); cmd.Parameters.AddWithValue("NPasswordDaysExp", GetSecuritySettings.NPasswordsExpireDays); cmd.Parameters.AddWithValue("MaximumMachineLoginLimit", GetSecuritySettings.MaximumMachineLoginLimit); cmd.Parameters.AddWithValue("UsePasswordComplexity", GetSecuritySettings.UsePasswordComplexity); cmd.Parameters.AddWithValue("LogoutInactivity", GetSecuritySettings.LogoutInactivity); cmd.ExecuteNonQuery(); //or you could try this if did not work } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
//WriteLog.WriteLog_("", userName, "Login successfull"); public static void WriteLog_(string userName, string CurrentUserLogIn, string action, string MacAddress, string settings) { SqlConnection sc = GetSQLConnection.get(); //Lets record this on auditlog table sc.Open(); if (string.IsNullOrEmpty(CurrentUserLogIn) == false) { SqlCommand cmd = new SqlCommand("exec usp_config_b3_security_writeLog @CurrentUserLogin = @CurrentUserLogin_ , @Action = '" + action + "', @MacAddress = '" + MacAddress + "', @UserName = @User_Name", sc); cmd.Parameters.AddWithValue("CurrentUserLogin_", CurrentUserLogIn); cmd.Parameters.AddWithValue("User_Name", userName); cmd.ExecuteNonQuery(); } else { SqlCommand cmd = new SqlCommand("exec usp_config_b3_security_writeLog @CurrentUserLogin = @CurrentUserLogin_ , @Action = '" + action + "', @MacAddress = '" + MacAddress + "'", sc); cmd.Parameters.AddWithValue("CurrentUserLogin_", CurrentUserLogIn); cmd.ExecuteNonQuery(); } sc.Close(); }
public GetNDSettings() { SqlConnection sc = GetSQLConnection.get(); try { //The SP will be deleted. Do not use this SP. sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_management_SystemSettings_GetNDSettings", sc)) { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { m_SalesMode = reader.GetBoolean(0); m_PayerPinLength = reader.GetInt32(1); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } finally { sc.Close(); } }
public void RunSQL() { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"usp_management_SystemSettings_SetNDSettings @SalesMode, @PlayerPinLength ", sc)) { cmd.Parameters.AddWithValue("SalesMode", m_SalesMode); cmd.Parameters.AddWithValue("PlayerPinLength", m_PlayerPinLength); cmd.ExecuteNonQuery(); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } finally { sc.Close(); } }
//This will get the current setting in the DB public GetSecuritySettings() { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_SystemSetting_b3_Security_Get", sc)) { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { MinPasswordLength = reader.GetInt32(0); PrevPasswordReuseN = reader.GetInt32(1); PrevPasswordLockoutAttempts = reader.GetInt32(2); NPasswordsExpireDays = reader.GetInt32(3); MaximumMachineLoginLimit = reader.GetInt32(4); UsePasswordComplexity = reader.GetBoolean(5); LogoutInactivity = reader.GetInt32(6); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
public static string GetBallFreqFor76Games(DateTime?PlayTime, int AccountNumber) { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_management_DisputeResolution_GetSpiritBallFreq @spPlayTime = @PlayTime ,@spAcctNumber = @AccountNumber ", sc)) { cmd.Parameters.AddWithValue("PlayTime", PlayTime); cmd.Parameters.AddWithValue("AccountNumber", AccountNumber); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { BallFreq = reader.GetString(0); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } return(BallFreq); }
public static int getTotalWinForDualAccount(int AcctNumber, string B4Games, DateTime?GameNumber) { SqlConnection sc = GetSQLConnection.get(); sc.Open(); int result = 0; try { using (SqlCommand cmd = new SqlCommand(@"exec usp_management_DisputeResolution_GetAmountWinForDoubleAccounting @spAcctNumber = @AcctNumber, @spB4Games = @B4Games, @spGameNumber = @GameNumber", sc)) { cmd.Parameters.AddWithValue("AcctNumber", AcctNumber); cmd.Parameters.AddWithValue("B4Games", B4Games); cmd.Parameters.AddWithValue("GameNumber", GameNumber); result = (int)cmd.ExecuteScalar(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } TotalWinForDA = result; return(result); }
//public string gamenum1 //{ // get { return GameNum1; } // set { GameNum1 = value; } //} //public string gamenum2 //{ // get { return GameNum2; } // set { GameNum2 = value; } //} //public string gamenum3 //{ // get { return GameNum3; } // set { GameNum3 = value; } //} //public string gamenum4 //{ // get { return GameNum4; } // set { GameNum4 = value; } //} //public string gamenum5 //{ // get { return GameNum5; } // set { GameNum5 = value; } //} //public string gamenum6 //{ // get { return GameNum6; } // set { GameNum6 = value; } //} //public string gamenum7 //{ // get { return GameNum7; } // set { GameNum7 = value; } //} //public string gamenum8 //{ // get { return GameNum8; } // set { GameNum8 = value; } //} public GetPlayerSettings() { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_management_SystemSettings_GetPlayerSettings", sc)) { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { ScreenCursor = reader.GetString(0); CalibrateTouch = reader.GetString(1); Disclaimer = reader.GetString(2); AnnounceCall = reader.GetString(3); PressToCollect = reader.GetString(4); TimeToCollect = reader.GetInt32(5); MainVolume = reader.GetInt32(6); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
public GetGameSettings() { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_SystemSetting_b3_Games_Get", sc)) { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { MinNumberOfPlayers = reader.GetInt32(0); CountDownTimer = reader.GetInt32(1); ConsolationPrize = (int)reader.GetInt64(2); GameRecalPasswords = reader.GetString(3); WaitCountDownForOtherPLayers = reader.GetInt32(4); m_GameThreads = reader.GetInt32(5); HandpayByPattern = reader.GetBoolean(6); RfRequiredForPlay = reader.GetInt32(7); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
/// <summary> /// Get the current user's loginID /// Assign value for LoginID /// </summary> /// <returns>LoginID</returns> public int Get(string username) { int loginID = 0; SqlConnection sc = GetSQLConnection.get(); sc.Open(); try { using (SqlCommand cmd = new SqlCommand(@"select LoginID from dbo.B3_Login where UserName = @UserName", sc)) { cmd.Parameters.AddWithValue("UserName", username); loginID = (int)cmd.ExecuteScalar(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } LoginID = loginID; //OR return(loginID); //OR }
public static int GetBonusPatternNForJailBreak(DateTime?PlayTime, int AccountNumber) { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"select BonusTrigger from [dbo].[JailBreak_GameJournal] where recdatetime = @PlayTime and creditacctnum = @AccountNumber ", sc)) { cmd.Parameters.AddWithValue("PlayTime", PlayTime); cmd.Parameters.AddWithValue("AccountNumber", AccountNumber); BonusPatterNJailBreak = (int)cmd.ExecuteScalar(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } return(BonusPatterNJailBreak); }
public static void GetHotBall(DateTime?PlayTime, int AccountNumber) { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_management_DisputeResolution_GetHotBall @spPlayTime = @PlayTime ,@spAcctNumber = @AccountNumber ", sc)) { cmd.Parameters.AddWithValue("PlayTime", PlayTime); cmd.Parameters.AddWithValue("AccountNumber", AccountNumber); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { HotBall = Convert.ToInt32(reader.GetByte(0)); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
public SetGameSettingsMayaMoney() { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"Exec usp_GameSettings_MayaMoney_Set @spmaxcards ,@spmaxbetlevel ,@spmaxpatterns ,@spmaxcalls ,@spcallspeed_min ,@spcallspeed_max ,@spautocall ,@spautoplay ,@spdenom_1 ,@spdenom_5 ,@spdenom_10 ,@spdenom_25 ,@spdenom_50 ,@spdenom_100 ,@spdenom_200 ,@spdenom_500 ,@sphidecardserialnum " , sc)) { //GetGameSettingsMayaMoney cmd.Parameters.AddWithValue("spmaxcards", GetGameSettingsMayaMoney.maxcards); cmd.Parameters.AddWithValue("spmaxbetlevel", GetGameSettingsMayaMoney.maxbetlevel); cmd.Parameters.AddWithValue("spmaxpatterns", GetGameSettingsMayaMoney.maxpatterns); cmd.Parameters.AddWithValue("spmaxcalls", GetGameSettingsMayaMoney.maxcalls); cmd.Parameters.AddWithValue("spcallspeed_min", GetGameSettingsMayaMoney.callspeed_min); cmd.Parameters.AddWithValue("spcallspeed_max", GetGameSettingsMayaMoney.callspeed_max); cmd.Parameters.AddWithValue("spautocall", GetGameSettingsMayaMoney.autocall); cmd.Parameters.AddWithValue("spautoplay ", GetGameSettingsMayaMoney.autoplay); cmd.Parameters.AddWithValue("spdenom_1", GetGameSettingsMayaMoney.denom_1); cmd.Parameters.AddWithValue("spdenom_5", GetGameSettingsMayaMoney.denom_5); cmd.Parameters.AddWithValue("spdenom_10", GetGameSettingsMayaMoney.denom_10); cmd.Parameters.AddWithValue("spdenom_25", GetGameSettingsMayaMoney.denom_25); cmd.Parameters.AddWithValue("spdenom_50", GetGameSettingsMayaMoney.denom_50); cmd.Parameters.AddWithValue("spdenom_100", GetGameSettingsMayaMoney.denom_100); cmd.Parameters.AddWithValue("spdenom_200", GetGameSettingsMayaMoney.denom_200); cmd.Parameters.AddWithValue("spdenom_500", GetGameSettingsMayaMoney.denom_500); cmd.Parameters.AddWithValue("sphidecardserialnum", GetGameSettingsMayaMoney.hidecardserialnum); cmd.ExecuteNonQuery(); //cmd.ExecuteNonQuery(); //or you could try this if did not work } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
public GetCardNumber2(int CardNumber) { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec rptCardImages @startid = @startid_ ,@endid = @endid_ ", sc)) { cmd.Parameters.AddWithValue("startid_", CardNumber); cmd.Parameters.AddWithValue("endid_", CardNumber); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { CardNum1 = reader.GetByte(1); CardNum2 = reader.GetByte(2); CardNum3 = reader.GetByte(3); CardNum4 = reader.GetByte(4); CardNum5 = reader.GetByte(5); CardNum6 = reader.GetByte(6); CardNum7 = reader.GetByte(7); CardNum8 = reader.GetByte(8); CardNum9 = reader.GetByte(9); CardNum10 = reader.GetByte(10); CardNum11 = reader.GetByte(11); CardNum12 = reader.GetByte(12); CardNum13 = reader.GetByte(13); CardNum14 = reader.GetByte(14); CardNum15 = reader.GetByte(15); CardNum16 = reader.GetByte(16); CardNum17 = reader.GetByte(17); CardNum18 = reader.GetByte(18); CardNum19 = reader.GetByte(19); CardNum20 = reader.GetByte(20); CardNum21 = reader.GetByte(21); CardNum22 = reader.GetByte(22); CardNum23 = reader.GetByte(23); CardNum24 = reader.GetByte(24); CardNum25 = reader.GetByte(25); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
public static void Set(List <string> activeGameList) { string[] gamesArray = new string[12]; Array.Copy(activeGameList.ToArray(), 0, gamesArray, 0, activeGameList.Count); SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_management_SetActiveGames @gameicon_1 ,@gameicon_2 ,@gameicon_3 ,@gameicon_4 ,@gameicon_5 ,@gameicon_6 ,@gameicon_7 ,@gameicon_8 ,@gameicon_9 ,@gameicon_10 ,@gameicon_11 ,@gameicon_12" , sc)) { cmd.Parameters.AddWithValue("gameicon_1", string.IsNullOrEmpty(gamesArray[0]) ? string.Empty : gamesArray[0]); cmd.Parameters.AddWithValue("gameicon_2", string.IsNullOrEmpty(gamesArray[1]) ? string.Empty : gamesArray[1]); cmd.Parameters.AddWithValue("gameicon_3", string.IsNullOrEmpty(gamesArray[2]) ? string.Empty : gamesArray[2]); cmd.Parameters.AddWithValue("gameicon_4", string.IsNullOrEmpty(gamesArray[3]) ? string.Empty : gamesArray[3]); cmd.Parameters.AddWithValue("gameicon_5", string.IsNullOrEmpty(gamesArray[4]) ? string.Empty : gamesArray[4]); cmd.Parameters.AddWithValue("gameicon_6", string.IsNullOrEmpty(gamesArray[5]) ? string.Empty : gamesArray[5]); cmd.Parameters.AddWithValue("gameicon_7", string.IsNullOrEmpty(gamesArray[6]) ? string.Empty : gamesArray[6]); cmd.Parameters.AddWithValue("gameicon_8", string.IsNullOrEmpty(gamesArray[7]) ? string.Empty : gamesArray[7]); cmd.Parameters.AddWithValue("gameicon_9", string.IsNullOrEmpty(gamesArray[8]) ? string.Empty : gamesArray[8]); cmd.Parameters.AddWithValue("gameicon_10", string.IsNullOrEmpty(gamesArray[9]) ? string.Empty : gamesArray[9]); cmd.Parameters.AddWithValue("gameicon_11", string.IsNullOrEmpty(gamesArray[10]) ? string.Empty : gamesArray[10]); cmd.Parameters.AddWithValue("gameicon_12", string.IsNullOrEmpty(gamesArray[11]) ? string.Empty : gamesArray[11]); cmd.ExecuteNonQuery(); //or you could try this if did not work } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
public int Get(string userName) { int N = 0; //Lets ge the LoginID instead GetCurrentIDPerUser x = new GetCurrentIDPerUser(); int LoginID = x.Get(userName); SqlConnection sc = GetSQLConnection.get(); sc.Open(); try { using (SqlCommand cmd = new SqlCommand(@"select [dbo].[B3_fnGetNAttemptLogin](@spLoginID)", sc)) { cmd.Parameters.AddWithValue("spLoginID", LoginID); N = (int)cmd.ExecuteScalar(); //if its 0 then lets update the db SqlCommand cmd2 = new SqlCommand("Update dbo.B3_Login set NOfLoginAttempt = 0 where LoginID = " + LoginID, sc); cmd2.ExecuteNonQuery(); /* --> I dont think this is supported in SQL 2005 * cmd.CommandType = CommandType.StoredProcedure; * cmd.Parameters.AddWithValue("@spLoginID", LoginID); * SqlParameter outPutParameter = new SqlParameter(); * outPutParameter.ParameterName = "@spNoOfAttempt"; * outPutParameter.SqlDbType = System.Data.SqlDbType.Int; * outPutParameter.Direction = System.Data.ParameterDirection.Output; * cmd.Parameters.Add(outPutParameter); * cmd.ExecuteNonQuery(); * string Test = outPutParameter.Value.ToString(); */ //cmd.Parameters.AddWithValue("UserName", userName); // N = (int)cmd.ExecuteScalar(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } nLoginAttempt = N; return(N); }
/// <summary> /// Unlock this user's if it is already passed 30 minutesfrom the time he was locked out. /// The time for how long the user is unlock is hardcoded on the sqlSP script. /// </summary> /// <param name="LoginID">User's LoginID</param> /// <returns>Returns true if the time from being locked is equal or greater than 30 min else return false</returns> public static bool YesNo(int LoginID) { SqlConnection sc = GetSQLConnection.get(); sc.Open(); bool IsUserUnlock = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnAutoUnlockUser(@LoginID)", sc)) { cmd.Parameters.AddWithValue("LoginID", LoginID); //this is the currentSelectedUserLoginID IsUserUnlock = Convert.ToBoolean(cmd.ExecuteScalar()); //(bool)cmd.ExecuteScalar(); } sc.Close(); return(IsUserUnlock); }
public static bool GetStatus(string B4Games, int GameNumber, DateTime?PlayTime) { SqlConnection sc = GetSQLConnection.get(); sc.Open(); bool isClass2 = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckClass2(@B4Games, @GameNumber, @PlayTime)", sc)) //Password is case sensitive { cmd.Parameters.AddWithValue("@B4Games", B4Games); //this is the currentSelectedUserLoginID cmd.Parameters.AddWithValue("@GameNumber", GameNumber); cmd.Parameters.AddWithValue("@PlayTime", PlayTime); isClass2 = Convert.ToBoolean(cmd.ExecuteScalar()); //(bool)cmd.ExecuteScalar(); } sc.Close(); return(isClass2); }
public static void GetBonusBallCall_(DateTime?PlayTime, string B4_Games, int AccountNumber, int BallCallCount) { BonusBallCall = string.Empty; SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_management_DisputeResolution_GetBonusBallCall @spPlayTime = @PlayTime ,@spB4Games = @B4_Games ,@spAcctNumber = @AccountNumber ,@spBallCallCount = @BallCallCount ", sc)) { cmd.Parameters.AddWithValue("PlayTime", PlayTime); cmd.Parameters.AddWithValue("B4_Games", B4_Games); cmd.Parameters.AddWithValue("AccountNumber", AccountNumber); cmd.Parameters.AddWithValue("BallCallCount", BallCallCount); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { BonusBallCall = reader.GetString(0); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } if (B4_Games == "WildBall") { //Lets get the first number BonusBallCall = BonusBallCallWildBall(BonusBallCall); } }
//Lets get the current CrazyBout Setting in DB public GetGameSettingsCrazyBout() { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_GameSettings_CrazyBout_Get", sc)) { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { maxcards = reader.GetInt32(0); maxbetlevel = reader.GetInt32(1); maxpatterns = reader.GetInt32(2); maxcalls = reader.GetInt32(3); maxpatterns_bonus = reader.GetInt32(4); maxcalls_bonus = reader.GetInt32(5); callspeed_min = reader.GetInt32(6); callspeed_max = reader.GetInt32(7); autocall = reader.GetString(8); autoplay = reader.GetString(9); denom_1 = reader.GetString(10); denom_5 = reader.GetString(11); denom_10 = reader.GetString(12); denom_25 = reader.GetString(13); denom_50 = reader.GetString(14); denom_100 = reader.GetString(15); denom_200 = reader.GetString(16); denom_500 = reader.GetString(17); singleofferbonus = reader.GetString(18); hidecardserialnum = reader.GetString(19); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
/// <summary> /// Get the current user's status for lock due to attempt login /// </summary> /// <returns>True or false if the user is currently locked due to attempt login.</returns> public static bool YesNo() { SqlConnection sc = GetSQLConnection.get(); sc.Open(); bool IsUserLocked = false; using (SqlCommand cmd = new SqlCommand(@"select count(*) from dbo.B3_Login where UserName = @UserName and LockedDueToLoginFailedAttempt = 'T' ", sc))//Password is case sensitive { cmd.Parameters.AddWithValue("UserName", CurrentUserLogged.LoggedUser); IsUserLocked = (int)cmd.ExecuteScalar() == 1; //Having issue with case sensitivity } sc.Close(); return(IsUserLocked); }
public static void WriteLogWithUMacAddress(string MacAddressChanged, string CurrentUserLogIn, string action, string MacAddress, string settings, string OldValue, string NewValue) { SqlConnection sc = GetSQLConnection.get(); //Lets record this on auditlog table sc.Open(); if (string.IsNullOrEmpty(CurrentUserLogIn) == false) { SqlCommand cmd = new SqlCommand (@"exec usp_config_b3_security_writeLog @CurrentUserLogin = @CurrentUserLogin_ , @Action = '" + action + "', @OldPassword = '******', @NewPassword = '******', @MacAddress = '" + MacAddress + "', @UserName = @User_Name , @Settings = '" + settings + "'", sc); cmd.Parameters.AddWithValue("CurrentUserLogin_", CurrentUserLogIn); cmd.Parameters.AddWithValue("User_Name", MacAddressChanged); cmd.ExecuteNonQuery(); } sc.Close(); }
public static bool IsPasswordReusable_(int LoginID, string password) { SqlConnection sc = GetSQLConnection.get(); sc.Open(); bool IsPasswordReusable = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckReusepassword(@LoginID, @Password)", sc)) //Password is case sensitive { cmd.Parameters.AddWithValue("LoginID", LoginID); //this is the currentSelectedUserLoginID cmd.Parameters.AddWithValue("Password", password); IsPasswordReusable = Convert.ToBoolean(cmd.ExecuteScalar()); //(bool)cmd.ExecuteScalar(); //Having issue with case sensitivity } sc.Close(); return(IsPasswordReusable); }
public static RecoverAccountStatus Recover(int accountNumber) { var status = RecoverAccountStatus.UnknownError; SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_server_RecoverOrphanedAccount @creditAccount" , sc)) { cmd.Parameters.AddWithValue("creditAccount", accountNumber); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { var value = reader.GetInt32(0); if (Enum.IsDefined(typeof(RecoverAccountStatus), value)) { status = (RecoverAccountStatus)value; } else { status = RecoverAccountStatus.UnknownError; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } return(status); }
public static bool IsPasswordCorrect_(string password) { SqlConnection sc = GetSQLConnection.get(); sc.Open(); bool IsPasswordCorrect = false; using (SqlCommand cmd = new SqlCommand(@"select count(*) from dbo.B3_Login where UserName = @UserName and [UserPassword] COLLATE SQL_Latin1_General_CP1_CS_AS = @UserPassword", sc))//Password is case sensitive { cmd.Parameters.AddWithValue("UserName", CurrentUserLogged.LoggedUser); cmd.Parameters.AddWithValue("UserPassword", password); IsPasswordCorrect = (int)cmd.ExecuteScalar() == 1; //Having issue with case sensitivity } sc.Close(); return(IsPasswordCorrect); }
public string Get() { SqlConnection sc = GetSQLConnection.get(); sc.Open(); try { using (SqlCommand cmd = new SqlCommand(@"select UserPassword from dbo.B3_Login where UserName = @UserName", sc)) { cmd.Parameters.AddWithValue("UserName", CurrentUserLogged.LoggedUser); UserPassword = cmd.ExecuteScalar().ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } return(UserPassword); }
public SetGameSettings() { SqlConnection sc = GetSQLConnection.get(); try { sc.Open(); using (SqlCommand cmd = new SqlCommand(@"exec usp_SystemSetting_b3_Game_Set @spMinPlayer , @spConsolationPrize , @spCountdownTimer ,@spGamePasswordRecall ,@spWaitCountdownTimerForOtherPlayers ,@handpayByPattern ,@rfRequiredForPlay" , sc)) { cmd.Parameters.AddWithValue("spMinPlayer", GetGameSettings.MinNumberOfPlayers); cmd.Parameters.AddWithValue("spConsolationPrize", GetGameSettings.ConsolationPrize); //GetSecuritySettings.PrevPasswordReuseN); cmd.Parameters.AddWithValue("spCountdownTimer", GetGameSettings.CountDownTimer); //GetSecuritySettings.PrevPasswordLockoutAttempts); cmd.Parameters.AddWithValue("spGamePasswordRecall", GetGameSettings.GameRecalPasswords); cmd.Parameters.AddWithValue("spWaitCountdownTimerForOtherPlayers", GetGameSettings.WaitCountDownForOtherPLayers); cmd.Parameters.AddWithValue("handpayByPattern", GetGameSettings.HandpayByPattern); cmd.Parameters.AddWithValue("rfRequiredForPlay", GetGameSettings.RfRequiredForPlay); cmd.ExecuteNonQuery(); //or you could try this if did not work } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } }
public static bool getDualAccountSettings() { SqlConnection sc = GetSQLConnection.get(); sc.Open(); string result = ""; try { using (SqlCommand cmd = new SqlCommand(@"select doubleaccount from [dbo].[B3_SystemConfig]", sc)) { result = (string)cmd.ExecuteScalar(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc.Close(); } bool returnValue; if (result == "T") { returnValue = true; } else { returnValue = false; } DualAccountSettings = returnValue; return(returnValue); }
//public static bool NDSettingsPermission(int LoginID) //{ // SqlConnection sc2 = GetSQLConnection.get(); // string sqlResult = "F"; // try // { // sc2.Open();//a select command that will return char or string // using (SqlCommand cmd = new SqlCommand("select [ND Settings] from [dbo].[B3_Login] where LoginID = @LoginID", sc2)) // { // cmd.Parameters.AddWithValue("@LoginID", LoginID); // sqlResult = cmd.ExecuteScalar().ToString(); // } // } // catch (Exception ex) // { // MessageBox.Show(ex.Message); // } // finally // { // sc2.Close(); // } // bool result = false; // if (sqlResult == "T") // { // result = true; // } // else // { // result = false; // } // return result; //} public static bool UserAccessPermission(int LoginID) { SqlConnection sc2 = GetSQLConnection.get(); string sqlResult = "F"; try { sc2.Open();//a select command that will return char or string using (SqlCommand cmd = new SqlCommand("select PermitClientAccessControl from [dbo].[B3_Login] where LoginID = @LoginID", sc2)) { cmd.Parameters.AddWithValue("@LoginID", LoginID); sqlResult = cmd.ExecuteScalar().ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { sc2.Close(); } bool result = false; if (sqlResult == "T") { result = true; } else { result = false; } return(result); }
public static bool IWC_(string NDubbed) { SqlConnection sc = GetSQLConnection.get(); sc.Open(); bool result = false; bool _result; if (result == false) { foreach (string patterns in TinyPyramid) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Tiny Pyramid"; } else { WinPattern = WinPattern + "Tiny Pyramid"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in AnyLines) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Any Line"; } else { WinPattern = WinPattern + "Any Line"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in CrazyStamps) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Crazy Stamp"; } else { WinPattern = WinPattern + "Crazy Stamp"; } result = _result; // break; } } } if (result == false) { ASP asp = new ASP(); foreach (string patterns in AnySixPack) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Any Six Pack"; } else { WinPattern = WinPattern + "Any Sick Pack"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in FourCorners) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Four Corners"; } else { WinPattern = WinPattern + "Four Corners"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in SmallX) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Small X"; } else { WinPattern = WinPattern + "Small X"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in Flower) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Flower"; } else { WinPattern = WinPattern + "Flower"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in Star) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Star"; } else { WinPattern = WinPattern + "Star"; } result = _result; // break; } } } if (result == false) { Pyramid_ p = new Pyramid_(); foreach (string patterns in Pyramid) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Pyramid"; } else { WinPattern = WinPattern + "Pyramid"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in Steps) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Steps"; } else { WinPattern = WinPattern + "Steps"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in Sun) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Sun"; } else { WinPattern = WinPattern + "Sun"; } result = _result; // break; } } } if (result == false) { foreach (string patterns in GreatPyramid) { _result = false; using (SqlCommand cmd = new SqlCommand(@"select dbo.b3_fnCheckCardIfWin(@DubbedN, @Pattern)", sc)) { cmd.Parameters.AddWithValue("DubbedN", NDubbed); cmd.Parameters.AddWithValue("Pattern", patterns); _result = Convert.ToBoolean(cmd.ExecuteScalar()); } if (_result == true) { if (WinPattern.Length > 1) { WinPattern = WinPattern + " ,Great Pyramid"; } else { WinPattern = WinPattern + "Great Pyramid"; } result = _result; // break; } } } Result = result; return(result); }