示例#1
0
        ///<summary>
        /// 获取银行账户列表
        ///</summary>
        ///<returns></returns>
        public IList <BankAccountInfo> GetBankAccountsList()
        {
            var selectSalePlatformInfo = CacheCollection.SalePlatform.Get(TargetId);

            if (selectSalePlatformInfo != null)
            {
                var bankAccountList = _bankAccountDaoWrite.GetListByTargetId(selectSalePlatformInfo.FilialeId);
                #region [已注释] 允许多绑
                //foreach (var bankAccountsInfo in bankAccountList)
                //{
                //    var iteminfo = new BankAccountsInfo
                //                    {
                //                        BankAccountsId = bankAccountsInfo.BankAccountsId,
                //                        Accounts =bankAccountsInfo.Accounts + " => " + bankAccountsInfo.BankName + " 【" +ERP.Enum.Attribute.EnumAttribute.GetKeyName((PaymentType) bankAccountsInfo.PaymentType) +"】"
                //                    };
                //    needBankAccountList.Add(iteminfo);
                //}
                #endregion

                #region  每个账号只对应一个公司
                var salePlatformList         = CacheCollection.SalePlatform.GetListByFilialeId(selectSalePlatformInfo.FilialeId);
                var bindingedBankAccountList = new List <BankAccountInfo>();
                foreach (var salePlatformInfo in salePlatformList)
                {
                    bindingedBankAccountList.AddRange(BankAccountManager.ReadInstance.GetListByTargetId(salePlatformInfo.ID));
                }

                #endregion
                return((from info in bankAccountList
                        where bindingedBankAccountList.All(ent => ent.BankAccountsId != info.BankAccountsId)
                        select new BankAccountInfo
                {
                    BankAccountsId = info.BankAccountsId,
                    Accounts = info.Accounts + " => " + info.BankName + "【" + EnumAttribute.GetKeyName((PaymentType)info.PaymentType) + "】"
                }).ToList());
            }
            var filiale = CacheCollection.Filiale.Get(TargetId);
            IList <BankAccountInfo> oldlist = filiale != null && filiale.FilialeTypes.Contains((int)MIS.Enum.FilialeType.SaleCompany) ?
                                              _bankAccountsWrite.GetBankAccountsNoBindingList().Where(b => b.IsUse).ToList():_bankAccountsWrite.GetBankAccountsList(new[] { PaymentType.Tradition, PaymentType.Tradition }).Where(b => b.IsUse).ToList();
            return(oldlist.Select(binfo => new BankAccountInfo
            {
                BankAccountsId = binfo.BankAccountsId,
                Accounts = binfo.Accounts + " => " + binfo.BankName + " 【" + EnumAttribute.GetKeyName((PaymentType)binfo.PaymentType) + "】"
            }).ToList());
        }