예제 #1
0
        public static bool GenerateRow(this ITableContent content, Authentication authentication)
        {
            var row = NewRandomRow(content, authentication);

            if (FillFields(row, authentication) == true)
            {
                if (RandomUtility.Within(25) == true)
                {
                    row.SetTags(authentication, tags.Random());
                }

                if (RandomUtility.Within(25) == true)
                {
                    row.SetIsEnabled(authentication, RandomUtility.NextBoolean());
                }

                try
                {
                    content.EndNew(authentication, row);
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
            return(false);
        }
예제 #2
0
        public static void CreateRow(this ITableContent content, Authentication authentication)
        {
            var    table      = content.Table;
            var    parent     = content.Parent;
            string relationID = null;

            if (parent != null && parent.Any() == true)
            {
                relationID = parent.Random().RelationID;
            }

            var row = content.AddNew(authentication, relationID);

            var types = table.GetService(typeof(ITypeCollection)) as ITypeCollection;

            foreach (var item in table.TableInfo.Columns)
            {
                if (item.AutoIncrement == false)
                {
                    //row.SetField(authentication, item.Name, TypeContextExtensions.GetRandomValue(types, item));
                }
            }

            if (RandomUtility.Within(25) == true)
            {
                row.SetTags(authentication, tags.Random());
            }

            if (RandomUtility.Within(25) == true)
            {
                row.SetIsEnabled(authentication, RandomUtility.NextBoolean());
            }

            content.EndNew(authentication, row);
        }
예제 #3
0
        public static ITableRow AddRandomRow(this ITableContent content, Authentication authentication)
        {
            var row = content.AddNew(authentication, null);

            row.InitializeRandom(authentication);
            content.EndNew(authentication, row);
            return(row);
        }
        public void EndNew()
        {
            var row = content.Dispatcher.Invoke(() =>
            {
                content.BeginEdit(authentication);
                content.EnterEdit(authentication);
                return(content.AddNew(authentication, null));
            });

            content.EndNew(authentication, row);
        }
예제 #5
0
 public void EndNew()
 {
     content.EndNew(authentication, row);
 }