Esempio n. 1
0
        public string GetShowCount()
        {
            string Timestamp = Request["Timestamp"].ToString().Trim();

            if (Timestamp == null || Timestamp.Equals(""))
            {
                Timestamp = "0";
            }
            string content    = string.Empty;
            VipBLL vipService = new VipBLL(Default.GetLoggingSession());
            var    respData   = new RespData();

            try
            {
                respData.Code        = "200";
                respData.Description = "操作成功";
                respData.count       = vipService.GetShowCount(Convert.ToInt64(Timestamp), out respData.NewTimestamp);
            }
            catch (Exception ex) {
                respData.Code        = "201";
                respData.Description = "操作失败";
                respData.Exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
Esempio n. 2
0
        public object AllProjectList()
        {
            RespData proStore = (RespData)Session["projectList"];

            foreach (var project in proStore.value)
            {
                WorkCounts StoredData           = new WorkCounts();
                var        criticalBug          = Workitemlist(project.name);
                var        Build                = logic.BuildDetails(project.name);
                var        Release              = logic.Release(project.name);
                var        workItemDeadLineList = WorkitemDeadlineGet(project.name);
                var        Buildcount           = 0;
                var        ReleaseCount         = 0;
                var        criticalBugCount     = 0;
                var        workItemDadLineCount = 0;
                if (Build == null)
                {
                    Buildcount = 0;
                }
                else
                {
                    Buildcount = Build.Count();
                }
                if (Release == null)
                {
                    ReleaseCount = 0;
                }
                else
                {
                    ReleaseCount = Release.Count();
                }
                if (criticalBug == null)
                {
                    criticalBugCount = 0;
                }
                else
                {
                    criticalBugCount = criticalBug.Count();
                }
                if (workItemDeadLineList == null)
                {
                    workItemDadLineCount = 0;
                }
                else
                {
                    workItemDadLineCount = workItemDeadLineList.Count();
                }

                //var criticalBugCount=criticalBug
                StoredData = DataStore(project.id, project.name, Buildcount, ReleaseCount, criticalBugCount, workItemDadLineCount);
                WorkList.Add(StoredData);
            }
            string output = JsonConvert.SerializeObject(WorkList);

            return(output);
        }
Esempio n. 3
0
        /// <summary>
        /// 生成html返回信息
        /// </summary>
        /// <param name="respflag"></param>
        /// <param name="resptoolstr"></param>
        /// <param name="respdata"></param>
        /// <param name="pagertottlecounts"></param>
        /// <returns></returns>
        public RespData MakeResponseData(string respflag, string resptoolstr, string respdata, string pagertottlecounts)
        {
            RespData resdata = new RespData();

            resdata.respflag          = respflag;
            resdata.resptoolstr       = resptoolstr;
            resdata.respdata          = respdata;
            resdata.pagertottlecounts = pagertottlecounts;
            return(resdata);
        }
Esempio n. 4
0
        public object GetProjects(string orgName)
        {
            Org.OrganizationName = orgName;
            RespData profileResp = logic.ProjectNamesStore();

            Session["projectList"] = profileResp;

            string output = JsonConvert.SerializeObject(profileResp);

            return(output);
        }
        /// <summary>
        /// 支付宝分润公共方法
        /// </summary>
        /// <param name="out_bill_no">该次分润的分润号,必填,保证其唯一性</param>
        /// <param name="out_trade_no">商户订单号,商户网站已经付款完成的商户网站订单号,out_trade_no、trade_no须至少填写一项</param>
        /// <param name="trade_no">支付宝交易号,已经付款完成的支付宝交易号,与商户网站订单号out_trade_no相对应</param>
        /// <param name="royalty_parameters">提成信息集,必填,格式设置参见接口技术文档</param>
        /// <returns>返回分润结果JSON字符串</returns>
        public string SubmitDistribute(string out_bill_no, string out_trade_no, string trade_no, string royalty_parameters)
        {
            BaseService.WriteLog("分润公共方法SubmitDistribute()");

            BaseService.WriteLog("把请求参数打包成数组");
            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", Config.Partner);
            sParaTemp.Add("_input_charset", Config.Input_charset.ToLower());
            sParaTemp.Add("service", "distribute_royalty");
            sParaTemp.Add("out_bill_no", out_bill_no);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("trade_no", trade_no);
            sParaTemp.Add("royalty_type", "10");
            sParaTemp.Add("royalty_parameters", royalty_parameters);

            BaseService.WriteLog("建立请求,以模拟远程HTTP的POST请求方式构造并获取支付宝的处理结果");
            //建立请求
            string sHtmlText = Submit.BuildRequest(sParaTemp);

            RespData    respData = new RespData();
            XmlDocument xmlDoc   = new XmlDocument();

            try
            {
                xmlDoc.LoadXml(sHtmlText);

                string is_success = xmlDoc.SelectSingleNode("/alipay/is_success").InnerText;
                if (!is_success.Equals("T"))
                {
                    string error = xmlDoc.SelectSingleNode("/alipay/error").InnerText;
                    respData.Code        = "F";
                    respData.Description = "操作失败";
                    respData.Exception   = error;
                }
            }
            catch (Exception exp)
            {
                respData.Code        = "F";
                respData.Description = "操作失败";
                respData.Exception   = exp.ToString();
            }

            return(respData.ToJSON());
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        public object AllDataWorkitem()
        {
            RespData proStore1 = (RespData)Session["projectList"];

            foreach (var project in proStore1.value)
            {
                WorkCounts StoredData           = new WorkCounts();
                var        criticalBug          = Workitemlist123(project.name);//Workitemlist(project.name);
                var        workItemDeadLineList = WorkitemDeadlineGet(project.name);
                var        criticalBugCount     = 0;
                var        workItemDadLineCount = 0;
                if (workItemDeadLineList == null)
                {
                    workItemDadLineCount = 0;
                }
                else
                {
                    workItemDadLineCount = workItemDeadLineList.Count();
                }
                if (criticalBug == null)
                {
                    criticalBugCount = 0;
                }
                else
                {
                    criticalBugCount = criticalBug.Count();
                }


                //var criticalBugCount=criticalBug
                StoredData = DataStore2(project.id, project.name, criticalBugCount, workItemDadLineCount);
                WorkList1.Add(StoredData);
            }
            string output = JsonConvert.SerializeObject(WorkList1);

            return(output);
        }
Esempio n. 8
0
        /// <summary>
        /// 主动给用户推送订单消息
        /// </summary>
        /// <returns></returns>
        public string SetOrderPush()
        {
            var respData = new RespData();

            if (string.IsNullOrEmpty(Request["WeiXinId"]) ||
                string.IsNullOrEmpty(Request["OpenId"]) ||
                string.IsNullOrEmpty(Request["OrdeNo"]))
            {
                respData.Code        = "103";
                respData.Description = "数据库操作错误";
                respData.Exception   = "请求的数据不能为空";
                return(respData.ToJSON());
            }

            string content = string.Empty;

            try
            {
                string vipID              = string.Empty;
                string vipName            = string.Empty;
                var    loggingSessionInfo = Default.GetLjLoggingSession();
                //根据客户标识获取连接字符串  qianzhi  2013-07-30
                if (!string.IsNullOrEmpty(Request["customerId"]))
                {
                    loggingSessionInfo = Default.GetBSLoggingSession(Request["customerId"].Trim(), "");
                }

                #region 获取VIP信息

                VipBLL vipService = new VipBLL(loggingSessionInfo);
                var    vipList    = vipService.QueryByEntity(new VipEntity()
                {
                    WeiXinUserId = Request["OpenId"],
                    WeiXin       = Request["WeiXinId"]
                }, null);

                if (vipList == null || vipList.Length == 0)
                {
                    respData.Code        = "103";
                    respData.Description = "未查找到匹配的VIP信息";
                    return(respData.ToJSON());
                }
                else
                {
                    vipID   = vipList.FirstOrDefault().VIPID;
                    vipName = vipList.FirstOrDefault().VipName;
                }

                #endregion

                // 推送消息
                string msgUrl  = ConfigurationManager.AppSettings["push_weixin_msg_url"].Trim();
                string msgText = string.Format("亲爱的会员{1},您单号为{0}的购买请求我们已经收到,请您到指定渠道下交纳钱款。谢谢再次惠顾!", Request["OrdeNo"], vipName);
                string msgData = "<xml><OpenID><![CDATA[" + Request["OpenId"] + "]]></OpenID><Content><![CDATA[" + msgText + "]]></Content></xml>";

                var msgResult = Common.Utils.GetRemoteData(msgUrl, "POST", msgData);
                #region 发送日志
                MarketSendLogBLL    logServer = new MarketSendLogBLL(loggingSessionInfo);
                MarketSendLogEntity logInfo   = new MarketSendLogEntity();
                logInfo.LogId           = BaseService.NewGuidPub();
                logInfo.IsSuccess       = 1;
                logInfo.MarketEventId   = Request["OrdeNo"];
                logInfo.SendTypeId      = "2";
                logInfo.TemplateContent = msgData;
                logInfo.VipId           = vipID;
                logInfo.WeiXinUserId    = Request["OpenId"];
                logInfo.CreateTime      = System.DateTime.Now;
                logServer.Create(logInfo);
                #endregion
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("PushMsgResult:{0}", msgResult)
                });
            }
            catch (Exception ex)
            {
                respData.Code        = "201";
                respData.Description = "操作失败";
                respData.Exception   = ex.ToString();
            }
            content = respData.ToJSON();
            return(content);
        }
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>d
        public string GetUserForLoginN(string req)
        {
            try
            {
                //解析参数实体
                reqdata = this.AnaRequestData(req);
                SSY_USER_DICT model   = this.json.Deserialize <SSY_USER_DICT>(reqdata.reqdata);
                StringBuilder toolStr = new StringBuilder();

                //准备日志参数实例
                List <SSY_LOGENTITY> ListBizLog = new List <SSY_LOGENTITY>();

                if (model.USERID.ToString().ToUpper() == "super".ToUpper())
                {
                    base.envirObj.distManagerParam.DistributeActionIden = DistributeActionIden.Query;
                }
                else
                {
                    base.envirObj.distManagerParam.DistributeActionIden = DistributeActionIden.TransAction;
                }

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

                //解密口令, 客户端已经加密,这里无需解密,直接比较密码串
                //string iv128str = APPConfig.GetAPPConfig().GetConfigValue("ivpwd", "5CRc851hRywf7W3m");
                //string key256str = APPConfig.GetAPPConfig().GetConfigValue("keypwd", "nW8FnftasWp7AVZrmgr9sdaGNXsjMWiw");
                //byte[] key256 = Security.CreateKeyByte(key256str);
                //byte[] iv128 = Security.CreateKeyByte(iv128str);
                //model.PASSWORD = Security.DeAES(model.PASSWORD.ToString(), key256, iv128);

                List <SSY_USER_DICT> uds = this._comBiz.GetUserForLogin(model, base.envirObj.distManagerParam, ListBizLog);

                if (uds.Count > 0)
                {
                    if (model.PASSWORD.ToString() == uds[0].PASSWORD.ToString())
                    {
                        if (uds[0].ISUSE.ToString() == "0")
                        {
                            //判断是否禁用
                            resdata = this.MakeResponseData("0", this.GetI18nLangItem("loginerr_Enabled", this.i18nModuleCurrLang), string.Empty, string.Empty);
                        }
                        else if (uds[0].LOCKED.ToString() == "1")
                        {
                            //判断是否锁定
                            resdata = this.MakeResponseData("0", this.GetI18nLangItem("loginerr_Locked", this.i18nModuleCurrLang), string.Empty, string.Empty);
                        }
                        else
                        {
                            #region 允许登录后,正常验证处理

                            //判断是否登录
                            bool alreadyLonin = false;
                            if (Utility.ObjHasData(uds[0].ISLONIN) && Utility.ObjHasData(uds[0].FROMPLAT))
                            {
                                if (uds[0].ISLONIN == "Y" && uds[0].FROMPLAT.ToUpper() == base.envirObj.distManagerParam.DistributeDataNodes[0].Systemname.ToUpper())
                                {
                                    alreadyLonin = true;
                                }
                            }
                            if (alreadyLonin)
                            {
                                //检查密码安全补存提示信息
                                //resdata = BaseWebPage.MakeResponseData("0", string.Format(BaseUI.GetNoticeCfg("com0008", "CommonNoticeCfg"), uds[0].FROMPLAT.ToUpper()), string.Empty);
                                resdata = this.MakeResponseData("0", this.GetI18nLangItem("loginok_exist", this.i18nModuleCurrLang), string.Empty, string.Empty);
                            }
                            else
                            {
                                //检查是否启用密码安全策略 检查首次登陆  检查超过时间间隔
                                if (base.envirObj.distManagerParam.DistributeDataNodes[0].Isusepwdsecuritycheck == "Y")
                                {
                                    if (base.envirObj.distManagerParam.DistributeDataNodes[0].Pwdfirstcheck == "Y" && uds[0].ISFIRSTLOGIN == "Y")
                                    {
                                        //首次登陆提示
                                        toolStr.AppendLine(this.GetI18nLangItem("loginok_firstlogin", this.i18nModuleCurrLang));
                                    }

                                    //这里取服务器时间即可
                                    //Frame.ServiceLibs.FrameManagerService tmpop = new FrameManagerService();
                                    //string currTime = string.Empty;
                                    //currTime =  tmpop.GetSystemDateTimesN(string.Empty);

                                    string currTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                    if ((!string.IsNullOrEmpty(currTime)) && (!string.IsNullOrEmpty(uds[0].LASTLOGINTIME.ToString())))
                                    {
                                        TimeSpan ts = Convert.ToDateTime(currTime) - Convert.ToDateTime(uds[0].LASTLOGINTIME.ToString());
                                        if (ts.TotalHours >= int.Parse(base.envirObj.distManagerParam.DistributeDataNodes[0].Pwdintervalhours))
                                        {
                                            //超过时间提示
                                            toolStr.AppendLine(string.Format(this.GetI18nLangItem("loginok_oversecuritytime", this.i18nModuleCurrLang),
                                                                             base.envirObj.distManagerParam.DistributeDataNodes[0].Pwdintervalhours));
                                        }
                                    }
                                }

                                #region 获取令牌

                                //节点中心安全服务
                                //string FrameNodeSecurity = APPConfig.GetAPPConfig().GetConfigValue("NodeCenterMaster", "") +
                                //    APPConfig.GetAPPConfig().GetConfigValue(SSY_ServiceHost.FrameNodeSecurityService, "").TrimStart('/');

                                //调用普通节点中心服务获取令牌
                                DataRow drServ = this.GetServiceConfigOne("framenodesecu", "1.0", "normal", "frameNode", this.serviceConfig);
                                //string FrameNodeSecurity = base.envirObj.BizNodeAddr + "/" + drServ["servcodename"].ToString().TrimStart('/');
                                string FrameNodeSecurity = drServ["url_addr"].ToString().TrimStart('/') + "/" + drServ["servcodename"].ToString().TrimStart('/');

                                SSY_DYNAMICTOKEN tokenModel = new SSY_DYNAMICTOKEN();
                                tokenModel.Dynamictoken = "";
                                tokenModel.ID           = "";
                                tokenModel.Remarks      = model.USERID.ToString();   //暂存用户账户,用于节点中心获取令牌时重新验证
                                tokenModel.Timestampss  = model.PASSWORD.ToString(); //暂存用户口令,用于节点中心获取令牌时重新验证

                                this.reqdata         = new ReqData();
                                this.reqdata.reqdata = json.Serialize(tokenModel);

                                //动态调用服务获取令牌
                                string tokenstr = DynamicInvokeWCF.Create <IFrameNodeSecurity>(FrameNodeSecurity).GetToken(this.json.Serialize(this.reqdata));

                                //返回执行结果
                                if (string.IsNullOrEmpty(tokenstr))
                                {
                                    resdata = this.MakeResponseData("0", this.GetI18nLangItem("loginok_notoken", this.i18nModuleCurrLang), string.Empty, string.Empty);
                                }
                                else
                                {
                                    //解析令牌
                                    RespData tmpToken = json.Deserialize <RespData>(tokenstr);

                                    if (tmpToken.respflag == "1")
                                    {
                                        //赋值当前登录用户数据
                                        base.envirObj.SysUserDict = uds[0];
                                        RespData tmpresdata = json.Deserialize <RespData>(tokenstr);

                                        //直接返回环境参数,去除口令和数据节点
                                        base.envirObj.TokenEncrpValue = tmpresdata.respdata;
                                        SysEnvironmentSerialize resTmp = new SysEnvironmentSerialize();
                                        resTmp = json.Deserialize <SysEnvironmentSerialize>(json.Serialize(base.envirObj));
                                        resTmp.SysUserDict.PASSWORD = "";   //不返回密码
                                        resTmp.distManagerParam     = null; //不返回数据节点
                                                                            //赋值用户数据到框架环境变量
                                        ManagerSysEnvironment.GetSysEnvironmentSerialize2SysEnvironment(base.envirObj);

                                        if (string.IsNullOrEmpty(toolStr.ToString()))
                                        {
                                            resdata = this.MakeResponseData("1", this.GetI18nLangItem("loginok", this.i18nModuleCurrLang), json.Serialize(resTmp), string.Empty);
                                        }
                                        else
                                        {
                                            resdata = this.MakeResponseData("2", this.GetI18nLangItem("loginok", this.i18nModuleCurrLang), json.Serialize(resTmp), string.Empty);
                                        }
                                    }
                                    else
                                    {
                                        resdata = this.MakeResponseData("0", this.GetI18nLangItem("loginok_gettokenerr", this.i18nModuleCurrLang), string.Empty, string.Empty);
                                    }
                                }

                                #endregion
                            }

                            #endregion
                        }
                    }
                    else
                    {
                        resdata = this.MakeResponseData("0", this.GetI18nLangItem("loginerr_userNotPassword", this.i18nModuleCurrLang), string.Empty, string.Empty);
                    }
                }
                else
                {
                    resdata = this.MakeResponseData("0", this.GetI18nLangItem("loginerr_nocurruser", this.i18nModuleCurrLang), string.Empty, string.Empty);
                }
            }
            catch (Exception ex)
            {
                resdata = this.MakeResponseData("0", this.GetI18nLangItem("loginerr_findexception", this.i18nModuleCurrLang) + ex.Message, string.Empty, string.Empty);
            }

            return(json.Serialize(resdata));
        }
        private void SubmitDistribute()
        {
            BaseService.WriteLog("多级分润接口-----------------------AlipayWapTrade2/DistributeRoyalty.aspx");

            ////////////////////////////////////////////请求参数////////////////////////////////////////////

            string out_bill_no        = string.Empty;
            string out_trade_no       = string.Empty;
            string trade_no           = string.Empty;
            string royalty_parameters = string.Empty;

            //该次分润的分润号
            //必填,保证其唯一性
            if (!string.IsNullOrEmpty(Request["out_bill_no"]))
            {
                out_bill_no = Request["out_bill_no"].Trim();
                BaseService.WriteLog("out_bill_no:  " + Request["out_bill_no"]);
            }
            else
            {
                BaseService.WriteLog("请求参数out_bill_no is null!!!!!");
            }

            //商户订单号
            //商户网站已经付款完成的商户网站订单号,out_trade_no、trade_no须至少填写一项
            if (!string.IsNullOrEmpty(Request["out_trade_no"]))
            {
                out_trade_no = Request["out_trade_no"].Trim();
                BaseService.WriteLog("out_trade_no:  " + Request["out_trade_no"]);
            }
            else
            {
                BaseService.WriteLog("请求参数out_trade_no is null!!!!!");
            }

            //支付宝交易号
            //已经付款完成的支付宝交易号,与商户网站订单号out_trade_no相对应
            if (!string.IsNullOrEmpty(Request["trade_no"]))
            {
                trade_no = Request["trade_no"].Trim();
                BaseService.WriteLog("trade_no:  " + Request["trade_no"]);
            }
            else
            {
                BaseService.WriteLog("请求参数trade_no is null!!!!!");
            }

            //提成信息集
            //必填,格式设置参见接口技术文档
            if (!string.IsNullOrEmpty(Request["royalty_parameters"]))
            {
                royalty_parameters = Request["royalty_parameters"].Trim();
                BaseService.WriteLog("royalty_parameters:  " + Request["royalty_parameters"]);
            }
            else
            {
                BaseService.WriteLog("请求参数royalty_parameters is null!!!!!");
            }

            ////////////////////////////////////////////////////////////////////////////////////////////////

            BaseService.WriteLog("把请求参数打包成数组");
            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", Config.Partner);
            sParaTemp.Add("_input_charset", Config.Input_charset.ToLower());
            sParaTemp.Add("service", "distribute_royalty");
            sParaTemp.Add("out_bill_no", out_bill_no);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("trade_no", trade_no);
            sParaTemp.Add("royalty_type", "10");
            sParaTemp.Add("royalty_parameters", royalty_parameters);

            BaseService.WriteLog("建立请求,以模拟远程HTTP的POST请求方式构造并获取支付宝的处理结果");
            //建立请求
            string sHtmlText = Submit.BuildRequest(sParaTemp);

            RespData    respData = new RespData();
            XmlDocument xmlDoc   = new XmlDocument();

            try
            {
                xmlDoc.LoadXml(sHtmlText);

                string is_success = xmlDoc.SelectSingleNode("/alipay/is_success").InnerText;
                if (!is_success.Equals("T"))
                {
                    string error = xmlDoc.SelectSingleNode("/alipay/error").InnerText;
                    respData.Code        = "F";
                    respData.Description = "操作失败";
                    respData.Exception   = error;
                }
            }
            catch (Exception exp)
            {
                respData.Code        = "F";
                respData.Description = "操作失败";
                respData.Exception   = exp.ToString();
            }

            Response.Write(respData.ToJSON());
        }
Esempio n. 11
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);
    }
Esempio n. 12
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;
        }
    }