自定义一个新类型的应用所涉及到的

1.更新脚本(cs_Default.sql)或者在数据库中执行

--增加TravelIS应用类型
if not exists( select * from cs_ApplicationType where ApplicationType = 12 )
 insert into cs_ApplicationType values( 12, 'TravelIS')
--增加CrmIS应用类型 
if not exists( select * from cs_ApplicationType where ApplicationType = 13 )
 insert into cs_ApplicationType values( 13, 'Crm')
2。修改CommunityServerComponents20\Enumerations\ApplicationType.cs

3.CommunityServer.config
  <Applications>
        <add type = "Tripal.Web.Community.Travel.Components.ForumApplication, Tripal.Web.Community.Travel"  />
  </Applications>
    <TravelForums>
      <AttachmentSettings
              enableFileSystemStorage="true" fileSystemStorageLocation="~/Travel/storage"
              enableDataStoreStorage="false"  enableDirectLinks="true" />
    </TravelForums>

4. public class ForumConfiguration : ApplicationConfiguration
{
      protected override string ConfigSection
     {
         get { return "CommunityServer/TravelForums"; }
     }
     public override ApplicationType ApplicationType
     {
         get { return ApplicationType.Forum; }
     }

}

5.ApplicationSet.
6.ForumApplication : CSApplicationData
7.后台设置页面
8.AppLocation

9.
      #region ApplicationSettings

        public override void CreateUpdateApplicationConfigurationSettings(ApplicationType appType, object obj)
        {
            using( SqlConnection connection = GetSqlConnection() )
            {
                SqlCommand command = new SqlCommand( this.databaseOwner + ".cs_ApplicationConfigurationSettings_CreateUpdate", connection);

                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.Add(this.SettingsIDParameter());
                command.Parameters.Add("@ApplicationType", SqlDbType.SmallInt, 4).Value = appType;
                command.Parameters.Add("@Settings", SqlDbType.NText).Value = Serializer.ConvertToString(obj);
                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            }

        }

        public override object GetApplicationConfigurationSettings(ApplicationType appType, Type objectType)
        {
            //cs_ApplicationConfigurationSettings_Get
            using( SqlConnection connection = GetSqlConnection() )
            {
                SqlCommand command = new SqlCommand( this.databaseOwner + ".cs_ApplicationConfigurationSettings_Get", connection);

                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.Add(this.SettingsIDParameter());
                command.Parameters.Add("@ApplicationType", SqlDbType.SmallInt, 4).Value = appType;
               
                connection.Open();
                string xml = command.ExecuteScalar() as string;
                connection.Close();
                return Serializer.ConvertToObject(xml,objectType);

            }
        }


        #endregion

posted @ 2007-07-04 16:00  烈马狂生  阅读(207)  评论(0编辑  收藏  举报