コード例 #1
0
ファイル: CMS_App_Categories.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// Adds a new child for the given parent category
        /// </summary>
        /// <param name="parent">parent category (0 for root)</param>
        /// <param name="form">form containig data</param>
        /// <returns></returns>
        public bool add(long parent, Form_Category_Add form)
        {
            category c = new category();
            c.date = DateTime.Now;
            c.parentid = parent;
            if (parent == 0)
            {
                c.parentid = null;
            }
            //c.name = form["name"].getValue();
            //c.alias = this._app.makeAlias(form["name"].getValue());

            using (LangDataContext a = new LangDataContext())
            {
                a.categories.InsertOnSubmit(c);
                try
                {
                    a.SubmitChanges();
                }
                catch (Exception)
                {
                    return false;
                }
            }

            return true;
        }
コード例 #2
0
ファイル: CMS_App_Comments.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// Adds a new comment to the article specifed with given id
        /// </summary>
        /// <param name="id">comment id</param>
        /// <param name="form">form containing data</param>
        /// <param name="ip">Client IP address</param>
        /// <returns></returns>
        public bool add(long id, Form_Comment_New form, string ip)
        {
            comment c = new comment();
            c.useralias = form["name"].getValue();
            c.title = form["title"].getValue();
            c.text = form["text"].getValue();
            c.parentid = null;
            c.ip = ip;
            c.email = form["email"].getValue();
            c.articlesid = id;

            if (this._app.users().isLogged())
            {
                c.usersid = this._app.users().getLogged().id;
            }

            try
            {
                using (LangDataContext a = new LangDataContext())
                {
                    a.comments.InsertOnSubmit(c);
                    a.SubmitChanges();
                }
            }
            catch
            {
                return false;
            }

            return true;
        }
コード例 #3
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <param name="a"></param>
 /// <returns></returns>
 public Array getAll(LangDataContext a)
 {
     using (a)
     {
         var data = a.articles;
         return data.ToArray();
     }
 }
コード例 #4
0
ファイル: CMS_App_Authors.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// Returns all authors
 /// </summary>
 /// <returns></returns>
 public List<author> getAll()
 {
     using (LangDataContext a = new LangDataContext())
     {
         var data = a.authors.ToList();
         return data;
     }
 }
コード例 #5
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        public void deleteArticle(long id)
        {
            using (LangDataContext a = new LangDataContext())
            {
                a.articles.DeleteAllOnSubmit(a.articles.Where(x => x.id == id));

                try
                {
                    a.SubmitChanges();
                }
                catch(Exception)
                {
                    CMS.Services.CMS_Services_Message.getInstance().addError("The article hasn't been deleted.");
                }
            }
        }
コード例 #6
0
ファイル: CMS_App_Categories.cs プロジェクト: jirihelmich/CMS
        public long add(CategoryInputModel input)
        {
            using (LangDataContext dataContext = new LangDataContext())
            {
                category c = new category();

                text title = new text();
                text content = new text();

                dataContext.categories.InsertOnSubmit(c);
                dataContext.texts.InsertOnSubmit(title);
                dataContext.texts.InsertOnSubmit(content);

                c.text = content;
                c.title = title;

                foreach (CategoryInputModel.Category cat in input.request)
                {
                    texts_value titleValue = new texts_value();
                    titleValue.culture = cat.lang;
                    titleValue.value = cat.data.Title;
                    titleValue.text = title;
                    titleValue.seo_value = this._app.makeAlias(cat.data.Title);

                    texts_value contentValue = new texts_value();
                    contentValue.culture = cat.lang;
                    contentValue.value = cat.data.Content;
                    contentValue.text = content;

                    dataContext.texts_values.InsertOnSubmit(titleValue);
                    dataContext.texts_values.InsertOnSubmit(contentValue);
                }

                c.parentid = input.catParent;
                c.date = DateTime.Now;

                dataContext.SubmitChanges();

                return c.id;

            }
        }
