Esempio n. 1
0
        public static FormEditArtical GetFormEditNewArtical(string category, string username)
        {
            InitializeForm(category, username);

            _tblArticle = CreateNewArticleInArchive();

            return _singleton;
        }
 private static Table_Article CreateNewArticleInArchive()
 {
     FormEditArtical._tblArticle = new Table_Article();
     
     // default value
     FormEditArtical._tblArticle.CategoryId = 0;
     FormEditArtical._tblArticle.ArticleContent = "Empty Content";
     FormEditArtical._tblArticle.CountComments = 0;
     FormEditArtical._tblArticle.CountViews = 0;
     FormEditArtical._tblArticle.CreatedBy = 0;
     FormEditArtical._tblArticle.EmbedObjId = 0;
     FormEditArtical._tblArticle.FlagActiveMivzak = true;
     FormEditArtical._tblArticle.FlagActiveRSS = true;
     FormEditArtical._tblArticle.FlagShowDateTime = true;
     FormEditArtical._tblArticle.FlagTak1ColPic = false;
     FormEditArtical._tblArticle.FlagTak1ColPicTxt = false;
     FormEditArtical._tblArticle.FlagTak1ColTxt = false;
     FormEditArtical._tblArticle.FlagTak2ColPic = false;
     FormEditArtical._tblArticle.FlagTak2ColPicTxt = false;
     FormEditArtical._tblArticle.FlagTak2ColTxt = false;
     FormEditArtical._tblArticle.FlagTak3ColPic = false;
     FormEditArtical._tblArticle.FlagTak3ColPicTxt = false;
     FormEditArtical._tblArticle.FlagTak3ColTxt = false;
     FormEditArtical._tblArticle.FlagTakLineFeeds = false;
     FormEditArtical._tblArticle.FlagTakSmallPic = false;
     FormEditArtical._tblArticle.FlagTakSmallPicTxt = false;
     FormEditArtical._tblArticle.FlagTakSmallTxt = false;
     FormEditArtical._tblArticle.ImageId = 0;
     FormEditArtical._tblArticle.IsPublished = false;
     FormEditArtical._tblArticle.KeysAssociated = "";
     FormEditArtical._tblArticle.KeysLookup = "";
     FormEditArtical._tblArticle.MetaTags = "";
     FormEditArtical._tblArticle.StatusId = 0;
     FormEditArtical._tblArticle.SubTitle = "Empty Subtitle";
     FormEditArtical._tblArticle.Summery = "";
     FormEditArtical._tblArticle.Title = "Empty Title";
     FormEditArtical._tblArticle.UpdatedBy = 0;
     // specific values
     DateTime now = DateTime.Now;
     FormEditArtical._tblArticle.CreateDate = now;
     FormEditArtical._tblArticle.UpdateDate = now;
     //FormEditArtical._tblArticle.CategoryId = (int)singleFormEditArtical.comboBoxArticleCategory.SelectedValue;
     FormEditArtical._db.Table_Articles.InsertOnSubmit(FormEditArtical._tblArticle);
     FormEditArtical._db.SubmitChanges();
     var newArticle = (from c in FormEditArtical._db.Table_Articles
                      where (c.CreateDate == now)
                      select c).Single();
     return newArticle;
 }
        public static FormEditArtical GetFormEditArtical(int articleId)
        {
            FormEditArtical._tblArticle = (from c in FormEditArtical._db.Table_Articles
                                           where c.ArticleId == articleId
                                           select c).Single();

            return FormEditArtical.singleFormEditArtical;
        }
Esempio n. 4
0
/*
        private static void FillComboBoxPhotosFromOriginId(int imgId)
        {
            var img = (from c in Db.Table_PhotosArchives
                       where c.Id == imgId
                       select c).Single();
            
            int? originId = img.OriginalPhotoId;
            
            var relatedPhotos = from c in Db.Table_PhotosArchives
                                where c.OriginalPhotoId == originId
                                select c;

            foreach (Table_PhotosArchive item in relatedPhotos)
            {
                _singl._comboBoxArticlePhoto.Items.Add(item);    
            }
        }
*/

        public static FormEditArtical GetFormEditArtical(int articleId)
        {
            if (_singleton == null)
                _singleton = new FormEditArtical();

            try
            {
                _tblArticle = (Db.Table_Articles
                    .Where(c => c.ArticleId == articleId))
                    .Single();

                PopulateFromArticle();
                _isNewArticle = false;
                return _singleton;
            }
            catch
            {
                _isNewArticle = true;
                return GetFormEditNewArtical("חדשות", "משה נעים");
            }
        }
Esempio n. 5
0
 private static Table_Article CreateNewArticleInArchive()
 {
     _tblArticle = new Table_Article
                       {
                           CategoryId = 0,
                           ArticleContent = "Empty Content",
                           CountComments = 0,
                           CountViews = 0,
                           CreatedBy = 0,
                           EmbedObjId = 0,
                           FlagActiveMivzak = true,
                           FlagActiveRSS = true,
                           FlagShowDateTime = true,
                           FlagTak1ColPic = false,
                           FlagTak1ColPicTxt = false,
                           FlagTak1ColTxt = false,
                           FlagTak2ColPic = false,
                           FlagTak2ColPicTxt = false,
                           FlagTak2ColTxt = false,
                           FlagTak3ColPic = false,
                           FlagTak3ColPicTxt = false,
                           FlagTak3ColTxt = false,
                           FlagTakLineFeeds = false,
                           FlagTakSmallPic = false,
                           FlagTakSmallPicTxt = false,
                           FlagTakSmallTxt = false,
                           ImageId = 0,
                           IsPublished = false,
                           KeysAssociated = "",
                           KeysLookup = "",
                           MetaTags = "",
                           StatusId = 0,
                           SubTitle = "Empty Subtitle",
                           Summery = "",
                           Title = "Empty Title",
                           UpdatedBy = 0
                       };
     
     // default value
     // specific values
     DateTime now = DateTime.Now;
     _tblArticle.CreateDate = now;
     _tblArticle.UpdateDate = now;
     //FormEditArtical._tblArticle.CategoryId = (int)singleFormEditArtical.comboBoxArticleCategory.SelectedValue;
     //Db.SubmitChanges();
     //var newArticle = (from c in Db.Table_Articles
     //                 where (c.CreateDate == now)
     //                 select c).Single();
     return _tblArticle;
 }