private void Create([Inject] IChildDataPortal <TestItem> childDataPortal)
 {
     Add(childDataPortal.FetchChild(123, "Zebra has stripes"));
     Add(childDataPortal.FetchChild(2233, "Software is neat"));
     Add(childDataPortal.FetchChild(453, "Run, the sky is falling"));
     Add(childDataPortal.FetchChild(12, "What is new?"));
 }
Exemplo n.º 2
0
 private void DataPortal_Fetch([Inject] IChildDataPortal <TestItem> childDataPortal)
 {
     Add(childDataPortal.FetchChild(123));
     Add(childDataPortal.FetchChild(2));
     Add(childDataPortal.FetchChild(13));
     Add(childDataPortal.FetchChild(23));
     Add(childDataPortal.FetchChild(3));
 }
Exemplo n.º 3
0
 private void DataPortal_Fetch([Inject] IChildDataPortal <InitializeRoot> childDataPortal)
 {
     using (SuppressListChangedEvents)
     {
         Add(childDataPortal.FetchChild("abc"));
     }
 }
Exemplo n.º 4
0
 private void Fetch(bool child, [Inject] IChildDataPortal <SingleRoot> childDataPortal)
 {
     LoadProperty(ChildProperty, childDataPortal.FetchChild(true));
     if (child)
     {
         MarkAsChild();
     }
 }
Exemplo n.º 5
0
 private void Fetch([Inject] DataAccess.IPersonDal dal, [Inject] IChildDataPortal <PersonInfo> personInfoPortal)
 {
     using (LoadListMode)
     {
         var data = dal.Get().Select(d => personInfoPortal.FetchChild(d));
         AddRange(data);
     }
 }
Exemplo n.º 6
0
 protected void DataPortal_Create(int criteria, [Inject] IChildDataPortal <CustomerContactList> childDataPortal)
 {
     LoadProperty(IdProperty, criteria);
     LoadProperty(NameProperty, "New Customer for Id: " + criteria.ToString());
     LoadProperty(DateCreatedProperty, new SmartDate(DateTime.Today));
     LoadProperty(DateTimeOffsetNotNullProperty, DateTimeOffset.Now);
     LoadProperty(ContactsProperty, childDataPortal.FetchChild(0));
 }
Exemplo n.º 7
0
        private void Fetch([Inject] DataAccess.IPersonDal dal, [Inject] IChildDataPortal <PersonInfo> personPortal)
        {
            IsReadOnly = false;
            var data = dal.Get().Select(d => personPortal.FetchChild(d));

            AddRange(data);
            IsReadOnly = true;
        }
Exemplo n.º 8
0
            private void DataPortal_Fetch([Inject] IChildDataPortal <SimpleBO> simpleBOPortal, [Inject] IChildDataPortal <SimpleBOList> simpleBOListPortal)
            {
                Depth = 0;
                LoadProperty(NameProperty, "Jupiter");
                LoadProperty(ChildProperty, simpleBOPortal.FetchChild(Depth + 1));
                LoadProperty(ChildListProperty, simpleBOListPortal.FetchChild(Depth + 1));

                BusinessRules.CheckRules();
            }
Exemplo n.º 9
0
 private void Child_Fetch(int customerID, [Inject] IChildDataPortal <CustomerContact> childDataPortal)
 {
     this.RaiseListChangedEvents = false;
     for (int i = 1; i <= customerID; i++)
     {
         Add(childDataPortal.FetchChild(customerID, i, "First Name # " + i.ToString(), "Last Name # " + i.ToString(), new DateTime(1980 + i, 1, 1)));
     }
     this.RaiseListChangedEvents = true;
 }
Exemplo n.º 10
0
            private void Child_Fetch(int depth, [Inject] IChildDataPortal <SimpleBO> simpleBOPortal, [Inject] IChildDataPortal <SimpleBOList> simpleBOListPortal)
            {
                Depth = depth;
                LoadProperty(NameProperty, "Saturn");

                if (depth < 4)
                {
                    LoadProperty(ChildProperty, simpleBOPortal.FetchChild(Depth + 1));
                    LoadProperty(ChildListProperty, simpleBOListPortal.FetchChild(Depth + 1));
                }

                BusinessRules.CheckRules();
            }
Exemplo n.º 11
0
        protected void DataPortal_Fetch(int criteria, [Inject] IChildDataPortal <CustomerContactList> childDataPortal)
        {
            LoadProperty(IdProperty, criteria);
            LoadProperty(NameProperty, "Customer Name for Id: " + criteria.ToString());
            LoadProperty(DateCreatedProperty, new SmartDate(new DateTime(2000 + criteria, 1, 1)));
            LoadProperty(ContactsProperty, childDataPortal.FetchChild(criteria));
            LoadProperty(DateTimeOffsetNotNullProperty, DateTimeOffset.Now);
            LoadProperty(TypeProperty, CustomeType.Inactive);

            if (criteria == customerIDThrowsException)
            {
                throw new ApplicationException("Test for Silverlight DataSource Error!");
            }
        }
