コード例 #1
0
        /* [Randy] Search within the list with a certain criteria */
        public SubmissionPagingQuery searchSubmission(int index, string criteria)
        {
            SubmissionPagingQuery page = new SubmissionPagingQuery();
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    int pageSize = 10;
                    int? scoreSum = 0;
                    int evalCount = 0;
                    double avgScore = 0.00;
                    int numOfEvaluations = 0;
                    //get all final submissions.
                    List<Submission> userSubmissions = new List<Submission>();
                    List<usersubmission> subList = context.usersubmission.Where(c => (c.submission.title.ToLower().Contains(criteria.ToLower()) || c.submission.topiccategory.name.ToLower().Contains(criteria.ToLower()) || c.submission.submissiontype.name.ToLower().Contains(criteria.ToLower()) || c.submission.status.ToLower().Contains(criteria.ToLower())) && c.deleted == false && c.finalSubmissionID != null).ToList();
                    foreach (var sub in subList)
                    {
                        long userID = sub.userID;
                        long submissionID = sub.submission == null ? -1 : sub.submission.submissionID;
                        String submissionTypeName = sub.submission == null ? null : sub.submission.submissiontype == null ? null : sub.submission.submissiontype.name;
                        int submissionTypeID = sub.submission == null ? -1 : sub.submission.submissionTypeID;
                        String submissionTitle = sub.submission == null ? null : sub.submission.title;
                        int topiccategoryID = sub.submission == null ? -1 : sub.submission.topicID;
                        String topic = sub.submission == null ? null : sub.submission.topiccategory == null ? null : sub.submission.topiccategory.name;
                        String status = sub.submission == null ? null : sub.submission.status;
                        bool byAdmin = sub.submission == null ? false : sub.submission.byAdmin == true ? true : false;
                        IEnumerable<IGrouping<long, evaluatiorsubmission>> groupBy = sub.submission == null ? null : sub.submission.evaluatiorsubmissions.Where(c => c.deleted == false).FirstOrDefault() == null ?
                           null : sub.submission.evaluatiorsubmissions.Where(c => c.deleted == false).GroupBy(s => s.submissionID).ToList();
                        if (groupBy != null)
                        {
                            foreach (var subGroup in groupBy)//goes through all groups of sub/evalsub
                            {
                                foreach (var evalsForSub in subGroup)//goes through all evaluatiorsubmission for each submission
                                {
                                    int? thisScore = evalsForSub.evaluationsubmitteds.Where(c => c.deleted == false).FirstOrDefault() == null ?
                                        -1 : evalsForSub.evaluationsubmitteds.Where(c => c.deleted == false).FirstOrDefault().score;
                                    if (thisScore != -1)//if submission has been evaluated
                                    {
                                        scoreSum = scoreSum + thisScore;
                                        evalCount++;
                                    }
                                }
                                avgScore = evalCount == 0 ? 0.00 : (double)scoreSum / evalCount;
                                numOfEvaluations = evalCount;
                                scoreSum = 0;
                                evalCount = 0;
                            }
                            userSubmissions.Add(new Submission(userID, submissionID, submissionTypeName,
                            submissionTypeID, submissionTitle, topiccategoryID, topic, status, avgScore, numOfEvaluations, byAdmin));
                        }
                        else
                        {
                            userSubmissions.Add(new Submission(userID, submissionID, submissionTypeName,
                            submissionTypeID, submissionTitle, topiccategoryID, topic, status, 0, numOfEvaluations, byAdmin));
                        }
                    }
                    scoreSum = 0;
                    evalCount = 0;
                    avgScore = 0.00;
                    numOfEvaluations = 0;
                    //get all submissions that do not have a final submission
                    List<usersubmission> subList2 = context.usersubmission.Where(c => (c.submission1.title.ToLower().Contains(criteria.ToLower()) || c.submission1.topiccategory.name.ToLower().Contains(criteria.ToLower()) || c.submission1.submissiontype.name.ToLower().Contains(criteria.ToLower()) || c.submission1.status.ToLower().Contains(criteria.ToLower())) && c.deleted == false && c.finalSubmissionID == null).ToList();
                    foreach (var sub in subList2)
                    {
                        long userID = sub.userID;
                        long submissionID = sub.submission1 == null ? -1 : sub.submission1.submissionID;
                        String submissionTypeName = sub.submission1 == null ? null : sub.submission1.submissiontype == null ? null : sub.submission1.submissiontype.name;
                        int submissionTypeID = sub.submission1 == null ? -1 : sub.submission1.submissionTypeID;
                        String submissionTitle = sub.submission1.title;
                        int topiccategoryID = sub.submission1 == null ? -1 : sub.submission1.topicID;
                        String topic = sub.submission1 == null ? null : sub.submission1.topiccategory == null ? null : sub.submission1.topiccategory.name;
                        String status = sub.submission1 == null ? null : sub.submission1.status;
                        bool byAdmin = sub.submission1 == null ? false : sub.submission1.byAdmin == true ? true : false;
                        IEnumerable<IGrouping<long, evaluatiorsubmission>> groupBy = sub.submission1 == null ? null : sub.submission1.evaluatiorsubmissions.Where(c => c.deleted == false).FirstOrDefault() == null ?
                                null : sub.submission1.evaluatiorsubmissions.Where(c => c.deleted == false).GroupBy(s => s.submissionID).ToList();
                        if (groupBy != null)
                        {
                            foreach (var subGroup in groupBy)//goes through all groups of sub/evalsub
                            {
                                foreach (var evalsForSub in subGroup)//goes through all evaluatiorsubmission for each submission
                                {
                                    int? thisScore = evalsForSub.evaluationsubmitteds.Where(c => c.deleted == false).FirstOrDefault() == null ?
                                        -1 : evalsForSub.evaluationsubmitteds.Where(c => c.deleted == false).FirstOrDefault().score;
                                    if (thisScore != -1)//if submission has been evaluated
                                    {
                                        scoreSum = scoreSum + thisScore;
                                        evalCount++;
                                    }
                                }
                                avgScore = evalCount == 0 ? 0.00 : (double)scoreSum / evalCount;
                                numOfEvaluations = evalCount;
                                scoreSum = 0;
                                evalCount = 0;
                            }
                            userSubmissions.Add(new Submission(userID, submissionID, submissionTypeName,
                            submissionTypeID, submissionTitle, topiccategoryID, topic, status, avgScore, numOfEvaluations, byAdmin));
                        }
                        else
                        {
                            userSubmissions.Add(new Submission(userID, submissionID, submissionTypeName,
                            submissionTypeID, submissionTitle, topiccategoryID, topic, status, 0, numOfEvaluations, byAdmin));
                        }
                    }
                    userSubmissions = userSubmissions.OrderBy(c => -c.avgScore).ToList();
                    page.rowCount = userSubmissions.Count();
                    if (page.rowCount > 0)
                    {
                        page.maxIndex = (int)Math.Ceiling(page.rowCount / (double)pageSize);
                        var allUserSubmissions = userSubmissions.Skip(pageSize * index).Take(pageSize).ToList(); //Skip past rows and take new elements
                        page.results = allUserSubmissions;
                    }

                    return page;
                }
            }
            catch (Exception ex)
            {
                Console.Write("SubmissionManager.getAllSubmissions error " + ex);
                return null;
            }
        }
