Exemplo n.º 1
0
        private static XmlDocument LoadConfig(SiteConfigurationItems configType)
        {
            SiteConfigurationEntity config = Instance.Get(configType);
            XmlDocument             XmlDoc = new XmlDocument();

            XmlDoc.PreserveWhitespace = true;
            XmlDoc.LoadXml(config.ModulesConfiguration);
            return(XmlDoc);
        }
Exemplo n.º 2
0
        //------------------------------------------
        #endregion

        #region --------------Update--------------
        /// <summary>
        /// Converts the Items object properties to SQL paramters and executes the update Items procedure.
        /// <example>[Example]bool  status=ItemsSqlDataPrvider.Instance.Update(itemsObject);.</example>
        /// </summary>
        /// <param name="itemsObject">The Items object.</param>
        /// <returns>The status of update query.</returns>
        public void Update(SiteConfigurationEntity config)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                SqlCommand myCommand = new SqlCommand("dbo.SiteConfiguration_Update", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                // Set the parameters
                myCommand.Parameters.Add("@ConfigID", SqlDbType.SmallInt, 2).Value          = config.ConfigID;
                myCommand.Parameters.Add("@ModulesConfiguration", SqlDbType.NVarChar).Value = config.ModulesConfiguration;
                //----------------------------------------------------------------------------------
                // Execute the command
                myConnection.Open();
                myCommand.ExecuteNonQuery();
                myConnection.Close();
                //return status;
            }
        }
Exemplo n.º 3
0
        //------------------------------------------
        #endregion

        #region --------------Get--------------
        public SiteConfigurationEntity Get(SiteConfigurationItems configID)
        {
            using (SqlConnection myConnection = GetSqlConnection())
            {
                SiteConfigurationEntity config = new SiteConfigurationEntity();
                SqlCommand myCommand           = new SqlCommand("dbo.SiteConfiguration_Get", myConnection);
                myCommand.CommandType = CommandType.StoredProcedure;
                //---------------------------------------------------------------------
                myCommand.Parameters.Add("@ConfigID", SqlDbType.SmallInt, 2).Value = (int)configID;
                //---------------------------------------------------------------------
                // Execute the command
                SqlDataReader dr;
                myConnection.Open();
                dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
                while (dr.Read())
                {
                    config = (SiteConfigurationEntity)GetEntity(dr, typeof(SiteConfigurationEntity));
                }
                dr.Close();
                myConnection.Close();
                return(config);
            }
        }