Beispiel #1
0
 public ContactFormService()
     : base(Global.connectionString, Global.siteList, Global.dnaDiagnostics)
 {
     contactFormComments = new Contacts(dnaDiagnostic, readerCreator, cacheManager, Global.siteList);
     contactFormComments.EmailServerAddress = Global.emailServerAddress;
     contactFormComments.FileCacheFolder = Global.fileCacheFolder;
     contactFormComments.FilterBy = FilterBy.ContactFormPosts;
     string basePath = ConfigurationManager.AppSettings["ServerBasePath"];
     basePath = basePath.Remove(basePath.LastIndexOf("/")) + "/ContactFormService.svc";
     contactFormComments.BasePath = basePath;
 }
        private void ProcessInputParameters()
        {
            if (InputContext.DoesParamExist("action", "process action param"))
            {
                switch (InputContext.GetParamStringOrEmpty("action", "process action param").ToLower())
                {
                    case "updatecontactemail":
                        {
                            int forumID = InputContext.GetParamIntOrZero("forumid", "Contact form forumid");
                            string contactEmailAddress = InputContext.GetParamStringOrEmpty("contactemail", "new contact email address");
                            if (forumID > 0 && contactEmailAddress.Length > 0)
                            {
                                Contacts contactForm = new Contacts(AppContext.TheAppContext.Diagnostics, AppContext.ReaderCreator, CacheFactory.GetCacheManager(), InputContext.TheSiteList);
                                BaseResult result = null;
                                if (contactForm.SetContactFormEmailAddress(forumID, contactEmailAddress))
                                {
                                    result = new Result("UPDATEEMAIL", "Contact Email Updated");
                                }
                                else
                                {
                                    result = new Error("UPDATEEMAIL", "Contact Email Invalid for update. Ensure it ends with '@bbc.co.uk' and valid");
                                }
                                SerialiseAndAppend(result, "");
                            }
                            break;
                        }
                    default :
                        break;
                }
            }

            if (InputContext.DoesParamExist("dnaskip", "Items to skip"))
            {
                skip = InputContext.GetParamIntOrZero("dnaskip", "Items to skip");
            }

            if (InputContext.DoesParamExist("dnashow", "Items to show"))
            {
                show = InputContext.GetParamIntOrZero("dnashow", "Items to show");
            }

            requestedSiteID = InputContext.GetParamIntOrZero("dnasiteid", "The specified site");
        }