public bool approveUsers(int id, string tableName, string type) { try { SqlConnection sqlConnection = ConnectionHandler.GetConnection(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlConnection; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.CommandText = "ApproveUsers"; sqlCommand.Parameters.AddWithValue("@id", id); sqlCommand.Parameters.AddWithValue("@table", tableName); sqlCommand.Parameters.AddWithValue("@type", type); SqlDataAdapter sqlDataAdaper = new SqlDataAdapter(sqlCommand); DataTable dt = new DataTable(); sqlDataAdaper.Fill(dt); if (dt.Rows.Count > 0) { if (!dt.Rows[0][0].ToString().Contains("Fail")) { return(true); } else { return(false); } } else { return(false); } } catch (Exception ex) { return(false); } }
//Super User Acceptance public void DALSuperUserAcceptance(string userId, bool response) { SqlConnection _sqlConnection = ConnectionHandler.GetConnection(); SqlCommand _sqlCommand = new SqlCommand("DALSuperUserAcceptance", _sqlConnection); _sqlCommand.CommandType = CommandType.StoredProcedure; _sqlCommand.Parameters.Add("@userId", SqlDbType.VarChar).Value = userId; _sqlCommand.Parameters.Add("@isActive", SqlDbType.Bit).Value = response; try { _sqlConnection.Open(); if (_sqlConnection.State == ConnectionState.Open) { _sqlCommand.ExecuteNonQuery(); } } catch (Exception ex) { } finally { _sqlConnection.Close(); } }
public BusinessBase() { db = new ConnectionHandler(); }