コード例 #2
0
        /* [Randy] Search within the list with a certain criteria */
        public SubmissionPagingQuery searchDeletedSubmission(int index, string criteria)
        {
            SubmissionPagingQuery page = new SubmissionPagingQuery();

            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    int pageSize = 10;
                    var subs = context.submissions.Where(c => (c.title.ToLower().Contains(criteria.ToLower()) || c.topiccategory.name.ToLower().Contains(criteria.ToLower()) || c.submissiontype.name.ToLower().Contains(criteria.ToLower())) && c.deleted == true).Select(d =>
                        new Submission
                        {
                            userID = d.usersubmissions.Where(c => c.deleted == true).FirstOrDefault() == null ? -1 : d.usersubmissions.Where(c => c.deleted == true).FirstOrDefault().userID,
                            submissionID = d.submissionID,
                            submissionTypeName = d.submissiontype.name,
                            submissionTypeID = d.submissionTypeID,
                            submissionTitle = d.title,
                            topiccategoryID = d.topicID,
                            topic = d.topiccategory.name,
                            status = d.status
                        }).OrderBy(c => c.submissionTitle).ToList();

                    page.rowCount = subs.Count();
                    if (page.rowCount > 0)
                    {
                        page.maxIndex = (int)Math.Ceiling(page.rowCount / (double)pageSize);
                        var registrationPayments = subs.Skip(pageSize * index).Take(pageSize).ToList(); //Skip past rows and take new elements
                        page.results = registrationPayments;
                    }

                    return page;
                }
            }
            catch (Exception ex)
            {
                Console.Write("SubmissionManager.getDeletedSubmissions error " + ex);
                return null;
            }
        }
