Beispiel #1
0
 public void SaveUserStatePolicy(int userID, StatePolicy policy)
 {
     dbConnection.CheckInput(policy.GetStateString());
     string [] valuesNames = { "@idParam", "@stateParam" };
     object[]  values      = { userID, policy.GetStateString() };
     dbConnection.InsertTable("StatePolicy", "SystemID,State", valuesNames, values);
 }
Beispiel #2
0
        private StatePolicy[] LoadUserStatePolicy(int userID)
        {
            List <StatePolicy> loadedStatesPolicies = new List <StatePolicy>();

            using (var dbReader = dbConnection.SelectFromTableWithCondition("StatePolicy", "State", "SystemID = " + userID))
            {
                while (dbReader.Read())
                {
                    StatePolicy.State state = StatePolicy.GetStateFromString(dbReader.GetString(0));
                    loadedStatesPolicies.Add(new StatePolicy(state));
                }
            }
            return(loadedStatesPolicies.ToArray());
        }