コード例 #7
0
ファイル: CMS_App_Pages.cs プロジェクト: jirihelmich/CMS
        public long add(PageInputModel input)
        {
            using (LangDataContext dataContext = new LangDataContext())
            {
                page p = new page();

                text title = new text();
                text content = new text();

                dataContext.pages.InsertOnSubmit(p);
                dataContext.texts.InsertOnSubmit(title);
                dataContext.texts.InsertOnSubmit(content);

                p.text = title;
                p.text1 = content;

                foreach (PageInputModel.Page newPage in input.request)
                {
                    texts_value titleValue = new texts_value();
                    titleValue.culture = newPage.lang;
                    titleValue.value = newPage.data.title;
                    titleValue.text = title;
                    titleValue.seo_value = this._app.makeAlias(newPage.data.title);

                    texts_value contentValue = new texts_value();
                    contentValue.culture = newPage.lang;
                    contentValue.value = newPage.data.content;
                    contentValue.text = content;

                    dataContext.texts_values.InsertOnSubmit(titleValue);
                    dataContext.texts_values.InsertOnSubmit(contentValue);
                }

                dataContext.SubmitChanges();

                return p.id;

            }
        }
コード例 #8
0
ファイル: CMS_App_Products.cs プロジェクト: jirihelmich/CMS
        public object delete(long id)
        {
            using (LangDataContext dc = new LangDataContext())
            {
                try
                {
                    var product = dc.products.Single(x => x.id == id);
                    dc.products.DeleteOnSubmit(product);

                    return new { result = true };
                }
                catch (Exception e)
                {
                    return new { result = false, errMsg = e.Message};
                }
            }
        }
コード例 #9
0
ファイル: CMS_App_Products.cs プロジェクト: jirihelmich/CMS
        public object edit(InputModels.ProductInputModel p)
        {
            try
            {
                using (LangDataContext dc = new LangDataContext())
                {

                    var prod = dc.products.Single(x => x.id == p.prodId);

                    foreach (string lang in Helpers.LangHelper.langs)
                    {
                        prod.text_title.texts_values.Single(x => x.culture == lang).value = p.request.Single(x => x.lang == lang).data.Title;
                        prod.text_subtitle.texts_values.Single(x => x.culture == lang).value = p.request.Single(x => x.lang == lang).data.Subtitle;
                        prod.text_description.texts_values.Single(x => x.culture == lang).value = p.request.Single(x => x.lang == lang).data.Shortdesc;
                        prod.text_text.texts_values.Single(x => x.culture == lang).value = p.request.Single(x => x.lang == lang).data.Content;
                    }

                    if (p.docGroups != null)
                    {
                        foreach (docgroups_product dgp in prod.docgroups_products.Where(x => p.docGroups.Where(u => u.Id == x.docgroup_id).Count() == 0))
                        {
                            prod.docgroups_products.Remove(dgp);
                        }

                        foreach (InputModels.DocGroupInputModel dg in p.docGroups)
                        {
                            if (dg.Id == null || prod.docgroups_products.Where(x => x.docgroup_id == dg.Id).Count() > 0) continue;

                            docgroups_product dgp = new docgroups_product();
                            dgp.docgroup_id = (long)dg.Id;
                            dgp.product = prod;
                        }
                    }

                    foreach (products_connection pdc in prod.products_connections.Where(x => !p.Connections.Contains(x.product_id)))
                    {
                        prod.products_connections.Remove(pdc);
                    }

                    foreach (long conn in p.Connections)
                    {
                        if (prod.products_connections.Select(x => x.product_id_2).Contains(conn)) continue;

                        products_connection prodConn = new products_connection();
                        prodConn.product = prod;
                        prodConn.product_id_2 = conn;
                    }

                    prod.image_id = p.mainImage;

                    dc.products.InsertOnSubmit(prod);

                    dc.SubmitChanges();

                    return new { result = true };
                }
            }
            catch (Exception e)
            {
                return new { result = false, errMsg = e.Message };
            }
        }
コード例 #10
0
ファイル: CMS_App_Products.cs プロジェクト: jirihelmich/CMS
        public object addCategory(long catId, long productId)
        {
            using (LangDataContext dc = new LangDataContext())
            {
                try
                {
                    products_category rel = new products_category();
                    rel.category_id = catId;
                    rel.product_id = productId;

                    dc.products_categories.InsertOnSubmit(rel);

                    return new { result = true };
                }
                catch (Exception e)
                {
                    return new { result = false, errMsg = e.Message };
                }
            }
        }