コード例 #3
0
        //Jaimeiris - gets the list of the submissions assigned to the evaluator with the userID that matches the userID sent in the parameter
        public SubmissionPagingQuery getAssignedSubmissions(long userID, int index)
        {
            SubmissionPagingQuery page = new SubmissionPagingQuery();
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    int pageSize = 10;
                    //gets all final evaluations assigned to the given evaluator
                    List<Submission> assignedFinalSubmissions = new List<Submission>();
                    //List<evaluatiorsubmission> finalevs = context.evaluatiorsubmissions.Where(c => c.evaluator.userID == userID && c.deleted == false && c.submission.usersubmissions.Where(d => d.deleted == false).FirstOrDefault() != null).ToList();

                    List<evaluatiorsubmission> finalevs = (from e in context.evaluators
                                                           from s in context.submissions
                                                           from es in context.evaluatiorsubmissions
                                                           from us in context.usersubmission
                                                           where (es.evaluatorID == e.evaluatorsID && es.submissionID == s.submissionID && s.submissionID == us.finalSubmissionID && e.userID == userID && es.deleted == false && us.deleted == false)
                                                           select es).ToList();

                    foreach (var i in finalevs)
                    {
                        Submission subEv = new Submission
                        {
                            submissionID = i.submissionID,
                            evaluatorID = i.evaluatorID,
                            userType = i.submission.usersubmissions.Where(c => c.deleted == false).FirstOrDefault() == null ? null : i.submission.usersubmissions.Where(c => c.deleted == false).FirstOrDefault().user.usertype.userTypeName,
                            submissionTitle = i.submission.title,
                            topic = i.submission.topiccategory.name,
                            isEvaluated = (i.evaluationsubmitteds.Where(c => c.deleted == false).FirstOrDefault() == null ? false : true),
                            isFinalSubmission = true
                        };
                        assignedFinalSubmissions.Add(subEv);
                    }

                    //gets all non-final the evaluations assigned to the given evaluator
                    List<Submission> assignedSubmissions = new List<Submission>();

                    //List<evaluatiorsubmission> evsub = context.evaluatiorsubmissions.Where(c => c.evaluator.userID == userID && c.deleted == false && c.submission.usersubmissions1.Where(d => d.deleted == false).FirstOrDefault() != null).ToList();
                    List<evaluatiorsubmission> evsub = (from e in context.evaluators
                                                        from s in context.submissions
                                                        from es in context.evaluatiorsubmissions
                                                        from us in context.usersubmission
                                                        where (es.evaluatorID == e.evaluatorsID && es.submissionID == s.submissionID && s.submissionID == us.initialSubmissionID && e.userID == userID && es.deleted == false && us.deleted == false)
                                                        select es).ToList();
                    foreach (var i in evsub)
                    {
                        Submission theSub = new Submission
                        {
                            submissionID = i.submissionID,
                            evaluatorID = i.evaluatorID,
                            userType = i.submission.usersubmissions1.Where(c => c.deleted == false).FirstOrDefault() == null ? null : i.submission.usersubmissions1.Where(c => c.deleted == false).FirstOrDefault().user.usertype.userTypeName,
                            submissionTitle = i.submission.title,
                            topic = i.submission.topiccategory.name,
                            isEvaluated = (i.evaluationsubmitteds.Where(c => c.deleted == false).FirstOrDefault() == null ? false : true),
                            isFinalSubmission = false
                        };
                        assignedSubmissions.Add(theSub);
                    }
                    //merge list of final submissions with non-final submissions
                    foreach (var finalSub in assignedFinalSubmissions)
                    {
                        assignedSubmissions.Add(finalSub);
                    }
                    //submissions are ordered  by title
                    assignedSubmissions = assignedSubmissions.OrderBy(n => n.submissionTitle).ToList();
                    page.rowCount = assignedSubmissions.Count();
                    if (page.rowCount > 0)
                    {
                        page.maxIndex = (int)Math.Ceiling(page.rowCount / (double)pageSize);
                        List<Submission> submissionPage = assignedSubmissions.Skip(pageSize * index).Take(pageSize).ToList(); //Skip past rows and take new elements
                        page.results = submissionPage;
                    }

                    return page;
                }
            }
            catch (Exception ex)
            {
                Console.Write("SubmissionManager.getAssignedSubmissions error " + ex);
                return null;
            }
        }
