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

mac2022-06-30  22

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 : CSApplicationData7.后台设置页面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

转载于:https://www.cnblogs.com/Elong/archive/2007/07/04/805822.html

最新回复(0)