Example #1
0
        public string SaveNewsletter(string newsletterItems, DateTime sendDate)
        {
            string[] newsletterArray = newsletterItems.Split('|');

            if (newsletterArray.Length > 0)
            {
                string newsLetterName = "Nyhedsbrev " + DateTime.Now.ToShortDateString();
                DocumentType dt = new DualShockManager().GetDocumentTypeByName("NewsletterDocType");
                Document newsLetter = Document.MakeNew(newsLetterName, dt, User.GetCurrent(),
                                                       new DualShockManager().SimpleSettingsPageDocType.NewsletterFolderId);
                int length = 1;
                string propertyValue = "";
                foreach (string array in newsletterArray)
                {
                    int id;

                    if (int.TryParse(array.Split(',')[0], out id))
                    {
                        string type = array.Split(',')[1] == "true" ? "nyhed" : "banner";
                        string item = NewsletterDataFormat(id, type, length == newsletterArray.Length);
                        propertyValue += item;
                    }

                    length++;
                }
                newsLetter.getProperty("newsletterData").Value = propertyValue;
                newsLetter.getProperty("sendDate").Value = sendDate;
                newsLetter.Publish(User.GetCurrent());
                library.UpdateDocumentCache(newsLetter.Id);

                return "Nyhedsbrevet : " + newsLetterName;
            }
            return "Der skete en fejl under oprettelsen af nyhedsbrevet";
        }
Example #2
0
        public string SaveNewsletter(string newsletterItems, DateTime sendDate)
        {
            string[] newsletterArray = newsletterItems.Split('|');

            if (newsletterArray.Length > 0)
            {
                string       newsLetterName = "Nyhedsbrev " + DateTime.Now.ToShortDateString();
                DocumentType dt             = new DualShockManager().GetDocumentTypeByName("NewsletterDocType");
                Document     newsLetter     = Document.MakeNew(newsLetterName, dt, User.GetCurrent(),
                                                               new DualShockManager().SimpleSettingsPageDocType.NewsletterFolderId);
                int    length        = 1;
                string propertyValue = "";
                foreach (string array in newsletterArray)
                {
                    int id;

                    if (int.TryParse(array.Split(',')[0], out id))
                    {
                        string type = array.Split(',')[1] == "true" ? "nyhed" : "banner";
                        string item = NewsletterDataFormat(id, type, length == newsletterArray.Length);
                        propertyValue += item;
                    }

                    length++;
                }
                newsLetter.getProperty("newsletterData").Value = propertyValue;
                newsLetter.getProperty("sendDate").Value       = sendDate;
                newsLetter.Publish(User.GetCurrent());
                library.UpdateDocumentCache(newsLetter.Id);

                return("Nyhedsbrevet : " + newsLetterName);
            }
            return("Der skete en fejl under oprettelsen af nyhedsbrevet");
        }
Example #3
0
 protected void uiBtnCreateNewsClick(object sender, EventArgs e)
 {
     int id = new DualShockManager().CreateNews(uiTxtNewsName.Text.Trim(), uiChbShowInMenu.Checked, uiChbPublish.Checked);
     if(id != -1)
     {
         Response.Redirect("/umbraco/editContent.aspx?id=" + id);
     }
 }
Example #4
0
        public List<DocumentTypeBase> GetResultsFromTagSearch(string tag)
        {
            if (!string.IsNullOrEmpty(tag))
            {
                List<DocumentTypeBase> results = new List<DocumentTypeBase>();

                List<TextPageDoctType> news = new DualShockManager().GetNews().Where(x => x.Tags.ToLower().Contains(tag)).ToList(); ;
                List<NominiesDocType> artists = new DualShockManager().GetNominies(new DualShockManager().SimpleSettingsPageDocType.NominiesFolderId).Where(x => x.Tags.ToLower().Contains(tag)).ToList();

                results.AddRange(news);
                results.AddRange(artists);

                return results.OrderBy(x => x.CreateDate).ToList();
            }
            return null;
        }
Example #5
0
        public List <DocumentTypeBase> GetResultsFromTagSearch(string tag)
        {
            if (!string.IsNullOrEmpty(tag))
            {
                List <DocumentTypeBase> results = new List <DocumentTypeBase>();

                List <TextPageDoctType> news    = new DualShockManager().GetNews().Where(x => x.Tags.ToLower().Contains(tag)).ToList();;
                List <NominiesDocType>  artists = new DualShockManager().GetNominies(new DualShockManager().SimpleSettingsPageDocType.NominiesFolderId).Where(x => x.Tags.ToLower().Contains(tag)).ToList();

                results.AddRange(news);
                results.AddRange(artists);

                return(results.OrderBy(x => x.CreateDate).ToList());
            }
            return(null);
        }
