コード例 #1
0
ファイル: DatabaseConnection.cs プロジェクト: uvbs/Holodeck
        /// <summary>
        /// Adds an area by taking in an instance of an Area object.
        /// </summary>
        /// <param name="area"></param>
        public void AddArea( Area area )
        {
            string areaCommand = "INSERT " + AreaTable + " (AreaID,AreaName,ParentAreaID) VALUES('" +
                area.ID + "','" + area.Name + "','" + area.Parent + "')";

            SqlCommand cmd = new SqlCommand( areaCommand, SqlDataConnection );

            // Execute the query to add to the table the new area.
            cmd.ExecuteNonQuery( );

            return;
        }
コード例 #2
0
ファイル: DatabaseConnection.cs プロジェクト: uvbs/Holodeck
        /// <summary>
        /// Retrive an Area by its ID...
        /// </summary>
        /// <param name="ID"></param>
        public Area RetrieveArea( string ID )
        {
            string areaCommand = "SELECT * FROM " + AreaTable + " WHERE AreaID='" + ID + "'";

            SqlCommand cmd = new SqlCommand( areaCommand, SqlDataConnection );

            SqlDataReader dataReader = cmd.ExecuteReader( );

            // we only expect one row in the result set, so read that row...
            dataReader.Read( );

            Area retrievedArea = new Area( );

            retrievedArea.ID = dataReader["AreaID"].ToString( );
            retrievedArea.Name = dataReader["AreaName"].ToString( );
            retrievedArea.Parent = dataReader["ParentAreaID"].ToString( );

            dataReader.Close( );

            return retrievedArea;
        }
コード例 #3
0
ファイル: testtracker.aspx.cs プロジェクト: uvbs/Holodeck
        private void AddArea_Click(object sender, System.EventArgs e)
        {
            Area area = new Area( );
            area.Parent = TestTreeView.GetNodeFromIndex( TestTreeView.SelectedNodeIndex ).ID;
            area.Name = AreaNameToAdd.Text;

            dbConnection.AddArea( area );

            PopulateTreeview( );

            AreaInfoPanel.Visible = false;
            TestEditPanel.Visible = false;
        }