示例#1
0
        //Get content found in the Registration section of the website
        public RegistrationQuery getRegistrationInfo()
        {
            try
            {
                RegistrationQuery registration = new RegistrationQuery();
                registration.registrationParagraph1 = this.getInterfaceElement("registrationParagraph1").content;
                registration.registrationParagraph2 = this.getInterfaceElement("registrationParagraph2").content;

                //Get registration fees
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    var undergraduateStudent = (from usertype in context.usertypes
                                                where usertype.userTypeName == "Undergraduate Student"
                                                select usertype).FirstOrDefault();

                    if (undergraduateStudent != null)
                    {
                        registration.undergraduateStudentFee = (double)undergraduateStudent.registrationCost;
                        registration.undergraduateStudentLateFee = (double)undergraduateStudent.registrationLateFee;
                    }

                    var graduateStudent = (from usertype in context.usertypes
                                           where usertype.userTypeName == "Graduate Student"
                                           select usertype).FirstOrDefault();

                    if (graduateStudent != null)
                    {
                        registration.graduateStudentFee = (double)graduateStudent.registrationCost;
                        registration.graduateStudentLateFee = (double)graduateStudent.registrationLateFee;
                    }

                    var highSchoolStudent = (from usertype in context.usertypes
                                             where usertype.userTypeName == "High School Student"
                                             select usertype).FirstOrDefault();

                    if (highSchoolStudent != null)
                    {
                        registration.highSchoolStudentFee = (double)highSchoolStudent.registrationCost;
                        registration.highSchoolStudentLateFee = (double)highSchoolStudent.registrationLateFee;
                    }

                    var companionStudent = (from usertype in context.usertypes
                                            where usertype.userTypeName == "Companion"
                                            select usertype).FirstOrDefault();

                    if (companionStudent != null)
                    {
                        registration.companionStudentFee = (double)companionStudent.registrationCost;
                        registration.companionStudentLateFee = (double)companionStudent.registrationLateFee;
                    }

                    var professionalAcademia = (from usertype in context.usertypes
                                                where usertype.userTypeName == "Professional Academia"
                                                select usertype).FirstOrDefault();

                    if (professionalAcademia != null)
                    {
                        registration.professionalAcademyFee = (double)professionalAcademia.registrationCost;
                        registration.professionalAcademyLateFee = (double)professionalAcademia.registrationLateFee;
                    }

                    var professionalIndustry = (from usertype in context.usertypes
                                                where usertype.userTypeName == "Professional Industry"
                                                select usertype).FirstOrDefault();
                    if (professionalIndustry != null)
                    {
                        registration.professionalIndustryFee = (double)professionalIndustry.registrationCost;
                        registration.professionalIndustryLateFee = (double)professionalIndustry.registrationLateFee;
                    }
                }

                return registration;
            }
            catch (Exception ex)
            {
                Console.Write("WebManager.getRegistrationInfo error " + ex);
                return null;
            }
        }
示例#2
0
        //Update content found in the Registration section of the website
        public bool saveRegistrationInfo(RegistrationQuery newRegistration)
        {
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    this.saveInterfaceElement("registrationParagraph1", newRegistration.registrationParagraph1);

                    this.saveInterfaceElement("registrationParagraph2", newRegistration.registrationParagraph2);

                    var undergraduateStudentFee = (from s in context.usertypes
                                                   where s.userTypeName == "Undergraduate Student"
                                                   select s).FirstOrDefault();

                    if (undergraduateStudentFee != null)
                    {
                        undergraduateStudentFee.registrationCost = newRegistration.undergraduateStudentFee;
                        undergraduateStudentFee.registrationLateFee = newRegistration.undergraduateStudentLateFee;
                    }

                    var graduateStudentFee = (from s in context.usertypes
                                              where s.userTypeName == "Graduate Student"
                                              select s).FirstOrDefault();

                    if (graduateStudentFee != null)
                    {
                        graduateStudentFee.registrationCost = newRegistration.graduateStudentFee;
                        graduateStudentFee.registrationLateFee = newRegistration.graduateStudentLateFee;
                    }

                    var highSchoolStudentFee = (from s in context.usertypes
                                                where s.userTypeName == "High School Student"
                                                select s).FirstOrDefault();

                    if (highSchoolStudentFee != null)
                    {
                        highSchoolStudentFee.registrationCost = newRegistration.highSchoolStudentFee;
                        highSchoolStudentFee.registrationLateFee = newRegistration.highSchoolStudentLateFee;
                    }

                    var companionStudentFee = (from s in context.usertypes
                                               where s.userTypeName == "Companion"
                                               select s).FirstOrDefault();

                    if (companionStudentFee != null)
                    {
                        companionStudentFee.registrationCost = newRegistration.companionStudentFee;
                        companionStudentFee.registrationLateFee = newRegistration.companionStudentLateFee;
                    }

                    var professionalIndustryFee = (from s in context.usertypes
                                                   where s.userTypeName == "Professional Industry"
                                                   select s).FirstOrDefault();

                    if (professionalIndustryFee != null)
                    {
                        professionalIndustryFee.registrationCost = newRegistration.professionalIndustryFee;
                        professionalIndustryFee.registrationLateFee = newRegistration.professionalIndustryLateFee;
                    }

                    var professionalAcademyFee = (from s in context.usertypes
                                                  where s.userTypeName == "Professional Academia"
                                                  select s).FirstOrDefault();

                    if (professionalAcademyFee != null)
                    {
                        professionalAcademyFee.registrationCost = newRegistration.professionalAcademyFee;
                        professionalAcademyFee.registrationLateFee = newRegistration.professionalAcademyLateFee;
                    }

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