Example #6
0
        private NewsletterItem ConvertToNewsletterItem(int id, string type)
        {
            NewsletterType thisType = GetType(type);
            NewsletterItem nli      = new NewsletterItem();

            if (thisType == NewsletterType.News)
            {
                TextPageDoctType news = new DualShockManager().GetNews(id);
                nli.Headline = news.Headline;
                nli.Content  = news.Description;
                nli.ImageUrl = news.ImageUpload;
            }

            if (thisType == NewsletterType.Banner)
            {
                nli.ImageUrl = DualShockManager.GetImageUrlFromId(id);
                nli.Type     = thisType;
                nli.LinkUrl  = "";
            }

            return(nli);
        }
Example #7
0
        public string CreateCategory(string categoryName)
        {
            //Locate Category node in umbraco tree
            CategoryListDocType categoryListDocType = new DualShockManager().GetCategoryListNode();

            if (categoryListDocType != null)
            {
                if (!string.IsNullOrEmpty(categoryName))
                {
                    if (DoesNodenameExicst(categoryName, categoryListDocType.Id))
                    {
                        DocumentType dt = GetDocumentTypeByName("CategoryDocType");
                        if (dt != null)
                        {
                            try
                            {
                                Document newCategoryDoc = Document.MakeNew(
                                    categoryName.Trim(),
                                    dt, User.GetCurrent(),
                                    GetCategoryListNode().Id);
                                newCategoryDoc.Publish(User.GetCurrent());
                                umbraco.library.UpdateDocumentCache(newCategoryDoc.Id);
                                return("Kategorien " + categoryName + " blev oprettet"); //TODO: Umbraco disc...?
                            }
                            catch (Exception ex)
                            {
                                //TODO: Custom logging...?

                                return(ex.Message);
                            }
                        }
                        return("Kunne ikke Kategori dokumenttypen");
                    }
                    return("Der findes allerede en kategori med navnet " + categoryName);
                }
                return("Kategori navn er ikke udfyldt");
            }
            return("Kunne ikke finde Kategori node");
        }
Example #8
0
        private NewsletterItem ConvertToNewsletterItem(int id, string type)
        {
            NewsletterType thisType = GetType(type);
            NewsletterItem nli = new NewsletterItem();
            if (thisType == NewsletterType.News)
            {
                TextPageDoctType news = new DualShockManager().GetNews(id);
                nli.Headline = news.Headline;
                nli.Content = news.Description;
                nli.ImageUrl = news.ImageUpload;
            }

            if(thisType == NewsletterType.Banner)
            {
                nli.ImageUrl = DualShockManager.GetImageUrlFromId(id);
                nli.Type = thisType;
                nli.LinkUrl = "";
            }

            return nli;
        }
Example #9
0
        public string CreateCategory(string categoryName)
        {
            //Locate Category node in umbraco tree
            CategoryListDocType categoryListDocType = new DualShockManager().GetCategoryListNode();
            if (categoryListDocType != null)
            {
                if (!string.IsNullOrEmpty(categoryName))
                {
                    if (DoesNodenameExicst(categoryName, categoryListDocType.Id))
                    {
                        DocumentType dt = GetDocumentTypeByName("CategoryDocType");
                        if (dt != null)
                        {
                            try
                            {
                                Document newCategoryDoc = Document.MakeNew(
                                    categoryName.Trim(),
                                    dt, User.GetCurrent(),
                                    GetCategoryListNode().Id);
                                newCategoryDoc.Publish(User.GetCurrent());
                                umbraco.library.UpdateDocumentCache(newCategoryDoc.Id);
                                return "Kategorien " + categoryName + " blev oprettet"; //TODO: Umbraco disc...?
                            }
                            catch (Exception ex)
                            {
                                //TODO: Custom logging...?

                                return ex.Message;

                            }

                        }
                        return "Kunne ikke Kategori dokumenttypen";
                    }
                    return "Der findes allerede en kategori med navnet " + categoryName;
                }
                return "Kategori navn er ikke udfyldt";
            }
            return "Kunne ikke finde Kategori node";
        }