Пример #1
0
 public static T New <T>()
 {
     try
     {
         return((T)TransactionAOP.newInstance(typeof(T)));
     }
     catch (Exception ex)
     {
         return(default(T));
     }
 }
Пример #2
0
        /// <summary>
        /// 实时调用DB,获取微信用户拥有的会员卡
        /// </summary>
        /// <param name="OpenID"></param>
        /// <returns></returns>
        public List <T_Member> GetMembers(string OpenID)
        {
            MemberBL pMemberService = (MemberBL)TransactionAOP.newInstance(typeof(MemberBL));

            return(pMemberService.GetMembers(OpenID));
        }
Пример #3
0
 MysqlADOTemplateTestClass GetMySqlADOInstance()
 {
     return(TransactionAOP.newInstance(typeof(MysqlADOTemplateTestClass)) as MysqlADOTemplateTestClass);
 }
Пример #4
0
 SqlServerADOTemplateTestClass GetSqlServerADOInstance()
 {
     return(TransactionAOP.newInstance(typeof(SqlServerADOTemplateTestClass)) as SqlServerADOTemplateTestClass);
 }
Пример #5
0
 OracleADOTemplateTestClass GetOracleADOInstance()
 {
     return(TransactionAOP.newInstance(typeof(OracleADOTemplateTestClass)) as OracleADOTemplateTestClass);
 }
Пример #6
0
        public void AOPConnectTest()
        {
            DataConsolidationBL dc = TransactionAOP.newInstance(typeof(DataConsolidationBL)) as DataConsolidationBL;

            dc.test();
        }
Пример #7
0
        /// <summary>
        /// 处理数据
        /// </summary>
        public HandlerResult HandlerData(string openId, DataTypes intputType, object rawData)
        {
            try
            {
                //根据不同的类型,进行rawData的转换,以及数据的存储处理
                switch (intputType)
                {
                case DataTypes.Text:
                {
                    var data = rawData as String;
                    if (data != null)
                    {
                        TextBL control_Text = TransactionAOP.newInstance(typeof(TextBL)) as TextBL;
                        control_Text.NewText(openId, data);

                        this.SuccessResponseResult = new ResponseTextMessage("您發送的文字內容分享成功!");
                        return(HandlerResult.Success);
                    }
                }
                break;

                case DataTypes.Image:
                {
                    var data = rawData as ImageCan;
                    if (data != null)
                    {
                        MediaBL control_Media = TransactionAOP.newInstance(typeof(MediaBL)) as MediaBL;
                        control_Media.NewMedia(openId, data.MediaID, Senparc.Weixin.MP.UploadMediaFileType.image);

                        this.SuccessResponseResult = new ResponseTextMessage("您發送的圖片內容分享成功!");
                        return(HandlerResult.Success);
                    }
                }
                break;

                case DataTypes.Voice:
                {
                    var data = rawData as VoiceCan;
                    if (data != null)
                    {
                        MediaBL control_Media = TransactionAOP.newInstance(typeof(MediaBL)) as MediaBL;
                        control_Media.NewMedia(openId, data.MediaID, Senparc.Weixin.MP.UploadMediaFileType.voice);

                        this.SuccessResponseResult = new ResponseTextMessage("您發送的語音內容分享成功!");
                        return(HandlerResult.Success);
                    }
                }
                break;

                case DataTypes.Video:
                {
                    var data = rawData as VideoCan;
                    if (data != null)
                    {
                        MediaBL control_Media = TransactionAOP.newInstance(typeof(MediaBL)) as MediaBL;
                        control_Media.NewMedia(openId, data.MediaID, Senparc.Weixin.MP.UploadMediaFileType.video);

                        this.SuccessResponseResult = new ResponseTextMessage("您發送的視頻內容分享成功!");
                        return(HandlerResult.Success);
                    }
                }
                break;

                default:
                {
                    this.FailResponseResult = new ResponseTextMessage("目前未支持此內容類型。\n請重新分享,類型要求為:文本或圖片、語音、視頻。");
                    return(HandlerResult.Fail);
                }
                }

                //没有合适处理时返回失败
                this.FailResponseResult = new ResponseTextMessage("分享失敗。");
                return(HandlerResult.Fail);
            }
            catch (Exception ex)
            {
                this.SuccessResponseResult = new ResponseTextMessage("抱歉,服務故障!");
                Logger.Log4Net.Error("CustomHandler_ShareMessage异常。", ex);
                return(HandlerResult.Success);
            }
        }