private void SortGridView(string sortExpression, string direction) { objPreTool = new ToolBarPresenter(this); //Get the Favorites from session objUserInfo = (UserInfo)Session["objUserInfo"]; //objPreTool.getFavorites(objUserInfo.FavList); objPreTool.getFavorites(); DataView dv = new DataView(dtFavorites); dv.Sort = sortExpression + " " + direction; gvFavorites.DataSource = dv; gvFavorites.DataBind(); DataTable dt = dv.ToTable(); if (objUserInfo != null) { objUserInfo.DtFavorites = dt; Session["objUserInfo"] = objUserInfo; } //favorites.Attributes["class"] = "show"; if (hdnGridImages_Status != null) { favorites.Attributes.Add("class", hdnGridImages_Status.Value); } }
//Method to fetch the favourites from DB for a particualr user protected void getFavorites() { string strUserName = string.Empty; try { objPreTool = new ToolBarPresenter(this); objPreTool.getCultureCode(); objUserInfo = (UserInfo)Session["objUserInfo"]; if (objUserInfo != null) { objPreTool.getFavorites(); } } catch (Exception ex) { AgriCastException currEx = new AgriCastException(objServicePre.GetServiceDetails(), ex); AgriCastLogger.Publish(currEx, AgriCastLogger.LogType.Error); HttpContext.Current.Session["ErrorMessage"] = objPreTool.getTranslatedText(Constants.FAVORITE_GENERIC_FAILURE, strCulCode) + ex.Message.ToString(); } }