Exemple #1
0
        public HttpResponseMessage SubmitPaperText([FromBody] PaperTextSubmit body)
        {
            var person     = db.People.Find(body.PERSON_ID);
            var conference = db.CONFERENCEs.Find(body.CONFERENCE_ID);
            var model      = new PaperTextModel();

            if (person == null)
            {
                return(ResponseFail(StringResource.Person_do_not_exist));
            }
            else if (conference == null)
            {
                return(ResponseFail(StringResource.Conference_do_not_exist));
            }
            else if (!model.checkConferencePaperTextSubmitExpired(body.CONFERENCE_ID))
            {
                return(ResponseFail(StringResource.Out_of_time));
            }
            else
            {
                var paperText = new PAPER_TEXT();
                paperText.PAPER_ID                        = body.PAPER_ID;
                paperText.PAPER_NUMBER_OR_CODE            = "PA" + paperText.PAPER_ID;
                paperText.PAPER_TEXT_TITLE_1              = body.PAPER_TEXT_TITLE;
                paperText.PAPER_TEXT_TITLE_EN_1           = body.PAPER_TEXT_TITLE_EN;
                paperText.PAPER_TEXT_1                    = body.PAPER_TEXT;
                paperText.PAPER_TEXT_EN_1                 = body.PAPER_TEXT_EN;
                paperText.PAPER_TEXT_ATTACHED_FILENAME_1  = body.PAPER_TEXT_ATTACHED_FILENAME;
                paperText.NUMBER_OF_PAGES_OF_PAPER_TEXT_1 = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                paperText.FIRST_SUBMITTED_DATE_1          = DateTime.Now;
                paperText.LAST_REVISED_DATE_1             = DateTime.Now;
                db.PAPER_TEXT.Add(paperText);
                db.SaveChanges();

                for (int i = 0; i < body.ListAuthor.Count; i++)
                {
                    var item = body.ListAuthor[i];
                    model.addAuthorPaperText(item, body.CONFERENCE_ID, paperText.PAPER_ID, i);
                }
                return(ResponseSuccess(StringResource.Success));
            }
        }
