コード例 #1
0
        public ActionResult Add_Blog_Tags()
        {
            string SSSession = ""; if (HttpContext.Request.Cookies["TSHPANDAControll" + StaticLicense.LicName] != null)

            {
                HttpCookie cookie = HttpContext.Request.Cookies.Get("TSHPANDAControll" + StaticLicense.LicName); if (cookie != null)
                {
                    SSSession = cookie.Value;
                }
                else
                {
                    SSSession = "N.A";
                }
            }
            else
            {
                SSSession = "N.A";
            } CheckAccess check = new CheckAccess(SSSession);

            if (check.HasAccess)
            {
                Blog_ModelFiller BMF = new Blog_ModelFiller();
                return(View(BMF.BCategory_Filler()));
            }
            else
            {
                return(RedirectToAction("NotAccess", "MS"));
            }
        }
コード例 #2
0
        public ActionResult NewBlogPost()
        {
            string SSSession = ""; if (HttpContext.Request.Cookies["TSHPANDAControll" + StaticLicense.LicName] != null)

            {
                HttpCookie cookie = HttpContext.Request.Cookies.Get("TSHPANDAControll" + StaticLicense.LicName); if (cookie != null)
                {
                    SSSession = cookie.Value;
                }
                else
                {
                    SSSession = "N.A";
                }
            }
            else
            {
                SSSession = "N.A";
            } CheckAccess check = new CheckAccess(SSSession);

            if (check.HasAccess)
            {
                //ControllerContext.ParentActionViewContext.ViewBag.PageTitle = "";
                Blog_ModelFiller BMF = new Blog_ModelFiller();
                var Model            = new Blog_Post_insert_Model()
                {
                    Category = BMF.BCategory_Filler(),
                    Groups   = BMF.Groups_Filler(),
                    Type     = BMF.B_Types_Filler(),
                    PostData = new PostModel()
                    {
                        Id        = 0,
                        AdminPic  = "",
                        Category  = "",
                        ImagePath = "",
                        InGroup   = "",
                        title     = "",
                        text_min  = "",
                        text      = "",
                        tags      = "", date = "", by = "", Tags = new List <string>(), Comments__ = 0, IsDeleted = 0, IsDisabled = 0, IsImportant = 0, SearchGravity = 0
                    }
                };



                return(View(Model));
            }
            else
            {
                return(RedirectToAction("NotAccess", "MS"));
            }
        }
コード例 #3
0
        public ActionResult EditPost(int Post_id)
        {
            string SSSession = ""; if (HttpContext.Request.Cookies["TSHPANDAControll" + StaticLicense.LicName] != null)

            {
                HttpCookie cookie = HttpContext.Request.Cookies.Get("TSHPANDAControll" + StaticLicense.LicName); if (cookie != null)
                {
                    SSSession = cookie.Value;
                }
                else
                {
                    SSSession = "N.A";
                }
            }
            else
            {
                SSSession = "N.A";
            }
            CheckAccess check = new CheckAccess(SSSession);

            if (check.HasAccess)
            {
                //ControllerContext.ParentActionViewContext.ViewBag.PageTitle = "";
                Blog_ModelFiller BMF = new Blog_ModelFiller();
                var Model            = new Blog_Post_insert_Model()
                {
                    Category = BMF.BCategory_Filler(),
                    Groups   = BMF.Groups_Filler(),
                    Type     = BMF.B_Types_Filler(),
                    PostData = BMF.EditModelFiller(Post_id)
                };
                Model.Tags = BMF.B_Tags_Filler(Convert.ToInt32(Model.PostData.Category));

                return(View(Model));
            }
            else
            {
                return(RedirectToAction("NotAccess", "MS"));
            }
        }
コード例 #4
0
        /// /////////////////////{ end : login }////////////////////////

        ////////////////////////{ start : blog }////////////////////////5
        ///مثال
        ////url = MS/blog?NamePage=post&page=1
        ////url = MS/blog?NamePage=Categories&Valuepage=اخبار پاندایی&page=1
        public ActionResult Blog(string Cat = "همه", int Page = 1, int Id = 0, string search = "")
        {
            PDBC   db = new PDBC("PandaMarketCMS", true);
            string SearchNAmeHeader = "تمامی مطالب";
            int    num = 1;

            db.Connect();
            if (Cat == "همه")
            {
                num = Convert.ToInt32(db.Select("SELECT Count(*) FROM [tbl_BLOG_Post]  where Is_Deleted=0 AND Is_Disabled=0").Rows[0][0]);
                db.DC();
            }
            else if (Cat == "دسته بندی")
            {
                num = Convert.ToInt32(db.Select("SELECT Count(*) FROM [tbl_BLOG_Post] where Is_Deleted=0 AND Is_Disabled=0 AND Cat_Id=" + Id).Rows[0][0]);
                using (DataTable dt2 = db.Select("SELECT [name] FROM  [tbl_BLOG_Categories] WHERE [Id] =" + Id))
                {
                    SearchNAmeHeader = dt2.Rows[0][0].ToString();
                }
                db.DC();
            }
            else if (Cat == "گروه بندی")
            {
                num = Convert.ToInt32(db.Select("SELECT Count(*) FROM [tbl_BLOG_Post] where Is_Deleted=0 AND Is_Disabled=0 AND [GroupId] = " + Id).Rows[0][0]);
                using (DataTable dt2 = db.Select("SELECT [name] FROM  [tbl_BLOG_Groups] WHERE [G_Id] =" + Id))
                {
                    SearchNAmeHeader = dt2.Rows[0][0].ToString();
                }
                db.DC();
            }
            else if (Cat == "برچسب")
            {
                num = Convert.ToInt32(db.Select("SELECT COUNT(*) FROM [tbl_BLOG_TagConnector] as A inner join [tbl_BLOG_Post] as B on A.Post_Id=B.Id where Is_Deleted=0 AND Is_Disabled=0 AND Tag_Id=" + Id).Rows[0][0]);
                using (DataTable dt2 = db.Select("SELECT [name] FROM  [tbl_BLOG_Tags] WHERE [Id] =" + Id))
                {
                    SearchNAmeHeader = dt2.Rows[0][0].ToString();
                }
                db.DC();
            }
            else if (Cat == "جست و جو")
            {
                num = Convert.ToInt32(db.Select("SELECT Count(*) FROM [tbl_BLOG_Post] where (Is_Deleted=0 AND Is_Disabled=0) AND (Title Like N'%" + search + "%' OR Text_min Like N'%" + search + "%' OR [Text] Like N'%" + search + "%') ").Rows[0][0]);
                db.DC();
            }

            if (num % 15 == 0)
            {
                num = (num / 15);
            }
            else
            {
                num = (num / 15) + 1;
            }



            Blog_ModelFiller BMF = new Blog_ModelFiller();
            var model            = new BlogPostsModel()
            {
                Categories         = BMF.BCategory_Filler(),
                Tags               = BMF.B_AllTags_Filler(),
                Posts              = BMF.UserPostModels(Cat, Page, Id, search),
                GroupsList         = BMF.C_AllTags_Filler(),
                Pages              = num,
                Page               = Page,
                Cat                = Cat,
                Id                 = Id,
                SearchNAmeHeaderH1 = SearchNAmeHeader
            };

            return(View(model));
        }