Example #1
0
        public void create(DB_objects.CheckPoint c)
        {
            SqlCommand comm = new SqlCommand("INSERT INTO check_point(name, description) VALUES(@name, @description)", myConnection);

            comm.Parameters.Add("@name", c.name);
            comm.Parameters.Add("@description", c.description);
        }
Example #2
0
        public bool update(DB_objects.CheckPoint c)
        {
            SqlCommand comm = new SqlCommand("UPDATE check_point SET name=@name, description=@description WHERE check_code=@check_code", myConnection);

            comm.Parameters.Add("@name", c.name);
            comm.Parameters.Add("@description", c.description);
            comm.Parameters.Add("@check_code", c.check_code);
            return(comm.ExecuteNonQuery() == 1);
        }
Example #3
0
        private static void fillChecks(string language, SqlConnection connection)
        {
            SqlCommand cmd = new SqlCommand("sp_connectCheck", connection);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.Add("@selectedLanguage", System.Data.SqlDbType.NVarChar).Value = language;
            SqlDataReader reader = cmd.ExecuteReader();

            DB_objects.CheckPoint cp;
            while (reader.Read())
            {
                cp = new DB_objects.CheckPoint(reader[1].ToString(), reader[2].ToString());
                cp.addAttribute(reader[3].ToString(), reader[4].ToString(), reader[5].ToString());
                checks[reader[0].ToString()] = cp;
            }
            reader.Close();
        }
Example #4
0
        public List <DB_objects.CheckPoint> retrieve()
        {
            List <DB_objects.CheckPoint> result = new List <DB_objects.CheckPoint>();
            SqlCommand comm = new SqlCommand("SELECT check_code, name, description " +
                                             "FROM check_point ", myConnection);
            SqlDataReader reader = comm.ExecuteReader();

            DB_objects.CheckPoint c;
            while (reader.Read())
            {
                c             = new DB_objects.CheckPoint();
                c.check_code  = Int32.Parse(reader[0].ToString());
                c.name        = reader[1].ToString();
                c.description = reader[2].ToString();
                result.Add(c);
            }
            reader.Close();
            return(result);
        }
Example #5
0
        public List <DB_objects.CheckPoint> getAvailableChecks(int scenario_code, string selection)
        {
            List <DB_objects.CheckPoint> result = new List <DB_objects.CheckPoint>();
            SqlCommand comm = new SqlCommand("SELECT check_code, name, description " +
                                             "FROM check_point " +
                                             "WHERE check_code NOT IN " + selection, myConnection);

            comm.Parameters.Add("@scenario_code", scenario_code);

            SqlDataReader reader = comm.ExecuteReader();

            DB_objects.CheckPoint cp;
            while (reader.Read())
            {
                cp             = new DB_objects.CheckPoint();
                cp.check_code  = Int32.Parse(reader[0].ToString());
                cp.name        = reader[1].ToString();
                cp.description = reader[2].ToString();
                result.Add(cp);
            }
            reader.Close();
            return(result);
        }