Exemple #2
0
        public HttpResponseMessage UpdatePaperText([FromBody] PaperTextSubmit body)
        {
            var paper      = db.PAPER_TEXT.Find(body.PAPER_ID);
            var person     = db.People.Find(body.PERSON_ID);
            var conference = db.CONFERENCEs.Find(body.CONFERENCE_ID);
            var model      = new PaperTextModel();

            if (paper == null)
            {
                return(ResponseFail(StringResource.Paper_abstract_do_not_exist));
            }
            else if (person == null)
            {
                return(ResponseFail(StringResource.Person_do_not_exist));
            }
            else if (conference == null)
            {
                return(ResponseFail(StringResource.Conference_do_not_exist));
            }
            else if (!model.checkConferencePaperTextSubmitExpired(body.CONFERENCE_ID))
            {
                return(ResponseFail(StringResource.Out_of_time));
            }
            else if (model.getTimesSent(paper) >= 5)
            {
                return(ResponseFail(StringResource.The_number_of_submition_after_review_has_out));
            }
            else
            {
                if (model.checkPaperTextReviewed(body.PAPER_ID, body.CONFERENCE_ID, model.getTimesSent(paper)) == false)//Chưa ai review
                {
                    int number = model.getTimesSent(paper);
                    if (number == 1)//Cập nhật lại nhóm 1
                    {
                        paper.PAPER_TEXT_TITLE_1              = body.PAPER_TEXT_TITLE;
                        paper.PAPER_TEXT_TITLE_EN_1           = body.PAPER_TEXT_TITLE_EN;
                        paper.PAPER_TEXT_1                    = body.PAPER_TEXT;
                        paper.PAPER_TEXT_EN_1                 = body.PAPER_TEXT_EN;
                        paper.PAPER_TEXT_ATTACHED_FILENAME_1  = body.PAPER_TEXT_ATTACHED_FILENAME;
                        paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_1 = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                        paper.LAST_REVISED_DATE_1             = DateTime.Now;
                        db.SaveChanges();

                        for (int i = 0; i < body.ListAuthor.Count; i++)
                        {
                            var item = body.ListAuthor[i];
                            if (!model.checkIsAuthor(item.PERSON_ID))
                            {
                                return(ResponseFail(StringResource.Account_does_not_author));
                            }
                            model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                        }
                        return(ResponseSuccess(StringResource.Success));
                    }
                    else if (number == 2)//Cập nhật lại nhóm 2
                    {
                        paper.PAPER_TEXT_TITLE_2              = body.PAPER_TEXT_TITLE;
                        paper.PAPER_TEXT_TITLE_EN_2           = body.PAPER_TEXT_TITLE_EN;
                        paper.PAPER_TEXT_2                    = body.PAPER_TEXT;
                        paper.PAPER_TEXT_EN_2                 = body.PAPER_TEXT_EN;
                        paper.PAPER_TEXT_ATTACHED_FILENAME_2  = body.PAPER_TEXT_ATTACHED_FILENAME;
                        paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_2 = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                        paper.LAST_REVISED_DATE_2             = DateTime.Now;
                        db.SaveChanges();

                        for (int i = 0; i < body.ListAuthor.Count; i++)
                        {
                            var item = body.ListAuthor[i];
                            if (!model.checkIsAuthor(item.PERSON_ID))
                            {
                                return(ResponseFail(StringResource.Account_does_not_author));
                            }
                            model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                        }
                        return(ResponseSuccess(StringResource.Success));
                    }
                    else if (number == 3)//Cập nhật lại nhóm 3
                    {
                        paper.PAPER_TEXT_TITLE_3              = body.PAPER_TEXT_TITLE;
                        paper.PAPER_TEXT_TITLE_EN_3           = body.PAPER_TEXT_TITLE_EN;
                        paper.PAPER_TEXT_3                    = body.PAPER_TEXT;
                        paper.PAPER_TEXT_EN_3                 = body.PAPER_TEXT_EN;
                        paper.PAPER_TEXT_ATTACHED_FILENAME_3  = body.PAPER_TEXT_ATTACHED_FILENAME;
                        paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_3 = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                        paper.LAST_REVISED_DATE_3             = DateTime.Now;
                        db.SaveChanges();

                        for (int i = 0; i < body.ListAuthor.Count; i++)
                        {
                            var item = body.ListAuthor[i];
                            if (!model.checkIsAuthor(item.PERSON_ID))
                            {
                                return(ResponseFail(StringResource.Account_does_not_author));
                            }
                            model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                        }
                        return(ResponseSuccess(StringResource.Success));
                    }
                    else if (number == 4)//Cập nhật lại nhóm 4
                    {
                        paper.PAPER_TEXT_TITLE_4              = body.PAPER_TEXT_TITLE;
                        paper.PAPER_TEXT_TITLE_EN_4           = body.PAPER_TEXT_TITLE_EN;
                        paper.PAPER_TEXT_4                    = body.PAPER_TEXT;
                        paper.PAPER_TEXT_EN_4                 = body.PAPER_TEXT_EN;
                        paper.PAPER_TEXT_ATTACHED_FILENAME_4  = body.PAPER_TEXT_ATTACHED_FILENAME;
                        paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_4 = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                        paper.LAST_REVISED_DATE_4             = DateTime.Now;
                        db.SaveChanges();

                        for (int i = 0; i < body.ListAuthor.Count; i++)
                        {
                            var item = body.ListAuthor[i];
                            if (!model.checkIsAuthor(item.PERSON_ID))
                            {
                                return(ResponseFail(StringResource.Account_does_not_author));
                            }
                            model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                        }
                        return(ResponseSuccess(StringResource.Success));
                    }
                    else if (number == 5)//Cập nhật lại nhóm 5
                    {
                        paper.PAPER_TEXT_TITLE_5              = body.PAPER_TEXT_TITLE;
                        paper.PAPER_TEXT_TITLE_EN_5           = body.PAPER_TEXT_TITLE_EN;
                        paper.PAPER_TEXT_5                    = body.PAPER_TEXT;
                        paper.PAPER_TEXT_EN_5                 = body.PAPER_TEXT_EN;
                        paper.PAPER_TEXT_ATTACHED_FILENAME_5  = body.PAPER_TEXT_ATTACHED_FILENAME;
                        paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_5 = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                        paper.LAST_REVISED_DATE_5             = DateTime.Now;
                        db.SaveChanges();

                        for (int i = 0; i < body.ListAuthor.Count; i++)
                        {
                            var item = body.ListAuthor[i];
                            if (!model.checkIsAuthor(item.PERSON_ID))
                            {
                                return(ResponseFail(StringResource.Account_does_not_author));
                            }
                            model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                        }
                        return(ResponseSuccess(StringResource.Success));
                    }
                    else
                    {
                        return(ResponseFail(StringResource.The_number_of_submition_after_review_has_out));
                    }
                }
                else//Đã có người review
                {
                    if (paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT == null)//Chưa được duyệt cuối
                    {
                        return(ResponseFail(StringResource.Paper_Text_is_being_reviewed_please_wait_for_results));
                    }
                    else if (paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT == true)
                    {
                        return(ResponseFail(StringResource.Paper_Text_accepted));
                    }
                    else//Bài được duyệt cuối
                    {
                        //Thêm nhóm (2 hoặc 3,4,5), phân tự động review lại
                        int number = model.getTimesSent(paper);
                        if (number == 1)//Thêm nhóm 2
                        {
                            paper.PAPER_TEXT_TITLE_2                             = body.PAPER_TEXT_TITLE;
                            paper.PAPER_TEXT_TITLE_EN_2                          = body.PAPER_TEXT_TITLE_EN;
                            paper.PAPER_TEXT_2                                   = body.PAPER_TEXT;
                            paper.PAPER_TEXT_EN_2                                = body.PAPER_TEXT_EN;
                            paper.PAPER_TEXT_ATTACHED_FILENAME_2                 = body.PAPER_TEXT_ATTACHED_FILENAME;
                            paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_2                = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                            paper.FIRST_SUBMITTED_DATE_2                         = DateTime.Now;
                            paper.LAST_REVISED_DATE_2                            = DateTime.Now;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT      = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_DATE = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_REVIEWER_PERSON_ID = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_SCRIPT             = null;
                            db.SaveChanges();

                            model.assignedBoardOfReviewerUpdate(paper.PAPER_ID, (Int16)2);
                            model.assignedReviewerUpdate(paper.PAPER_ID, (Int16)2);

                            for (int i = 0; i < body.ListAuthor.Count; i++)
                            {
                                var item = body.ListAuthor[i];
                                if (!model.checkIsAuthor(item.PERSON_ID))
                                {
                                    return(ResponseFail(StringResource.Account_does_not_author));
                                }
                                model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                            }
                            return(ResponseSuccess(StringResource.Success));
                        }
                        else if (number == 2)//Thêm nhóm 3
                        {
                            paper.PAPER_TEXT_TITLE_3                             = body.PAPER_TEXT_TITLE;
                            paper.PAPER_TEXT_TITLE_EN_3                          = body.PAPER_TEXT_TITLE_EN;
                            paper.PAPER_TEXT_3                                   = body.PAPER_TEXT;
                            paper.PAPER_TEXT_EN_3                                = body.PAPER_TEXT_EN;
                            paper.PAPER_TEXT_ATTACHED_FILENAME_3                 = body.PAPER_TEXT_ATTACHED_FILENAME;
                            paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_3                = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                            paper.FIRST_SUBMITTED_DATE_3                         = DateTime.Now;
                            paper.LAST_REVISED_DATE_3                            = DateTime.Now;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT      = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_DATE = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_REVIEWER_PERSON_ID = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_SCRIPT             = null;
                            db.SaveChanges();

                            model.assignedBoardOfReviewerUpdate(paper.PAPER_ID, (Int16)3);
                            model.assignedReviewerUpdate(paper.PAPER_ID, (Int16)3);

                            for (int i = 0; i < body.ListAuthor.Count; i++)
                            {
                                var item = body.ListAuthor[i];
                                if (!model.checkIsAuthor(item.PERSON_ID))
                                {
                                    return(ResponseFail(StringResource.Account_does_not_author));
                                }
                                model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                            }
                            return(ResponseSuccess(StringResource.Success));
                        }
                        else if (number == 3)//Thêm nhóm 4
                        {
                            paper.PAPER_TEXT_TITLE_4                             = body.PAPER_TEXT_TITLE;
                            paper.PAPER_TEXT_TITLE_EN_4                          = body.PAPER_TEXT_TITLE_EN;
                            paper.PAPER_TEXT_4                                   = body.PAPER_TEXT;
                            paper.PAPER_TEXT_EN_4                                = body.PAPER_TEXT_EN;
                            paper.PAPER_TEXT_ATTACHED_FILENAME_4                 = body.PAPER_TEXT_ATTACHED_FILENAME;
                            paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_4                = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                            paper.FIRST_SUBMITTED_DATE_4                         = DateTime.Now;
                            paper.LAST_REVISED_DATE_4                            = DateTime.Now;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT      = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_DATE = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_REVIEWER_PERSON_ID = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_SCRIPT             = null;
                            db.SaveChanges();

                            model.assignedBoardOfReviewerUpdate(paper.PAPER_ID, (Int16)4);
                            model.assignedReviewerUpdate(paper.PAPER_ID, (Int16)4);

                            for (int i = 0; i < body.ListAuthor.Count; i++)
                            {
                                var item = body.ListAuthor[i];
                                if (!model.checkIsAuthor(item.PERSON_ID))
                                {
                                    return(ResponseFail(StringResource.Account_does_not_author));
                                }
                                model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                            }
                            return(ResponseSuccess(StringResource.Success));
                        }
                        else if (number == 4)//Thêm nhóm 5
                        {
                            paper.PAPER_TEXT_TITLE_5                             = body.PAPER_TEXT_TITLE;
                            paper.PAPER_TEXT_TITLE_EN_5                          = body.PAPER_TEXT_TITLE_EN;
                            paper.PAPER_TEXT_5                                   = body.PAPER_TEXT;
                            paper.PAPER_TEXT_EN_5                                = body.PAPER_TEXT_EN;
                            paper.PAPER_TEXT_ATTACHED_FILENAME_5                 = body.PAPER_TEXT_ATTACHED_FILENAME;
                            paper.NUMBER_OF_PAGES_OF_PAPER_TEXT_5                = body.NUMBER_OF_PAGES_OF_PAPER_TEXT;
                            paper.FIRST_SUBMITTED_DATE_5                         = DateTime.Now;
                            paper.LAST_REVISED_DATE_5                            = DateTime.Now;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT      = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_DATE = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_REVIEWER_PERSON_ID = null;
                            paper.FINAL_APPROVAL_OR_REJECTION_OF_PAPER_TEXT_SCRIPT             = null;
                            db.SaveChanges();

                            model.assignedBoardOfReviewerUpdate(paper.PAPER_ID, (Int16)5);
                            model.assignedReviewerUpdate(paper.PAPER_ID, (Int16)5);

                            for (int i = 0; i < body.ListAuthor.Count; i++)
                            {
                                var item = body.ListAuthor[i];
                                if (!model.checkIsAuthor(item.PERSON_ID))
                                {
                                    return(ResponseFail(StringResource.Account_does_not_author));
                                }
                                model.addAuthorPaperText(item, body.CONFERENCE_ID, paper.PAPER_ID, i);
                            }
                            return(ResponseSuccess(StringResource.Success));
                        }
                        else
                        {
                            return(ResponseFail(StringResource.The_number_of_submition_after_review_has_out));
                        }
                    }
                }
            }
        }