示例#1
0
        public ReportModel()
        {
            MichelleDBEntities mdb = new MichelleDBEntities();
            Teams = mdb.Teams.ToList();

            AvailableReports = new Dictionary<int, string>();
            AvailableReports.Add(1, "Status of the team");
            AvailableReports.Add(2, "Applying quantitative methods");
            AvailableReports.Add(3, "Applying quantitative methods");
        }
示例#2
0
        public ActionResult SampleData()
        {
            Random rnd = new Random();
            MichelleDBEntities db = new MichelleDBEntities();
            db.Database.ExecuteSqlCommand("TruncateAll");
            if (db.Departments.Count() == 0)
            {
                db.Departments.Add(new Departments() { DepartmentName = "Department a" });
                db.Departments.Add(new Departments() { DepartmentName = "Department b" });
                db.Departments.Add(new Departments() { DepartmentName = "Department c" });
                db.SaveChanges();
            }

            if (db.TeamRoles.Count() == 0)
            {
                db.TeamRoles.Add(new TeamRoles() { TeamRoleName = "MARKETING TECHNOLOGIST" });
                db.TeamRoles.Add(new TeamRoles() { TeamRoleName = "SEO CONSULTANT" });
                db.TeamRoles.Add(new TeamRoles() { TeamRoleName = "GROWTH HACKER" });
                db.TeamRoles.Add(new TeamRoles() { TeamRoleName = "CONTENT STRATEGIST" });
                db.TeamRoles.Add(new TeamRoles() { TeamRoleName = "UX DESIGNER" });
                db.TeamRoles.Add(new TeamRoles() { TeamRoleName = "FRONT-END DEVELOPER" });
                db.TeamRoles.Add(new TeamRoles() { TeamRoleName = "MOBILE DEVELOPER" });
                db.SaveChanges();
            }
            var firstNames = new string[20] {
                "Wilmer", "Bryon", "Terrence", "Schumaker", "Danuta", "Rosy", "Luann",
            "Tabatha", "Thurman", "Deandrea", "Ned", "Isabell", "Marlon",
            "Janee", "Bok", "Wan", "Karry", "Macy", "Twila", "Jada"
            };
            var lastNames = new string[20] {
                "Frisch", "Aoki", "Bergevin", "Delsie", "Seder", "Castaldo", "Weast",
                "Moreira", "Wheatley", "Craft", "Jines", "Brannon", "Kahler",
                "Stansbury", "Mccreery", "Madia", "Mossman", "Bitner", "Luiz", "Daniels"
            };
            if (db.Employees.Count() == 0)
            {
                for (int i=0; i < firstNames.Length; i++)
                {
                    db.Employees.Add(new Employees()
                    {
                        EmployeeId = (i+1).ToString(),
                        FirstName = firstNames[i],
                        FamilyName = lastNames[i],
                        d_DepartmentId = rnd.Next(1, 4),
                        BeginningOfWork = new DateTime(rnd.Next(2012, 2016), rnd.Next(1, 13), rnd.Next(1, 29)),
                        r_TeamRoleId = rnd.Next(1, 8),
                        AdminType = i%2+1
                    });
                    
                }
                db.SaveChanges();
            }

            if (db.Teams.Count() == 0)
            {
                db.Teams.Add(new Teams()
                {
                    TeamName = "The Sun",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "1"
                });
                db.Teams.Add(new Teams()
                {
                    TeamName = "Mercury",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "2"
                });
                db.Teams.Add(new Teams()
                {
                    TeamName = "Venus",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "3"
                });
                db.Teams.Add(new Teams()
                {
                    TeamName = "Earth",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "4"
                });
                db.Teams.Add(new Teams()
                {
                    TeamName = "Mars",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "5"
                });
                db.Teams.Add(new Teams()
                {
                    TeamName = "Jupiter",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "6"
                });
                db.Teams.Add(new Teams()
                {
                    TeamName = "Saturn",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "7"
                });
                db.Teams.Add(new Teams()
                {
                    TeamName = "Uranus",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "8"
                });
                db.Teams.Add(new Teams()
                {
                    TeamName = "Neptune",
                    TeamStatus = "Active",
                    e_Employee_team_leader = "9"
                });
                db.SaveChanges();
            }
            return View("Index");
            /*
           

*/
        }