Esempio n. 1
0
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("it-IT");
            var endpoint = new IPEndPoint(IPAddress.Loopback, 1113);
            var esCon    = EventStoreConnection.Create(endpoint);

            esCon.Connect();

            var credentials = new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit");

            var cm = new CommandManager(esCon);
            var pm = new MyBudget.Projections.ProjectionManager(endpoint, credentials, new MyBudget.Infrastructure.EventStoreAdapter(endpoint, credentials));

            pm.Run();

            var tu = pm.GetUsersList().AllUsers();

            tu.Wait();
            userId   = tu.Result.Select(s => s.Id).FirstOrDefault();
            budgetId = pm.GetBudgetsList().GetBudgetsUserCanView(new MyBudget.Domain.Users.UserId(userId)).Select(s => s.Id).FirstOrDefault();

            using (var con = new System.Data.SqlClient.SqlConnection(_cs))
            {
                con.Open();
                var movements = LoadMovements(con);

                foreach (var anno in movements.GroupBy(g => g.DateTime.Year))
                {
                    var str = ServiceStack.Text.CsvSerializer.SerializeToCsv(anno.OrderBy(d => d.DateTime));
                    System.IO.File.WriteAllText(@"c:\temp\Year_" + anno.Key + ".csv", str);
                }
                var importer = new ImportManager(cm, pm);
                importer.ImportCategoriesByName(movements.Select(s => s.Category), budgetId, userId);

                var categories = pm.GetCategories().GetBudgetsCategories(budgetId);

                var handler = cm.Create <CreateLine>();
                foreach (var m in movements)
                {
                    handler(m.ToCreateLine(new BudgetId(budgetId), userId, categories));
                }
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("it-IT");
            var endpoint = new IPEndPoint(IPAddress.Loopback, 1113);
            var esCon = EventStoreConnection.Create(endpoint);
            esCon.Connect();

            var credentials = new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit");

            var cm = new CommandManager(esCon);
            var pm = new MyBudget.Projections.ProjectionManager(endpoint, credentials, new MyBudget.Infrastructure.EventStoreAdapter(endpoint, credentials));
            pm.Run();

            var tu = pm.GetUsersList().AllUsers();
            tu.Wait();
            userId = tu.Result.Select(s => s.Id).FirstOrDefault();
            budgetId = pm.GetBudgetsList().GetBudgetsUserCanView(new MyBudget.Domain.Users.UserId(userId)).Select(s => s.Id).FirstOrDefault();

            using (var con = new System.Data.SqlClient.SqlConnection(_cs))
            {
                con.Open();
                var movements = LoadMovements(con);

                foreach (var anno in movements.GroupBy(g=> g.DateTime.Year))
                {
                    
                    var str = ServiceStack.Text.CsvSerializer.SerializeToCsv(anno.OrderBy(d=> d.DateTime));
                    System.IO.File.WriteAllText(@"c:\temp\Year_"+anno.Key + ".csv", str);
                }
                var importer = new ImportManager(cm, pm);
                importer.ImportCategoriesByName(movements.Select(s => s.Category), budgetId, userId);

                var categories = pm.GetCategories().GetBudgetsCategories(budgetId);

                var handler = cm.Create<CreateLine>();
                foreach (var m in movements)
                    handler(m.ToCreateLine(new BudgetId(budgetId), userId, categories));
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {

            var endpoint = new IPEndPoint(IPAddress.Loopback, 1113);
            var esCon = EventStoreConnection.Create(endpoint);
            esCon.Connect();

            var credentials = new UserCredentials("admin", "changeit");

            var cm = new CommandManager(esCon);
            var pm = new MyBudget.Projections.ProjectionManager(endpoint, credentials, new EventStoreAdapter(endpoint, credentials));
            pm.Run();

            //var comuni = @"F:\Skydrive\Documents\Spese Laura e Valerio\Spese Laura e Valerio.xlsx";
            //var context = new BudgetChooser(pm).ChooseBudget(comuni);
            //new ImportDistribution(pm, cm).Run(context.BudgetId, context.UserId, comuni);

            var singole = @"F:\Skydrive\Documents\spese.xlsx";
            //var singole = @"c:\Users\Valerio\Downloads\spese (1).xlsx";
            var c2 = new BudgetChooser(pm).ChooseBudget(singole);
            new ImportStandard(pm, cm).Run(c2.BudgetId, c2.UserId, singole);
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            var endpoint = new IPEndPoint(IPAddress.Loopback, 1113);
            var esCon    = EventStoreConnection.Create(endpoint);

            esCon.Connect();

            var credentials = new UserCredentials("admin", "changeit");

            var cm = new CommandManager(esCon);
            var pm = new MyBudget.Projections.ProjectionManager(endpoint, credentials, new EventStoreAdapter(endpoint, credentials));

            pm.Run();

            //var comuni = @"F:\Skydrive\Documents\Spese Laura e Valerio\Spese Laura e Valerio.xlsx";
            //var context = new BudgetChooser(pm).ChooseBudget(comuni);
            //new ImportDistribution(pm, cm).Run(context.BudgetId, context.UserId, comuni);

            var singole = @"F:\Skydrive\Documents\spese.xlsx";
            //var singole = @"c:\Users\Valerio\Downloads\spese (1).xlsx";
            var c2 = new BudgetChooser(pm).ChooseBudget(singole);

            new ImportStandard(pm, cm).Run(c2.BudgetId, c2.UserId, singole);
        }