Beispiel #1
0
        public static WX_Info AddOrGetWXInfo(WX_Info model)
        {
            IWXAccount factory  = WXAccountFactory.GetFactory();
            WX_Info    oldModel = factory.QueryWXInfoByMobilePhone(model.MobilePhone, model.CompanyID);

            if (oldModel == null)
            {
                using (DbOperator dbOperator = ConnectionManager.CreateReadConnection())
                {
                    try
                    {
                        dbOperator.BeginTransaction();
                        bool result = factory.AddWXAccount(model, dbOperator);
                        if (!result)
                        {
                            throw new MyException("添加微信账号信息失败");
                        }
                        result = factory.AddWXInfo(model, dbOperator);
                        if (!result)
                        {
                            throw new MyException("添加微信信息失败");
                        }
                        dbOperator.CommitTransaction();
                    }
                    catch {
                        dbOperator.RollbackTransaction();
                        throw;
                    }
                }
            }
            return(factory.QueryWXInfoByMobilePhone(model.MobilePhone, model.CompanyID));
        }
Beispiel #2
0
        public static WX_Info QueryWXInfoByMobilePhone(string mobilePhone, string companyId)
        {
            IWXAccount factory = WXAccountFactory.GetFactory();

            return(factory.QueryWXInfoByMobilePhone(mobilePhone, companyId));
        }