コード例 #4
0
        /* [Randy] Search within the list with a certain criteria */
        public SubmissionPagingQuery searchAssignedSubmission(long userID, int index, string criteria)
        {
            SubmissionPagingQuery page = new SubmissionPagingQuery();
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    int pageSize = 10;
                    bool searchingFinal = criteria.ToLower().Contains("final");
                    bool searchingPending = criteria.ToLower().Contains("pending");
                    //gets all final evaluations assigned to the given evaluator
                    List<Submission> assignedFinalSubmissions = context.evaluatiorsubmissions.
                        Where(c => (c.submission.title.ToLower().Contains(criteria.ToLower())
                            || c.submission.usersubmissions.Where(j => j.deleted == false).FirstOrDefault().user.usertype.userTypeName.ToLower().Contains(criteria.ToLower())
                            || c.submission.topiccategory.name.ToLower().Contains(criteria.ToLower())
                            // || (c.evaluationsubmitteds.Where(j => j.deleted == false).FirstOrDefault() == null) == searchingPending
                            || searchingFinal)
                            && c.evaluator.userID == userID && c.deleted == false && c.submission.usersubmissions.Where(d => d.deleted == false).FirstOrDefault() != null).
                        Select(i => new Submission
                        {
                            submissionID = i.submissionID,
                            evaluatorID = i.evaluatorID,
                            userType = i.submission.usersubmissions.Where(c => c.deleted == false).FirstOrDefault() == null ? null : i.submission.usersubmissions.Where(c => c.deleted == false).FirstOrDefault().user.usertype.userTypeName,
                            submissionTitle = i.submission.title,
                            topic = i.submission.topiccategory.name,
                            isEvaluated = (i.evaluationsubmitteds.Where(c => c.deleted == false).FirstOrDefault() == null ? false : true),
                            isFinalSubmission = true
                        }).ToList();

                    //gets all non-final the evaluations assigned to the given evaluator
                    List<Submission> assignedSubmissions = context.evaluatiorsubmissions.
                        Where(c => (c.submission.title.ToLower().Contains(criteria.ToLower())
                            || c.submission.usersubmissions.Where(j => j.deleted == false).FirstOrDefault().user.usertype.userTypeName.ToLower().Contains(criteria.ToLower())
                            || c.submission.topiccategory.name.ToLower().Contains(criteria.ToLower())
                            //  || (c.evaluationsubmitteds.Where(j => j.deleted == false).FirstOrDefault() == null) == searchingPending
                          )
                            && c.evaluator.userID == userID && c.deleted == false && c.submission.usersubmissions1.Where(d => d.deleted == false).FirstOrDefault() != null).
                        Select(i => new Submission
                        {
                            submissionID = i.submissionID,
                            evaluatorID = i.evaluatorID,
                            userType = i.submission.usersubmissions1.Where(c => c.deleted == false).FirstOrDefault() == null ? null : i.submission.usersubmissions1.Where(c => c.deleted == false).FirstOrDefault().user.usertype.userTypeName,
                            submissionTitle = i.submission.title,
                            topic = i.submission.topiccategory.name,
                            isEvaluated = (i.evaluationsubmitteds.Where(c => c.deleted == false).FirstOrDefault() == null ? false : true),
                            isFinalSubmission = false
                        }).ToList();
                    foreach (var finalSub in assignedFinalSubmissions)
                    {
                        assignedSubmissions.Add(finalSub);
                    }
                    assignedSubmissions = assignedSubmissions.OrderBy(n => n.submissionTitle).ToList();
                    page.rowCount = assignedSubmissions.Count();
                    if (page.rowCount > 0)
                    {
                        page.maxIndex = (int)Math.Ceiling(page.rowCount / (double)pageSize);
                        List<Submission> submissionPage = assignedSubmissions.Skip(pageSize * index).Take(pageSize).ToList(); //Skip past rows and take new elements
                        page.results = submissionPage;
                    }

                    return page;
                }
            }
            catch (Exception ex)
            {
                Console.Write("SubmissionManager.getAssignedSubmissions error " + ex);
                return null;
            }
        }