Exemplo n.º 12
0
        public void RootChangedMetastateEventsChild()
        {
            IChildDataPortal <Child> childDataPortal = _testDIContext.CreateChildDataPortal <Child>();

            Csla.ApplicationContext.PropertyChangedMode = ApplicationContext.PropertyChangedModes.Xaml;
            var graph   = NewRoot();
            var changed = new List <string>();

            graph.PropertyChanged += (o, e) =>
            {
                changed.Add(e.PropertyName);
            };
            graph.Name = "abc";
            changed.Clear();
            graph.Children.Add(childDataPortal.FetchChild(123, "xyz"));

            Assert.IsTrue(graph.IsDirty, "IsDirty should be true");

            Assert.IsFalse(changed.Contains("Children"), "Children after add");
            Assert.IsTrue(changed.Contains("IsDirty"), "IsDirty after add");
            Assert.IsFalse(changed.Contains("IsSelfDirty"), "IsSelfDirty after add");
            Assert.IsTrue(changed.Contains("IsValid"), "IsValid after add");
            Assert.IsFalse(changed.Contains("IsSelfValid"), "IsSelfValid after add");
            Assert.IsTrue(changed.Contains("IsSavable"), "IsSavable after add");
            Assert.IsFalse(changed.Contains("IsNew"), "IsNew after add");
            Assert.IsFalse(changed.Contains("IsDeleted"), "IsDeleted after add");

            graph = graph.Save();
            changed.Clear();
            graph.PropertyChanged += (o, e) =>
            {
                changed.Add(e.PropertyName);
            };

            Assert.IsFalse(graph.IsDirty, "IsDirty should be false");

            graph.Children[0].Name = "mnop";

            Assert.IsTrue(graph.IsDirty, "IsDirty should be true");

            Assert.IsFalse(changed.Contains("Children"), "Children after add");
            Assert.IsTrue(changed.Contains("IsDirty"), "IsDirty after add");
            Assert.IsFalse(changed.Contains("IsSelfDirty"), "IsSelfDirty after add");
            Assert.IsTrue(changed.Contains("IsValid"), "IsValid after add");
            Assert.IsFalse(changed.Contains("IsSelfValid"), "IsSelfValid after add");
            Assert.IsTrue(changed.Contains("IsSavable"), "IsSavable after add");
            Assert.IsFalse(changed.Contains("IsNew"), "IsNew after add");
            Assert.IsFalse(changed.Contains("IsDeleted"), "IsDeleted after add");
        }
Exemplo n.º 13
0
        public void Blb2Loc_Add()
        {
            IDataPortal <TestList>      dataPortal      = _testDIContext.CreateDataPortal <TestList>();
            IChildDataPortal <TestItem> childDataPortal = _testDIContext.CreateChildDataPortal <TestItem>();

            var source = dataPortal.Create();
            var query  = from r in source
                         where r.Id > 100
                         select r;
            var synced = source.ToSyncList(query);

            var newItem = childDataPortal.FetchChild(432, "New item");

            synced.Add(newItem);

            Assert.AreEqual(4, synced.Count, "synced should have item");
            Assert.AreEqual(5, source.Count, "source should have item");
            Assert.IsTrue(synced.Contains(newItem), "synced should contain new item");
            Assert.IsTrue(source.Contains(newItem), "source should contain new item");
        }
Exemplo n.º 14
0
 public static ChildList GetList(IChildDataPortal <ChildList> childDataPortal)
 {
     return(childDataPortal.FetchChild());
 }
Exemplo n.º 15
0
 public static ArrayDataPortalClass GetChildParams(IChildDataPortal <ArrayDataPortalClass> dataPortal, params string[] values)
 {
     return(dataPortal.FetchChild(values));
 }
Exemplo n.º 16
0
 public static ArrayDataPortalClass GetChild(IChildDataPortal <ArrayDataPortalClass> dataPortal, int[] values)
 {
     return(dataPortal.FetchChild(values));
 }
Exemplo n.º 17
0
 public static ChildList GetChildObject(IChildDataPortal <ChildList> dataPortal)
 {
     return(dataPortal.FetchChild());
 }
Exemplo n.º 18
0
 internal static ItemWithAsynchRule GetOneItemForList(IChildDataPortal <ItemWithAsynchRule> childDataPortal, string id)
 {
     return(childDataPortal.FetchChild(id));
 }
Exemplo n.º 19
0
 private void Fetch([Inject] IChildDataPortal <SingleChild> childDataPortal)
 {
     LoadProperty(ChildProperty, childDataPortal.FetchChild(true));
 }
Exemplo n.º 20
0
 private void DataPortal_Fetch(int id, [Inject] IChildDataPortal <ChildList> dataPortal)
 {
     Children = dataPortal.FetchChild(id);
 }
Exemplo n.º 21
0
 public static Child GetChild(IChildDataPortal <Child> childDataPortal)
 {
     return(childDataPortal.FetchChild());
 }
Exemplo n.º 22
0
 public void FetchChild(IChildDataPortal <Child> childDataPortal)
 {
     SetProperty(ChildProperty, childDataPortal.FetchChild());
 }
Exemplo n.º 23
0
 protected void DataPortal_Fetch([Inject] IChildDataPortal <Child> childDataPortal, [Inject] IChildDataPortal <ChildList> childListDataPortal)
 {
     LoadProperty(ChildProperty, childDataPortal.FetchChild());
     LoadProperty(ChildListProperty, childListDataPortal.FetchChild());
 }
Exemplo n.º 24
0
 private void Child_Fetch(int depth, [Inject] IChildDataPortal <SimpleBO> childDataPortal)
 {
     Depth = depth;
     Add(childDataPortal.FetchChild(depth));
 }