Esempio n. 1
0
        //Get content found in the Administator->Deadlines section of the website
        public DeadlinesQuery getDeadlines()
        {
            try
            {
                //Get Registration deadlines, and custom deadlines
                DeadlinesQuery deadline = new DeadlinesQuery();
                deadline.deadline1 = this.getInterfaceElement("deadline1").content;
                deadline.deadlineDate1 = this.getInterfaceElement("deadlineDate1").content;
                deadline.deadline2 = this.getInterfaceElement("deadline2").content;
                deadline.deadlineDate2 = this.getInterfaceElement("deadlineDate2").content;
                deadline.deadline3 = this.getInterfaceElement("deadline3").content;
                deadline.deadlineDate3 = this.getInterfaceElement("deadlineDate3").content;
                deadline.registrationDeadline = this.getInterfaceElement("registrationDeadline").content;
                deadline.lateRegistrationDeadline = this.getInterfaceElement("lateRegistrationDeadline").content;
                deadline.paragraph = this.getInterfaceElement("deadlineParagraph1").content;

                //Submission Deadlines
                deadline.extendedPaperDeadline = this.getDeadlineElement("Extended Paper").content;
                deadline.posterDeadline = this.getDeadlineElement("Poster ").content;
                deadline.panelDeadline = this.getDeadlineElement("Panel").content;
                deadline.othersDeadline = this.getDeadlineElement("Others").content;
                deadline.workshopDeadline = this.getDeadlineElement("Workshop").content;
                deadline.sponsorDeadline = this.getInterfaceElement("sponsorDeadline").content;

                return deadline;
            }
            catch (Exception ex)
            {
                Console.Write("WebManager.getDeadline error " + ex);
                return null;
            }
        }
Esempio n. 2
0
        //Get content found in the Deadlines section of the website
        public DeadlinesQuery getInterfaceDeadlines()
        {
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    DeadlinesQuery deadline = new DeadlinesQuery();
                    deadline.deadline1 = this.getInterfaceElement("deadline1").content;
                    deadline.deadlineDate1 = this.getInterfaceElement("deadlineDate1").content;
                    deadline.deadline2 = this.getInterfaceElement("deadline2").content;
                    deadline.deadlineDate2 = this.getInterfaceElement("deadlineDate2").content;
                    deadline.deadline3 = this.getInterfaceElement("deadline3").content;
                    deadline.deadlineDate3 = this.getInterfaceElement("deadlineDate3").content;
                    deadline.registrationDeadline = this.getInterfaceElement("registrationDeadline").content;
                    deadline.lateRegistrationDeadline = this.getInterfaceElement("lateRegistrationDeadline").content;
                    deadline.paragraph = this.getInterfaceElement("deadlineParagraph1").content;

                    deadline.extendedPaperDeadline = this.getDeadlineElement("Extended Paper").content;
                    deadline.posterDeadline = this.getDeadlineElement("Poster ").content;
                    deadline.panelDeadline = this.getDeadlineElement("Panel").content;
                    deadline.othersDeadline = this.getDeadlineElement("Others").content;
                    deadline.workshopDeadline = this.getDeadlineElement("Workshop").content;
                    deadline.sponsorDeadline = this.getInterfaceElement("sponsorDeadline").content;

                    //Convert Dates
                    deadline.deadlineDate1 = this.convertDates(deadline.deadlineDate1);
                    deadline.deadlineDate2 = this.convertDates(deadline.deadlineDate2);
                    deadline.deadlineDate3 = this.convertDates(deadline.deadlineDate3);
                    deadline.registrationDeadline = this.convertDates(deadline.registrationDeadline);
                    deadline.lateRegistrationDeadline = this.convertDates(deadline.lateRegistrationDeadline);
                    deadline.extendedPaperDeadline = this.convertDates(deadline.extendedPaperDeadline);
                    deadline.posterDeadline = this.convertDates(deadline.posterDeadline);
                    deadline.panelDeadline = this.convertDates(deadline.panelDeadline);
                    deadline.othersDeadline = this.convertDates(deadline.othersDeadline);
                    deadline.workshopDeadline = this.convertDates(deadline.workshopDeadline);
                    deadline.sponsorDeadline = this.convertDates(deadline.sponsorDeadline);

                    return deadline;
                }
            }
            catch (Exception ex)
            {
                Console.Write("WebManager.getInterfaceDeadlines error " + ex);
                return null;
            }
        }
