Exemplo n.º 1
0
        public ActionResult Create(Bug bug)
        {
            var BugSession = new MongoSession<Bug>();
            var UserSession = new MongoSession<User>();
            var ProjectSession = new MongoSession<BugProject>();

            var gebr = UserSession.Queryable.AsEnumerable();
            var bugpr = ProjectSession.Queryable.AsEnumerable();
            string id = "51495c0264489c9010010000";
            var bp = bugpr.Where(ps => ps.Id == (Norm.ObjectId)id).FirstOrDefault();

            var thisuser = UserSession.Queryable.AsEnumerable().Where(u => u.Email == User.Identity.Name).FirstOrDefault();

            bug.BugSubmitter = thisuser;
            bug.BugProject = bp;

            BugSession.Save(bug);

            if (Request.IsAjaxRequest())
            {
                return Json(bug);
            }

            return new RedirectResult("Create");
        }
Exemplo n.º 2
0
        public static void initializeBugBase()
        {
            newUser("Jacqueline", "*****@*****.**", "12345");
            // User jp = findUser("*****@*****.**");

            //NIEUW BUGPROJECT
             User u = findUser("*****@*****.**");
             BugProject bp = newBugProject(u, "Example Project", "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam");

            //nieuwe bug

             Bug bug = new Bug();
             bug.BugProject = bp;
             bug.BugSubmitter = u;
             bug.Description = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
             bug.Name = "Example name";

             var BugSession = new MongoSession<Bug>();
             BugSession.Save(bug);
        }
Exemplo n.º 3
0
        public static void newBug(string mail, string desc, string bugnaam)
        {
            var BugSession = new MongoSession<Bug>();
            var UserSession = new MongoSession<User>();

            var users = UserSession.Queryable.AsEnumerable();
            var thisuser = users.Where(u => u.Email == mail).FirstOrDefault();

            Bug myB = new Bug
            {
                Description = desc,
                Name = bugnaam,
                BugSubmitter = thisuser
            };
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            //NIEUW BUGPROJECT
               // User u = findUser("*****@*****.**");
               // newBugProject(u, "Website for insurancecompany", "Development of a new company website for a insurancecompany with brandnew web 3.0 techniques");

            //NIEUWE USER
            //newUser("Jacqueline", "*****@*****.**", "12345");

            /*
            var UserSession = new MongoSession<User>();
            var ProjectSession = new MongoSession<BugProject>();
            var BugSession = new MongoSession<Bug>();

            var gebr = UserSession.Queryable.AsEnumerable();
            var thisuser = gebr.Where(u => u.Email == "*****@*****.**" ).FirstOrDefault();
            var bugpr = ProjectSession.Queryable.AsEnumerable();
            string id = "76a1a60164489cb00c000000";
            var bp = bugpr.Where(ps => ps.Id == (Norm.ObjectId)id).FirstOrDefault();

            Bug bug = new Bug();
            bug.BugProject = bp;
            bug.BugSubmitter = thisuser;
            bug.Description = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
            bug.Name = "Example name";

            BugSession.Save(bug);

            //bug.BugSubmitter = thisuser;

            /*
            p.ProjectDescription = "BugBaseProject zelf";
            p.ProjectName = "BugBase";
            p.ProjectOwner = thisuser;

            ProjectSession.Save(p);
            */
                /*
            var projecten = ProjectSession.Queryable.AsEnumerable();
            foreach (BugProject B in projecten)
            {
                Console.WriteLine(B.ProjectName);
                Console.WriteLine(B.ProjectOwner.UserName);
                Console.WriteLine(B.Id);
            }

            var bugsies = BugSession.Queryable.AsEnumerable();
            var dezebugs = bugsies.Where(p => p.BugProject.Id == (Norm.ObjectId)id);
            Console.WriteLine("Hier de bugsies");
            foreach (Bug b in dezebugs)
            {
                Console.WriteLine(b.BugProject.Id);
                Console.WriteLine(b.BugSubmitter.UserName);
                Console.WriteLine(b.Id);
            }

            */

            //initializeBugBase();

               // createMap();

            //var session = new MongoSession<BugProject>();
            //var buglist = session.Queryable.AsEnumerable<BugProject>();
            var user = new User { Email = "*****@*****.**", UserName = "******" };
            var bugproject = new BugProject {
                ProjectDescription = "Blackberry app",
                ProjectName = "test",
                ProjectOwner = user };

            var bug1 = new Bug {
                Description = "ridicuously slow your app"
            };
            var bug2 = new Bug {
                Description = "take an english lesson please"};

            bugproject.addBug(bug1);
            bugproject.addBug(bug2);

            Mapper.CreateMap<BugProject, BugProjectDTO>();
            BugProjectDTO dto = Mapper.Map<BugProject, BugProjectDTO>(bugproject);

            Console.WriteLine(dto.getBugCount);
        }
Exemplo n.º 5
0
 public void addBug(Bug bug)
 {
     buglist.Add(bug);
 }