示例#1
0
        public void SingleList_Serialized()
        {
            int lc = 0;
            int cc = 0;

            Csla.Core.ChildChangedEventArgs cca = null;

            var root = new SingleList();

            root.Add(new SingleRoot(true));
            root = root.Clone();

            System.ComponentModel.PropertyDescriptor lcp = null;
            root.ListChanged += (o, e) =>
            {
                lc++;
                lcp = e.PropertyDescriptor;
            };
            root.ChildChanged += (o, e) =>
            {
                cc++;
                cca = e;
            };
            root[0].Name = "abc";
            Assert.AreEqual(1, lc, "ListChanged should have fired");
            Assert.IsNotNull(lcp, "PropertyDescriptor should be provided");
            Assert.AreEqual("Name", lcp.Name, "PropertyDescriptor.Name should be Name");
            Assert.AreEqual(1, cc, "ChildChanged should have fired");
            Assert.IsTrue(ReferenceEquals(root[0], cca.ChildObject), "Ref should be equal");
        }
示例#2
0
        public void SingleList_Serialized()
        {
            IDataPortal <SingleList> listDataPortal = _testDIContext.CreateDataPortal <SingleList>();
            IDataPortal <SingleRoot> dataPortal     = _testDIContext.CreateDataPortal <SingleRoot>();

            int lc = 0;
            int cc = 0;

            Csla.Core.ChildChangedEventArgs cca = null;

            var root = listDataPortal.Fetch(false);

            root.Add(dataPortal.Fetch(true));
            root = root.Clone();

            System.ComponentModel.PropertyDescriptor lcp = null;
            root.ListChanged += (o, e) =>
            {
                lc++;
                lcp = e.PropertyDescriptor;
            };
            root.ChildChanged += (o, e) =>
            {
                cc++;
                cca = e;
            };
            root[0].Name = "abc";
            Assert.AreEqual(1, lc, "ListChanged should have fired once");
            Assert.IsNotNull(lcp, "PropertyDescriptor should be provided");
            Assert.AreEqual("Name", lcp.Name, "PropertyDescriptor.Name should be Name");
            Assert.AreEqual(1, cc, "ChildChanged should have fired");
            Assert.IsTrue(ReferenceEquals(root[0], cca.ChildObject), "Ref should be equal");
        }
示例#3
0
 void newValue_ChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     if (e.PropertyChangedArgs != null && e.PropertyChangedArgs.PropertyName == "AmountPaid")
     {
         this.Model.TotalAmountPaid = this.Model.PaymentDetails.Sum(x => x.AmountPaid);
     }
 }
示例#4
0
        public void GrandChild()
        {
            bool pc  = false;
            bool cc  = false;
            bool cpc = false;
            bool ccc = false;

            Csla.Core.ChildChangedEventArgs cca = null;

            var root = new Grandchild();

            root.PropertyChanged += (o, e) =>
            {
                pc = true;
            };
            root.ChildChanged += (o, e) =>
            {
                cc = true;
            };
            root.Child.PropertyChanged += (o, e) =>
            {
                cpc = true;
            };
            root.Child.ChildChanged += (o, e) =>
            {
                ccc = true;
                cca = e;
            };
            root.Child.Child.Name = "abc";
            Assert.IsFalse(cpc, "C PropertyChanged should not have fired");
            Assert.IsTrue(ccc, "C ChildChanged should have fired");
            Assert.IsFalse(pc, "PropertyChanged should not have fired");
            Assert.IsTrue(cc, "ChildChanged should have fired");
            Assert.IsTrue(ReferenceEquals(root.Child.Child, cca.ChildObject), "Ref should be equal");
        }
示例#5
0
 protected override void OnChildChanged(Csla.Core.ChildChangedEventArgs e)
 {
     if (e.ChildObject is FakePersonEmailAddresses)
     {
         BusinessRules.CheckRules(EmailAddressesProperty);
         OnPropertyChanged(EmailAddressesProperty);
     }
     base.OnChildChanged(e);
 }
示例#6
0
 protected override void OnChildChanged(Csla.Core.ChildChangedEventArgs e)
 {
     if (e.ChildObject is ProjectResources)
     {
         BusinessRules.CheckRules(ResourcesProperty);
         OnPropertyChanged(ResourcesProperty);
     }
     base.OnChildChanged(e);
 }
示例#7
0
 protected override void OnChildChanged(Csla.Core.ChildChangedEventArgs e)
 {
     base.OnChildChanged(e);
     if (e.ChildObject is PersonaCorreos)
     {
         //Recheck our rules.
         BusinessRules.CheckRules(CorreosProperty);
         //OnPropertyChanged(CorreosProperty);
     }
 }
示例#8
0
 void newValue_ChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     if (e.PropertyChangedArgs != null)
     {
         if (this.Model.BillItems.IsValid && (e.PropertyChangedArgs.PropertyName == "Quantity" || e.PropertyChangedArgs.PropertyName == "Rate"))
         {
             this.ComputeTotalBill();
         }
     }
 }