コード例 #5
0
        public ProfileModules(ITokenizer tokenizer)
            : base("/profile")
        {
            ProfileInfoManager profileInfo = new ProfileInfoManager();
            SubmissionManager submission = new SubmissionManager();
            ProfileAuthorizationManager profileAuthorization = new ProfileAuthorizationManager();

            // [Randy] Get information for the user profile
            Get["/getProfileInfo/{userID:long}"] = parameters =>
            {
                var user = this.Bind<UserInfo>();
                return Response.AsJson(profileInfo.getProfileInfo(user));
            };

            // [Randy] Edit information of the user profile
            Put["/updateProfileInfo"] = parameters =>
            {
                var user = this.Bind<UserInfo>();
                if (profileInfo.updateProfileInfo(user))
                    return HttpStatusCode.OK;

                else
                    return HttpStatusCode.Conflict;
            };

            // [Randy] Make application to attend the conference
            Put["/apply"] = parameters =>
            {
                var user = this.Bind<UserInfo>();
                if (profileInfo.apply(user))
                    return HttpStatusCode.OK;

                else
                    return HttpStatusCode.Conflict;
            };

            //Put["/makePayment"] = parameters =>
            //{
            //    var user = this.Bind<UserInfo>();
            //    if (.makePayment(user))
            //        return HttpStatusCode.OK;

            //    else
            //        return HttpStatusCode.Conflict;
            //};

            // [Randy] Register as a complementary user without paying
            Put["/complementaryPayment"] = parameters =>
            {
                var user = this.Bind<UserInfo>();
                if (profileInfo.complementaryPayment(user, user.key))
                    return HttpStatusCode.OK;

                else
                    return HttpStatusCode.Conflict;
            };

            // [Randy] Verify the complementary key
            Get["/checkComplementaryKey/{complementaryKey}"] = parameters =>
            {
                var key = parameters.complementaryKey;

                return (profileInfo.checkComplementaryKey(key));
            };

            //------------------------EVALUATOR - SUBMISSIONS-------------------------------------------
            // [Jaimeiris] Gets the list of submissions assigned to the evaluator currently logged in to the system
            Get["/getAssignedSubmissions/{evaluatorUserID:long}/{index:int}"] = parameters =>
            {
                long evaluatorUserID = parameters.evaluatorUserID; //ID of the evaluator that is currently signed in
                int index = parameters.index;
                SubmissionPagingQuery assignedSubmissions = submission.getAssignedSubmissions(evaluatorUserID, index);
                if (assignedSubmissions == null)
                {
                    assignedSubmissions = new SubmissionPagingQuery();
                }
                return Response.AsJson(assignedSubmissions);
            };

            /* [Randy] Search within the list with a certain criteria */
            Get["/searchAssignedSubmission/{evaluatorUserID}/{index}/{criteria}"] = parameters =>
            {
                long evaluatorUserID = parameters.evaluatorUserID; //ID of the evaluator that is currently signed in
                int index = parameters.index;
                string criteria = parameters.criteria;
                SubmissionPagingQuery assignedSubmissions = submission.searchAssignedSubmission(evaluatorUserID, index, criteria);
                if (assignedSubmissions == null)
                {
                    assignedSubmissions = new SubmissionPagingQuery();
                }
                return Response.AsJson(assignedSubmissions);
            };

            // [Jaimeiris] Get the info of a submission
            Get["/getSubmission/{submissionID:long}/{evaluatorID:long}"] = parameters =>
            {
                long submissionID = parameters.submissionID;
                long evaluatorID = parameters.evaluatorID;
                AssignedSubmission sub = submission.getSubmissionForEvaluation(submissionID, evaluatorID);
                if (sub == null)
                {
                    sub = new AssignedSubmission();
                }
                return Response.AsJson(sub);
            };

            // [Jaimeiris] Post new evaluation for a submission
            Post["/addEvaluation"] = parameters =>
            {
                var evaluation = this.Bind<evaluationsubmitted>();
                usersubmission usersub = this.Bind<usersubmission>();

                if (submission.addEvaluation(evaluation, usersub)) return HttpStatusCode.OK;
                else return HttpStatusCode.Conflict;
            };

            // [Jaimeiris] Edit evaluation for a submission
            Put["/editEvaluation"] = parameters =>
            {
                var evaluation = this.Bind<evaluationsubmitted>();
                usersubmission usersub = this.Bind<usersubmission>();

                if (submission.editEvaluation(evaluation, usersub)) return HttpStatusCode.OK;
                else return HttpStatusCode.Conflict;
            };
            //------------------------------------USER SUBMISSIONS---------------------------------
            // [Jaimeiris] Get list of all submissions
            Get["/getUserSubmissionList/{id}"] = parameters =>
            {
                long userID = parameters.id; //ID of the evaluator that is currently signed in
                List<Submission> userSubmissions = submission.getUserSubmissions(userID);
                if (userSubmissions == null)
                {
                    userSubmissions = new List<Submission>();
                }

                return Response.AsJson(userSubmissions);
            };
            // [Jaimeiris] Get single user submission
            Get["/getUserSubmission/{id}"] = parameters =>
            {
                long submissionID = parameters.id;
                CurrAndPrevSub sub = submission.getUserSubmission(submissionID);
                if (sub == null)
                {
                    sub = new CurrAndPrevSub();
                }
                return Response.AsJson(sub);
            };
            // [Jaimeiris] Get submission types
            Get["/getSubmissionTypes"] = parameters =>
            {
                List<SubmissionType> subTypes = submission.getSubmissionTypes();
                if (subTypes == null)
                {
                    subTypes = new List<SubmissionType>();
                }
                return Response.AsJson(subTypes);
            };
            // [Jaimeiris] Delete a submission
            Delete["/deleteSubmission/{id}"] = parameters =>
            {
                long submissionID = parameters.id;
                Submission prevSub = submission.deleteSubmission(submissionID);
                if (prevSub != null)
                    return Response.AsJson(prevSub);
                else return null;
            };
            // [Jaimeiris] Add a submission
            Post["/postSubmission"] = parameters =>
            {
                panel pannelToAdd = null;
                workshop workshopToAdd = null;
                submission submissionToAdd = this.Bind<submission>();
                usersubmission usersubTA = this.Bind<usersubmission>();

                int submissionTypeID = submissionToAdd.submissionTypeID;
                if (submissionTypeID == 3)
                {
                    pannelToAdd = this.Bind<panel>();
                }
                else if (submissionTypeID == 5)
                {
                    workshopToAdd = this.Bind<workshop>();
                }
                Submission newSubmission =
                    submission.addSubmission(usersubTA, submissionToAdd, pannelToAdd, workshopToAdd);
                return Response.AsJson(newSubmission);

            };
            // [Jaimeiris] Add new file to submission
            Put["/addSubmissionFile"] = parameters =>
            {
                documentssubmitted doc = this.Bind<documentssubmitted>();
                if (doc.document != null)
                {
                    return Response.AsJson(submission.addSubmissionFile(doc));

                }
                else return null;
            };
            // [Jaimeiris] Manage existing files for a submission
            Put["/manageExistingFiles"] = parameters =>
            {
                //documentssubmitted sub = this.Bind<documentssubmitted>();
                ExistingFile sub = this.Bind<ExistingFile>();
                /*if (sub.IDsList.Count == 0)
                {
                    return HttpStatusCode.OK;
                }
                else
                {*/

                if (submission.manageExistingFiles(sub.submissionID, sub.IDsList))
                    return HttpStatusCode.OK;
                else
                    return HttpStatusCode.Conflict;
                // }

            };

            // [Jaimeiris] Re-create final submission files
            Put["/createFinalSubmissionFiles"] = parameters =>
            {
                //documentssubmitted sub = this.Bind<documentssubmitted>();
                ExistingFile sub = this.Bind<ExistingFile>();

                if (submission.createFinalSubmissionFiles(sub.submissionID, sub.prevID, sub.IDsList))
                    return HttpStatusCode.OK;
                else
                    return HttpStatusCode.Conflict;

            };

            // [Jaimeiris] Edit submission
            Put["/editSubmission"] = parameters =>
            {
                panel pannelToEdit = null;
                workshop workshopToEdit = null;
                submission submissionToEdit = this.Bind<submission>();

                int submissionTypeID = submissionToEdit.submissionTypeID;
                if (submissionTypeID == 3)
                {
                    pannelToEdit = this.Bind<panel>();
                }
                else if (submissionTypeID == 5)
                {
                    workshopToEdit = this.Bind<workshop>();
                }
                Submission editedSubmission =
                    submission.editSubmission(submissionToEdit, pannelToEdit, workshopToEdit);
                return Response.AsJson(editedSubmission);
            };
            // [Jaimeiris] Post final version of evaluation
            Post["/postFinalSubmission"] = parameters =>
            {
                panel pannelToAdd = null;
                workshop workshopToAdd = null;
                submission submissionToAdd = this.Bind<submission>();
                documentssubmitted submissionDocuments = this.Bind<documentssubmitted>();
                usersubmission usersubTA = this.Bind<usersubmission>();

                int submissionTypeID = submissionToAdd.submissionTypeID;
                if (submissionDocuments.document == null && submissionDocuments.documentName == null)
                {
                    submissionDocuments = null;
                }
                if (submissionTypeID == 3)
                {
                    pannelToAdd = this.Bind<panel>();
                }
                else if (submissionTypeID == 5)
                {
                    workshopToAdd = this.Bind<workshop>();
                }
                Submission newSubmission =
                    submission.addFinalSubmission(usersubTA, submissionToAdd, submissionDocuments, pannelToAdd, workshopToAdd);
                return Response.AsJson(newSubmission);
            };
            // [Jaimeiris] Get the deadline for the additon of submissions
            Get["/getSubmissionDeadlines"] = parameters =>
            {
                return Response.AsJson(submission.getSubmissionDeadlines());
            };
            // [Jaimeiris] Get the template file
            Get["/getTemplateFile/{id}"] = parameters =>
            {
                int templateID = parameters.id;
                return Response.AsJson(profileAuthorization.getTemplateFile(templateID));
            };
            // [Jaimeiris] Get the authorization file
            Get["/getAuthorizationFile/{id}"] = parameters =>
            {
                int authorizationID = parameters.id;
                return Response.AsJson(profileAuthorization.getAuthorizationFile(authorizationID));
            };
            // [Jaimeiris] Get evaluation template
            Get["/getEvaluationTemplate/{templateID:long}"] = parameters =>
            {
                int templateID = parameters.templateID;
                return Response.AsJson(submission.getEvaluationTemplate(templateID));
            };
            // [Jaimeiris] Get evaluation file
            Get["/getEvaluationFile/{submissionID:long}/{evaluatorID:long}"] = parameters =>
            {
                long submissionID = parameters.submissionID;
                long evaluatorID = parameters.evaluatorID;
                return Response.AsJson(submission.getEvaluationFile(submissionID, evaluatorID));
            };

            //------------------------AUTHORIZATION----------------------------------
            // [Randy] Upload an authorization document
            Put["/uploadDocument"] = parameters =>
            {
                var doc = this.Bind<Authorization>();
                var minor = this.Bind<MinorUser>();
                return Response.AsJson(profileAuthorization.uploadDocument(doc, minor));
            };
            // [Randy] Get list of authorization templates
            Get["/getTemplates"] = parameters =>
            {
                return Response.AsJson(profileAuthorization.getTemplates());
            };
            // [Randy] Get list of authorization documents submitted
            Get["/getDocuments/{userID:long}"] = parameters =>
            {
                var user = this.Bind<UserInfo>();
                return Response.AsJson(profileAuthorization.getDocuments(user));
            };
            // [Randy] Delete a specific document
            Put["/deleteDocument"] = parameters =>
            {
                var doc = this.Bind<Authorization>();

                if (profileAuthorization.deleteDocument(doc))
                    return HttpStatusCode.OK;
                else
                    return HttpStatusCode.Conflict;
            };
            // [Randy] Bind companion with minor
            Post["/selectCompanion"] = parameters =>
            {
                var user = this.Bind<UserInfo>();
                var companion = this.Bind<companion>();

                var status = profileAuthorization.selectCompanion(user, companion);
                if (status != null)
                    return status;
                else
                    return HttpStatusCode.Conflict;
            };
            // [Randy] Get submitted companion key
            Get["/getCompanionKey/{userID:long}"] = parameters =>
            {
                var user = this.Bind<UserInfo>();
                return Response.AsJson(profileAuthorization.getCompanionKey(user));
            };
        }