Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ShowWarning("This is Online Marketing sample data generator. This tool should be used for the internal purposes only. It wasn't fully tested and using it may corrupt your data. Internet connection is needed to generate contacts with real names and personas.");

        btnGenerate.Click += (_, __) =>
        {
            var generator = new SampleDataGenerator(SiteContext.CurrentSiteID)
            {
                Information = s => ShowInformation(s),
                Error       = s => ShowError(s)
            };

            var stopwatch = Stopwatch.StartNew();

            generator.Generate(new SampleDataGenerator.GenerationOptions()
            {
                GenerateContactStatuses = chckCreateContactStatuses.Checked,
                ContactsCount           = chckGenerateContacts.Checked ? txtContactsCount.Text.ToInteger(0) : 0,
                ContactsWithRealNames   = chckContactRealNames.Checked,
                GeneratePersonas        = txtGeneratePersonas.Checked,
                ScoresCount             = chckGenerateScores.Checked ? txtScoresCount.Text.ToInteger(0) : 0,
                ActivitiesForEachExistingContactCount = chckGenerateActivities.Checked ? txtActivitiesCount.Text.ToInteger(0) : 0,
            });

            ShowInformation("Time elapsed: " + stopwatch.Elapsed);
        };
    }
    private void GenerateBtnClickAction(object sender, EventArgs e)
    {
        var generator = new SampleDataGenerator(SiteContext.CurrentSiteID)
        {
            Information = s => ShowInformation(s),
            Error = s => ShowError(s)
        };

        var stopwatch = Stopwatch.StartNew();

        generator.Generate(new SampleDataGenerator.GenerationOptions()
        {
            GenerateContactStatuses = chckCreateContactStatuses.Checked,
            ContactsCount = chckGenerateContacts.Checked ? txtContactsCount.Text.ToInteger(0) : 0,
            GenerateMergedContacts = chckGenerateMergedContacts.Checked,
            GenerateContactRelationships = chckGenerateRelationships.Checked,
            ContactsWithRealNames = chckContactRealNames.Checked,
            GeneratePersonas = txtGeneratePersonas.Checked,
            GenerateContactGroups = chckGenerateCGs.Checked ? txtCGsCount.Text.ToInteger(0) : 0,
            ScoresCount = chckGenerateScores.Checked ? txtScoresCount.Text.ToInteger(0) : 0,
            ActivitiesForEachExistingContactCount = chckGenerateActivities.Checked ? txtActivitiesCount.Text.ToInteger(0) : 0,
        });

        ShowInformation("Time elapsed: " + stopwatch.Elapsed);
    }