/******************************************************************************
 * 文件名称: Global.cs
 * 文件说明: 全局变量及静态方法等
 * 当前版本: V1.0
 * 创建日期: 2022-06-20
 *
 * * 2020-06-20: 增加 Global 类
 * *****  2020-06-20: 增加 CardReader 方法,获取URL地址,USER信息,地方版SSCard.dll使用



******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PTMedicalInsurance.Common;
using System.Reflection;
using System.IO;


namespace PTMedicalInsurance.Variables
{
    public static class Global
    {
        //当前路径
        public static String currentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
        public static IrisConfigue hisConfig;
        public static IrisConfigue insuConfig;
        public static InterfaceInfo inf;
        public static Patients pat;
        public static Settlements Set;
        public static currentEnvironment curEvt;
        public static User user;
        public static string businessType;
        //写日志 二次封装
        public static void writeLog(string content)
        {
            string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_YB.Log";
            Log log = new Log(logDir, logName);

            string timeLine = "**********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + "***********" + "\r\n";
            log.Write(timeLine + content);

        }

        public static Boolean IsNeedEncrypt(string funNO)
        {
            List<string> infList = new List<string> { "10000", "9001", "9002", "1101", "1201", "2001", "2101", "2101A", "2102", "2102A", "2103", "2201", "2202", "2203", "2203A", "2204", "2205", "2206", "2207", "2208", "2301", "2302", "2303", "2304", "2305", "2401", "2402", "2403", "2404", "2405", "2501", "2501A", "2502", "2503", "2504", "2505", "2506", "2601", "3101", "3102", "5101", "5102", "5201", "5202", "5203", "5204", "5205", "5206", "5301", "5302", "5303", "5304", "5401", "5402", "1160", "5260", "3261" };
            return infList.Contains(funNO);
        }
        public static void writeLog(string tradeName, string inParam, string outParam)
        {
            string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_YB.Log";
            Log log = new Log(logDir, logName);

            string content = "****************************交易开始(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
            content = content + "交易名称:" + tradeName + "\r\n";
            content = content + "交易入参:" + inParam + "\r\n";
            content = content + "交易出参:" + outParam + "\r\n";
            //content = content + "****************************交易结束(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
            log.Write(content);
        }

        public static void writeLog_Iris(string content)
        {
            string logDir = Global.curEvt.path + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_iris.Log";
            Log log = new Log(logDir, logName);

            string timeLine = "**********" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + "***********" + "\r\n";
            log.Write(timeLine + content);

        }
        public static void writeLog_Iris(string tradeName, string inParam, string outParam)
        {
            string logDir = Global.curEvt.path  + "\\Log", logName = DateTime.Now.ToString("yyyy-MM-dd") + "_iris.Log";
            Log log = new Log(logDir, logName);

            string content = "****************************交易开始(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
            content = content + "交易名称:" + tradeName + "\r\n";
            content = content + "交易入参:" + inParam + "\r\n";
            content = content + "交易出参:" + outParam + "\r\n";
            //content = content + "****************************交易结束(" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ffff") + ")****************************" + "\r\n";
            log.Write(content);
        }
    }
}