Esempio n. 1
0
        private async Task <ReturnedSaveFuncInfo> SaveBankAccountAsync(SqlTransaction tr)
        {
            var res = new ReturnedSaveFuncInfo();

            try
            {
                res.AddReturnedValue(await PeoplesBankAccountBussines.RemoveAsync(Guid, tr));
                if (res.HasError)
                {
                    return(res);
                }

                foreach (var item in BankList)
                {
                    item.ParentGuid = Guid;
                    res.AddReturnedValue(await BankSegestBussines.CheckBankAsync(item.BankName, tr));
                    if (res.HasError)
                    {
                        return(res);
                    }
                }
                res.AddReturnedValue(await PeoplesBankAccountBussines.SaveRangeAsync(BankList, tr));
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
                res.AddReturnedValue(ex);
            }

            return(res);
        }
        public static async Task <ReturnedSaveFuncInfo> CheckBankAsync(string bankName, SqlTransaction tr)
        {
            var res = new ReturnedSaveFuncInfo();

            try
            {
                var bank = await GetAsync(bankName);

                if (bank != null)
                {
                    return(res);
                }
                bank = new BankSegestBussines()
                {
                    Guid     = Guid.NewGuid(),
                    BankName = bankName
                };
                res.AddReturnedValue(await bank.SaveAsync(tr));
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
                res.AddReturnedValue(ex);
            }

            return(res);
        }