示例#9
0
 void newValue_ChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     if (e.PropertyChangedArgs != null)
     {
         if (this.Model.BillItems.IsValid)
         {
             this.ComputeTotalBill();
         }
     }
 }
示例#10
0
        public void ListOfLists()
        {
            IDataPortal <ListContainerList> listContainerDataPortal = _testDIContext.CreateDataPortal <ListContainerList>();
            IDataPortal <ContainsList>      listDataPortal          = _testDIContext.CreateDataPortal <ContainsList>();
            IDataPortal <SingleRoot>        dataPortal = _testDIContext.CreateDataPortal <SingleRoot>();

            bool rcc = false;
            bool ccc = false;
            bool cc  = false;

            Csla.Core.ChildChangedEventArgs cca = null;

            var root  = listContainerDataPortal.Fetch();
            var child = listDataPortal.Fetch(true);

            root.Add(child);
            child.List.Add(dataPortal.Fetch(true));
            root.ChildChanged += (o, e) =>
            {
                rcc = true;
            };
            System.ComponentModel.PropertyDescriptor lcp = null;
            root.ListChanged += (o, e) =>
            {
                Assert.Fail("root.ListChanged should not fire");
            };
            child.ChildChanged += (o, e) =>
            {
                ccc = true;
            };
            child.PropertyChanged += (o, e) =>
            {
                Assert.IsTrue(false, "child.PropertyChanged should not fire");
            };
            bool lc = false;

            child.List.ListChanged += (o, e) =>
            {
                lc  = true;
                lcp = e.PropertyDescriptor;
            };
            child.List.ChildChanged += (o, e) =>
            {
                cc  = true;
                cca = e;
            };
            child.List[0].Name = "abc";
            Assert.IsTrue(lc, "ListChanged should have fired");
            Assert.IsNotNull(lcp, "PropertyDescriptor should be provided");
            Assert.AreEqual("Name", lcp.Name, "PropertyDescriptor.Name should be Name");
            Assert.IsTrue(rcc, "root.ChildChanged should have fired");
            Assert.IsTrue(ccc, "child.ChildChanged should have fired");
            Assert.IsTrue(cc, "list.ChildChanged should have fired");
            Assert.IsTrue(ReferenceEquals(child.List[0], cca.ChildObject), "Ref should be equal");
        }
示例#11
0
 void newValue_ChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     if (e.PropertyChangedArgs != null)
     {
         if (this.Model.BillItems.IsValid && (e.PropertyChangedArgs.PropertyName == "UnitCount" || e.PropertyChangedArgs.PropertyName == "Uom" ||
                                              e.PropertyChangedArgs.PropertyName == "WeightUsed" || e.PropertyChangedArgs.PropertyName == "IsTaxable"))
         {
             this.ComputeTotalBill();
         }
     }
 }
        protected virtual void HandleChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
        {
            NotifyOfPropertyChange(() => this.ModelList);
            //Model.BeginSave((s2, r2) =>
            //{
            //  if (r2.Error != null)
            //    throw r2.Error;
            //  Model = (PhraseList)r2.NewObject;
            //});
            //NotifyOfPropertyChange(() => CanSave);
            NotifyOfPropertyChange(() => CanInitiateDeleteChecked);

            //NotifyOfPropertyChange(() => CanCancelEdit);
        }
示例#13
0
        public void ContainedList_Serialized()
        {
            int lc  = 0;
            int rcc = 0;
            int cc  = 0;

            Csla.Core.ChildChangedEventArgs cca = null;

            var root = new ContainsList();

            root.List.Add(new SingleRoot(true));
            root = root.Clone();

            root.PropertyChanged += (o, e) =>
            {
                Assert.IsTrue(false, "root.PropertyChanged should not fire");
            };
            root.ChildChanged += (o, e) =>
            {
                rcc++;
            };
#if !SILVERLIGHT
            System.ComponentModel.PropertyDescriptor lcp = null;
            root.List.ListChanged += (o, e) =>
            {
                lc++;
                lcp = e.PropertyDescriptor;
            };
#else
            root.List.CollectionChanged += (o, e) =>
            {
                lc++;
            };
#endif
            root.List.ChildChanged += (o, e) =>
            {
                cc++;
                cca = e;
            };
            root.List[0].Name = "abc";
#if !SILVERLIGHT
            Assert.AreEqual(1, lc, "ListChanged should have fired");
            Assert.IsNotNull(lcp, "PropertyDescriptor should be provided");
            Assert.AreEqual("Name", lcp.Name, "PropertyDescriptor.Name should be Name");
#endif
            Assert.AreEqual(1, rcc, "root.ChildChanged should have fired");
            Assert.AreEqual(1, cc, "list.ChildChanged should have fired");
            Assert.IsTrue(ReferenceEquals(root.List[0], cca.ChildObject), "Ref should be equal");
        }
