public ActionResult AdminStoriesExcel(string category, string subcategory, string rating, string market, string events, string searchname)
        {
            StoryBL            _storybl = new StoryBL();
            IList <StoryModel> stories  = _storybl.GetAll(category, subcategory, rating, market, events, searchname);

            StoryCategoryBL       _storycatbl = new StoryCategoryBL();
            StoryCategoryModel    _storycat;
            StorySubCategoryBL    _storysubcatbl = new StorySubCategoryBL();
            StorySubCategoryModel _storysubcat;
            StoryRatingBL         _ratingbl = new StoryRatingBL();
            StoryRatingModel      _rating;
            ProfileBL             _profilebl = new ProfileBL();
            ProfileModel          _profile;

            foreach (StoryModel m in stories)
            {
                decimal dCategory    = (m.STORY_CATEGORY == null ? 0 :(decimal)m.STORY_CATEGORY);
                decimal dsubCategory = (m.STORY_SUBCATEGORY == null ? 0 : (decimal)m.STORY_SUBCATEGORY);
                decimal dRating      = (m.STORY_RATING == null ? 0 : (decimal)m.STORY_RATING);

                _storycat     = _storycatbl.GetStoryCategoryModelByID(dCategory);
                _storysubcat  = _storysubcatbl.GetStorySubCategoryModelByID(dsubCategory);
                _rating       = _ratingbl.GetStoryRatingModelByID(dRating);
                _profile      = _profilebl.GetProfileByStarzId(m.STARS_ID);
                m.Category    = _storycat;
                m.SubCategory = _storysubcat;
                m.Rating      = _rating;
                m.Profile     = _profile;
            }
            return(PartialView(stories));
        }
        public ActionResult AdminStories(string search, string filter, int?page, string order, string asc)
        {
            ViewBag.homeid = "story";

            ViewBag.search = string.IsNullOrEmpty(search) ? "ALL" : search;
            ViewBag.filter = string.IsNullOrEmpty(filter) ? string.Empty : filter;
            ViewBag.page   = page ?? 1;
            int pag = page ?? 1;

            Session["cat"]         = (Session["cat"] == null? "":Session["cat"]);
            Session["subcat"]      = (Session["subcat"] == null ? "" : Session["subcat"]);
            Session["rating"]      = (Session["rating"] == null ? "" : Session["rating"]);
            Session["market"]      = (Session["market"] == null ? "" : Session["market"]);
            Session["event"]       = (Session["event"] == null ? "" : Session["event"]);
            Session["searchname"]  = (Session["searchname"] == null ? "" : Session["searchname"]);
            Session["checkall0"]   = (Session["checkall0"] == null ? "" : Session["checkall0"].ToString());
            Session["checkall100"] = (Session["checkall100"] == null ? "" : Session["checkall100"].ToString());
            Session["checkall300"] = (Session["checkall300"] == null ? "" : Session["checkall300"].ToString());
            if (Session["fromdate"] == null)
            {
                Session["fromdate"] = DateTime.Parse("01/01/2015").ToString("MM/dd/yyyy");
            }
            if (Session["todate"] == null)
            {
                Session["todate"] = DateTime.Today.ToString("MM/dd/yyyy");
            }

            string sCategory    = Session["cat"].ToString();
            string sSubCategory = Session["subcat"].ToString();
            string sRating      = Session["rating"].ToString();

            string   sMarket    = Session["market"].ToString();
            string   sEvent     = Session["event"].ToString();
            string   SearchName = Session["searchname"].ToString();
            DateTime fromDate   = DateTime.Parse(Session["fromdate"].ToString());
            DateTime toDate     = DateTime.Parse(Session["todate"].ToString());


            IPagedList <StoryModel> lstModel = _storybl.GetAll(sCategory, sSubCategory, sRating, sMarket, sEvent, SearchName, fromDate, toDate, pag, 10, order, asc);

            StorySubCategoryBL    _storysubcatbl = new StorySubCategoryBL();
            StorySubCategoryModel _storysubcat;
            StoryRatingBL         _storyratingbl = new StoryRatingBL();
            StoryRatingModel      _storyrating;

            foreach (StoryModel m in lstModel)
            {
                decimal dsubCategory = (m.STORY_SUBCATEGORY == null ? 0 : (decimal)m.STORY_SUBCATEGORY);
                decimal drating      = (m.STORY_RATING == null ? 0 : (decimal)m.STORY_RATING);

                _storysubcat = _storysubcatbl.GetStorySubCategoryModelByID(dsubCategory);
                _storyrating = _storyratingbl.GetStoryRatingModelByID(drating);

                m.SubCategory = _storysubcat;
                m.Rating      = _storyrating;
            }

            return(View(lstModel));
        }
        public PartialViewResult GetSelections()
        {
            ViewBag.homeid = "Story";

            StoryModel story = new StoryModel();

            StoryCategoryBL           _StoryCATBL        = new StoryCategoryBL();
            List <StoryCategoryModel> _StoreCategoryList = _StoryCATBL.GetAll();

            StorySubCategoryBL           _StorySubCATBL   = new StorySubCategoryBL();
            List <StorySubCategoryModel> _SubCategoryList = _StorySubCATBL.GetAll();

            StoryRatingBL           _StoryRatingBL   = new StoryRatingBL();
            List <StoryRatingModel> _StoreRatingList = _StoryRatingBL.GetAll();

            story.CategoryList    = _StoreCategoryList;
            story.SubCategoryList = _SubCategoryList;
            story.RatingList      = _StoreRatingList;
            return(PartialView("_Selections", story));
        }
            public StorySubCategoryListProvider(string defaultText = null)
            {
                if (!string.IsNullOrEmpty(defaultText))
                {
                    Add(string.Empty, defaultText);
                }

                StorySubCategoryBL _storesubcategory = new StorySubCategoryBL();

                List <StorySubCategoryModel> lst = _storesubcategory.GetAll();

                for (int i = 0; i < lst.Count; i++)
                {
                    StorySubCategoryModel item = new StorySubCategoryModel()
                    {
                        SEQ_NO       = lst.ElementAt(i).SEQ_NO,
                        SUB_CAT_NAME = lst.ElementAt(i).SUB_CAT_NAME
                    };
                    Add(item.SEQ_NO.ToString(), item.SUB_CAT_NAME);
                }
            }
        public ActionResult AdminStories(FormCollection frm, int?page, string order, string asc)
        {
            ViewBag.homeid = "story";

            string sCategory = (frm["Category"] == null ? "" : frm["Category"].ToString());

            string sSubCategory = (frm["subCategory"] == null ? "" : frm["subCategory"].ToString());

            string sRating = (frm["Rating"] == null ? "" : frm["Rating"].ToString());

            string   sMarket    = (frm["market"] == null || frm["market"] == "ALL" ? "" : frm["market"].ToString());
            string   sEvent     = (frm["event"] == null ? "" : frm["event"].ToString());
            string   SearchName = (frm["SearchName"] == null ? "" : frm["SearchName"].ToString());
            DateTime fromDate;
            DateTime toDate;

            if (frm["fromDate"] == null || frm["fromDate"] == "")
            {
                fromDate = DateTime.Parse("01/01/2015");
            }
            else
            {
                fromDate = DateTime.Parse(frm["fromDate"]);
            }
            if (frm["fromDate"] == null || frm["toDate"] == "")
            {
                toDate = DateTime.Today;
            }
            else
            {
                toDate = DateTime.Parse(frm["toDate"]);
            }
            //DateTime toDate = (frm["toDate"] == null && frm["toDate"] == "" ? DateTime.Parse("12/31/9999") : DateTime.Parse(frm["toDate"]));
            Session["checkall0"]   = (frm["checkall0"] == null ? "" : frm["checkall0"].ToString());
            Session["checkall100"] = (frm["checkall100"] == null ? "" : frm["checkall100"].ToString());
            Session["checkall300"] = (frm["checkall300"] == null ? "" : frm["checkall300"].ToString());

            Session["cat"]        = sCategory;
            Session["subcat"]     = sSubCategory;
            Session["rating"]     = sRating;
            Session["market"]     = sMarket;
            Session["event"]      = sEvent;
            Session["searchname"] = SearchName;
            Session["fromdate"]   = fromDate.ToString("MM/dd/yyyy");
            Session["todate"]     = toDate.ToString("MM/dd/yyyy");

            ViewBag.page = page ?? 1;
            int pag = page ?? 1;
            IPagedList <StoryModel> lstModel = _storybl.GetAll(sCategory, sSubCategory, sRating, sMarket, sEvent, SearchName, fromDate, toDate, pag, 10, order, asc);

            StorySubCategoryBL    _storysubcatbl = new StorySubCategoryBL();
            StorySubCategoryModel _storysubcat;
            StoryRatingBL         _storyratingbl = new StoryRatingBL();
            StoryRatingModel      _storyrating;

            foreach (StoryModel m in lstModel)
            {
                decimal dsubCategory = (m.STORY_SUBCATEGORY == null ? 0 : (decimal)m.STORY_SUBCATEGORY);
                decimal drating      = (m.STORY_RATING == null ? 0 : (decimal)m.STORY_RATING);

                _storysubcat = _storysubcatbl.GetStorySubCategoryModelByID(dsubCategory);
                _storyrating = _storyratingbl.GetStoryRatingModelByID(drating);

                m.SubCategory = _storysubcat;
                m.Rating      = _storyrating;
            }
            return(View("AdminStories", lstModel));
        }