Ejemplo n.º 1
0
        public static List <AssignmentViewModel> getAssignments(String username)
        {
            int teamID      = DapperORM.getMyTeam(username);
            var assignments = new List <AssignmentViewModel>();

            using (NpgsqlConnection connection = new NpgsqlConnection("Server=localhost;Port=5432;User Id=postgres;Password=nikola000;Database=BugTrackerDB;"))
            {
                connection.Open();
                var query = @"SELECT ""zadatakID"",""zadatakIme"",""zadatakOpis"",""username"" AS ""Submitter"",""nazivTim"",""datum""
                              FROM ""Zadatak""
                              INNER JOIN ""Tim""
                              ON ""Zadatak"".""timID"" = ""Tim"".""timID""
                              INNER JOIN ""Rok""
                              ON ""Zadatak"".""rokID"" = ""Rok"".""rokID""
                              INNER JOIN ""Korisnik""
                              ON ""Korisnik"".""korisnikID"" = ""Zadatak"".""korisnikID""
                              WHERE ""Tim"".""timID""=" + teamID;



                assignments = (List <AssignmentViewModel>)connection.Query <AssignmentViewModel>(query);
            };

            return(assignments);
        }
Ejemplo n.º 2
0
        public static void saveTicket(Ticket Ticket)
        {
            using (var connection = new NpgsqlConnection("Host=localhost;Username=postgres;Password=nikola000;Database=BugTrackerDB"))
            {
                connection.Open();
                var user         = HttpContext.Current.User;
                var listOfUserID = connection.Query <int>("SELECT \"korisnikID\" FROM public.\"Korisnik\" WHERE \"email\"='" + user.Identity.GetUserName() + "'");
                int userID       = 0;
                int statusID     = 1;
                int myTeamID     = DapperORM.getMyTeam(DapperORM.getUsername());


                foreach (var item in listOfUserID)
                {
                    userID = item;
                }


                connection.Query <string>("INSERT INTO public.\"Pogreška\" VALUES(" + Ticket.Bug.BugID + ",'" + Ticket.Bug.Description + "'," + Ticket.Bug.PriorityID + ")");
                connection.Query <Team>("INSERT INTO public.\"Listić\" (\"listićID\",\"korisnikID\",\"pogreskaID\",\"listićIme\",\"datum\",\"projektID\",\"slika\",\"statusID\",\"timID\")VALUES(" + Ticket.Bug.BugID + "," + userID + "," + Ticket.Bug.BugID + ",'" + Ticket.TicketTitle + "','" + Ticket.Time + "'," + Ticket.projektID + ",'" + Ticket.ImageURL + "'," + 1 + "," + myTeamID + ")");


                System.Diagnostics.Debug.WriteLine("hi");
            };
        }
Ejemplo n.º 3
0
        public static void saveAssignment(newAssignmentViewModel Assignment)
        {
            using (NpgsqlConnection connection = new NpgsqlConnection("Server=localhost;Port=5432;User Id=postgres;Password=nikola000;Database=BugTrackerDB;"))
            {
                connection.Open();

                connection.Query <string>("INSERT INTO \"Rok\" VALUES(" + Assignment.zadatakID + ",'" + Assignment.rokDo + "')");
                connection.Query <string>("UPDATE \"Listić\" SET \"statusID\"=" + 3 + "WHERE \"listićID\"=" + Assignment.zadatakID);

                string query = @"INSERT INTO ""Zadatak"" VALUES(" + Assignment.zadatakID + "," + Assignment.timID + "," + Assignment.zadatakID + ",'" + Assignment.zadatakOpis + "'," + DapperORM.getUserID(Assignment.username) + ",'" + Assignment.zadatakIme + "'," + Assignment.zadatakID + ")";
                connection.Query <string>(query);
            };
        }