Example #1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public CustomService()
 {
     //实例化DA
     m_DA = CastleAOPUtil.NewPxyByClass <TServiceConfigDA>(new DataWritingInterceptor(this.RemoveCache, this.m_CacheConfig));
     //构造时,获取定制服务集合
     m_pListTSer = GetCServiceCache();
 }
Example #2
0
        /// <summary>
        /// 保存微信资源至DB
        /// </summary>
        /// <param name="strTargetType"></param>
        /// <param name="strValue"></param>
        /// <param name="media_ID"></param>
        private int SaveWXResource(int?lcid, string lcName, string lcClassify, string strTargetType, string strValue, string media_ID, int iSourceType)
        {
            m_CacheConfig = new WXResourceCacheConfig(strTargetType);
            //初始化数据访问DA
            m_DA = CastleAOPUtil.NewPxyByClass <WXResourceDA>(new DataWritingInterceptor(this.RemoveCache, this.m_CacheConfig));
            if (lcid == 0)
            {
                lcid = null;
            }

            //保存资源——暂时不能分类及命名
            lcid = m_DA.SaveResource(lcid, lcName, lcClassify, media_ID, strTargetType, strValue, DateTime.Now, iSourceType, m_sdk == null ? 0 : m_sdk.WXType);
            if (lcid == null)
            {
                EGExceptionOperator.ThrowX <Exception>("微信资源DataBase保存错误", EGActionCode.未知错误);
            }
            return(lcid.Value);
        }
Example #3
0
        /// <summary>
        /// 刪除資源
        /// </summary>
        /// <param name="strTargetType"></param>
        /// <param name="lcid"></param>
        public void DeleteResource(string strTargetType, int lcid)
        {
            if (string.IsNullOrEmpty(strTargetType) || lcid < 1)
            {
                return;
            }

            m_CacheConfig = new WXResourceCacheConfig(strTargetType);
            //初始化数据访问DA
            m_DA = CastleAOPUtil.NewPxyByClass <WXResourceDA>(new DataWritingInterceptor(this.RemoveCache, this.m_CacheConfig));

            int iRes = m_DA.DeleteResource(lcid);

            if (lcid == null)
            {
                EGExceptionOperator.ThrowX <Exception>("微信资源刪除错误", EGActionCode.未知错误);
            }
        }
Example #4
0
        /// <summary>
        /// 更新订购周期
        /// </summary>
        /// <typeparam name="TM"></typeparam>
        /// <returns></returns>
        public bool UpdateOrderCycle <TM>(TM pCycle)
            where TM : OrderCycleTM
        {
            var pCycles = new List <TM>();

            pCycles.Add(pCycle);
            var dtCycles = CommonFunction.GetDataTableFromEntities <TM>(pCycles);
            //生成用户创建时输入的最大流水号是否与系统当前最大流水号一致
            CycleNoConfig pCurData    = CreateCycleNo(pCycle.CycleNo);
            int           pMaxNoInSys = NumberHelper.Singleton.GetNo(_DicKey);

            if (pMaxNoInSys != -1 && pCurData.MaxNo != pMaxNoInSys)
            {
                throw new Exception("");
            }
            //定义数据更新后执行action
            Action pAfter = () => { NumberHelper.Singleton.SetNo(_DicKey, GetNextCycleNo); };
            //添加AOP拦截,当有周期维护更新时,同时更新最大流水号(周期编号CycleNo)
            var pDataWriting = new DataWritingInterceptor(() => { }, pAfter);
            var pDA          = CastleAOPUtil.NewPxyByClass <OrderCycleDA>(pDataWriting);

            return(pDA.Update(dtCycles));
        }
Example #5
0
 /// <summary>
 /// 构造函数——开启AOP
 /// </summary>
 public WCUserServiceLocal()
 {
     m_WeChatUserDA = CastleAOPUtil.NewPxyByClass <WeChatUserDA>(new DataWritingInterceptor(this.RemoveCache, this.m_WCUserCacheConfig));
 }
Example #6
0
 /// <summary>
 /// 构造函数——开启AOP
 /// </summary>
 public WXGroupServiceLocal()
 {
     m_DA = CastleAOPUtil.NewPxyByClass <WeChatGroupDA>(new DataWritingInterceptor(this.RemoveCache, this.m_WCGroupCacheConfig));
 }