Ejemplo n.º 1
0
        /// <summary>
        /// 获取全部系统字典
        /// </summary>
        /// <param name="model"></param>
        /// <param name="ddnmParams"></param>
        /// <returns></returns>
        public override DataTable GetFrameDictAll(Xxx.Entities.SSY_FRAME_DICT model, DistributeDataNodeManagerParams ddnmParams)
        {
            DataSet       ds  = null;
            StringBuilder sbb = new StringBuilder();

            try
            {
                sbb.AppendLine(string.Format(@" select DOMAINNAMEIDEN, DOMAINNAMES, sum(1) dicts FROM {0}.SSY_FRAME_DICT group by DOMAINNAMEIDEN, DOMAINNAMES",
                                             DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.DbSchema));
                ds = DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.GetDataSet(sbb.ToString(), SqlExecType.SqlText, null);
            }
            catch (Exception ex)
            {
                return(null);
            }

            if (Common.Utility.DsHasData(ds))
            {
                return(ds.Tables[0]);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载节点服务地址,仅仅加载目前可用节点(包含业务和数据)
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public string GetDataNodeCollection(string req)
        {
            DistributeDataNodeManagerParams distManagerParam = null; //分布式管理参数

            try
            {
                reqdata = this.AnaRequestData(req);
                string usestate = reqdata.reqdata;
                DistributeDataNodeManagerParams ddnmtmp = (DistributeDataNodeManagerParams)currCache.Get("dataNodes");
                if (ddnmtmp != null)
                {
                    distManagerParam = ddnmtmp;
                }
                else
                {
                    FrameNodeBizCommon fnodecom = new FrameNodeBizCommon();
                    distManagerParam = fnodecom.GetDistributeDataNodeManager(usestate);
                }
                if (distManagerParam.DistributeDataNodes.Count > 0)
                {
                    resdata = this.MakeResponseData("1", string.Empty, json.Serialize(distManagerParam), string.Empty);
                }
                else
                {
                    resdata = this.MakeResponseData("0", this.GetI18nLangItem("noFindDataNodes", this.i18nModuleCurrLang), string.Empty, string.Empty);
                }
            }
            catch (Exception ex)
            {
                resdata = this.MakeResponseData("0", this.GetI18nLangItem("initDataNodeErr", this.i18nModuleCurrLang) + ex.Message, string.Empty, string.Empty);
            }

            return(json.Serialize(resdata));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取系统字典(某个字典的全部字典项)
        /// </summary>
        /// <param name="model"></param>
        /// <param name="ddnmParams"></param>
        /// <param name="pager"></param>
        /// <returns></returns>
        public override DataTable GetBizDictPager(Xxx.Entities.SSY_BIZ_DICT model, DistributeDataNodeManagerParams ddnmParams, SSY_PagingParam pager)
        {
            //分页数据获取实现
            //分页参数数据
            SSY_PagingExecuteParam pageExecute = new SSY_PagingExecuteParam();

            pageExecute.PagingParam = pager;

            //参数值,若有,增加到该集合
            List <IDataParameter> parameters  = new List <IDataParameter>();
            StringBuilder         sbbSqlWhere = new StringBuilder();

            if (model != null)
            {
                if (Utility.ObjHasData(model.DOMAINNAMEIDEN))
                {
                    sbbSqlWhere.AppendLine(string.Format(@"and DOMAINNAMEIDEN = {0}DOMAINNAMEIDEN ",
                                                         DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.ParamSign()));
                    parameters.Add(DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.
                                   GetDataParameter("DOMAINNAMEIDEN",
                                                    DbType.String, model.DOMAINNAMEIDEN.ToString()));
                }
            }

            pageExecute.TableNameOrView = string.Format(@" {0}.SSY_BIZ_DICT ",
                                                        DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.DbSchema);

            pageExecute.Joins      = string.Empty;
            pageExecute.Fields     = "*";
            pageExecute.OrderField = "SSY_BIZ_DICTID";
            pageExecute.SqlWhere   = " 1=1 " + sbbSqlWhere.ToString();

            StringBuilder sbbSql = new StringBuilder();

            if (pager.TotalSize == 0)
            {
                //首次计算总记录
                sbbSql.Clear();
                if (string.IsNullOrEmpty(pageExecute.SqlWhere))
                {
                    sbbSql.Append(string.Format(@"SELECT count(*) as cnt FROM {0} {1} ", pageExecute.TableNameOrView, pageExecute.Joins));
                }
                else
                {
                    sbbSql.Append(string.Format(@"SELECT count(*) as cnt FROM {0} {1} where {2} ", pageExecute.TableNameOrView, pageExecute.Joins,
                                                pageExecute.SqlWhere));
                }

                DataTable dt = DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.GetDataTable(sbbSql.ToString(),
                                                                                                                  SqlExecType.SqlText, parameters.ToArray());

                if (Utility.DtHasData(dt))
                {
                    pager.TotalSize = int.Parse(dt.Rows[0]["cnt"].ToString());
                }
            }

            return(DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.GetDataPager(pageExecute, parameters.ToArray()));
        }
Ejemplo n.º 4
0
    /// <summary>
    /// 启动更新数据缓存
    /// </summary>
    /// <param name="obj"></param>
    public void ExecUpdateCacheData()
    {
        System.Web.Caching.Cache currCache = HttpRuntime.Cache;
        int  cacheMinute = 50;
        bool executeFlag = true;

        while (executeFlag)
        {
            executeFlag = false;

            try
            {
                #region 缓存处理

                //加载缓存服务配置
                DataTable dtservconfig = BaseServiceUtility.GetServiceConfig(APPConfig.GetAPPConfig().GetConfigValue("ServiceConfigPath", ""));
                currCache.Insert("serviceConfig", dtservconfig, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));

                //缓存默认公共语言包
                string    defaultlang        = APPConfig.GetAPPConfig().GetConfigValue("currlang", "");
                string    commoni18nLangPath = string.Format(APPConfig.GetAPPConfig().GetConfigValue("Commoni18nLang", ""), defaultlang);
                DataTable i18nCommonCurrLang = BaseServiceUtility.GetI18nLang(commoni18nLangPath);
                currCache.Insert("i18nCommonCurrLang", i18nCommonCurrLang, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));

                //缓存默认各模块语言包,多个模块独立累加
                string    FrameNodei18nLang     = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameNodei18nLang", ""), defaultlang);
                DataTable i18nFrameNodei18nLang = BaseServiceUtility.GetI18nLang(FrameNodei18nLang);
                currCache.Insert("i18nFrameNodei18nLang", i18nFrameNodei18nLang, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));


                //缓存数据节点
                DistributeDataNodeManagerParams distManagerParam = new DistributeDataNodeManagerParams(); //分布式管理参数
                FrameNodeBizCommon fnodecom = new FrameNodeBizCommon();
                distManagerParam = fnodecom.GetDistributeDataNodeManager("1");
                if (distManagerParam.DistributeDataNodes.Count > 0)
                {
                    currCache.Insert("dataNodes", distManagerParam, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));
                }

                //缓存业务节点
                DataTable dtbiznodeaddrconfig = BaseServiceUtility.GetBizNodesConfig(APPConfig.GetAPPConfig().GetConfigValue("XmldataPath", "") + "\\SSY_BIZNODE_ADDR.xml");
                currCache.Insert("bizNodeConfig", dtbiznodeaddrconfig, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));

                Common.Utility.RecordLog("完成节点中心配置缓存!", this.logpathForDebug, this.isLogpathForDebug);

                #endregion
            }
            catch (Exception ex)
            {
                //记录结果
                Common.Utility.RecordLog("配置节点中心缓存,发生异常!原因:" + ex.Message, this.logpathForDebug, this.isLogpathForDebug);
            }

            Thread.Sleep(this.internalTime * 60000);//延迟秒级别
            executeFlag = true;
        }
    }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取某个字典
        /// </summary>
        /// <param name="DOMAINNAMEIDEN">字典设别</param>
        /// <param name="dicttype">字典类型(公共、业务)</param>
        /// <param name="ddnmParams"></param>
        /// <returns></returns>
        public override DataTable GetDicts(string DOMAINNAMEIDEN, DictType dicttype, DistributeDataNodeManagerParams ddnmParams)
        {
            DataSet       ds       = null;
            StringBuilder sbb      = new StringBuilder();
            string        dictname = string.Empty;

            if (dicttype == DictType.BizDict)
            {
                dictname = "SSY_BIZ_DICT";
            }
            else if (dicttype == DictType.FrameDict)
            {
                dictname = "SSY_FRAME_DICT";
            }
            else
            {
                //throw new Exception("必须设置字典类型!");
                throw new Exception(BaseServiceUtility.GetI18nLangItem("noticeinfo_setDictType", base.i18nXxxManageri18nLang));
            }

            if (string.IsNullOrEmpty(DOMAINNAMEIDEN))
            {
                //throw new Exception("必须设置字典设别!");
                throw new Exception(BaseServiceUtility.GetI18nLangItem("noticeinfo_setDictIden", base.i18nXxxManageri18nLang));
            }

            List <IDataParameter> parameters = new List <IDataParameter>();

            try
            {
                sbb.AppendLine(string.Format(@" select * FROM {0}.{1} where DOMAINNAMEIDEN = {2}DOMAINNAMEIDEN",
                                             DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.DbSchema,
                                             dictname,
                                             DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.ParamSign()));

                parameters.Add(DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.
                               GetDataParameter("DOMAINNAMEIDEN", DbType.String, DOMAINNAMEIDEN));

                ds = DBFactorySingleton.GetInstance(ddnmParams.DistributeDataNode).Factory.GetDataSet(sbb.ToString(), SqlExecType.SqlText, null);
            }
            catch (Exception ex)
            {
                return(null);
            }

            if (Common.Utility.DsHasData(ds))
            {
                return(ds.Tables[0]);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取所有用户list
        /// </summary>
        /// <param name="ud"></param>
        /// <param name="distributeDataNodeManagerParams"></param>
        /// <returns></returns>
        public List <SSY_USER_DICT> GetAllUsers(SSY_USER_DICT ud, DistributeDataNodeManagerParams distributeDataNodeManagerParams)
        {
            List <SSY_USER_DICT> listReturn = new List <SSY_USER_DICT>();
            DataTable            dt         = this.comBize.GetAllUsers(ud, distributeDataNodeManagerParams);

            if (Common.Utility.DtHasData(dt))
            {
                listReturn = Common.UtilitysForT <SSY_USER_DICT> .GetListsObj(dt);
            }

            return(listReturn);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取系统表结构
        /// </summary>
        /// <param name="dataEntName"></param>
        /// <param name="distributeDataNodeManagerParams"></param>
        /// <returns></returns>
        public List <SSY_DATAENTITY> GetDataEntity(string dataEntName, DistributeDataNodeManagerParams distributeDataNodeManagerParams)
        {
            List <SSY_DATAENTITY> listReturn = new List <SSY_DATAENTITY>();
            DataTable             dt         = this.comBize.GetDataEntity(dataEntName, distributeDataNodeManagerParams);

            if (Common.Utility.DtHasData(dt))
            {
                listReturn = Common.UtilitysForT <SSY_DATAENTITY> .GetListsObj(dt);
            }

            return(listReturn);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取系统字典(某个字典的全部字典项)
        /// </summary>
        /// <param name="model"></param>
        /// <param name="ddnmParams"></param>
        /// <param name="pager"></param>
        /// <returns></returns>
        public List <SSY_BIZ_DICT> GetBizDictPager(SSY_BIZ_DICT model, DistributeDataNodeManagerParams ddnmParams, SSY_PagingParam pager)
        {
            List <SSY_BIZ_DICT> listReturn = new List <SSY_BIZ_DICT>();

            DataTable dt = this.comBize.GetBizDictPager(model, ddnmParams, pager);

            if (Common.Utility.DtHasData(dt))
            {
                listReturn = Common.UtilitysForT <SSY_BIZ_DICT> .GetListsObj(dt);
            }

            return(listReturn);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 获取全部系统字典
        /// </summary>
        /// <param name="model"></param>
        /// <param name="ddnmParams"></param>
        /// <returns></returns>
        public List <SSY_FRAME_DICT> GetFrameDictAll(SSY_FRAME_DICT model, DistributeDataNodeManagerParams ddnmParams)
        {
            List <SSY_FRAME_DICT> listReturn = new List <SSY_FRAME_DICT>();

            DataTable dt = this.comBize.GetFrameDictAll(model, ddnmParams);

            if (Common.Utility.DtHasData(dt))
            {
                listReturn = Common.UtilitysForT <SSY_FRAME_DICT> .GetListsObj(dt);
            }

            return(listReturn);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取用户list
        /// </summary>
        /// <param name="ud"></param>
        /// <param name="distributeDataNodeManagerParams">分布式管理参数,必须存在有框架赋值</param>
        /// <param name="ListBizLog">记录日志内容参数,若不记录日志可以不传入</param>
        /// <returns></returns>
        public List <SSY_USER_DICT> GetUserForLogin(SSY_USER_DICT ud, DistributeDataNodeManagerParams distributeDataNodeManagerParams,
                                                    List <SSY_LOGENTITY> ListBizLog)
        {
            List <SSY_USER_DICT> listReturn = new List <SSY_USER_DICT>();
            DataTable            dt         = this.comBize.GetUserForLogin(ud, distributeDataNodeManagerParams, ListBizLog);

            if (Common.Utility.DtHasData(dt))
            {
                listReturn = Common.UtilitysForT <SSY_USER_DICT> .GetListsObj(dt);
            }

            return(listReturn);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 获取页面
        /// </summary>
        /// <param name="bizobj"></param>
        /// <param name="ddnmParams"></param>
        /// <returns></returns>
        public List <SSY_PAGE_DICT> GetPage(SSY_PAGE_DICT bizobj, DistributeDataNodeManagerParams ddnmParams)
        {
            List <SSY_PAGE_DICT> listReturn = new List <SSY_PAGE_DICT>();

            DataSet ds = this.comBize.GetPage(bizobj, ddnmParams);

            if (Common.Utility.DsHasData(ds))
            {
                listReturn = Common.UtilitysForT <SSY_PAGE_DICT> .GetListsObj(ds.Tables[0]);
            }

            return(listReturn);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取用户
        /// </summary>
        /// <param name="bizobj"></param>
        /// <param name="ddnmParams"></param>
        /// <param name="pager"></param>
        /// <returns></returns>
        public List <SSY_USER_DICT> GetUserdict(SSY_USER_DICT bizobj, DistributeDataNodeManagerParams ddnmParams, SSY_PagingParam pager)
        {
            List <SSY_USER_DICT> listReturn = new List <SSY_USER_DICT>();

            DataTable dt = this.comBize.GetUserdict(bizobj, ddnmParams, pager);

            if (Common.Utility.DtHasData(dt))
            {
                listReturn = Common.UtilitysForT <SSY_USER_DICT> .GetListsObj(dt);
            }

            return(listReturn);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取用户组(带分页)
        /// </summary>
        /// <param name="gd"></param>
        /// <param name="distributeDataNodeManagerParams"></param>
        /// <param name="pager"></param>
        /// <returns></returns>
        public List <SSY_GROUP_DICT> GetGroup(SSY_GROUP_DICT gd, DistributeDataNodeManagerParams distributeDataNodeManagerParams, SSY_PagingParam pager)
        {
            List <SSY_GROUP_DICT> listReturn = new List <SSY_GROUP_DICT>();

            DataTable dt = this.comBize.GetGroup(gd, distributeDataNodeManagerParams, pager);

            if (Common.Utility.DtHasData(dt))
            {
                listReturn = Common.UtilitysForT <SSY_GROUP_DICT> .GetListsObj(dt);
            }

            return(listReturn);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 获取用户组名
        /// </summary>
        /// <returns></returns>
        /// <param name="gd"></param>
        /// <param name="distributeDataNodeManagerParams"></param>
        public List <SSY_GROUP_DICT> GetGroup(SSY_GROUP_DICT gd, DistributeDataNodeManagerParams distributeDataNodeManagerParams)
        {
            List <SSY_GROUP_DICT> listReturn = new List <SSY_GROUP_DICT>();

            DataSet ds = this.comBize.GetGroup(gd, distributeDataNodeManagerParams);

            if (Common.Utility.DsHasData(ds))
            {
                listReturn = Common.UtilitysForT <SSY_GROUP_DICT> .GetListsObj(ds.Tables[0]);
            }

            return(listReturn);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 初始化分布式节点管理参数
        /// </summary>
        private DistributeDataNodeManagerParams InitNodeDistManagerParams()
        {
            DistributeDataNodeManagerParams distManagerParam = null; //分布式管理参数
            List <SSY_DATANODE_ADDR>        dataNodes        = new List <SSY_DATANODE_ADDR>();

            UseNodeCollection unc = new UseNodeCollection();
            SSY_ResponseResult <UseNodeCollection> res = this.GetUseNodeCollection("1");

            if (res.IsCompleted)
            {
                #region 初始化数据节点

                unc = res.Result;
                //分布式参数
                distManagerParam = new DistributeDataNodeManagerParams();
                distManagerParam.DistributeDataNode    = new DistributeDataNode();
                distManagerParam.DistributeActionIden  = DistributeActionIden.Query; //默认给查询,需要在具体业务工作方法重新设定
                distManagerParam.DistriActionSqlParams = new List <DistActionSql>(); //由于支持单点操作延后执行,需要在具体业务工作方法重新设定
                distManagerParam.DistributeDataNode    = new DistributeDataNode();   //只需处理工厂配置参数,其他参数系统框架会自动根据数据节点及配置文件设定

                if (unc.DataNodeList.Count > 0)
                {
                    foreach (var item in unc.DataNodeList)
                    {
                        //若配置加密数据库相关参数,这里需要先进行解密
                        item.Url_addr = Common.Security.DeEncryptInfo(item.Url_addr.ToString(), item.Encrykeystr,
                                                                      int.Parse(item.Encryhashlenth), item.Isencrydbconn.ToUpper());

                        item.Data_schema = Common.Security.DeEncryptInfo(item.Data_schema.ToString(), item.Encrykeystr,
                                                                         int.Parse(item.Encryhashlenth), item.Isencrydbconn.ToUpper());
                        item.Data_user = Common.Security.DeEncryptInfo(item.Data_user.ToString(), item.Encrykeystr,
                                                                       int.Parse(item.Encryhashlenth), item.Isencrydbconn.ToUpper());
                        item.Data_password = Common.Security.DeEncryptInfo(item.Data_password.ToString(), item.Encrykeystr,
                                                                           int.Parse(item.Encryhashlenth), item.Isencrydbconn.ToUpper());

                        item.Data_conn = Common.Security.DeEncryptInfo(item.Data_conn.ToString(), item.Encrykeystr,
                                                                       int.Parse(item.Encryhashlenth), item.Isencrydbconn.ToUpper());

                        dataNodes.Add(item);
                    }
                    distManagerParam.DistributeDataNodes = dataNodes;
                    distManagerParam.DistributeDataNode.DbFactoryName = unc.DataNodeList[0].DBFactoryName;
                }

                #endregion
            }

            return(distManagerParam);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 装载数据节点
        /// </summary>
        /// <returns></returns>
        public DistributeDataNodeManagerParams GetDistributeDataNodeManagerParams()
        {
            DistributeDataNodeManagerParams distManagerParam = new DistributeDataNodeManagerParams(); //分布式管理参数

            //调用节点中心服务获取数据节点
            DataRow drServ            = this.GetServiceConfigOne("framenodesecu", "1.0", "normal", "frameNode", this.serviceConfig);
            string  FramenodeSecurity = drServ["url_addr"].ToString().TrimStart('/') + "/" + drServ["servcodename"].ToString().TrimStart('/');

            this.reqdata         = new ReqData();
            this.reqdata.reqdata = "1";
            string resdatanode = DynamicInvokeWCF.Create <IFrameNodeSecurity>(FramenodeSecurity).GetDataNodeCollection(json.Serialize(this.reqdata));

            this.resdata = json.Deserialize <RespData>(resdatanode);
            if (this.resdata.respflag == "1")
            {
                distManagerParam = json.Deserialize <DistributeDataNodeManagerParams>(this.resdata.respdata);
            }

            return(distManagerParam);
        }
Ejemplo n.º 17
0
 /// <summary>
 /// 获取某个字典
 /// </summary>
 /// <param name="DOMAINNAMEIDEN">字典设别</param>
 /// <param name="dicttype">字典类型(公共 业务)</param>
 /// <param name="ddnmParams"></param>
 /// <returns></returns>
 public abstract DataTable GetDicts(string DOMAINNAMEIDEN, DictType dicttype, DistributeDataNodeManagerParams ddnmParams);
Ejemplo n.º 18
0
 /// <summary>
 /// 获取系统字典(某个字典的全部字典项)
 /// </summary>
 /// <param name="model"></param>
 /// <param name="ddnmParams"></param>
 /// <param name="pager"></param>
 /// <returns></returns>
 public abstract DataTable GetBizDictPager(Xxx.Entities.SSY_BIZ_DICT model, DistributeDataNodeManagerParams ddnmParams, SSY_PagingParam pager);
Ejemplo n.º 19
0
 /// <summary>
 /// 获取全部业务字典
 /// </summary>
 /// <param name="model"></param>
 /// <param name="ddnmParams"></param>
 /// <returns></returns>
 public abstract DataTable GetBizDictAll(Xxx.Entities.SSY_BIZ_DICT model, DistributeDataNodeManagerParams ddnmParams);
Ejemplo n.º 20
0
        public override IMessage Invoke(IMessage msg)
        {
            #region 日志准备

            List <string> opObjPerporty = UtilitysForT <SSY_LOGENTITY> .GetAllColumns(new SSY_LOGENTITY()); //要操作的属性名

            List <string> opWherePerporty = new List <string>();                                            //where条件属性名
            opWherePerporty.Add("LOGID");
            List <string> mainProperty = new List <string>();                                               //主键属性名
            mainProperty.Add("LOGID");

            //string errStr = string.Empty;
            List <string>        errStr  = new List <string>();
            List <SSY_LOGENTITY> opList  = new List <SSY_LOGENTITY>();
            SSY_LOGENTITY        logenti = null;

            BizExectuteCommon recordLog = new BizExectuteCommon(ManagerSysEnvironment.GetSysEnvironmentSerialize()); //其他工厂记录日志也利用该公共方法

            //日志固定部分
            string USERNAMES = string.Empty;
            if (FrameCommon.SysEnvironment.SysUserDict != null)
            {
                if (FrameCommon.SysEnvironment.SysUserDict.USERNAME != null)
                {
                    USERNAMES = FrameCommon.SysEnvironment.SysUserDict.USERNAME.ToString();
                }
            }
            string IPS = string.Empty;
            if (!string.IsNullOrEmpty(FrameCommon.SysEnvironment.Ips))
            {
                IPS = FrameCommon.SysEnvironment.Ips;
            }
            string SYSTEMNAME = string.Empty;
            if (!string.IsNullOrEmpty(FrameCommon.SysEnvironment.distManagerParam.DistributeDataNodes[0].Systemname))
            {
                SYSTEMNAME = FrameCommon.SysEnvironment.distManagerParam.DistributeDataNodes[0].Systemname;
            }

            #endregion

            IMethodCallMessage mcall = (IMethodCallMessage)msg; //劫持方法,准备执行
            var resResult            = new ReturnMessage(new Exception(), mcall);

            #region 获取必要参数

            //distributeActionIden  分布式动作识别, 必须存在
            //distributeDataNodes 分布式数据节点集合, 必须存在
            //distributeDataNode 分布式数据节点参数, 必须存在
            //distriActionSql 分布式操作sql集合,必须存在,包括sql正文和参数
            //ddnmParams

            //singleActionList  单点操作失败集合, out参数 非必须存在,传入空的参数即可

            //TODO 检查必须的参数,若不存在不进行执行业务方法,返回执行异常

            //获取分布式管理参数
            DistributeDataNodeManagerParams distManagerParam = new  DistributeDataNodeManagerParams();
            for (int i = 0; i < mcall.InArgs.Length; i++)
            {
                if (mcall.GetInArgName(i).ToUpper() == "ddnmParams".ToUpper())
                {
                    distManagerParam = ((DistributeDataNodeManagerParams)mcall.GetInArg(i));
                    //SYSTEMNAME = distManagerParam.DistributeDataNodes[0].Systemname;
                    break;
                }
            }

            //获取分布式动作识别参数
            DistributeActionIden distBAC = distManagerParam.DistributeActionIden;

            //加载数据节点集合,然后根据节点数量及分布式动作识别初始化分布式数据节点及分布式事务处理
            //数据节点集合由服务方法传入
            //获取数据节点集合参数
            List <SSY_DATANODE_ADDR> dataNodes = distManagerParam.DistributeDataNodes;

            //获取数据节点参数
            DistributeDataNode ddn = distManagerParam.DistributeDataNode;

            //单点操作失败集合,最后要报告给节点中心,out参数
            bool permitSingleDataOperation = false; //是否支持单点操作失败后进行报告
            List <SSY_DATA_ACTION_TASK> data_action_task = new List <SSY_DATA_ACTION_TASK>();
            for (int i = 0; i < mcall.InArgs.Length; i++)
            {
                if (mcall.GetInArgName(i).ToUpper() == "singleActionList".ToUpper())
                {
                    permitSingleDataOperation = true;
                    data_action_task          = mcall.GetInArg(i) as List <SSY_DATA_ACTION_TASK>;
                    break;
                }
            }

            #endregion

            if (distBAC == DistributeActionIden.Query)
            {
                //处理数据节点
                //distManagerParam.DistributeDataNode
                distManagerParam.DistributeDataNode.Connectionstring = string.Format(dataNodes[0].Data_conn, dataNodes[0].Url_addr,
                                                                                     dataNodes[0].Data_user, dataNodes[0].Data_password);
                distManagerParam.DistributeDataNode.DbSchema = dataNodes[0].Data_schema;

                //只执行一次即可
                #region 执行业务方法

                try
                {
                    object objRv = mcall.MethodBase.Invoke(this.Target, mcall.Args);

                    #region 记录业务日志

                    //执行方法后记录正常业务日志,内容来自方法ListBizLog参数
                    //若要记录日志,要求该方法必须传入该参数,且名字必须为ListBizLog,内容为要记录的业务日志内容
                    SSY_LOGENTITY tempLog = null;
                    for (int i = 0; i < mcall.InArgs.Length; i++)
                    {
                        if (mcall.GetInArgName(i).ToUpper() == "ListBizLog".ToUpper())
                        {
                            List <SSY_LOGENTITY> dictBizLog = mcall.GetInArg(i) as List <SSY_LOGENTITY>;

                            for (int j = 0; j < dictBizLog.Count; j++)
                            {
                                //遍历记录业务日志
                                tempLog = dictBizLog[j] as SSY_LOGENTITY;

                                //获取日志控制,确定是否记录该类日志
                                if (recordLog.CheckIsRecord(tempLog.DOMAINNAME.ToString(), tempLog.OPTIONNAME.ToString(), distManagerParam))
                                {
                                    tempLog.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                                    //业务直接使用业务端提交的数据,不在读取框架环境变量,因为登录时这部分数据滞后,导致不能记入日志
                                    //tempLog.USERNAMES = USERNAMES;
                                    //tempLog.IPS = IPS;
                                    //tempLog.SYSTEMNAME = SYSTEMNAME;

                                    opList.Add(tempLog);
                                }
                            }
                            if (opList.Count > 0)
                            {
                                //记录日志
                                bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                            }
                            break;
                        }
                    }

                    #endregion

                    resResult = new ReturnMessage(objRv, mcall.Args, mcall.Args.Length, mcall.LogicalCallContext, mcall);
                }
                catch (Exception ex)
                {
                    Common.Utility.RecordLog("工厂 Query 模式发生异常!原因" + ex.Message + ex.Source, this.logpathForDebug, this.isLogpathForDebug);

                    #region 记录异常日志

                    if (ex.InnerException != null)
                    {
                        //获取日志控制,确定是否记录该类日志
                        if (recordLog.CheckIsRecord("ExceptionErr", "ExceptionErr", distManagerParam))
                        {
                            //处理异常类相关信息
                            string CLASSNAME   = mcall.TypeName;
                            string METHORDNAME = mcall.MethodName;

                            //异常时这部分可没有内容
                            string TABLENAME            = "";
                            string RECORDIDENCOLS       = "";
                            string RECORDIDENCOLSVALUES = "";
                            string FUNCTIONNAME         = "";

                            logenti = LogCommon.CreateLogDataEnt(LogTypeDomain.ExceptionErr, LogLevelOption.ExecptionErr, recordLog.GetSystemDateTime(distManagerParam),
                                                                 CLASSNAME, METHORDNAME, LogAction.ExecptionErr, TABLENAME, RECORDIDENCOLS, RECORDIDENCOLSVALUES, USERNAMES, IPS, FUNCTIONNAME,
                                                                 ex.InnerException.Message, SYSTEMNAME, "");
                            logenti.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                            opList.Add(logenti);

                            if (opList.Count > 0)
                            {
                                //记录日志
                                bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                            }
                        }

                        resResult = new ReturnMessage(ex.InnerException, mcall);
                    }

                    #endregion

                    resResult = new ReturnMessage(ex, mcall);
                }

                #endregion
            }
            else if (distBAC == DistributeActionIden.SingleAction)
            {
                //数据节点有几个执行几次,单次提交,发现执行异常,将异常报告给节点中心,继续执行,直到完毕
                for (int m = 0; m < dataNodes.Count; m++)
                {
                    //ddn.DbFactoryName  数据库工厂取配置文件,目前不考虑同构不同种类的数据库
                    distManagerParam.DistributeDataNode.Connectionstring = string.Format(dataNodes[m].Data_conn, dataNodes[m].Url_addr, dataNodes[m].Data_user,
                                                                                         dataNodes[m].Data_password);
                    distManagerParam.DistributeDataNode.DbSchema = dataNodes[m].Data_schema;

                    #region 执行业务方法

                    try
                    {
                        object objRv = mcall.MethodBase.Invoke(this.Target, mcall.Args);

                        #region 记录业务日志

                        //执行方法后记录正常业务日志,内容来自方法ListBizLog参数
                        //若要记录日志,要求该方法必须传入该参数,且名字必须为ListBizLog,内容为要记录的业务日志内容
                        SSY_LOGENTITY tempLog = null;
                        for (int i = 0; i < mcall.InArgs.Length; i++)
                        {
                            if (mcall.GetInArgName(i).ToUpper() == "ListBizLog".ToUpper())
                            {
                                List <SSY_LOGENTITY> dictBizLog = mcall.GetInArg(i) as List <SSY_LOGENTITY>;

                                for (int j = 0; j < dictBizLog.Count; j++)
                                {
                                    //遍历记录业务日志
                                    tempLog = dictBizLog[j] as SSY_LOGENTITY;

                                    //获取日志控制,确定是否记录该类日志
                                    if (recordLog.CheckIsRecord(tempLog.DOMAINNAME.ToString(), tempLog.OPTIONNAME.ToString(), distManagerParam))
                                    {
                                        tempLog.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                                        //业务直接使用业务端提交的数据,不在读取框架环境变量,因为登录时这部分数据滞后,导致不能记入日志
                                        //tempLog.USERNAMES = USERNAMES;
                                        //tempLog.IPS = IPS;
                                        //tempLog.SYSTEMNAME = SYSTEMNAME;

                                        opList.Add(tempLog);
                                    }
                                }
                                if (opList.Count > 0)
                                {
                                    //记录日志
                                    bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                                }
                                break;
                            }
                        }

                        #endregion

                        resResult = new ReturnMessage(objRv, mcall.Args, mcall.Args.Length, mcall.LogicalCallContext, mcall);
                    }
                    catch (Exception ex)
                    {
                        SSY_DATA_ACTION_TASK tempDataTask = null;

                        #region 记录异常日志

                        if (ex.InnerException != null)
                        {
                            //获取日志控制,确定是否记录该类日志
                            if (recordLog.CheckIsRecord("ExceptionErr", "ExceptionErr", distManagerParam))
                            {
                                //处理异常类相关信息
                                string CLASSNAME   = mcall.TypeName;
                                string METHORDNAME = mcall.MethodName;

                                //异常时这部分可没有内容
                                string TABLENAME            = "";
                                string RECORDIDENCOLS       = "";
                                string RECORDIDENCOLSVALUES = "";
                                string FUNCTIONNAME         = "";

                                logenti = LogCommon.CreateLogDataEnt(LogTypeDomain.ExceptionErr, LogLevelOption.ExecptionErr, recordLog.GetSystemDateTime(distManagerParam),
                                                                     CLASSNAME, METHORDNAME, LogAction.ExecptionErr, TABLENAME, RECORDIDENCOLS, RECORDIDENCOLSVALUES, USERNAMES, IPS, FUNCTIONNAME,
                                                                     ex.InnerException.Message, SYSTEMNAME, "");
                                logenti.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                                opList.Add(logenti);

                                if (opList.Count > 0)
                                {
                                    //记录日志
                                    bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                                }
                            }
                            if (permitSingleDataOperation)
                            {
                                #region 获取失败操作sql

                                //获取失败记录,以便将任务报告给节点中心
                                //获取操作sql  List<DistActionSql> DistriActionSqlParams

                                for (int task = 0; task < distManagerParam.DistriActionSqlParams.Count; task++)
                                {
                                    tempDataTask            = new SSY_DATA_ACTION_TASK();
                                    tempDataTask.Action_sql = distManagerParam.DistriActionSqlParams[task].ActionSqlText;
                                    string tempSqlParamSeq = string.Empty;
                                    bool   temddddd        = JsonSerializer.Serialize(distManagerParam.DistriActionSqlParams[task].ActionSqlTextParams, out tempSqlParamSeq);
                                    //保存sql参数序列化结果
                                    tempDataTask.Action_sql_params = tempSqlParamSeq;
                                    tempDataTask.Data_real_conn    = ddn.Connectionstring;
                                    data_action_task.Add(tempDataTask);
                                }
                                //执行完毕后,清除本次的sql记录
                                distManagerParam.DistriActionSqlParams.Clear();

                                //TODO 报告单点异常给节点中心,暂时不支持,后续扩展
                                #endregion
                            }
                        }

                        #endregion

                        continue; //继续执行
                    }

                    #endregion
                }
            }
            else if (distBAC == DistributeActionIden.TransAction)
            {
                try
                {
                    //分布式事务执行, 按数据节点数量执行,同步提交
                    using (var ts = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, TimeSpan.FromHours(1)))
                    {
                        for (int m = 0; m < dataNodes.Count; m++)
                        {
                            //ddn.DbFactoryName  数据库工厂取配置文件,目前不考虑同构不同种类的数据库
                            distManagerParam.DistributeDataNode.Connectionstring = string.Format(dataNodes[m].Data_conn, dataNodes[m].Url_addr, dataNodes[m].Data_user,
                                                                                                 dataNodes[m].Data_password);
                            distManagerParam.DistributeDataNode.DbSchema = dataNodes[m].Data_schema;

                            #region 执行业务方法

                            object objRv = mcall.MethodBase.Invoke(this.Target, mcall.Args);

                            #region 记录业务日志

                            //执行方法后记录正常业务日志,内容来自方法ListBizLog参数
                            //若要记录日志,要求该方法必须传入该参数,且名字必须为ListBizLog,内容为要记录的业务日志内容
                            SSY_LOGENTITY tempLog = null;
                            for (int i = 0; i < mcall.InArgs.Length; i++)
                            {
                                if (mcall.GetInArgName(i).ToUpper() == "ListBizLog".ToUpper())
                                {
                                    List <SSY_LOGENTITY> dictBizLog = mcall.GetInArg(i) as List <SSY_LOGENTITY>;

                                    for (int j = 0; j < dictBizLog.Count; j++)
                                    {
                                        //遍历记录业务日志
                                        tempLog = dictBizLog[j] as SSY_LOGENTITY;

                                        //获取日志控制,确定是否记录该类日志
                                        if (recordLog.CheckIsRecord(tempLog.DOMAINNAME.ToString(), tempLog.OPTIONNAME.ToString(), distManagerParam))
                                        {
                                            tempLog.LOGID = recordLog.GetID(MakeIDType.YMDHMS_3, string.Empty, null, distManagerParam);

                                            //业务直接使用业务端提交的数据,不在读取框架环境变量,因为登录时这部分数据滞后,导致不能记入日志
                                            //tempLog.USERNAMES = USERNAMES;
                                            //tempLog.IPS = IPS;
                                            //tempLog.SYSTEMNAME = SYSTEMNAME;

                                            opList.Add(tempLog);
                                        }
                                    }
                                    //这里事物不能同时记录日志,需要放到业务方法提交完成后单独记录日志
                                    if (opList.Count > 0)
                                    {
                                        //记录日志
                                        bool flag = recordLog.OpBizObjectSingle <SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);
                                    }
                                    break;
                                }
                            }

                            #endregion

                            resResult = new ReturnMessage(objRv, mcall.Args, mcall.Args.Length, mcall.LogicalCallContext, mcall);

                            #endregion
                        }

                        ts.Complete();
                        ts.Dispose();
                    }

                    //同时记录日志,因为日志记录去掉事物方式
                    ////恢复事物默认标识
                    //distManagerParam.DistributeActionIden = DistributeActionIden.Query;
                    ////启用事物日志需要独立记录,不能和业务操作混在一个事物里
                    //for (int m = 0; m < dataNodes.Count; m++)
                    //{
                    //    //ddn.DbFactoryName  数据库工厂取配置文件,目前不考虑同构不同种类的数据库
                    //    distManagerParam.DistributeDataNode.Connectionstring = string.Format(dataNodes[m].Data_conn, dataNodes[m].Url_addr, dataNodes[m].Data_user,
                    //    dataNodes[m].Data_password);
                    //    distManagerParam.DistributeDataNode.DbSchema = dataNodes[m].Data_schema;

                    //    if (opList.Count > 0)
                    //    {
                    //        //记录日志
                    //        bool flag = recordLog.OpBizObjectSingle<SSY_LOGENTITY>(opList, opObjPerporty, opWherePerporty, mainProperty, errStr, distManagerParam);

                    //    }
                    //}
                }
                catch (Exception ex)
                {
                    Common.Utility.RecordLog("工厂 TransAction 模式发生异常!原因" + ex.Message + ex.Source, this.logpathForDebug, this.isLogpathForDebug);
                }
            }

            //最终返回结果,循环处理数据节点时,只返回最后一个执行成功的数据节点的执行情况
            return(resResult);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// 通用获取单个实体所有数据
 /// </summary>
 /// <param name="tablename"></param>
 /// <param name="ddnmParams"></param>
 /// <returns></returns>
 public abstract DataTable GetEntityAllDataForCommon(string tablename, DistributeDataNodeManagerParams ddnmParams);
Ejemplo n.º 22
0
 /// <summary>
 /// 通用查询数据实体是否存在数据库中,批量查询,支持分别查询一个字段、一组字段是否存在,可查询多条记录
 /// </summary>
 /// <param name="bizObjectName">数据实体表名</param>
 /// <param name="fields">要查询的字段组合,支持多组查询。例如:field1|field2|field3|field4;field5|field6,表示的分别查询字段1、字段2、字段3、字段6分别单独不重复,字段4和字段5组合不重复</param>
 /// <param name="fieldsValue">每个字段对应的数据值,字符串集合</param>
 /// <param name="splitChar">要查询的重复单元分隔符号。对应例子中的竖杠 |  可自定义其他,但要确保不和数据内容冲突</param>
 /// <param name="splitCharSub">要查询的组合分隔符号。对应例子中的分号 ; 可自定义其他 但要确保不和数据内容冲突</param>
 /// <param name="ddnmParams"></param>
 /// <returns></returns>
 public abstract List <string> CheckBizObjectsRepat(string bizObjectName, string fields, List <string> fieldsValue, string splitChar, string splitCharSub,
                                                    DistributeDataNodeManagerParams ddnmParams);
Ejemplo n.º 23
0
 /// <summary>
 /// 通用查询数据实体是否存在数据库中
 /// </summary>
 /// <param name="bizobjectname">数据库中的表名</param>
 /// <param name="wherePropertyL">字段|字段值,例如:prop1|value1</param>
 /// <param name="splitchar">wherePropertyL中的分割符号,默认|</param>
 /// <param name="distributeDataNodeManagerParams"></param>
 /// <param name="errStr"></param>
 /// <returns></returns>
 public abstract bool CheckBizObjectRepat(string bizobjectname, List <string> wherePropertyL, string splitchar,
                                          DistributeDataNodeManagerParams distributeDataNodeManagerParams, List <string> errStr);
Ejemplo n.º 24
0
 /// <summary>
 /// 统一操作业务实体泛型
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="objLists">业务实体List</param>
 /// <param name="opObjPropertyL">要操作的业务实体属性名称,对应于数据库字段,若确认都是删除时,可入空字符串</param>
 /// <param name="wherePropertyL">业务实体where语句属性名称,对应于数据库标示数据字段</param>
 /// <param name="mainPropertyL">主键字段说明</param>
 /// <param name="errStr"></param>
 /// <param name="distributeDataNodeManagerParams"></param>
 /// <param name="ListBizLog"></param>
 /// <returns></returns>
 public abstract bool OpBizObjectSingle <T>(List <T> objLists, List <string> opObjPropertyL, List <string> wherePropertyL, List <string> mainPropertyL, List <string> errStr,
                                            DistributeDataNodeManagerParams distributeDataNodeManagerParams, List <SSY_LOGENTITY> ListBizLog);
Ejemplo n.º 25
0
 /// <summary>
 /// 获取系统时间
 /// </summary>
 /// <param name="ddnmParams"></param>
 /// <returns></returns>
 public virtual string GetSystemDateTime(DistributeDataNodeManagerParams ddnmParams)
 {
     return(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
 }
Ejemplo n.º 26
0
 /// <summary>
 /// 获取全部系统字典
 /// </summary>
 /// <param name="model"></param>
 /// <param name="ddnmParams"></param>
 /// <returns></returns>
 public abstract DataTable GetFrameDictAll(Xxx.Entities.SSY_FRAME_DICT model, DistributeDataNodeManagerParams ddnmParams);
Ejemplo n.º 27
0
        public string currlang = APPConfig.GetAPPConfig().GetConfigValue("currlang", ""); //默认语种

        public CommonBaseService()
        {
            //支持CROSS访问
            if (OperationContext.Current != null)
            {
                //wcf通道不存在跨域问题
            }
            if (WebOperationContext.Current != null)
            {
                #region 跨域访问
                if (WebOperationContext.Current.IncomingRequest.Method == "OPTIONS")
                {
                    if (WebOperationContext.Current.OutgoingResponse.Headers["Access-Control-Allow-Methods"] == null)
                    {
                        WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*");
                        WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
                        WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Headers", "Origin, Cache-Control, X-Requested-With, Content-Type, Accept, token");
                        WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Max-Age", "1728000");
                    }
                }
                else
                {
                    if (WebOperationContext.Current.OutgoingResponse.Headers["Access-Control-Allow-Methods"] == null)
                    {
                        WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*");
                        WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE");
                        WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type");
                    }
                }

                #endregion
            }
            if (HttpContext.Current != null)
            {
                HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
                if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
                {
                    HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
                    HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Origin, Cache-Control, X-Requested-With, Content-Type, Accept, token");
                    HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000");
                    HttpContext.Current.Response.End();
                }
            }

            envirObj = new SysEnvironmentSerialize();

            try
            {
                //获取框架环境
                string token = this.GetToken();
                if (!string.IsNullOrEmpty(token))
                {
                    //bool temps = JsonSerializer.Deserialize<SysEnvironmentSerialize>(Encoding.Default.GetString(Convert.FromBase64String(token)), out envirObj);
                    //TODO 后续考虑js的base64处理
                    envirObj = json.Deserialize <SysEnvironmentSerialize>(token);
                }
                else
                {
                    envirObj.I18nCurrLang = currlang;
                }

                //赋值框架实例到静态框架环境
                ManagerSysEnvironment.GetSysEnvironmentSerialize2SysEnvironment(envirObj);

                //这里装载框架级语言包,具体模块在模块内装载
                DataTable comlangtmp = (DataTable)currCache.Get("i18nCommonCurrLang");
                if (comlangtmp != null)
                {
                    if (currlang == envirObj.I18nCurrLang)
                    {
                        i18nCommonCurrLang = comlangtmp;
                    }
                    else
                    {
                        string commoni18nLangPath = string.Format(APPConfig.GetAPPConfig().GetConfigValue("Commoni18nLang", ""), envirObj.I18nCurrLang);
                        i18nCommonCurrLang = this.GetI18nLang(commoni18nLangPath);
                    }
                }
                else
                {
                    string commoni18nLangPath = string.Format(APPConfig.GetAPPConfig().GetConfigValue("Commoni18nLang", ""), envirObj.I18nCurrLang);
                    i18nCommonCurrLang = this.GetI18nLang(commoni18nLangPath);
                }

                //装载服务配置
                //serviceConfig = this.GetServiceConfig(APPConfig.GetAPPConfig().GetConfigValue("ServiceConfigPath", ""));
                DataTable dttmp = (DataTable)currCache.Get("serviceConfig");
                if (dttmp != null)
                {
                    serviceConfig = dttmp;
                }
                else
                {
                    serviceConfig = this.GetServiceConfig(APPConfig.GetAPPConfig().GetConfigValue("ServiceConfigPath", ""));
                }

                //装载数据配置
                //distManagerParam = this.GetDistributeDataNodeManagerParams();
                DistributeDataNodeManagerParams ddnmtmp = (DistributeDataNodeManagerParams)currCache.Get("dataNodes");
                if (ddnmtmp != null)
                {
                    distManagerParam = ddnmtmp;
                }
                //这里不需要再装载了,缓存已经装载了
                //else
                //{
                //    distManagerParam = this.GetDistributeDataNodeManagerParams();
                //}

                //设置语言运行环境
                Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(envirObj.I18nCurrLang);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(envirObj.I18nCurrLang);
                //due to an error of freetextbox, all the cultures must use a dot as NumberDecimalSeparator
                Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator = ".";

                this.successStr = this.GetI18nLangItem("successStr", this.i18nCommonCurrLang);
                this.errorStr   = this.GetI18nLangItem("errorStr", this.i18nCommonCurrLang);
            }
            catch (Exception ex)
            {
                throw new Exception("Unknown exception! Reason:" + ex.Message);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 获取系统ID字符串
        /// </summary>
        /// <param name="makeIDType"></param>
        /// <param name="formmat"></param>
        /// <param name="makeCustemTypeID"></param>
        /// <param name="ddnmParams"></param>
        /// <returns></returns>
        public virtual string GetID(MakeIDType makeIDType, string formmat, MakeCustemTypeID makeCustemTypeID, DistributeDataNodeManagerParams ddnmParams)
        {
            string retId = string.Empty;

            if (makeIDType == MakeIDType.YMDHMM)
            {
                retId = System.Convert.ToDateTime(this.GetSystemDateTime(ddnmParams)).ToString("yyyyMMddHHmmss");
            }
            else if (makeIDType == MakeIDType.GUID)
            {
                if (string.IsNullOrEmpty(formmat))
                {
                    return(System.Guid.NewGuid().ToString());
                }
                else
                {
                    System.Guid guid = new System.Guid(formmat);
                    return(guid.ToString());
                }
            }
            else if (makeIDType == MakeIDType.YMDHMS_1)
            {
                retId = System.Convert.ToDateTime(this.GetSystemDateTime(ddnmParams)).ToString("yyyyMMddHHmmss") + Utility.GetRandNum(1).ToString();
            }
            else if (makeIDType == MakeIDType.YMDHMS_2)
            {
                retId = System.Convert.ToDateTime(this.GetSystemDateTime(ddnmParams)).ToString("yyyyMMddHHmmss") + Utility.GetRandNum(2).ToString();
            }
            else if (makeIDType == MakeIDType.YMDHMS_3)
            {
                retId = System.Convert.ToDateTime(this.GetSystemDateTime(ddnmParams)).ToString("yyyyMMddHHmmss") + Utility.GetRandNum(3).ToString();
            }
            else if (makeIDType == MakeIDType.YMDHMS_4)
            {
                retId = System.Convert.ToDateTime(this.GetSystemDateTime(ddnmParams)).ToString("yyyyMMddHHmmss") + Utility.GetRandNum(4).ToString();
            }
            else if (makeIDType == MakeIDType.YMDHMS_5)
            {
                retId = System.Convert.ToDateTime(this.GetSystemDateTime(ddnmParams)).ToString("yyyyMMddHHmmss") + Utility.GetRandNum(5).ToString();
            }
            else if (makeIDType == MakeIDType.YMDHMS_10)
            {
                retId = System.Convert.ToDateTime(this.GetSystemDateTime(ddnmParams)).ToString("yyyyMMddHHmmss") + Utility.GetRandNum(10).ToString();
            }
            else if (makeIDType == MakeIDType.CUSTEMTYPE)
            {
                return(makeCustemTypeID());
            }

            return(retId);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 加载全部的环境变量
        /// </summary>
        /// <param name="envirObj"></param>
        /// <returns></returns>
        public void GetAllSysEnvironment()
        {
            this.envirObj.distManagerParam = this.distManagerParam;

            //后续若需要,考虑补全用户实体信息
        }
Ejemplo n.º 30
0
 /// <summary>
 /// 获取系统字典(某个字典的全部字典项)
 /// </summary>
 /// <param name="model"></param>
 /// <param name="ddnmParams"></param>
 /// <param name="pager"></param>
 /// <returns></returns>
 public abstract DataTable GetFrameDictPager(SSY_FRAME_DICT model, DistributeDataNodeManagerParams ddnmParams, SSY_PagingParam pager);