using NPOI.SS.Formula.Functions; using System; using System.Collections.Generic; using System.Diagnostics; using System.Web; using System.Web.UI.WebControls; using WebLib; namespace Education { public class PublicVariable : WebLib.PublicVariable { private static Random r = new Random(); // 常用變數 public static string[] 換行分隔 = { "\r\n" }; #region SESSION 變數名稱 public const string CompanyId = "CompanyId"; public const string EmployeeId = "EmployeeId"; public const string EmployeeName = "EmployeeName"; public const string EmployeeFunction = "EmployeeFunction"; public const string CurrentPlace = "CurrentPlace"; public const string CurrentPlaceName = "CurrentPlaceName"; public const string UserGroups = "UserGroups"; public const string EventPicturePath = "~/Upload/Event/"; public const string BulletinAttachPath = "~/Upload/Attach/"; public const string IsManager = "IsManager"; public const string IsWorker = "IsWorker"; public const string IsBackend = "IsBackend"; #endregion #region 檔案上傳/圖檔上傳路徑 public const string 講師照片路徑 = "~/PhotoUpload/Teacher/"; public const string 場地照片路徑 = "~/PhotoUpload/Place/"; public const string 課程剪影路徑 = "~/PhotoUpload/Class/"; public const string 證照上傳路徑 = "~/DocUpload/Certificate/"; public const string 溝通記錄上傳路徑 = "~/DocUpload/Communication/"; #endregion #region 系統設定變數,由 Global.asax 讀取 web.config 中的設定 /// /// 系統名稱 /// public static string SystemName = "Education"; /// /// 未登入時開放某些功能 /// public static bool NoLoginFunction = false; /// /// 是否為偵錯模式,會將系統錯誤訊息顯示在網頁上 /// public static bool DEBUG = true; /// /// 管理員群組 /// public static string ManagerGroup = "'TR01'"; /// /// 承辦人群組 /// public static string WorkerGroup = "'TR02'"; /// /// 總管理處ID /// public static int 總管理處ID = 2; /// /// 人資部ID /// public static int 人資部ID = 56; /// /// 財務部ID /// public static int 財務部ID = 60; /// /// 是否使用 SSL 登入發郵件 /// public static bool SendMailBySSL = false; /// /// 郵件發送主機 /// public static string SendMailHost = ""; /// /// 郵件發送通訊埠,不使用 SSL 的通常是 25,使用 SSL 的通常是 465 /// public static int SendMailPort = 25; /// /// 郵件發送帳號 /// public static string SendMailUserName = ""; /// /// 郵件發送密碼 /// public static string SendMailPassword = ""; #region 滿意度調查催填設定 public const string SurveyReminderDeadlineDaysKey = "SurveyReminderDeadlineDays"; public const string SurveyReminderExcludeEmployeesKey = "SurveyReminderExcludeEmployees"; public const string SurveyReminderMinCourseDateKey = "SurveyReminderMinCourseDate"; public const string SiteBaseUrlKey = "SiteBaseUrl"; /// /// 上課後幾天內要填寫滿意度調查 /// public static int SurveyReminderDeadlineDays = 10; /// /// 排除催填的員工編號(逗號分隔) /// public static string SurveyReminderExcludeEmployees = "00002,00003"; /// /// 只催填此日期之後的課程 /// public static DateTime SurveyReminderMinCourseDate = new DateTime(2026, 7, 1); /// /// 站台基礎 URL(如 http://hostname:port) /// public static string SiteBaseUrl = ""; #endregion #endregion public static string SystemVersion { get { System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location); return fvi.FileVersion; } } private static DateTime? _領據關帳年月UpdateTime = null; private static string _領據關帳年月 = string.Empty; public static string 領據關帳年月 { get { if (string.IsNullOrEmpty(_領據關帳年月) || !_領據關帳年月UpdateTime.HasValue || _領據關帳年月UpdateTime < DateTime.Now.AddMinutes(-10)) { using (var conn = DAC.NewConnection()) { var daoBWEX = new DAC_BWEX(conn); _領據關帳年月 = daoBWEX.Read領據關帳年月; _領據關帳年月UpdateTime = DateTime.Now; } } return _領據關帳年月; } set { _領據關帳年月 = value; _領據關帳年月UpdateTime = DateTime.Now; using (var conn = DAC.NewConnection()) { new DAC_BWEX(conn).WriteSetting("領據關帳年月", 1, value); } } } private static decimal? _領據執行業務所得課稅門檻 = null; public static decimal 領據執行業務所得課稅門檻 { get { if (!_領據執行業務所得課稅門檻.HasValue) { using (var conn = DAC.NewConnection()) { _領據執行業務所得課稅門檻 = new DAC_BRTE(conn).領據執行業務所得課稅門檻; } } return _領據執行業務所得課稅門檻.Value; } } private static decimal? _領據薪資課稅門檻 = null; public static decimal 領據薪資課稅門檻 { get { if (!_領據薪資課稅門檻.HasValue) { using (var conn = DAC.NewConnection()) { _領據薪資課稅門檻 = new DAC_BRTE(conn).領據薪資課稅門檻; } } return _領據薪資課稅門檻.Value; } } private static decimal? _領據基本工資 = null; public static decimal 領據基本工資 { get { if (!_領據基本工資.HasValue) { using (var conn = DAC.NewConnection()) { _領據基本工資 = new DAC_BRTE(conn).領據基本工資; } } return _領據基本工資.Value; } } private static decimal? _領據執行業務所得稅率 = null; public static decimal 領據執行業務所得稅率 { get { if (!_領據執行業務所得稅率.HasValue) { using (var conn = DAC.NewConnection()) { _領據執行業務所得稅率 = new DAC_BRTE(conn).領據執行業務所得稅率; } } return _領據執行業務所得稅率.Value; } } private static decimal? _領據薪資稅率 = null; public static decimal 領據薪資稅率 { get { if (!_領據薪資稅率.HasValue) { using (var conn = DAC.NewConnection()) { _領據薪資稅率 = new DAC_BRTE(conn).領據薪資稅率; } } return _領據薪資稅率.Value; } } } }