Ejemplo n.º 1
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="comCore"></param>
 /// <param name="config"></param>
 public FormFontAndColor(CommonMC2D comCore, APPConfig config)
 {
     InitializeComponent();
     m_comCore      = comCore;
     m_config       = config;
     m_FontAndColor = config.FontAndColors[config.Whole.ColorTheme];
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 检查令牌
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public string CheckToken(string req)
        {
            try
            {
                reqdata = this.AnaRequestData(req);
                SSY_DYNAMICTOKEN model = this.json.Deserialize <SSY_DYNAMICTOKEN>(reqdata.reqdata);

                //检查节点令牌, TODO后续优化考虑缓冲令牌
                string cols                   = "id|dynamictoken|remarks|timestampss";
                string colTypes               = "String|String|String|String";
                string tokenFilePath          = APPConfig.GetAPPConfig().GetConfigValue("XmldataPath", "") + "\\SSY_DYNAMICTOKEN.xml";
                System.Data.DataTable dtToken = Common.Utility.GetTableFromXml(cols, colTypes, tokenFilePath);

                if (Utility.DtHasData(dtToken))
                {
                    DataRow[] drs = dtToken.Select(string.Format("dynamictoken = '{0}'", model.Dynamictoken));
                    if (drs.Length > 0)
                    {
                        resdata = this.MakeResponseData("1", this.GetI18nLangItem("tokenOk", this.i18nModuleCurrLang), string.Empty, string.Empty);
                        return(json.Serialize(resdata));
                    }
                }

                resdata = this.MakeResponseData("0", this.GetI18nLangItem("tokenErr", this.i18nModuleCurrLang), string.Empty, string.Empty);
            }
            catch (Exception ex)
            {
                resdata = this.MakeResponseData("0", this.GetI18nLangItem("tokenCheckErr", this.i18nModuleCurrLang) + ex.Message, string.Empty, string.Empty);
            }

            return(json.Serialize(resdata));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        private CommonMC2D()
        {
            m_d2Stg = new D2StageFile();
            // 衝突判定用チップイメージ
            m_aCollisionChipImg = new Bitmap[36];
            int i;

            for (i = 0; i < 36; ++i)
            {
                m_aCollisionChipImg[i] = CopyCatRectangleBitmap(
                    global::EditorMC2D.Properties.Resources.colli_chip,
                    new Rectangle(i % 12 * 40, i / 12 * 40, 40, 40),
                    40
                    );
            }

            //-------------------------------------------
            // コンフィグ作成
            //-------------------------------------------
            m_config = APPConfig.Read();

            //--
            m_rectImg = global::EditorMC2D.Properties.Resources.gura;

            m_process = new ProcessMC2D();
            InitOutputWindowDatas();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取节点中心同源单点数据操作任务状态
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public string GetSameDataActionTaskStatusN(string req)
        {
            try
            {
                reqdata = this.AnaRequestData(req);
                SSY_DATA_ACTION_TASK model = this.json.Deserialize <SSY_DATA_ACTION_TASK>(reqdata.reqdata);

                string cols           = "id|data_real_conn|action_sql|action_sql_params|action_status|execute_cnt|max_execute_cnt|remarks|timestampss";
                string colTypes       = "String|String|String|String|String|String|String|String|String";
                string nodeDataAction = APPConfig.GetAPPConfig().GetConfigValue("xmldataPath", "") + "\\SSY_DATA_ACTION_TASK.xml";
                System.Data.DataTable dtdataActionTask = Common.Utility.GetTableFromXml(cols, colTypes, nodeDataAction);

                List <SSY_DATA_ACTION_TASK> dataActionTask = new List <SSY_DATA_ACTION_TASK>();
                if (Utility.DtHasData(dtdataActionTask))
                {
                    dataActionTask = UtilitysForT <SSY_DATA_ACTION_TASK> .GetListsObj(dtdataActionTask);
                }

                if (dataActionTask.Count > 0)
                {
                    resdata = this.MakeResponseData("0", string.Empty, json.Serialize(dataActionTask), string.Empty);
                }
                else
                {
                    resdata = this.MakeResponseData("0", this.GetI18nLangItem("noFindSameDataActionTaskStatu", this.i18nModuleCurrLang), string.Empty, string.Empty);
                }
            }
            catch (Exception ex)
            {
                resdata = this.MakeResponseData("0", this.GetI18nLangItem("getSameDataActionTaskStatuErr", this.i18nModuleCurrLang) + ex.Message,
                                                string.Empty, string.Empty);
            }

            return(json.Serialize(resdata));
        }
Ejemplo n.º 5
0
    public CacheDataMgt(HttpServerUtility currservers)
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //

        try
        {
            leaveTime    = int.Parse(APPConfig.GetAPPConfig().GetConfigValue("NodeCenterDataLeaveTime", ""));
            internalTime = int.Parse(WebConfigurationManager.AppSettings["NodeCenterDataInternalTime"].ToString());
        }
        catch (Exception ex)
        {
            leaveTime    = 1;
            internalTime = 3;
        }

        //cacheDataMgtTimer = new System.Threading.Timer(new TimerCallback(ExecUpdateCacheData), currservers, leaveTime * 60000, internalTime * 60000);

        //定时同步缓存数据
        ThreadStart AutoSynCacheData = new ThreadStart(ExecUpdateCacheData);
        Thread      AutoThread       = new Thread(AutoSynCacheData);

        AutoThread.Start();
    }
Ejemplo n.º 6
0
        /// <summary>
        /// 查询节点异常情况
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public string GetNodeErrorLogsN(string req)
        {
            try
            {
                reqdata = this.AnaRequestData(req);
                SSY_NODE_ERRORS model = this.json.Deserialize <SSY_NODE_ERRORS>(reqdata.reqdata);

                string cols            = "id|url_addr|node_typs|error_desc|remarks|timestampss";
                string colTypes        = "String|String|String|String|String|String";
                string useNodeErrorLog = APPConfig.GetAPPConfig().GetConfigValue("xmldataPath", "") + "\\SSY_NODE_ERRORS.xml";
                System.Data.DataTable dtXmlNodeErrors = Common.Utility.GetTableFromXml(cols, colTypes, useNodeErrorLog);

                List <SSY_NODE_ERRORS> nodeErrors = new List <SSY_NODE_ERRORS>();
                if (Utility.DtHasData(dtXmlNodeErrors))
                {
                    nodeErrors = UtilitysForT <SSY_NODE_ERRORS> .GetListsObj(dtXmlNodeErrors);
                }

                if (nodeErrors.Count > 0)
                {
                    resdata = this.MakeResponseData("0", string.Empty, json.Serialize(nodeErrors), string.Empty);
                }
                else
                {
                    resdata = this.MakeResponseData("0", this.GetI18nLangItem("noFindNodeErrorLog", this.i18nModuleCurrLang), string.Empty, string.Empty);
                }
            }
            catch (Exception ex)
            {
                resdata = this.MakeResponseData("0", this.GetI18nLangItem("getNodeErrorLogErr", this.i18nModuleCurrLang) + ex.Message, string.Empty, string.Empty);
            }

            return(json.Serialize(resdata));
        }
        public FrameSecurityService()
        {
            //这里具体服务语言包
            //string FrameSecurityi18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameSecurityi18nLang", ""), envirObj.I18nCurrLang);
            //i18nModuleCurrLang = this.GetI18nLang(FrameSecurityi18nLang);

            DataTable servlangtmp = (DataTable)currCache.Get("i18nFrameSecurityi18nLang");

            if (servlangtmp != null)
            {
                if (currlang == envirObj.I18nCurrLang)
                {
                    i18nModuleCurrLang = servlangtmp;
                }
                else
                {
                    string FrameSecurityi18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameSecurityi18nLang", ""), envirObj.I18nCurrLang);
                    i18nModuleCurrLang = this.GetI18nLang(FrameSecurityi18nLang);
                }
            }
            else
            {
                string FrameSecurityi18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameSecurityi18nLang", ""), envirObj.I18nCurrLang);
                i18nModuleCurrLang = this.GetI18nLang(FrameSecurityi18nLang);
            }

            _comBiz = new BizExecFacade.CommonBizFacade(envirObj);
        }
Ejemplo n.º 8
0
        public SomebizService()
        {
            //这里具体服务语言包
            DataTable servlangtmp = (DataTable)currCache.Get("i18nXxxi18nLang");

            if (servlangtmp != null)
            {
                if (currlang == envirObj.I18nCurrLang)
                {
                    i18nModuleCurrLang = servlangtmp;
                }
                else
                {
                    string XxxManageri18nLang = string.Format(this.baseXmlPath + APPConfig.GetAPPConfig().GetConfigValue("XxxManageri18nLang", ""), envirObj.I18nCurrLang);
                    i18nModuleCurrLang = this.GetI18nLang(XxxManageri18nLang);
                }
            }
            else
            {
                string XxxManageri18nLang = string.Format(this.baseXmlPath + APPConfig.GetAPPConfig().GetConfigValue("XxxManageri18nLang", ""), envirObj.I18nCurrLang);
                i18nModuleCurrLang = this.GetI18nLang(XxxManageri18nLang);
            }

            _comBiz     = new CommonBizFacade(envirObj);
            _comSomebiz = new BizFacadeSomebiz(envirObj);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 向节点中心报告业务节点、数据节点异常情况
        /// </summary>
        /// <param name="req"></param>
        /// <returns>0 成功  其他失败</returns>
        public string RecordNodeErrorLogN(string req)
        {
            try
            {
                reqdata = this.AnaRequestData(req);
                List <SSY_NODE_ERRORS> model = this.json.Deserialize <List <SSY_NODE_ERRORS> >(reqdata.reqdata);

                string        nodeErrorLog = APPConfig.GetAPPConfig().GetConfigValue("xmldataPath", "") + "\\SSY_NODE_ERRORS.xml";
                string        attiName     = "id|url_addr|node_typs|error_desc|remarks|timestampss";
                List <string> attiValue    = new List <string>();
                string        attiValueOne = @"{0}|{1}|{2}|{3}|{4}|{5}";

                for (int i = 0; i < model.Count; i++)
                {
                    string tempattiValueOne = string.Format(attiValueOne, model[i].ID, model[i].Url_addr, model[i].Node_typs, model[i].Error_desc,
                                                            model[i].Remarks, model[i].Timestampss);
                    attiValue.Add(tempattiValueOne);
                }

                bool tempFlag = Utility.AddNodeForXml("root", "item", nodeErrorLog, attiName, attiValue, "|");

                if (tempFlag)
                {
                    #region  时修正节点中心、业务节点、业务数据库运行状态
                    for (int i = 0; i < model.Count; i++)
                    {
                        ServiceType servType  = ServiceType.BizDueWith;
                        string      node_addr = model[i].Url_addr;
                        string      errStr    = model[i].Error_desc;
                        if (model[i].Node_typs == "DataBaseErr")
                        {
                            servType = ServiceType.DataBaseErr;
                        }
                        else if (model[i].Node_typs == "BizDueWith")
                        {
                            servType = ServiceType.BizDueWith;
                        }
                        else if (model[i].Node_typs == "NodeCenter")
                        {
                            servType = ServiceType.NodeCenter;
                        }
                        this.UpdateNodeRunStatus(servType, node_addr, errStr);
                    }
                    #endregion

                    resdata = this.MakeResponseData("1", this.GetI18nLangItem("RecordNodeErrorLogSuccess", this.i18nModuleCurrLang), "0", string.Empty);
                }
                else
                {
                    resdata = this.MakeResponseData("0", this.GetI18nLangItem("RecordNodeErrorLogFailed", this.i18nModuleCurrLang), string.Empty, string.Empty);
                }
            }
            catch (Exception ex)
            {
                resdata = this.MakeResponseData("0", this.GetI18nLangItem("RecordNodeErrorLogErr", this.i18nModuleCurrLang) + ex.Message,
                                                string.Empty, string.Empty);
            }

            return(json.Serialize(resdata));
        }
Ejemplo n.º 10
0
        //保存历史计算引擎配置
        private void bt_savehistorycalcu_Click(object sender, EventArgs e)
        {
            APPConfig.SaveConfig("/config", "historycalcu_period4RTD", APPConfig.historycalcu_period4RTD.ToString());

            APPConfig.SaveConfig("/config", "historycalcu_period4PSL", APPConfig.historycalcu_period4PSL.ToString());

            this.Close();
        }
Ejemplo n.º 11
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;
        }
    }
        public static DistributeDataNode GetDistributeDataNode()
        {
            DistributeDataNode ddn = new DistributeDataNode();

            ddn.DbFactoryName    = APPConfig.GetAPPConfig().GetConfigValue("DBFactoryName", "");
            ddn.Connectionstring = APPConfig.GetAPPConfig().GetConfigValue("ConnectionString", "");
            ddn.DbSchema         = APPConfig.GetAPPConfig().GetConfigValue("Dbschema", "");
            return(ddn);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 获取节点中心地址
        /// </summary>
        /// <returns></returns>
        public List <string> GetNodeCenterAddr()
        {
            List <string> nodeCenterAddr = new List <string>();

            nodeCenterAddr.Add(APPConfig.GetAPPConfig().GetConfigValue("NodeCenterMaster", ""));
            nodeCenterAddr.Add(APPConfig.GetAPPConfig().GetConfigValue("NodeCenterSlave", ""));

            return(nodeCenterAddr);
        }
Ejemplo n.º 14
0
        private void bt_save_Click(object sender, EventArgs e)
        {
            //"计算结果标签名自动生成“
            if (this.rb_TagAuto.Checked)
            {//这里注意SaveConfig()接口,第一个参数要写xpaht,并且写到要更新节点的父节点。
                APPConfig.SaveConfig("/config", "resulttagauto", "1");
                APPConfig.rdbtable_resulttagauto = "1";
            }
            else
            {
                APPConfig.SaveConfig("/config", "resulttagauto", "0");
                APPConfig.rdbtable_resulttagauto = "0";
            }
            //"计算结果标签名自动生成“
            if (this.rb_IncludeIntervalType.Checked)
            {//这里注意SaveConfig()接口,第一个参数要写xpaht,并且写到要更新节点的父节点。
                APPConfig.SaveConfig("/config", "resulttagincludeinterval", "1");
                APPConfig.rdbtable_resulttagincludeinterval = "1";
            }
            else
            {
                APPConfig.SaveConfig("/config", "resulttagincludeinterval", "0");
                APPConfig.rdbtable_resulttagincludeinterval = "0";
            }
            //“生成tag id映射表时,重新编id号
            if (this.rb_TagAuto.Checked)
            {
                APPConfig.SaveConfig("/config", "tag2idalwaysreset", "1");
                APPConfig.rdbtable_tag2idalwaysreset = "1";
            }
            else
            {
                APPConfig.SaveConfig("/config", "tag2idalwaysreset", "0");
                APPConfig.rdbtable_tag2idalwaysreset = "0";
            }
            //“初始化时包含psldata表”
            if (this.cbIniTableIncludePSLData.Checked)
            {
                APPConfig.SaveConfig("/config", "rdbtable_iniTableIncludePsldata", "1");
                APPConfig.rdbtable_tag2idalwaysreset = "1";
            }
            else
            {
                APPConfig.SaveConfig("/config", "rdbtable_iniTableIncludePsldata", "0");
                APPConfig.rdbtable_tag2idalwaysreset = "0";
            }
            //psldata时间
            APPConfig.psldata_startyear = int.Parse(this.tbStartYear.Text);
            APPConfig.SaveConfig("/config", "startyear", int.Parse(this.tbStartYear.Text).ToString());
            APPConfig.psldata_endyear = int.Parse(this.tbEndYear.Text);
            APPConfig.SaveConfig("/config", "endyear", int.Parse(this.tbEndYear.Text).ToString());


            this.Close();
        }
Ejemplo n.º 15
0
        //若包含其他需要累加

        public Somebiz(SysEnvironmentSerialize _envirObj)
        {
            string _currlang = _envirObj.I18nCurrLang;

            System.Web.Caching.Cache currCache = HttpRuntime.Cache;                       //当前缓存
            string defaultlang = APPConfig.GetAPPConfig().GetConfigValue("currlang", ""); //默认语种

            this.envirObj = _envirObj;

            #region 通用语言包

            DataTable comlangtmp = (DataTable)currCache.Get("i18nCommonCurrLang");
            if (comlangtmp != null)
            {
                if (defaultlang == _currlang)
                {
                    i18nCommonCurrLang = comlangtmp;
                }
                else
                {
                    string commoni18nLangPath = string.Format(APPConfig.GetAPPConfig().GetConfigValue("Commoni18nLang", ""), _currlang);
                    i18nCommonCurrLang = BaseServiceUtility.GetI18nLang(commoni18nLangPath);
                }
            }
            else
            {
                string commoni18nLangPath = string.Format(APPConfig.GetAPPConfig().GetConfigValue("Commoni18nLang", ""), _currlang);
                i18nCommonCurrLang = BaseServiceUtility.GetI18nLang(commoni18nLangPath);
            }

            #endregion

            #region Somebiz语言包

            DataTable servFrameSecuriylangtmp = (DataTable)currCache.Get("i18nXxxi18nLang");
            if (servFrameSecuriylangtmp != null)
            {
                if (defaultlang == _currlang)
                {
                    i18nXxxManageri18nLang = servFrameSecuriylangtmp;
                }
                else
                {
                    string Somebizi18nLang = string.Format(this.baseXmlPath + APPConfig.GetAPPConfig().GetConfigValue("XxxManageri18nLang", ""), _currlang);
                    i18nXxxManageri18nLang = BaseServiceUtility.GetI18nLang(Somebizi18nLang);
                }
            }
            else
            {
                string Somebizi18nLang = string.Format(this.baseXmlPath + APPConfig.GetAPPConfig().GetConfigValue("XxxManageri18nLang", ""), _currlang);
                i18nXxxManageri18nLang = BaseServiceUtility.GetI18nLang(Somebizi18nLang);
            }

            #endregion
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 登录按钮操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            _isLogin = APPConfig.UserLogin(textBoxName.Text, textBoxPassWord.Text);

            if (_isLogin)
            {
                MessageBox.Show("登录成功!");

                this.Close();
            }
            else
            {
                MessageBox.Show("验证失败!");
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 获取节点中心服务站点服务
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public SSY_ResponseResult <IEnumerable <SSY_SERVICESITE_SERVICES> > GetNodeServiceSiteService(SSY_SERVICESITE_SERVICES model)
        {
            string cols     = "id|sitecode|servicecode|servicename|service_relaUrl|remarks|timestampss";
            string colTypes = "String|String|String|String|String|String|String";
            string serviceSiteServicePath = APPConfig.GetAPPConfig().GetConfigValue("xmldataPath", "") + "\\SSY_SERVICESITE_SERVICES.xml";

            System.Data.DataTable dtserviceSiteService = Common.Utility.GetTableFromXml(cols, colTypes, serviceSiteServicePath);

            List <SSY_SERVICESITE_SERVICES> serviceSiteServiceList = new List <SSY_SERVICESITE_SERVICES>();

            if (Utility.DtHasData(dtserviceSiteService))
            {
                serviceSiteServiceList = UtilitysForT <SSY_SERVICESITE_SERVICES> .GetListsObj(dtserviceSiteService);
            }

            return(new SSY_ResponseResult <IEnumerable <SSY_SERVICESITE_SERVICES> >(serviceSiteServiceList));
        }
Ejemplo n.º 18
0
        //保存实时计算引擎配置
        private void btSaveCalcu_Click(object sender, EventArgs e)
        {
            //是否自动计算
            if (this.cbAutoRun.Checked)
            {
                APPConfig.realcalcu_autorun = "1";
                APPConfig.SaveConfig("/config", "autorun", "1");
            }
            else
            {
                APPConfig.realcalcu_autorun = "0";
                APPConfig.SaveConfig("/config", "autorun", "0");
            }
            //计算扫描周期
            if (this.tb_CalcuPeriod.Text != "")
            {
                APPConfig.SaveConfig("/config", "period", this.tb_CalcuPeriod.Text);
                APPConfig.realcalcu_period = int.Parse(this.tb_CalcuPeriod.Text);
            }
            //保存计算配置对象信息周期
            if (this.tb_WritePeriod.Text != "")
            {
                APPConfig.SaveConfig("/config", "periodwritepslcalcuitem", this.tb_WritePeriod.Text);
                APPConfig.realcalcu_periodwritepslcalcuitem = int.Parse(this.tb_WritePeriod.Text);
            }
            //统计计算模件用时
            if (this.cbCalcuTime.Checked)
            {
                APPConfig.realcalcu_recordcalcutime = "1";
                APPConfig.SaveConfig("/config", "recordcalcutime", "1");
            }
            else
            {
                APPConfig.realcalcu_recordcalcutime = "0";
                APPConfig.SaveConfig("/config", "recordcalcutime", "0");
            }
            if (this.tb_saveNumber.Text != "")
            {
                APPConfig.realcalcu_recordsavenumber = int.Parse(this.tb_saveNumber.Text);
                APPConfig.SaveConfig("/config", "recordsavenumber", this.tb_saveNumber.Text);
            }
            //单次读取实时数据记录最大数量
            //该参数不允许在界面配置。

            this.Close();
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 向中心节点报告同源单点数据操作失败任务
        /// 节点中心后续会继续进行补充完成数据操作
        /// </summary>
        /// <param name="req"></param>
        /// <returns>0 成功  其他失败</returns>
        public string ReportSameDataActionTaskN(string req)
        {
            try
            {
                reqdata = this.AnaRequestData(req);
                List <SSY_DATA_ACTION_TASK> model = this.json.Deserialize <List <SSY_DATA_ACTION_TASK> >(reqdata.reqdata);

                string        nodeDataAction = APPConfig.GetAPPConfig().GetConfigValue("xmldataPath", "") + "\\SSY_DATA_ACTION_TASK.xml";
                string        attiName       = "id|data_real_conn|action_sql|action_sql_params|action_status|execute_cnt|max_execute_cnt|remarks|timestampss";
                List <string> attiValue      = new List <string>();
                string        attiValueOne   = @"{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}";

                for (int i = 0; i < model.Count; i++)
                {
                    string tempattiValueOne = string.Format(attiValueOne, model[i].ID, model[i].Data_real_conn, model[i].Action_sql, model[i].Action_status,
                                                            model[i].Execute_cnt, model[i].Max_execute_cnt, model[i].Remarks, model[i].Timestampss);
                    attiValue.Add(tempattiValueOne);
                }

                bool tempFlag = Utility.AddNodeForXml("root", "item", nodeDataAction, attiName, attiValue, "|");

                if (tempFlag)
                {
                    resdata = this.MakeResponseData("1", this.GetI18nLangItem("ReportSameDataActionTaskSuccess", this.i18nModuleCurrLang), string.Empty, string.Empty);
                }
                else
                {
                    resdata = this.MakeResponseData("0", this.GetI18nLangItem("ReportSameDataActionTaskFailed", this.i18nModuleCurrLang), string.Empty, string.Empty);
                }
            }
            catch (Exception ex)
            {
                resdata = this.MakeResponseData("0", this.GetI18nLangItem("ReportSameDataActionTaskErr", this.i18nModuleCurrLang) + ex.Message,
                                                string.Empty, string.Empty);
            }

            return(json.Serialize(resdata));
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 报告节点异常,包括节点中心服务、业务节点服务、业务节点数据库
        /// </summary>
        /// <param name="servType"></param>
        /// <param name="node_addr"></param>
        /// <param name="errStr"></param>
        private void ReportNodeError(ServiceType servType, string node_addr, string errStr)
        {
            //报告节点异常
            string FrameManagerNodeService = this.GetNodeBaseAddr(this.GetNodeCenterAddr(), servType) +
                                             APPConfig.GetAPPConfig().GetConfigValue(SSY_ServiceHost.FrameManagerNodeService, "").TrimStart('/');

            List <SSY_NODE_ERRORS> model    = new List <SSY_NODE_ERRORS>();
            SSY_NODE_ERRORS        modelOne = new SSY_NODE_ERRORS();

            string timestr = DateTime.Now.ToString("yyyyMMddHHmmss");

            modelOne.ID          = timestr + Utility.GetRandNum(3);
            modelOne.Node_typs   = servType.ToString();
            modelOne.Url_addr    = node_addr;
            modelOne.Error_desc  = errStr;
            modelOne.Remarks     = "";
            modelOne.Timestampss = timestr;

            model.Add(modelOne);

            //报告节点异常
            var res = DynamicInvokeWCF.Create <IFrameManagerNode>(FrameManagerNodeService).RecordNodeErrorLogN(this.json.Serialize(model));
        }
Ejemplo n.º 21
0
        public FrameManagerNodeService()
        {
            //这里具体服务语言包
            DataTable servlangtmp = (DataTable)currCache.Get("i18nFrameNodei18nLang");

            if (servlangtmp != null)
            {
                if (currlang == envirObj.I18nCurrLang)
                {
                    i18nModuleCurrLang = servlangtmp;
                }
                else
                {
                    string FrameNodei18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameNodei18nLang", ""), envirObj.I18nCurrLang);
                    i18nModuleCurrLang = this.GetI18nLang(FrameNodei18nLang);
                }
            }
            else
            {
                string FrameNodei18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameNodei18nLang", ""), envirObj.I18nCurrLang);
                i18nModuleCurrLang = this.GetI18nLang(FrameNodei18nLang);
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 更新节点运行状态
        /// </summary>
        /// <param name="servType"></param>
        /// <param name="node_addr"></param>
        /// <param name="errStr"></param>
        public void UpdateNodeRunStatus(ServiceType servType, string node_addr, string errStr)
        {
            bool   tempFlag           = false;
            string nodeStatusFileName = string.Empty;
            string updateNodeName     = string.Empty;
            string updateNodeValue    = string.Empty;
            string idName             = string.Empty;
            string idValue            = string.Empty;

            if (servType == ServiceType.NodeCenter)
            {
                //节点中心服务ID(NCServices) 节点中心后台工作服务ID(NCBServices)
                //配置文件节点属性名
                //"id|nodeAddr|nodeName|runStatus|nodeCenterClass|remarks|timestampss";
                idName  = "id";
                idValue = "NCServices";

                //需要更新的节点名及节点值,必须一一对应
                updateNodeName  = "runStatus|timestampss";
                updateNodeValue = string.Format("{0}|{1}", "停止", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                //更新节点中心状态
                nodeStatusFileName = "\\SSY_NodeCenter_RunStatus.xml";
                tempFlag           = Utility.UpdateAttributeFromXmls(APPConfig.GetAPPConfig().GetConfigValue("XmldataPath", "") + nodeStatusFileName, idName, idValue,
                                                                     updateNodeName, updateNodeValue, '|');
            }
            else if (servType == ServiceType.BizDueWith)
            {
                //业务节点状态
                //配置文件节点属性名
                //id="xxx" url_addr="xxx" use_status="xxx"  remarks="xxx" timestampss="xxx";
                idName  = "url_addr";
                idValue = node_addr;

                //需要更新的节点名及节点值,必须一一对应
                updateNodeName  = "use_status|timestampss";
                updateNodeValue = string.Format("{0}|{1}", "0", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                //更新业务节点运行状态
                nodeStatusFileName = "\\SSY_BIZNODE_ADDR.xml";
                tempFlag           = Utility.UpdateAttributeFromXmls(APPConfig.GetAPPConfig().GetConfigValue("XmldataPath", "") + nodeStatusFileName, idName, idValue,
                                                                     updateNodeName, updateNodeValue, '|');
            }
            else if (servType == ServiceType.BizDueWith)
            {
                //数据库节点状态
                //配置文件节点属性名
                //id="xxx" url_addr="xxx" use_status="xxx" data_schema="xxx" data_user="******"  data_password="******" data_conn="xxx"  remarks="xxx"
                //timestampss ="xxx" dbfactoryname="xxx" systemname="xxx" isconfigdb="" isencrydbconn="" isencrypwd="xxx" encryhashlenth="xxx"
                //encrykeystr ="xxx" securitycode="xxx" isusepwdsecuritycheck="xxx" pwdintervalhours="xxx" pwdfirstcheck="xxx"
                idName  = "url_addr";
                idValue = node_addr;

                //需要更新的节点名及节点值,必须一一对应
                updateNodeName  = "use_status|timestampss";
                updateNodeValue = string.Format("{0}|{1}", "0", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                //更新业务节点运行状态
                nodeStatusFileName = "\\SSY_DATANODE_ADDR.xml";
                tempFlag           = Utility.UpdateAttributeFromXmls(APPConfig.GetAPPConfig().GetConfigValue("XmldataPath", "") + nodeStatusFileName, idName, idValue,
                                                                     updateNodeName, updateNodeValue, '|');
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 获取可用节点,包括业务及数据
        /// </summary>
        /// <param name="use_state"></param>
        /// <returns></returns>
        public UseNodeCollection GetUseNodeCollections(string use_state)
        {
            UseNodeCollection        unc      = new UseNodeCollection();
            List <SSY_BIZNODE_ADDR>  bizNode  = new List <SSY_BIZNODE_ADDR>();
            List <SSY_DATANODE_ADDR> dataNode = new List <SSY_DATANODE_ADDR>();

            unc.BizNodeList  = bizNode;
            unc.DataNodeList = dataNode;

            //业务节点
            string cols        = "id|url_addr|use_status|moudiden|remarks|timestampss";
            string colTypes    = "String|String|String|String|String|String";
            string useNodeAddr = APPConfig.GetAPPConfig().GetConfigValue("xmldataPath", "") + "\\SSY_BIZNODE_ADDR.xml";

            System.Data.DataTable dtXmlDataBiz = Common.Utility.GetTableFromXml(cols, colTypes, useNodeAddr);

            if (Utility.DtHasData(dtXmlDataBiz))
            {
                DataRow[] drsBiz = null;
                if (!string.IsNullOrEmpty(use_state))
                {
                    drsBiz = dtXmlDataBiz.Select(string.Format("use_status = '{0}'", use_state));
                }
                else
                {
                    drsBiz = dtXmlDataBiz.Select(string.Format("1 = {0}", "1"));
                }

                if (drsBiz.Length > 0)
                {
                    SSY_BIZNODE_ADDR tempBizNode = null;
                    for (int i = 0; i < drsBiz.Length; i++)
                    {
                        tempBizNode            = new SSY_BIZNODE_ADDR();
                        tempBizNode.ID         = drsBiz[i]["id"].ToString();
                        tempBizNode.Url_addr   = drsBiz[i]["Url_addr"].ToString();
                        tempBizNode.Moudiden   = drsBiz[i]["Moudiden"].ToString();
                        tempBizNode.Use_status = drsBiz[i]["Use_status"].ToString();
                        bizNode.Add(tempBizNode);
                    }
                }
            }

            //数据节点
            string cols1           = @"id|url_addr|use_status|data_schema|data_user|data_password|data_conn|remarks|timestampss|dbfactoryname|systemname|isencrydbconn|isencrypwd|encryhashlenth|encrykeystr|isusepwdsecuritycheck|pwdintervalhours|pwdfirstcheck";
            string colTypes1       = @"String|String|String|String|String|String|String|String|String|String|String|String|String|String|String|String|String|String";
            string useDataNodeAddr = APPConfig.GetAPPConfig().GetConfigValue("xmldataPath", "") + "\\SSY_DATANODE_ADDR.xml";

            System.Data.DataTable dtXmlDataData = Common.Utility.GetTableFromXml(cols1, colTypes1, useDataNodeAddr);

            if (Utility.DtHasData(dtXmlDataData))
            {
                DataRow[] drsData = null;
                if (!string.IsNullOrEmpty(use_state))
                {
                    drsData = dtXmlDataData.Select(string.Format("use_status = '{0}'", use_state));
                }
                else
                {
                    drsData = dtXmlDataData.Select(string.Format("1 = {0}", "1"));
                }
                if (drsData.Length > 0)
                {
                    SSY_DATANODE_ADDR tempDataNode = null;
                    for (int i = 0; i < drsData.Length; i++)
                    {
                        tempDataNode    = new SSY_DATANODE_ADDR();
                        tempDataNode.ID = drsData[i]["id"].ToString();

                        tempDataNode.Use_status            = drsData[i]["use_status"].ToString();
                        tempDataNode.DBFactoryName         = drsData[i]["dbfactoryname"].ToString();
                        tempDataNode.Systemname            = drsData[i]["systemname"].ToString();
                        tempDataNode.Isencrypwd            = drsData[i]["isencrypwd"].ToString();
                        tempDataNode.Encryhashlenth        = drsData[i]["encryhashlenth"].ToString();
                        tempDataNode.Encrykeystr           = drsData[i]["encrykeystr"].ToString();
                        tempDataNode.Isusepwdsecuritycheck = drsData[i]["isusepwdsecuritycheck"].ToString();
                        tempDataNode.Pwdintervalhours      = drsData[i]["pwdintervalhours"].ToString();
                        tempDataNode.Pwdfirstcheck         = drsData[i]["pwdfirstcheck"].ToString();

                        tempDataNode.Isencrydbconn = drsData[i]["isencrydbconn"].ToString();
                        tempDataNode.Url_addr      = drsData[i]["url_addr"].ToString();
                        tempDataNode.Data_schema   = drsData[i]["data_schema"].ToString();
                        tempDataNode.Data_user     = drsData[i]["data_user"].ToString();
                        tempDataNode.Data_password = drsData[i]["data_password"].ToString();
                        tempDataNode.Data_conn     = drsData[i]["data_conn"].ToString();

                        dataNode.Add(tempDataNode);
                    }
                }
            }

            return(unc);
        }
Ejemplo n.º 24
0
 public void UpdateAppConfig(APPConfig entity)
 {
     this.Update <APPConfig>(entity);
 }
Ejemplo n.º 25
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.º 26
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    FrameSecurityi18nLang     = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameSecurityi18nLang", ""), defaultlang);
                DataTable i18nFrameSecurityi18nLang = BaseServiceUtility.GetI18nLang(FrameSecurityi18nLang);
                currCache.Insert("i18nFrameSecurityi18nLang", i18nFrameSecurityi18nLang, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));

                //框架管理语言包
                string    FrameManageri18nLang     = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameManageri18nLang", ""), defaultlang);
                DataTable i18nFrameManageri18nLang = BaseServiceUtility.GetI18nLang(FrameManageri18nLang);
                currCache.Insert("i18nFrameManageri18nLang", i18nFrameManageri18nLang, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));

                //加载缓存数据节点
                //调用普通节点中心服务加载数据节点
                DataRow drServ            = BaseServiceUtility.GetServiceConfigOne("framenodesecu", "1.0", "normal", "frameNode", dtservconfig);
                string  FrameNodeSecurity = drServ["url_addr"].ToString().TrimStart('/') + "/" + drServ["servcodename"].ToString().TrimStart('/');
                JavaScriptSerializer json = new JavaScriptSerializer();
                ReqData reqdata           = new ReqData();
                reqdata.reqdata = "1";
                RespData resdata = new RespData();
                //获取节点中心数据节点,
                string datanodes = DynamicInvokeWCF.Create <IFrameNodeSecurity>(FrameNodeSecurity).GetDataNodeCollection(json.Serialize(reqdata));
                DistributeDataNodeManagerParams distManagerParam = new DistributeDataNodeManagerParams(); //分布式管理参数
                resdata = json.Deserialize <RespData>(datanodes);
                if (resdata.respflag == "1")
                {
                    distManagerParam = json.Deserialize <DistributeDataNodeManagerParams>(resdata.respdata);
                    if (distManagerParam.DistributeDataNodes.Count > 0)
                    {
                        currCache.Insert("dataNodes", distManagerParam, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));
                    }
                }

                //获取业务模块节点
                string            nodelists = DynamicInvokeWCF.Create <IFrameNodeSecurity>(FrameNodeSecurity).GetNodeCollection(json.Serialize(reqdata));
                UseNodeCollection nodes     = new UseNodeCollection(); //节点集合
                resdata = json.Deserialize <RespData>(nodelists);
                if (resdata.respflag == "1")
                {
                    nodes = json.Deserialize <UseNodeCollection>(resdata.respdata);
                    if (nodes.BizNodeList.Count > 0)
                    {
                        currCache.Insert("bizNodes", nodes.BizNodeList, 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.º 27
0
    /// <summary>
    /// 启动更新数据缓存
    /// </summary>
    /// <param name="obj"></param>
    public void ExecUpdateCacheData(object obj)
    {
        System.Web.Caching.Cache currCache = HttpRuntime.Cache;
        int cacheMinute = 50;

        //加载缓存服务配置
        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    Xxxi18nLang     = string.Format(this.baseXmlPath + APPConfig.GetAPPConfig().GetConfigValue("XxxManageri18nLang", ""), defaultlang);
        DataTable i18nXxxi18nLang = BaseServiceUtility.GetI18nLang(Xxxi18nLang);

        currCache.Insert("i18nXxxi18nLang", i18nXxxi18nLang, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));


        //加载缓存数据节点
        //调用普通节点中心服务加载数据节点
        DataRow drServ            = BaseServiceUtility.GetServiceConfigOne("framenodesecu", "1.0", "normal", "frameNode", dtservconfig);
        string  FrameNodeSecurity = drServ["url_addr"].ToString().TrimStart('/') + "/" + drServ["servcodename"].ToString().TrimStart('/');
        JavaScriptSerializer json = new JavaScriptSerializer();
        ReqData reqdata           = new ReqData();

        reqdata.reqdata = "1";
        RespData resdata = new RespData();
        //获取节点中心数据节点,
        string datanodes = DynamicInvokeWCF.Create <IFrameNodeSecurity>(FrameNodeSecurity).GetDataNodeCollection(json.Serialize(reqdata));
        DistributeDataNodeManagerParams distManagerParam = new DistributeDataNodeManagerParams(); //分布式管理参数

        resdata = json.Deserialize <RespData>(datanodes);
        if (resdata.respflag == "1")
        {
            distManagerParam = json.Deserialize <DistributeDataNodeManagerParams>(resdata.respdata);
            if (distManagerParam.DistributeDataNodes.Count > 0)
            {
                currCache.Insert("dataNodes", distManagerParam, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));
            }
        }

        //获取业务模块节点
        string            nodelists = DynamicInvokeWCF.Create <IFrameNodeSecurity>(FrameNodeSecurity).GetNodeCollection(json.Serialize(reqdata));
        UseNodeCollection nodes     = new UseNodeCollection(); //节点集合

        resdata = json.Deserialize <RespData>(nodelists);
        if (resdata.respflag == "1")
        {
            nodes = json.Deserialize <UseNodeCollection>(resdata.respdata);
            if (nodes.BizNodeList.Count > 0)
            {
                currCache.Insert("bizNodes", nodes.BizNodeList, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, cacheMinute, 0));
            }
        }

        Common.Utility.RecordLog("完成Somebiz模块配置缓存!", this.logpathForDebug, this.isLogpathForDebug);
    }
Ejemplo n.º 28
0
        public string isLogpathForDebug = APPConfig.GetAPPConfig().GetConfigValue("isLogpathForDebug", ""); //是否记录调试日志



        //若包含其他需要累加

        public CommonBiz(SysEnvironmentSerialize _envirObj)
        {
            string _currlang = _envirObj.I18nCurrLang;

            System.Web.Caching.Cache currCache = HttpRuntime.Cache;                       //当前缓存
            string defaultlang = APPConfig.GetAPPConfig().GetConfigValue("currlang", ""); //默认语种

            this.envirObj = _envirObj;
            this.permitMaxLoginFailtCnt = APPConfig.GetAPPConfig().GetConfigValue("permitMaxLoginFailtCnt", "5");  //允许最大错误登录次数, 默认5次

            #region 通用语言包

            DataTable comlangtmp = (DataTable)currCache.Get("i18nCommonCurrLang");
            if (comlangtmp != null)
            {
                if (defaultlang == _currlang)
                {
                    i18nCommonCurrLang = comlangtmp;
                }
                else
                {
                    string commoni18nLangPath = string.Format(APPConfig.GetAPPConfig().GetConfigValue("Commoni18nLang", ""), _currlang);
                    i18nCommonCurrLang = BaseServiceUtility.GetI18nLang(commoni18nLangPath);
                }
            }
            else
            {
                string commoni18nLangPath = string.Format(APPConfig.GetAPPConfig().GetConfigValue("Commoni18nLang", ""), _currlang);
                i18nCommonCurrLang = BaseServiceUtility.GetI18nLang(commoni18nLangPath);
            }

            #endregion

            #region 框架安全语言包

            DataTable servFrameSecuriylangtmp = (DataTable)currCache.Get("i18nFrameSecurityi18nLang");
            if (servFrameSecuriylangtmp != null)
            {
                if (defaultlang == _currlang)
                {
                    i18nFrameSecurityi18nLang = servFrameSecuriylangtmp;
                }
                else
                {
                    string FrameSecurityi18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameSecurityi18nLang", ""), _currlang);
                    i18nFrameSecurityi18nLang = BaseServiceUtility.GetI18nLang(FrameSecurityi18nLang);
                }
            }
            else
            {
                string FrameSecurityi18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameSecurityi18nLang", ""), _currlang);
                i18nFrameSecurityi18nLang = BaseServiceUtility.GetI18nLang(FrameSecurityi18nLang);
            }

            #endregion

            #region 框架管理语言包

            DataTable servFrameManagerlangtmp = (DataTable)currCache.Get("i18nFrameManageri18nLang");
            if (servFrameManagerlangtmp != null)
            {
                if (defaultlang == _currlang)
                {
                    i18nFrameManageri18nLang = servFrameManagerlangtmp;
                }
                else
                {
                    string FrameManageri18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameManageri18nLang", ""), _currlang);
                    i18nFrameManageri18nLang = BaseServiceUtility.GetI18nLang(FrameManageri18nLang);
                }
            }
            else
            {
                string FrameManageri18nLang = string.Format(APPConfig.GetAPPConfig().GetConfigValue("FrameManageri18nLang", ""), _currlang);
                i18nFrameManageri18nLang = BaseServiceUtility.GetI18nLang(FrameManageri18nLang);
            }

            #endregion
        }
 public FormASTextEditorConfig(CommonMC2D comCore, APPConfig config)
 {
     InitializeComponent();
     m_comCore = comCore;
     m_config  = config;
 }
        /// <summary>
        /// ScintillNETエディタの初期化と設定
        /// </summary>
        /// <param name="TextArea"></param>
        /// <param name="Config"></param>
        public AngelScriptEditorSetting(AngleScriptEditor form, ScintillaNET.Scintilla e, APPConfig c)
        {
            this.Form     = form;
            this.TextArea = e;
            this.Config   = c;
            //ScintillaNET.X
            var tx = Config.GetTextEditorTheme("TextEditor");

            Items = tx.DisplayItems;



            // ホワイトスペースをオンにします?
            if (Config.TextConfig.IsWhiteSpace)
            {
                TextArea.ViewWhitespace = WhitespaceMode.VisibleAlways;
            }
            else
            {
                TextArea.ViewWhitespace = WhitespaceMode.Invisible;
            }


            // ワードラップをオンにします?
            if (Config.TextConfig.IsWordWrap)
            {
                TextArea.WrapMode = WrapMode.Word;
            }
            else
            {
                TextArea.WrapMode = WrapMode.None;
            }
            // INITIAL VIEW CONFIG
            TextArea.IndentationGuides = IndentView.LookBoth;

            TextArea.Lexer = Lexer.Cpp;
            TextArea.Font  = new Font(tx.FontName, tx.FontSize);

            InitColors();

            //--------------------------
            // フォントの色をセット
            //--------------------------
            // Configure the default style
            TextArea.StyleResetDefault();
            SetStyle(Style.Cpp.Default, Items["TextFormat"]);
            TextArea.StyleClearAll();



            //SetStyle(c, GetStyle(e, "BRACEBAD"), aItem["IndicatorMargin"]);//★
            //SetStyle(c, GetStyle(e, "BRACELIGHT"), aItem["IndicatorMargin"]);//★
            //SetStyle(c, GetStyle(e, "CALLTIP"), aItem["IndicatorMargin"]);//★
            //SetStyle(c, GetStyle(e, "CONTROLCHAR"), aItem["IndicatorMargin"]);//★

            //SetStyle(c, GetStyle(e, "SIDESYMBOL"), aItem["IndicatorMargin"]);

            SetStyle(Style.Cpp.Comment, Items["Comment"]);
            SetStyle(Style.Cpp.CommentLine, Items["Comment"]);
            SetStyle(Style.Cpp.CommentDoc, Items["Comment"]);
            SetStyle(Style.Cpp.Word, Items["AS_UserKeyword"]);
            SetStyle(Style.Cpp.Number, Items["Number"]);
            SetStyle(Style.Cpp.String, Items["String"]);
            SetStyle(Style.Cpp.Character, Items["String"]);
            SetStyle(Style.Cpp.Verbatim, Items["String"]);
            //SetStyle(c, GetStyle(e, "UUID"), aItem["TextFormat"]);
            SetStyle(Style.Cpp.Preprocessor, Items["PreprocessorKeyword"]);
            SetStyle(Style.Cpp.Operator, Items["Operator"]);
            SetStyle(Style.Cpp.Identifier, Items["Identifier"]);
            SetStyle(Style.Cpp.StringEol, Items["LineNumber"]);
            SetStyle(Style.Cpp.Regex, Items["Regex"]);
            SetStyle(Style.Cpp.CommentLineDoc, Items["Doxygen"]);
            SetStyle(Style.Cpp.Word2, Items["AS_UserKeyword"]);
            SetStyle(Style.Cpp.GlobalClass, Items["AS_UserKeyword"]);

            SetStyle(Style.Cpp.CommentDocKeyword, Items["DoxygenCommand"]);
            SetStyle(Style.Cpp.CommentDocKeywordError, Items["DoxygenErrKey"]);
            //SetStyle(c, GetStyle(e, "DOXY_ARG_0"), aItem["DoxygenFirstArg"]);
            //SetStyle(c, GetStyle(e, "DOXY_ARG_1"), aItem["DoxygenSecondArg"]);
            //SetStyle(c, GetStyle(e, "DOXY_ARG_2"), aItem["DoxygenThirdArg"]);

            SetStyle(Style.Cpp.GlobalClass, Items["AS_UserKeyword"]);//★
            //SetStyle(c, GetStyle(e, "STRINGRAW"), aItem["String"]);//★
            //SetStyle(c, GetStyle(e, "TRIPLEVERBATIM"), aItem["AS_UserKeyword"]);//★
            //SetStyle(c, GetStyle(e, "HASHQUOTEDSTRING"), aItem["AS_UserKeyword"]);//★
            //SetStyle(c, GetStyle(e, "PREPROCESSORCOMMENT"), aItem["Doxygen"]);//★
            //SetStyle(c, GetStyle(e, "PREPROCESSORCOMMENTDOC"), aItem["Doxygen"]);//★
            //SetStyle(c, GetStyle(e, "USERLITERAL"), aItem["AS_UserKeyword"]);//★
            //SetStyle(c, GetStyle(e, "TASKMARKER"), aItem["AS_UserKeyword"]);//★
            //SetStyle(c, GetStyle(e, "ESCAPESEQUENCE"), aItem["AS_UserKeyword"]);//★

            TextArea.SetKeywords(0, "class interface new case do while else if for in switch throw get set function var while with default break continue delete return each const namespace package include use is as instanceof typeof author copy default deprecated example exception haxe internal link mtasc mxmlc param private return since throws usage version langversion productversion dynamic private public partial intrinsic internal native override protected AS3 final super this arguments null Infinity NaN undefined true false abstract as base bool break by byte case catch char checked class const continue decimal default delegate do double descending explicit event extern else enum false finally fixed float for foreach from goto group if implicit in int interface internal into is lock long new null namespace object operator out override orderby params private protected public readonly ref return switch struct sbyte sealed short sizeof stackalloc string select this throw true try typeof uint ulong unchecked unsafe ushort using var virtual volatile void while where yield");
            TextArea.SetKeywords(1, "void Null arguments Array Boolean Class Date DefinitionError Error EvalError Function int String uint Boolean Byte Char Int16 Int32 Int64 IntPtr SByte Single UInt16 UInt32 UInt64 UIntPtr Void Path File System Windows Forms ScintillaNET");


            // NUMBER MARGIN
            InitNumberMargin();

            // BOOKMARK MARGIN
            InitBookmarkMargin(tx, Items["BreakpointEnabled"]);

            // CODE FOLDING MARGIN
            InitCodeFolding();

            // INIT HOTKEYS
            InitHotkeys();

            // マーカ類の初期化
            //UtilMarker.InitMarker(e);

            //e.FindReplace.HighlightAll(e.FindReplace.FindAll(ToolStripComboBoxTexteARechercherRapide.Text));
            //e.FindReplace.MarkAll(e.FindReplace.FindAll(ToolStripComboBoxTexteARechercherRapide.Text));
        }