示例#14
0
        void Model_ChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
        {
            if (e.PropertyChangedArgs != null)
            {
                if (e.PropertyChangedArgs.PropertyName == "VehicleType")
                {
                    var fee = this.VehicleTypes.SingleOrDefault(x => x.Id == this.SelectedItem.VehicleType);
                    if (fee != null)
                    {
                        this.SelectedItem.Fee = fee.Fee;
                    }
                }

                if (e.PropertyChangedArgs.PropertyName == "Fee")
                {
                    OnPropertyChanged("TotalServiceFees");
                    OnPropertyChanged("TotalVAT");
                    OnPropertyChanged("Total");
                }
            }
        }
示例#15
0
        public void GrandChild()
        {
            IDataPortal <Grandchild> dataPortal = _testDIContext.CreateDataPortal <Grandchild>();

            bool pc  = false;
            bool cc  = false;
            bool cpc = false;
            bool ccc = false;

            Csla.Core.ChildChangedEventArgs cca = null;

            var root = dataPortal.Fetch();

            root.PropertyChanged += (o, e) =>
            {
                pc = true;
            };
            root.ChildChanged += (o, e) =>
            {
                cc = true;
            };
            root.Child.PropertyChanged += (o, e) =>
            {
                cpc = true;
            };
            root.Child.ChildChanged += (o, e) =>
            {
                ccc = true;
                cca = e;
            };
            root.Child.Child.Name = "abc";
            Assert.IsFalse(cpc, "C PropertyChanged should not have fired");
            Assert.IsTrue(ccc, "C ChildChanged should have fired");
            Assert.IsFalse(pc, "PropertyChanged should not have fired");
            Assert.IsTrue(cc, "ChildChanged should have fired");
            Assert.IsTrue(ReferenceEquals(root.Child.Child, cca.ChildObject), "Ref should be equal");
        }
 private void DataObject_ChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     DataPropertyChanged(e.PropertyChangedArgs);
 }
 void HandlePhrasesList_ChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     NotifyOfPropertyChange(() => Model);
 }
 protected override void OnChildChanged(Csla.Core.ChildChangedEventArgs e)
 {
     base.OnChildChanged(e);
     //if (e.ChildObject != null)
     //  (Csla.Core.BusinessBase)e.ChildObject.BusinessRules.CheckRules();
 }
示例#19
0
 protected virtual void HandleChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     NotifyOfPropertyChange(() => this.ModelList);
     NotifyOfPropertyChange(() => CanSave);
     NotifyOfPropertyChange(() => CanCancelEdit);
 }
示例#20
0
        public void ListOfLists()
        {
            bool rcc = false;
            bool ccc = false;
            bool cc  = false;

            Csla.Core.ChildChangedEventArgs cca = null;

            var root  = new ListContainerList();
            var child = new ContainsList(true);

            root.Add(child);
            child.List.Add(new SingleRoot(true));
            root.ChildChanged += (o, e) =>
            {
                rcc = true;
            };
#if !SILVERLIGHT
            System.ComponentModel.PropertyDescriptor lcp = null;
            root.ListChanged += (o, e) =>
            {
                Assert.Fail("root.ListChanged should not fire");
            };
#else
            root.CollectionChanged += (o, e) =>
            {
                Assert.IsTrue(false, "root.ListChanged should not fire");
            };
#endif
            child.ChildChanged += (o, e) =>
            {
                ccc = true;
            };
            child.PropertyChanged += (o, e) =>
            {
                Assert.IsTrue(false, "child.PropertyChanged should not fire");
            };
#if !SILVERLIGHT
            bool lc = false;
            child.List.ListChanged += (o, e) =>
            {
                lc  = true;
                lcp = e.PropertyDescriptor;
            };
#endif
            child.List.ChildChanged += (o, e) =>
            {
                cc  = true;
                cca = e;
            };
            child.List[0].Name = "abc";
#if !SILVERLIGHT
            Assert.IsTrue(lc, "ListChanged should have fired");
            Assert.IsNotNull(lcp, "PropertyDescriptor should be provided");
            Assert.AreEqual("Name", lcp.Name, "PropertyDescriptor.Name should be Name");
#endif
            Assert.IsTrue(rcc, "root.ChildChanged should have fired");
            Assert.IsTrue(ccc, "child.ChildChanged should have fired");
            Assert.IsTrue(cc, "list.ChildChanged should have fired");
            Assert.IsTrue(ReferenceEquals(child.List[0], cca.ChildObject), "Ref should be equal");
        }
 protected virtual void HandleChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     NotifyOfPropertyChange(() => this.ModelList);
     NotifyOfPropertyChange(() => CanSave);
     NotifyOfPropertyChange(() => CanInitiateDeleteChecked);
 }
示例#22
0
 private void PollSubmission_ChildChanged(object sender, Csla.Core.ChildChangedEventArgs e)
 {
     this.RaisePropertyChanged(() => this.CanSubmit);
 }
 protected override void OnChildChanged(Csla.Core.ChildChangedEventArgs e)
 {
     base.OnChildChanged(e);
     BusinessRules.CheckRules(PhrasesProperty);
     BusinessRules.CheckRules(ContextPhraseProperty);
 }