예제 #1
0
        public void SaveAll()
        {
            AdoEFUOW.ADoEFUow o = new AdoEFUOW.ADoEFUow();

            o.CustomerDal = CustomerDal;
            o.AddressDal  = AddressDal;
            o.PhoneDal    = PhoneDal;
            CustomerBase y = Factory <CustomerBase> .Create(cust.Type);

            y.Id           = cust.Id;
            y.CustomerName = cust.CustomerName;
            y.PhoneNumber  = cust.PhoneNumber;
            y.Address      = cust.Address;
            y.BillAmount   = cust.BillAmount;
            y.BillDate     = cust.BillDate;
            CustomerDal.AddInMemory(y);

            foreach (AddressPhone a in cust.Addresses)
            {
                AddressBase a1 = Factory <AddressBase> .Create("Address");

                a1.Address1 = a.Address1;
                AddressDal.AddInMemory((AddressBase)a);
                foreach (PhoneBase i in a.Phones)
                {
                    PhoneDal.AddInMemory((PhoneBase)i);
                }
            }
            o.Committ();
        }