Exemplo n.º 1
0
        /// <summary>
        /// 加载配置
        /// </summary>
        /// <param name="path"></param>
        public void LoadConfigs(IConfigParam param)
        {
            try
            {
                UserAppConfigParam appConfig = param as UserAppConfigParam;
                if (File.Exists(appConfig.ConfigPath))
                {
                    UserAppConfig config = SerializeHelper.Load(typeof(UserAppConfig), appConfig.ConfigPath) as UserAppConfig;
                    if (config != null)
                    {
                        this.公共缓存配置目录  = config.公共缓存配置目录;
                        this.衍生品缓存配置目录 = config.衍生品缓存配置目录;
                        this.权益缓存配置目录  = config.权益缓存配置目录;
                        this.固收缓存配置目录  = config.固收缓存配置目录;

                        this.分行策略     = config.分行策略;
                        this.时间戳提取策略  = config.时间戳提取策略;
                        this.缓存匹配策略列表 = new List <CachePattern>(config.缓存匹配策略列表);
                    }
                    else
                    {
                        Init();
                    }
                }
                else
                {
                    Init();
                }
            }
            catch (Exception ex)
            {
                AppConfigManage.LogError(string.Format("加载用户应用程序配置错误:{0};StackTrace:{1}", ex.Message, ex.StackTrace));
                Init();
            }
        }
