public CV_PM_WECHAT_DEPARTMENTBO()
 {
     cV_PM_WECHAT_DEPARTMENTDAO     = ObjectContainer.BuildUp <ICV_PM_WECHAT_DEPARTMENTDAO>();
     cv_PM_WECHAT_USER_DEPARTMENTBO = ObjectContainer.BuildUp <ICV_PM_WECHAT_USER_DEPARTMENTBO>();
     pm_ALT_NOTIBO = ObjectContainer.BuildUp <IPM_ALT_NOTIBO>();
     alt_BSC_BO    = ObjectContainer.BuildUp <IALT_BSC_BO>();
 }
Exemple #2
0
        public MsgService(string name) //: base(name)
        {
            try
            {
                //_PM_ALT_EVENT_LOGBO = ObjectContainer.BuildUp<IPM_ALT_EVENT_LOGBO>();
                //_cv_PM_ALT_EVENT_LOGBO = ObjectContainer.BuildUp<ICV_PM_ALT_EVENT_LOGBO>();
                //_cv_PM_ALT_EVENT_TYPE_GRPBO = ObjectContainer.BuildUp<ICV_PM_ALT_EVENT_TYPE_GRPBO>();
                //_pm_ALT_MESSAGEBO = ObjectContainer.BuildUp<IPM_ALT_MESSAGEBO>();
                //_cv_PM_WECHAT_NOTIBO = ObjectContainer.BuildUp<Siemens.Simatic.Wechat.BusinessLogic.ICV_PM_WECHAT_NOTIBO>();
                //_pm_WECHAT_NOTIBO = ObjectContainer.BuildUp<IPM_WECHAT_NOTIBO>();
                //SM_CONFIG_KEYBO = ObjectContainer.BuildUp<ISM_CONFIG_KEYBO>();
                alt_BSC_BO = ObjectContainer.BuildUp <IALT_BSC_BO>();
            }
            catch (Exception e)
            {
                log.Error(e.Message, e);
            }

            //string strsql = "select sKey,sValue FROM SM_CONFIG_KEY WHERE sKey IN('SenderUser','SenderPwd','SenderAccount','SmtpServer','SmtpPort') ";
            //DataTable dt = alt_BSC_BO.GetDataTableBySql(strsql);
            //if (dt == null || dt.Rows.Count <= 0)
            //{
            //    return;
            //}
            //else
            //{
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        if (dr[0] == "SenderUser")
            //        {
            //            this.SenderUser = dr[1].ToString();
            //        }
            //        else if (dr[0] == "SenderPwd")
            //        {
            //            this.SenderPassword = dr[1].ToString();
            //        }
            //        else if (dr[0] == "SenderAccount")
            //        {
            //            this.SenderName = dr[1].ToString();
            //        }
            //        else if (dr[0] == "SmtpServer")
            //        {
            //            this.SmtpServer = dr[1].ToString();
            //        }
            //        else if (dr[0] == "SmtpPort")
            //        {
            //            this.SmtpPort = dr[1].ToString();
            //        }
            //    }
            //}

            //this.SenderUser = SM_CONFIG_KEYBO.GetConfigKey("SenderUser").sValue;
            //this.SenderPassword = SM_CONFIG_KEYBO.GetConfigKey("SenderPwd").sValue;
            //this.SenderName = SM_CONFIG_KEYBO.GetConfigKey("SenderAccount").sValue;
            //this.SmtpServer = SM_CONFIG_KEYBO.GetConfigKey("SmtpServer").sValue;
            //this.SmtpPort = SM_CONFIG_KEYBO.GetConfigKey("SmtpPort").sValue;
        }
        public NotifyService()
        {
            InitializeComponent();
            alt_BSC_BO = ObjectContainer.BuildUp <IALT_BSC_BO>();

            //Alert_Interval = Convert.ToInt32(ConfigurationSettings.AppSettings["Alert_Interval"]);
            //this.tmrAlert.Interval = Alert_Interval;
            Notify_Interval         = Convert.ToInt32(ConfigurationSettings.AppSettings["Notify_Interval"]);
            this.tmrNotify.Interval = Notify_Interval;

            //alt_BSC_BO.ExecuteNotifyAll();
            //return;

            this.tmrNotify.Start();
            Thread.Sleep(1000);
        }
        //获得access_token
        public void Gettoken(IALT_BSC_BO bscbo, string corpid, string corpsecret)
        {
            //获得数据库中的access_token
            DataTable dt = bscbo.GetDataTableBySql(selectTokenSql);

            if (dt != null && dt.Rows.Count > 0)
            {
                enterprise.Access_token = dt.Rows[0]["Access_token"].ToString();
            }
            else
            {
                //获得新的token
                ReturnValue val = enterprise.Gettoken(corpid, corpsecret);
                if (val.Success)
                {
                    //并更新token
                    string sql = string.Format(CultureInfo.InvariantCulture, updateSql, val.Result);
                    bscbo.ExecuteNonQueryBySql(sql);
                }
            }
        }