コード例 #1
0
 private void PopulateDebtInfo(Tbl_Account account, Tbl_ComplaintMain complaint)
 {
     complaint.Tbl_Account.AccountNumber = account.AccountNumber;
     complaint.Tbl_Account.FirstName = account.FirstName;
     complaint.Tbl_Account.LastName = account.LastName;
     complaint.Tbl_Account.Address = account.Address;
     complaint.Tbl_Account.City = account.City;
     complaint.Tbl_Account.StateId = account.StateId;
     complaint.Tbl_Account.Zip = account.Zip;
     complaint.Tbl_Account.LastFourSSN = account.LastFourSSN;
     complaint.Tbl_Account.MobilePhone = account.MobilePhone;
     complaint.Tbl_Account.HomePhone = account.HomePhone;
     complaint.Tbl_Account.WorkPhone = account.WorkPhone;
     complaint.Tbl_Account.DebtCurrentBalance = account.DebtCurrentBalance;
     complaint.Tbl_Account.DebtPurchaseBalance = account.DebtPurchaseBalance;
     complaint.Tbl_Account.CreditorName = account.CreditorName;
 }
コード例 #2
0
        public Tbl_Account Post(Tbl_Account account)
        {
            UnitOfWork uo = null;
            Tbl_Account accountToSave = null;
            bool editingRequired = true;
            try
            {
                uo = new UnitOfWork("CCATDBEntities");
                accountToSave = uo.AccountRepository.GetById(account.AccountNumber);
                if (accountToSave == null)
                {
                    accountToSave = new Tbl_Account();
                    accountToSave.AgencyId = (account.AgencyId == null) ? uo.Repository<Tbl_Agency>().GetAll().Where(r => r.Name == account.Tbl_Agency.Name).SingleOrDefault().AgencyId:account.AgencyId ;
                    editingRequired = false;
                }
                accountToSave.AccountNumber = account.AccountNumber;
                accountToSave.Address = account.Address;
                accountToSave.Address2 = account.Address2;
                accountToSave.City = account.City;
                accountToSave.DebtCurrentBalance = account.DebtCurrentBalance;
                accountToSave.DebtPurchaseBalance = account.DebtPurchaseBalance;
                accountToSave.FirstName = account.FirstName;
                accountToSave.HomePhone = account.HomePhone;
                accountToSave.LastFourSSN = account.LastFourSSN;
                accountToSave.LastName = account.LastName;
                accountToSave.MobilePhone = account.MobilePhone;
                accountToSave.StateId = account.StateId;
                accountToSave.WorkPhone = account.WorkPhone;
                accountToSave.Zip = account.Zip;

                if (editingRequired)
                    uo.Repository<Tbl_Account>().Update(accountToSave);
                else
                    uo.Repository<Tbl_Account>().Add(accountToSave);
                uo.Save();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return account;
        }