Exemplo n.º 2
0
        public static SqlDataBaseService.sqlAction.BaseDbActionService CurrentDB()
        {
            SqlDataBaseService.ConnectInfo info;
            SqlDataBaseService.sqlAction.BaseDbActionService service;
            service = CreateNewDbAction(SqlDataBaseService.DataBaseFactory.Factory(AppConfigManage.CurrentDb()));
Label_0015:
            return(service);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 加载数据
        /// </summary>
        /// <param name="param"></param>
        public void LoadConfigs(IConfigParam param)
        {
            Init();
            //读取缓存配置信息
            CacheLogConfigParam configParam = param as CacheLogConfigParam;

            if (File.Exists(configParam.公共缓存配置目录))
            {
                try
                {
                    基础组缓存表   = ExcelUtility.ExcelToDataTable(configParam.公共缓存配置目录, "缓存表");
                    基础组缓存字段表 = ExcelUtility.ExcelToDataTable(configParam.公共缓存配置目录, "缓存表字段");
                }
                catch (Exception ex)
                {
                    AppConfigManage.LogError(string.Format("加载公共缓存配置出错:配合文件【{0}】,错误信息【{1}】", configParam.公共缓存配置目录, ex.Message));
                }
            }
            if (File.Exists(configParam.衍生品缓存配置目录))
            {
                try
                {
                    衍生品缓存表   = ExcelUtility.ExcelToDataTable(configParam.衍生品缓存配置目录, "缓存表");
                    衍生品缓存字段表 = ExcelUtility.ExcelToDataTable(configParam.衍生品缓存配置目录, "缓存表字段");
                }
                catch (Exception ex)
                {
                    AppConfigManage.LogError(string.Format("加载衍生品缓存配置出错:配合文件【{0}】,错误信息【{1}】", configParam.衍生品缓存配置目录, ex.Message));
                }
            }
            if (File.Exists(configParam.固收缓存配置目录))
            {
                try
                {
                    固收缓存表   = ExcelUtility.ExcelToDataTable(configParam.固收缓存配置目录, "缓存表");
                    固收缓存字段表 = ExcelUtility.ExcelToDataTable(configParam.固收缓存配置目录, "缓存表字段");
                }
                catch (Exception ex)
                {
                    AppConfigManage.LogError(string.Format("加载固收缓存配置出错:配合文件【{0}】,错误信息【{1}】", configParam.固收缓存配置目录, ex.Message));
                }
            }
            if (File.Exists(configParam.权益缓存配置目录))
            {
                try
                {
                    权益缓存表   = ExcelUtility.ExcelToDataTable(configParam.权益缓存配置目录, "缓存表");
                    权益缓存字段表 = ExcelUtility.ExcelToDataTable(configParam.权益缓存配置目录, "缓存表字段");
                }
                catch (Exception ex)
                {
                    AppConfigManage.LogError(string.Format("加载权益缓存配置出错:配合文件【{0}】,错误信息【{1}】", configParam.权益缓存配置目录, ex.Message));
                }
            }
        }
Exemplo n.º 4
0
        public static void SaveToSession(XT_LOGIN_INFO info)
        {
            XT_LoginInfoService service = ServiceManage.GetService <XT_LoginInfoService>();

            service.Insert(info);
            string key   = Base64Ulits.EncryptBase64(AppConfigManage.GetSysUserSessionFlag());
            string value = value = Base64Ulits.EncryptBase64(info.ID);

            value = Base64Ulits.EncryptBase64(value);
            SessionUlits.Save(key, value);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取客服端用户登录的信息
        /// </summary>
        /// <returns></returns>
        public static XT_LOGIN_INFO GetLoginInfo()
        {
            string key     = Base64Ulits.EncryptBase64(AppConfigManage.GetSysUserSessionFlag());
            string loginId = (string)SessionUlits.GetData(key);

            if (string.IsNullOrWhiteSpace(loginId))
            {
                return(null);
            }
            loginId = Base64Ulits.DecryptBase64(loginId);
            loginId = Base64Ulits.DecryptBase64(loginId);
            XT_LoginInfoService service = ServiceManage.GetService <XT_LoginInfoService>();
            SQLHelper           helper  = new SQLHelper("select * from XT_LOGIN_INFO where ID=@0", loginId);
            XT_LOGIN_INFO       info    = service.SelectFirstOrDefault(helper);

            return(info);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 用户登录验证
        /// </summary>
        /// <param name="userLoginName"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        public static UserLoginData Login(string userLoginName, string pwd)
        {
            UserLoginData  loginData = new UserLoginData();
            SQLHelper      helper    = new SQLHelper("select * from XT_USER where USER_NAME=@0 and PWD=@1", userLoginName, MD5Ulits.GetMd5Hash(pwd));
            XT_UserService service   = ServiceManage.GetService <XT_UserService>();
            XT_USER        user      = service.SelectFirstOrDefault(helper);

            if (user == null && userLoginName == AppConfigManage.GetSysUserInfo()[0])
            {
                user = service.SelectByLoginName(userLoginName);
                if (user != null)
                {
                    loginData.Message    = "用户名或密码错误";
                    loginData.LoginState = false;
                    return(loginData);
                }
                user = new XT_USER()
                {
                    USER_NAME   = userLoginName,
                    PWD         = MD5Ulits.GetMd5Hash(pwd),
                    CREATE_BY   = "system_",
                    CREATE_TIME = DateTime.Now,
                    LOGIN_NAME  = userLoginName,
                    MODIFY_BY   = "system_",
                    MODIFY_TIME = DateTime.Now,
                    PING_YIN    = ""
                };
                service.Insert(user);
            }
            else
            {
                if (user == null)
                {
                    loginData.Message    = "用户名或密码错误";
                    loginData.LoginState = false;
                    return(loginData);
                }
            }

            loginData.Message    = "登录成功";
            loginData.LoginState = true;
            loginData.Data       = user;
            return(loginData);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 根据用户编号查询用户可授予别的用户角色
        /// </summary>
        /// <param name="userId"></param>
        public List <XT_ROLE> SelectByUser(string userId)
        {
            XT_USER user = ServiceManage.GetService <XT_UserService>().SelectById(userId);

            if (user == null)
            {
                return(new List <XT_ROLE>());
            }
            if (user.LOGIN_NAME == AppConfigManage.GetSysUserInfo()[0])
            {
                return(SelectAll());
            }
            SQLHelper helper = new SQLHelper("select c.* from XT_USER a,XT_USER_ROLE b, XT_ROLE c)");

            helper.Append("where a.ID = b.USER_ID");
            helper.Append("and b.ROLE_ID = c.ID ");
            helper.Append("and a.ID=@0", userId);
            return(Select(helper));
        }
        public override void OnException(ExceptionContext filterContext)
        {
            Exception e = filterContext.Exception;
            ConnectionStringSettings settings = AppConfigManage.GetSysLogConnection();
            SysLogService            service  = ServiceManage.GetService <SysLogService>();
            XT_SYS_LOG log = new XT_SYS_LOG()
            {
                ADDRESS_URL = HttpContext.Current.Request.Url.AbsolutePath,
                CREATE_BY   = "sys",
                MODIFY_BY   = "sys",
                CREATE_TIME = DateTime.Now,
                MODIFY_TIME = DateTime.Now,
                EX_MESSAGE  = e.Message,
                ID          = GuidTools.NewGuid(),
                USER_ID     = UserManage.GetCurrentUserInfo().ID
            };

            service.Insert(log);
            NameValueCollection collection      = HttpContext.Current.Request.Params;
            StringBuilder       builder         = new StringBuilder();
            SysLogParamter      paramterService = ServiceManage.GetService <SysLogParamter>();

            foreach (string name in collection.Keys)
            {
                XT_REQUEST_PARAMETER paramters = new XT_REQUEST_PARAMETER()
                {
                    ID              = GuidTools.NewGuid(),
                    CREATE_BY       = log.CREATE_BY,
                    CREATE_TIME     = log.CREATE_TIME,
                    LOG_ID          = log.ID,
                    MODIFY_BY       = log.MODIFY_BY,
                    MODIFY_TIME     = log.MODIFY_TIME,
                    PARAMETER_NAME  = name,
                    PARAMETER_VALUE = collection[name]
                };
                paramterService.Insert(paramters);
            }

            HttpContext.Current.Server.ClearError();
        }
Exemplo n.º 9
0
 /// <summary>
 /// 获取当前数据库连接操作对象
 /// </summary>
 /// <returns></returns>
 public static BaseDbActionService CurrentDB()
 {
     return(CreateNewDbAction(DataBaseFactory.Factory(AppConfigManage.CurrentDb())));
 }
Exemplo n.º 10
0
        /// <summary>
        /// 系统基本数据数据集检查
        /// </summary>
        /// <returns></returns>
        private void CheckedDataTable()
        {
            OnCheckInitListener(this);
            string    assembly_path = AppConfigManage.GetConfigValue <string>("system_model_Assembly");
            var       db            = DbAction.CurrentDB();
            SQLHelper helper        = new SQLHelper(db.ShowAllDataBaseTables());
            DataTable table         = new DataTable();

            try
            {
                table = db.ExecuteToDataTable(helper);
            }
            catch (Exception e) {
                OnCheckExceptionListener(this, e);
                OnCheckEndListener(this);
                return;
                //throw new Exception("系统数据集自检失败", e);
            }
            if (table != null || table.Columns.Count < 1)
            {
                table.Columns[0].ColumnName = "NAME";
            }
            Assembly assembly = Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "bin\\" + assembly_path);

            Type[] types = assembly.GetTypes();
            List <Dictionary <string, object> > fixList = new List <Dictionary <string, object> >();

            fixList.Clear();
            OnCheckStartListener(this, types.Length);
            int index = 0;

            foreach (Type type in types)
            {
                OnCheckIngListener(this, types.Length, index);
                if (!type.IsClass)
                {
                    continue;
                }
                TargetTbaleAttribute targetTbale = type.GetCustomAttribute <TargetTbaleAttribute>();
                if (targetTbale == null)
                {
                    continue;
                }
                ObjectResolverManage        resolverManage = ObjectResolverManage.GetInstance();
                Dictionary <string, object> object_data    = resolverManage.ResolverObject(type);
                if (object_data == null)
                {
                    continue;
                }
                DataRow[] rows = table.Select("NAME='" + object_data[ObjectAttrResolver.TABLE_NAME] + "'");
                if (rows.Count() > 0)
                {
                    continue;
                }
                fixList.Add(object_data);
                index++;
            }
            index = 0;
            foreach (Dictionary <string, object> tableInfo in fixList)
            {
                try
                {
                    TableUlits.CreateTable(tableInfo);

                    OnFixListener(this, fixList.Count, index);
                }
                catch (Exception e) {
                }
                index++;
            }
            OnCheckEndListener(this);
            Control.CheckForIllegalCrossThreadCalls = true;
            return;
        }