Esempio n. 3
0
        //Update content found in the Deadlines section of the website
        public bool saveDeadlines(DeadlinesQuery newDeadline)
        {
            try
            {
                //Check the dates are not invalid.
                if (newDeadline.deadlineDate1 == "Invalid Date")
                {
                    newDeadline.deadlineDate1 = "";
                }

                if (newDeadline.deadlineDate2 == "Invalid Date")
                {
                    newDeadline.deadlineDate2 = "";
                }

                if (newDeadline.deadlineDate3 == "Invalid Date")
                {
                    newDeadline.deadlineDate3 = "";
                }

                if (newDeadline.registrationDeadline == "Invalid Date")
                {
                    newDeadline.registrationDeadline = "";
                }

                if (newDeadline.lateRegistrationDeadline == "Invalid Date")
                {
                    newDeadline.lateRegistrationDeadline = "";
                }

                //Check submission dates are not invalid
                if (newDeadline.extendedPaperDeadline == "Invalid Date")
                {
                    newDeadline.extendedPaperDeadline = "";
                }

                if (newDeadline.posterDeadline == "Invalid Date")
                {
                    newDeadline.posterDeadline = "";
                }

                if (newDeadline.panelDeadline == "Invalid Date")
                {
                    newDeadline.panelDeadline = "";
                }

                if (newDeadline.othersDeadline == "Invalid Date")
                {
                    newDeadline.othersDeadline = "";
                }

                if (newDeadline.workshopDeadline == "Invalid Date")
                {
                    newDeadline.workshopDeadline = "";
                }

                if (newDeadline.sponsorDeadline == "Invalid Date")
                {
                    newDeadline.sponsorDeadline = "";
                }

                /*
                //Check registration and late registration
                //If dates are not empty, and in the correct date format
                else if (newDeadline.registrationDeadline != "" && newDeadline.lateRegistrationDeadline != "" && newDeadline.registrationDeadline.Split('/').Count() > 2 && newDeadline.lateRegistrationDeadline.Split('/').Count() > 2)
                {

                    var rDay = Convert.ToInt32(newDeadline.registrationDeadline.Split('/')[1]);
                    var rMonth = Convert.ToInt32(newDeadline.registrationDeadline.Split('/')[0]);
                    var rYear = Convert.ToInt32(newDeadline.registrationDeadline.Split('/')[2]);

                    var lrDay = Convert.ToInt32(newDeadline.lateRegistrationDeadline.Split('/')[1]);
                    var lrMonth = Convert.ToInt32(newDeadline.lateRegistrationDeadline.Split('/')[0]);
                    var lrYear = Convert.ToInt32(newDeadline.lateRegistrationDeadline.Split('/')[2]);

                    // Constructor (Year, Month, Day)

                    DateTime registrationDate = new DateTime(rYear, rMonth, rDay);
                    DateTime lateRegistrationDate = new DateTime(lrYear, lrMonth, lrDay);

                    double differenceDays = lateRegistrationDate.Subtract(registrationDate).TotalDays;

                    //if late registration occurs before registration
                    if (differenceDays < 0)
                    {
                        newDeadline.lateRegistrationDeadline = "";
                    }
                }*/

                using (conferenceadminContext context = new conferenceadminContext())
                {
                    this.saveInterfaceElement("deadlineParagraph1", newDeadline.paragraph);
                    this.saveInterfaceElement("deadline1", newDeadline.deadline1);
                    this.saveInterfaceElement("deadline2", newDeadline.deadline2);
                    this.saveInterfaceElement("deadline3", newDeadline.deadline3);
                    this.saveInterfaceElement("deadlineDate1", newDeadline.deadlineDate1);
                    this.saveInterfaceElement("deadlineDate2", newDeadline.deadlineDate2);
                    this.saveInterfaceElement("deadlineDate3", newDeadline.deadlineDate3);
                    this.saveInterfaceElement("registrationDeadline", newDeadline.registrationDeadline);
                    this.saveInterfaceElement("lateRegistrationDeadline", newDeadline.lateRegistrationDeadline);
                    this.saveInterfaceElement("sponsorDeadline", newDeadline.sponsorDeadline);

                    //Submission deadlines
                    var extendedPaperDeadline = (from s in context.submissiontypes
                                              where s.name == "Extended Paper"
                                              select s).FirstOrDefault();

                    if (extendedPaperDeadline != null)
                        extendedPaperDeadline.deadline = newDeadline.extendedPaperDeadline;

                    var posterDeadline = (from s in context.submissiontypes
                                          where s.name == "Poster"
                                          select s).FirstOrDefault();

                    if (posterDeadline != null)
                        posterDeadline.deadline = newDeadline.posterDeadline;

                    var panelDeadline = (from s in context.submissiontypes
                                         where s.name == "Panel"
                                         select s).FirstOrDefault();

                    if (panelDeadline != null)
                        panelDeadline.deadline = newDeadline.panelDeadline;

                    var othersDeadline = (from s in context.submissiontypes
                                       where s.name == "Others"
                                              select s).FirstOrDefault();

                    if (othersDeadline != null)
                        othersDeadline.deadline = newDeadline.othersDeadline;

                    var workshopDeadline = (from s in context.submissiontypes
                                            where s.name == "Workshop"
                                            select s).FirstOrDefault();

                    if (workshopDeadline != null)
                        workshopDeadline.deadline = newDeadline.workshopDeadline;

                    context.SaveChanges();
                    return true;
                }
            }
            catch (Exception ex)
            {
                Console.Write("WebManger.saveDeadlines error " + ex);
                return false;
            }
        }