90 lines
2.5 KiB
C#
90 lines
2.5 KiB
C#
using Sarand.BusinessMgr.Net.Standard.Base.Helpers;
|
|
using Sarand.Net.Standard.Base.Helpers;
|
|
using System.Reflection;
|
|
using System;
|
|
using Sarand.Net.Standard.Base.Utils;
|
|
|
|
namespace Sarand.BusinessMgr.Web.Control.Helpers
|
|
{
|
|
//=======================================================================
|
|
public static class SbmcResourceHelper
|
|
{
|
|
//-------------------------------------------------------------------
|
|
// Definitions.
|
|
public enum TextResource
|
|
{
|
|
// Email stylesheets.
|
|
Email_Main_Css,
|
|
// Email partial content.
|
|
Email_Header_Html,
|
|
Email_Footer_Html,
|
|
// Email templates.
|
|
Email_RequestPassword_Html,
|
|
}
|
|
public enum ImageResource
|
|
{
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Properties.
|
|
public static Assembly Assembly { get { return typeof(SacsResourceHelper).GetTypeInfo().Assembly; } }
|
|
|
|
//-------------------------------------------------------------------
|
|
// Text resources.
|
|
public static String GetResourceText(TextResource textResource)
|
|
{
|
|
String partialPath = "";
|
|
String resourceFilename = "";
|
|
switch (textResource)
|
|
{
|
|
// Email stylesheet.
|
|
case TextResource.Email_Main_Css:
|
|
resourceFilename = "sbmc-email-main.css";
|
|
break;
|
|
// Email partial content.
|
|
case TextResource.Email_Header_Html:
|
|
resourceFilename = "sbmc-email-header.html";
|
|
break;
|
|
case TextResource.Email_Footer_Html:
|
|
resourceFilename = "sbmc-email-footer.html";
|
|
break;
|
|
// Email templates.
|
|
case TextResource.Email_RequestPassword_Html:
|
|
resourceFilename = "sbmc-email-request-password.html";
|
|
break;
|
|
// Data.
|
|
}
|
|
if (!StringUtil.IsEmpty(resourceFilename))
|
|
{
|
|
String resourceText = SacsResourceHelper.GetManifestResourceAsText(Assembly, partialPath, resourceFilename);
|
|
if (!StringUtil.IsEmpty(resourceText))
|
|
return resourceText;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Image resources.
|
|
public static byte[] GetResourceImage(ImageResource imageResource)
|
|
{
|
|
String partialPath = "";
|
|
String resourceFilename = "";
|
|
switch (imageResource)
|
|
{
|
|
default:
|
|
break;
|
|
}
|
|
if (!StringUtil.IsEmpty(resourceFilename))
|
|
{
|
|
byte[] resourceData = SacsResourceHelper.GetManifestResourceAsBinary(Assembly, partialPath, resourceFilename);
|
|
if (resourceData != null)
|
|
return resourceData;
|
|
}
|
|
return new byte[0];
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
}
|
|
//=======================================================================
|
|
}
|