using System.Text;
|
using System.Reflection;
|
using System.IO;
|
using HotelPms.Share.Util;
|
|
namespace HotelPms.Share.Data.Script;
|
|
public class ResourceFile
|
{
|
public enum ResType : int
|
{
|
SP_GetCreateTableScript = 0,
|
SP_CloseDBConnect,
|
}
|
|
public static string GetName(ResType type)
|
{
|
string name = string.Empty;
|
switch (type)
|
{
|
case ResType.SP_GetCreateTableScript:
|
case ResType.SP_CloseDBConnect:
|
name = string.Format("HotelPms.Share.Data.Script.MsSql.{0}.sql", type.ToString());
|
break;
|
}
|
return name;
|
}
|
|
public static string GetScript(ResType type)
|
{
|
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetName(type));
|
byte[] data = CConvert.ToBytes(stream);
|
return Encoding.Default.GetString(data);
|
}
|
}
|