コード例 #11
0
ファイル: CMS_App_Products.cs プロジェクト: jirihelmich/CMS
        public object changeCategory(long oldCatId, long newCatId, long productId)
        {
            using (LangDataContext dc = new LangDataContext())
            {
                try
                {
                    var product = dc.products.Single(x => x.id == productId);

                    product
                        .products_categories
                        .Single(x => x.category_id == oldCatId && x.product_id == productId)
                        .category_id = newCatId;

                    return new { result = true };
                }
                catch (Exception e)
                {
                    return new { result = false, errMsg = e.Message };
                }
            }
        }
コード例 #12
0
ファイル: CMS_App_Comments.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// Returns all commments related to the article indentified by the
        /// given id
        /// </summary>
        /// <param name="articleid">ID of article</param>
        //public void getByArticleId(long articleid)
        //{
        //    using (LangDataContext a = new LangDataContext())
        //    {
        //        var data = a.comments.Where(x => x.articleid == articleid).ToList();
        //        return data;
        //    }
        //}
        /// <summary>
        /// Returns a comment identified by the given id
        /// </summary>
        /// <param name="id">Comment id</param>
        /// <returns></returns>
        public comment getById(long id)
        {
            using (LangDataContext a = new LangDataContext())
            {
                try
                {
                    var data = a.comments.Where(x => x.id == id).Single();

                    return data;
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }
コード例 #13
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public int getCount()
 {
     using (LangDataContext a = new LangDataContext())
     {
         return a.articles.Count();
     }
 }
コード例 #14
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public List<category> getCategoriesListById(long id)
 {
     using (LangDataContext a = new LangDataContext())
     {
         return a.articles_categories.Where(x => x.articlesid == id).Select(x => x.category).ToList();
     }
 }
コード例 #15
0
ファイル: CMS_App_Products.cs プロジェクト: jirihelmich/CMS
        public List<ProductOutputModel> search(CMS.InputModels.StringInputModel s)
        {
            using (LangDataContext dc = new LangDataContext())
            {
                var products = dc.products.Where(u => dc.texts_values.Where(x => x.value.Contains(s.str)).Select(x=>x.text).Contains(u.text_title));

                List<ProductOutputModel> list = new List<ProductOutputModel>();

                foreach (product p in products)
                {
                    list.Add(new ProductOutputModel(p));
                }

                return list;
            }
        }
コード例 #16
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public int getFrontpageArticlesCount()
        {
            List<long> levels = this._app.allowedLevels();

            using (LangDataContext a = new LangDataContext())
            {
                var data = a.articles
                    .Where(x => x.published == 1 && levels.Contains(x.level) && x.date_published <= DateTime.Now && (x.date_pullback <= x.date_published || x.date_pullback > DateTime.Now))
                    .Count();
                return data;
            }
        }
コード例 #17
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public List<tag> getTagsById(long id)
 {
     using (LangDataContext a = new LangDataContext())
     {
         return a.tags_articles.Where(x => x.articlesid == id).Select(x => x.tag).ToList();
     }
 }
コード例 #18
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// 
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public List<article> getFrontpage(int count, int start, string order)
        {
            List<long> allowedLevels = this._app.allowedLevels();
            using (LangDataContext a = new LangDataContext())
            {
                var data = a.articles
                    .Where(x => x.published == 1 && allowedLevels.Contains(x.level) && x.date_published <= DateTime.Now && (x.date_pullback <= x.date_published || x.date_pullback > DateTime.Now));

                if (order == "date")
                {
                    return data.OrderByDescending(x => x.date_published)
                        .Skip(start)
                        .Take(count).ToList();
                }else if (order == "id")
                {
                    return data.OrderBy(x => x.id)
                        .Skip(start)
                        .Take(count).ToList();
                }
                else if (order == "hits")
                {
                    return data.OrderByDescending(x => x.hits)
                        .Skip(start)
                        .Take(count).ToList();
                }
                else if (order == "title")
                {
                    return data.OrderBy(x => x.title)
                            .Skip(start)
                            .Take(count).ToList();
                }else{
                    return data.Skip(start).Take(count).ToList();
                }
            }
        }
コード例 #19
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public int getCountByCategoryId(long id)
 {
     using (LangDataContext a = new LangDataContext())
     {
         return a.articles_categories
             .Where(x => x.categoriesid == id)
             .Select(x => x.article)
             .Count();
     }
 }
コード例 #20
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public int getCountByAuthorId(long id)
 {
     using (LangDataContext a = new LangDataContext())
     {
         return a.articles_authors
             .Where(x => x.authorsid == id)
             .Select(x => x.article)
             .Count();
     }
 }
コード例 #21
0
ファイル: CMS_App_Products.cs プロジェクト: jirihelmich/CMS
        public List<ProductOutputModel> getAll()
        {
            using (LangDataContext dc = new LangDataContext())
            {
                var data = dc.products;

                List<ProductOutputModel> output = new List<ProductOutputModel>();

                foreach (product p in data)
                {
                    output.Add(new ProductOutputModel(p));
                }

                return output;
            }
        }
コード例 #22
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="a"></param>
        /// <returns></returns>
        public article getById(long id, LangDataContext a)
        {
            using (a)
            {
                try
                {
                    var data = a.articles
                        .Single(x => x.id == id);

                    data.hits++;

                    try
                    {
                        a.SubmitChanges();
                    }
                    catch (Exception)
                    {
                    }

                    return data;
                }
                catch (Exception)
                {
                    return null;
                }
            }
        }
コード例 #23
0
ファイル: CMS_App_Products.cs プロジェクト: jirihelmich/CMS
 public ProductOutputModel getById(long id)
 {
     using (LangDataContext dc = new LangDataContext())
     {
         var product = dc.products.SingleOrDefault(x => x.id == id);
         return new ProductOutputModel(product);
     }
 }
コード例 #24
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <param name="count"></param>
 /// <param name="start"></param>
 /// <returns></returns>
 public List<article> getByCategoryId(long id, int count, int start)
 {
     using (LangDataContext a = new LangDataContext())
     {
         return a.articles_categories
             .Where(x => x.categoriesid == id)
             .Select(x => x.article)
             .Skip(start)
             .Take(count).ToList();
     }
 }
コード例 #25
0
ファイル: CMS_App_Products.cs プロジェクト: jirihelmich/CMS
        public object add(InputModels.ProductInputModel p)
        {
            using (LangDataContext dc = new LangDataContext())
            {
                product prod = new product();
                prod.text_title = new text();
                prod.text_subtitle = new text();
                prod.text_description = new text();
                prod.text_text = new text();

                foreach (InputModels.ProductInputModel.Product inProd in p.request)
                {
                    texts_value titleval = new texts_value();
                    titleval.culture = inProd.lang;
                    titleval.value = inProd.data.Title;
                    titleval.text = prod.text_title;
                    titleval.seo_value = this._app.makeAlias(inProd.data.Title);

                    texts_value subtitleval = new texts_value();
                    subtitleval.culture = inProd.lang;
                    subtitleval.value = inProd.data.Subtitle;
                    subtitleval.text = prod.text_subtitle;

                    texts_value descval = new texts_value();
                    descval.culture = inProd.lang;
                    descval.value = inProd.data.Shortdesc;
                    descval.text = prod.text_description;

                    texts_value textval = new texts_value();
                    textval.culture = inProd.lang;
                    textval.value = inProd.data.Content;
                    textval.text = prod.text_text;
                }

                if (p.docGroups != null)
                {
                    foreach (InputModels.DocGroupInputModel dg in p.docGroups)
                    {
                        if (dg.Id == null) continue;

                        docgroups_product dgp = new docgroups_product();
                        dgp.docgroup_id = (long)dg.Id;
                        dgp.product = prod;
                    }
                }

                foreach (long cat in p.Categories)
                {
                    products_category pc = new products_category();
                    pc.product = prod;
                    pc.category_id = cat;
                }

                foreach (long conn in p.Connections)
                {
                    products_connection prodConn = new products_connection();
                    prodConn.product = prod;
                    prodConn.product_id_2 = conn;
                }

                prod.image_id = p.mainImage;

                dc.products.InsertOnSubmit(prod);

                dc.SubmitChanges();

                return new { Id = prod.id };
            }
        }
コード例 #26
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <returns></returns>
 public List<long> getAllLevels()
 {
     using (LangDataContext a = new LangDataContext())
     {
         return a.articles.Select(x => x.level).Distinct().ToList();
     }
 }
コード例 #27
0
ファイル: CMS_App_Comments.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// Saves a reply to a comment with the given id
        /// </summary>
        /// <param name="id">Comment id</param>
        /// <param name="form">Reply data</param>
        /// <param name="aid">Article id</param>
        /// <param name="ip">Client IP address</param>
        /// <returns></returns>
        public bool reply(long id, Form_Comment_New form, string ip, out long aid)
        {
            comment c = new comment();
            c.useralias = form["name"].getValue();
            c.title = form["title"].getValue();
            c.text = form["text"].getValue();
            c.parentid = id;
            c.ip = ip;
            c.email = form["email"].getValue();

            if (this._app.users().isLogged())
            {
                c.usersid = this._app.users().getLogged().id;
            }

            try
            {
                using (LangDataContext a = new LangDataContext())
                {
                    comment replied = a.comments.Where(x => x.id == id).Single();
                    aid = c.articlesid = replied.articlesid;
                    a.comments.InsertOnSubmit(c);
                    a.SubmitChanges();
                }
            }
            catch
            {
                aid = 0;
                return false;
            }

            return true;
        }
コード例 #28
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// 
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public List<comment> getCommentsById(long id)
 {
     using (LangDataContext a = new LangDataContext())
     {
         return a.comments.Where(x => x.articlesid == id).ToList();
     }
 }
コード例 #29
0
ファイル: CMS_App_Comments.cs プロジェクト: jirihelmich/CMS
 /// <summary>
 /// Removes the comment with the given id from data source
 /// </summary>
 /// <param name="id"></param>
 public void deleteById(long id)
 {
     using (LangDataContext a = new LangDataContext())
     {
         try
         {
             a.comments.DeleteOnSubmit(a.comments.Where(x => x.id == id).Single());
         }
         catch (Exception)
         {
             CMS.Services.CMS_Services_Message.getInstance().addError("The comment cannot be deleted.");
         }
     }
 }
コード例 #30
0
ファイル: CMS_App_Articles.cs プロジェクト: jirihelmich/CMS
        /// <summary>
        /// 
        /// </summary>
        /// <param name="form"></param>
        /// <param name="Request"></param>
        /// <returns></returns>
        public bool saveArticle(CMS_Form form, HttpRequestBase Request)
        {
            long id = long.Parse(Request.Params["id"]);

            using (LangDataContext dataContext = new LangDataContext())
            {

                DateTime published = this._app.dateFromString(form["published"].getValue());
                DateTime pullback = this._app.dateFromString(form["pullback"].getValue());

                try
                {
                    article original = dataContext.articles.Where(x => x.id == id).Single();
                    article modified = dataContext.articles.Where(x => x.id == id).Single();

                    modified.date_published = published;
                    modified.date_lastmod = DateTime.Now;
                    modified.alias = this._app.makeAlias(form["title"].getValue());
                    modified.date_pullback = pullback;
                    modified.fulltext = form["text"].getValue();
                    modified.modifications_count++;
                    modified.title = form["title"].getValue();
                    modified.introtext = form["perex"].getValue();
                    modified.level = int.Parse(form["roles"].getValue());
                    modified.published = int.Parse(form["published_bool"].getValue());

                    dataContext.articles_authors.DeleteAllOnSubmit(dataContext.articles_authors.Where(x => x.articlesid == id));

                    try
                    {
                        dataContext.SubmitChanges();
                    }
                    catch (Exception)
                    {
                        return false;
                    }

                    foreach (string articleAuthorIdString in ((CMS_Form_Element_Select)form["authors"]).getValues())
                    {
                        articles_author authorArticles = new articles_author();
                        authorArticles.articlesid = id;
                        authorArticles.authorsid = long.Parse(articleAuthorIdString);
                        authorArticles.date = DateTime.Now;
                        modified.articles_authors.Add(authorArticles);
                    }

                    string[] tags = form["tags"].getValue().Split(' ');

                    dataContext.tags_articles.DeleteAllOnSubmit(dataContext.tags_articles.Where(x => x.articlesid == id));

                    try
                    {
                        dataContext.SubmitChanges();
                    }
                    catch (Exception)
                    {
                        return false;
                    }

                    foreach (string t in tags)
                    {
                        long tagId = 0;
                        try
                        {
                            var tag = dataContext.tags.Where(x => x.name == t).Single();
                            tagId = tag.id;
                        }
                        catch (InvalidOperationException)
                        {
                            tag newTag = new tag();
                            newTag.name = t;
                            newTag.date = DateTime.Now;

                            dataContext.tags.InsertOnSubmit(newTag);

                            try
                            {
                                dataContext.SubmitChanges();
                            }
                            catch
                            {
                                return false;
                            }

                            tagId = newTag.id;
                        }

                        tags_article tagArticle = new tags_article();
                        tagArticle.articlesid = id;
                        tagArticle.tagsid = tagId;

                        dataContext.tags_articles.InsertOnSubmit(tagArticle);

                    }

                    dataContext.articles_categories.DeleteAllOnSubmit(dataContext.articles_categories.Where(x => x.articlesid == id));

                    try
                    {
                        dataContext.SubmitChanges();
                    }
                    catch (Exception)
                    {
                        return false;
                    }

                    CMS_Form_Element_Select cats = (CMS_Form_Element_Select)form["categories"];

                    foreach (string cat in cats.getValues())
                    {
                        long catId = long.Parse(cat);

                        articles_category articleCategory = new articles_category();
                        articleCategory.date = DateTime.Now;
                        articleCategory.articlesid = id;
                        articleCategory.categoriesid = catId;

                        dataContext.articles_categories.InsertOnSubmit(articleCategory);
                    }

                    try
                    {
                        dataContext.SubmitChanges();
                    }
                    catch (Exception)
                    {
                        return false;
                    }

                    if (Request.Files.Count != 2)
                    {
                        CMS_Services_Message.getInstance().addError("Unexpected count of uploaded files, skipping.");
                    }
                    else
                    {

                        HttpPostedFileBase small = Request.Files[0];
                        if (small.ContentLength > 0 && small.ContentType == "image/jpeg")
                        {
                            string filename = id.ToString();
                            var path = Path.Combine(Request.MapPath("./../images"), filename + "_small.jpg");

                            small.SaveAs(path);

                            System.Drawing.Image i = System.Drawing.Image.FromFile(path);
                            if (i.Width != 100 || i.Height != 100)
                            {
                                CMS_Services_Message.getInstance().addError("Invalid image size - small icon should be 100x100 pixels");
                                FileInfo f = new FileInfo(path);
                                f.Delete();
                            }
                        }
                        else
                        {
                            CMS_Services_Message.getInstance().addError("Invalid image - small icon");
                        }

                        HttpPostedFileBase big = Request.Files[1];
                        if (big.ContentLength > 0 && big.ContentType == "image/jpeg")
                        {
                            string filename = id.ToString();
                            var path = Path.Combine(Request.MapPath("./../images"), filename + "_big.jpg");

                            big.SaveAs(path);

                            System.Drawing.Image i = System.Drawing.Image.FromFile(path);
                            if (i.Width != 320 || i.Height != 240)
                            {
                                CMS_Services_Message.getInstance().addError("Invalid image size - big icon should be 320x240 pixels");
                                FileInfo f = new FileInfo(path);
                                f.Delete();
                            }
                        }
                        else
                        {
                            CMS_Services_Message.getInstance().addError("Invalid image - big icon");
                        }
                    }

                }
                catch(InvalidOperationException) {
                    CMS_Services_Message.getInstance().addError("Article with specified ID does not exit");
                    return false;
                }

            }

            return true;
        }