public List <ArticleCat> GridBind() { try { List <ArticleCat> lA = new List <ArticleCat>(); foreach (var item in _ctx.SBH_TM_ARTICLE_CAT .Where(x => x.ROW_STATUS == fn.fg.IsActive)) { ArticleCat oA = new ArticleCat(); oA.ID = item.ID; oA.ARTICLE_CAT_DESC = item.ARTICLE_CAT_DESC; oA.CREATED_TIME = item.CREATED_TIME; oA.CREATED_BY = item.CREATED_BY; oA.LAST_MODIFIED_TIME = item.LAST_MODIFIED_TIME; oA.LAST_MODIFIED_BY = item.LAST_MODIFIED_BY; oA.ROW_STATUS = item.ROW_STATUS; lA.Add(oA); } return(lA); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool Add(ArticleCat art) { bool res = false; try { SBH_TM_ARTICLE_CAT a = new SBH_TM_ARTICLE_CAT() { ID = art.ID, ARTICLE_CAT_DESC = art.ARTICLE_CAT_DESC, CREATED_TIME = DateTime.Now, CREATED_BY = "System", ROW_STATUS = fn.fg.IsActive }; _ctx.SBH_TM_ARTICLE_CAT.Add(a); _ctx.SaveChanges(); res = true; } catch (Exception ex) { throw new Exception(ex.Message); } return(res); }
public bool Edit(int id, ArticleCat art) { bool res = false; try { SBH_TM_ARTICLE_CAT a = _ctx.SBH_TM_ARTICLE_CAT.Find(id); if (a != null) { a.ID = art.ID; a.ARTICLE_CAT_DESC = art.ARTICLE_CAT_DESC; a.LAST_MODIFIED_TIME = DateTime.Now; a.LAST_MODIFIED_BY = "System"; _ctx.Entry(a).State = System.Data.Entity.EntityState.Modified; _ctx.SaveChanges(); res = true; } } catch (Exception ex) { throw new Exception(ex.Message); } return(res); }
public ArticleCat Retrived(int id) { try { ArticleCat oA = new ArticleCat(); SBH_TM_ARTICLE_CAT oB = _ctx.SBH_TM_ARTICLE_CAT .Where(x => x.ROW_STATUS == fn.fg.IsActive && x.ID == id).FirstOrDefault(); if (oB != null) { oA.ID = oB.ID; oA.ARTICLE_CAT_DESC = oB.ARTICLE_CAT_DESC; oA.CREATED_TIME = oB.CREATED_TIME; oA.CREATED_BY = oB.CREATED_BY; oA.LAST_MODIFIED_TIME = oB.LAST_MODIFIED_TIME; oA.LAST_MODIFIED_BY = oB.LAST_MODIFIED_BY; oA.ROW_STATUS = oB.ROW_STATUS; return(oA); } else { return(null); } } catch (Exception ex) { return(null); throw new Exception(ex.Message); } }
private void BindList() { CatId = (int)Util.Val(Request.QueryString["catid"]); OrderBy = (int)Util.Val(Request.QueryString["ob"]); SortBy = (int)Util.Val(Request.QueryString["sb"]); //Get the current file path string ParamURL = Request.CurrentExecutionFilePath + "?&catid=" + CatId; int GetPage = (int)Util.Val(Request.QueryString["page"]); int iPage; if (string.IsNullOrEmpty(this.Request.QueryString["page"])) { iPage = 1; //If request pageindex is empty, assign pageindex of 1 = 1st page } else { iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value } //Initialize pagesize and pageindex int PageSize = pagerlinks.DefaultPageSize; int PageIndex = iPage; try { //Get category datasource object ArticleCategoryProvider GetCategory = new ArticleCategoryProvider(CatId, OrderBy, SortBy, PageIndex, PageSize); //Instantiate pager link object pagerlinks Pager = new pagerlinks(PageIndex, PageSize, GetCategory.RecordCount, PlaceHolder1); string artcatname; artcatname = GetCategory.Category; lbcatname.Text = GetCategory.Category; lbcount.Text = "(" + GetCategory.RecordCount.ToString() + ")"; //Display numeric pager link lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage); //Display the top right corner pager counter lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging; //Display the bottom pager counter lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging; ArticleCat.DataSource = GetCategory.GetCategories(); ArticleCat.DataBind(); //Release allocated memory GetCategory = null; Pager = null; } catch { } }
public Uri CatPublicUrl(ArticleCat cat, int page = 1) { var url = CatUrl(cat) + "/" + cat.Url; if (page > 1) { url += $"/page/{page}"; } return(GetUrl(ArticlesRoutesEnum.ArticlePage, new { parentUrl = cat.Parent.ParentUrl, url })); }
private static string CatUrl(ArticleCat cat) { var urls = new SortedList <int, string>(); var i = 0; while (cat != null) { urls.Add(i, cat.Url); i++; cat = cat.ParentCat; } return(string.Join("/", urls.Reverse().Select(x => x.Value).ToArray())); }
//Handles show edit article listing private void ShowEditArticleListing() { //Instantiate sql params object Blogic myBL = new Blogic(); //Instantiate validation Utility Util = new Utility(); int CatId; CatId = (int)Util.Val(Request.QueryString["catid"]); if (string.IsNullOrEmpty(this.Request.QueryString["catid"])) { Panel1.Visible = false; } else { Panel1.Visible = true; try { IDataReader dr = myBL.GetArticleCategory(CatId, 3); //3 = Category OrderBy Name. dr.Read(); lbcatname.Text = dr["CAT_NAME"].ToString(); dr.Close(); ArticleCat.DataSource = myBL.GetArticleCategory(CatId, 3); //3 = Category OrderBy Name. ArticleCat.DataBind(); } catch { Error.Text = "No Record Found."; return; } //Release allocated memory myBL = null; Util = null; } }
public ArticleCatViewModel(BaseViewModelConfig config, ArticleCat articleCat) : base(config) { ArticleCat = articleCat; }
private void BindList() { CatId = (int)Util.Val(Request.QueryString["catid"]); strKeyword = Request.QueryString["find"].ToString(); OrderBy = (int)Util.Val(Request.QueryString["ob"]); SortBy = (int)Util.Val(Request.QueryString["sb"]); //Get the current file path string ParamURL = Request.CurrentExecutionFilePath + "?find=" + strKeyword + "&catid=" + CatId; int GetPage = (int)Util.Val(Request.QueryString["page"]); int iPage; if (string.IsNullOrEmpty(this.Request.QueryString["page"])) { iPage = 1; //If request pageindex is empty, assign pageindex of 1 = 1st page } else { iPage = (int)Util.Val(Request.QueryString["page"]); //Grab the querystring pageindex value } //Initialize pagesize and page index int PageSize = pagerlinks.DefaultPageSize; int PageIndex = iPage; try { //Get category datasource object ArticleSearchProvider GetArticle = new ArticleSearchProvider(strKeyword, CatId, OrderBy, SortBy, PageIndex, PageSize); //Instantiate pager link object pagerlinks Pager = new pagerlinks(PageIndex, PageSize, GetArticle.RecordCount, PlaceHolder1); string strSearchIn; if (CatId == 0) { strSearchIn = "in all category."; } else { strSearchIn = "in <b>" + GetArticle.Category + "</b> category."; } //Get recipe count in category and assign it to the labale lbcount.Text = "(" + GetArticle.RecordCount.ToString() + ") recipes found for keyword (<b>" + strKeyword + "</b>) " + strSearchIn; //Display numeric pager link lbPagerLink.Text = Pager.DisplayNumericPagerLink(ParamURL, OrderBy, SortBy, GetPage); //Display the top right corner pager counter lblRecpagetop.Text = Pager.GetTopRightPagerCounterCustomPaging; //Display the bottom pager counter lblRecpage.Text = Pager.GetBottomPagerCounterCustomPaging; //Bind Generic List to a repeater ArticleCat.DataSource = GetArticle.GetArticleSearchResult(); ArticleCat.DataBind(); //Release allocated memory GetArticle = null; Pager = null; } catch { lblNorecordFound.Visible = true; lblNorecordFound.Text = " No Article Found for the keyword (" + strKeyword + "). Please try again."; } }
public async Task <IEnumerable <Article> > GetLastArticles(ArticleCat cat, int count = 5) { return((await Mediator.Send(new GetCategoryArticlesQuery { Cat = cat, PageSize = count })).models); }