Exemple #1
0
        private void SeedTasks()
        {
            using (var context = new TorshiaContext())
            {
                var affectedSector = context.SectorTypes.FirstOrDefault(s => s.Name == "Customers");

                for (int i = 0; i < 5; i++)
                {
                    Random rand          = new Random();
                    int    randomSectors = rand.Next(1, context.SectorTypes.Count());

                    context.Tasks.Add(new Task()
                    {
                        Title           = $"GeneratedTitle {new string(char.Parse(i.ToString()), 5)}",
                        DueDate         = DateTime.ParseExact("01-12-2018", "dd-MM-yyyy", CultureInfo.InstalledUICulture),
                        IsReported      = false,
                        Participants    = "Pesho, Gosho, User",
                        Description     = $"{new string('A', 10)}",
                        AffectedSectors = $"{randomSectors}",
                    });
                }


                context.SaveChanges();
            }
        }
Exemple #2
0
        public override void Configure()
        {
            using (var context = new TorshiaContext())
            {
                if (!context.Users.Any())
                {
                    Console.WriteLine("SEEDING DATABASE");
                    SeedDatabase();
                }

                if (!context.Tasks.Any())
                {
                    SeedTasks();
                }
            }
        }
Exemple #3
0
        public static void Main()
        {
            var context = new TorshiaContext();

            for (int i = 0; i < 6; i++)
            {
                context.Reports.Add(new Report
                {
                    Status     = Status.Completed,
                    TaskId     = 2,
                    ReporterId = 1,
                    ReportedOn = DateTime.Now
                });
            }

            context.SaveChanges();
            WebHost.Start(new StartUp());
        }
Exemple #4
0
        static void Main(string[] args)
        {
            var context = new TorshiaContext();

            //for (int i = 1; i < 8; i++)
            //{
            //    context.Tasks.Add(new Task
            //    {
            //        Title = $"StarWars Episode:{i}",
            //        Description = $"Bad rating {i}/10",
            //        DueDate = DateTime.Now,
            //        Participants = "J. Lucfuk u dumb ass sellout bi4 nigg"
            //    });
            //}
            //context.SaveChanges();

            WebHost.Start(new StartUp());
        }
Exemple #5
0
        private void SeedDatabase()
        {
            using (var context = new TorshiaContext())
            {
                context.UserRoles.Add(new UserRole {
                    Name = "User"
                });
                context.UserRoles.Add(new UserRole {
                    Name = "Admin"
                });

                context.SectorTypes.Add(new SectorType {
                    Name = "Customers"
                });
                context.SectorTypes.Add(new SectorType {
                    Name = "Marketing"
                });
                context.SectorTypes.Add(new SectorType {
                    Name = "Finances"
                });
                context.SectorTypes.Add(new SectorType {
                    Name = "Internal"
                });
                context.SectorTypes.Add(new SectorType {
                    Name = "Management"
                });

                context.ReportStatuses.Add(new ReportStatus {
                    Name = "Completed"
                });
                context.ReportStatuses.Add(new ReportStatus {
                    Name = "Archived"
                });

                context.SaveChanges();
            }
        }
Exemple #6
0
        private static void SeedTasks()
        {
            var db = new TorshiaContext();

            for (int i = 1; i <= 10; i++)
            {
                db.Tasks.Add(new Task
                {
                    Title           = $"Fix Business Agenda{i}",
                    DueDate         = new System.DateTime(2019 + i, 09, 11 + i),
                    Description     = $"The business agaenda of the company needs to be rethought.{i}",
                    Participants    = $"Todor Ivanov{i}, Jordan Draganov{i}, Dimitar Stefanov{i}",
                    AffectedSectors = new List <TaskSector>()
                    {
                        new TaskSector()
                        {
                            Sector = Sector.Management
                        },
                        new TaskSector()
                        {
                            Sector = Sector.Finances
                        },
                        new TaskSector()
                        {
                            Sector = Sector.Management
                        },
                        new TaskSector()
                        {
                            Sector = Sector.Internal
                        }
                    }
                });
            }

            db.SaveChanges();
        }
Exemple #7
0
 public TasksService(TorshiaContext context)
 {
     this.context = context;
 }
Exemple #8
0
 public ReportsService(TorshiaContext context)
 {
     this.context = context;
 }
 public BaseController()
 {
     this.db = new TorshiaContext();
 }
Exemple #10
0
 public TasksService(TorshiaContext context)
     : base(context)
 {
 }
 public UsersService(TorshiaContext context)
     : base(context)
 {
 }
Exemple #12
0
 public TaskService(TorshiaContext context)
 {
     db = context;
 }
 public ReportService(TorshiaContext db, ITaskService taskService)
 {
     this.db          = db;
     this.taskService = taskService;
 }
Exemple #14
0
 protected BaseController()
 {
     this.db = new TorshiaContext();
 }
 public UserService(TorshiaContext db)
 {
     this.db = db;
 }
 public BaseService(TorshiaContext context)
 {
     this.context = context;
 }
Exemple #17
0
 public UserService(TorshiaContext context)
 {
     db = context;
 }
Exemple #18
0
 public UsersServices(TorshiaContext context)
 {
     this.context = context;
 }
Exemple #19
0
 public TaskService(TorshiaContext db)
 {
     this.db = db;
 }
Exemple #20
0
 public ReportService(TorshiaContext context)
 {
     db = context;
 }
Exemple #21
0
 public ReportService(TorshiaContext context, ITasksService tasksService)
     : base(context)
 {
     this.taskService = tasksService;
 }
Exemple #22
0
 protected BaseService(TorshiaContext context)
 {
     this.context = context;
 }