/// <summary> /// Obtain child pages. /// </summary> /// <param name="pageList">List of PageEntity class.</param> /// <param name="parent">Object of PageEntity class. </param> /// <param name="lstPages">List of PageEntity class</param> public static void GetChildPages(ref List<PageEntity> pageList, PageEntity parent, List<PageEntity> lstPages) { foreach (PageEntity obj in lstPages) { if (obj.ParentID == parent.PageID) { obj.PageNameWithoughtPrefix = obj.PageName; obj.Prefix = GetPrefix(obj.Level); obj.PageName = obj.Prefix + obj.PageName; pageList.Add(obj); GetChildPages(ref pageList, obj, lstPages); } } }
/// <summary> /// Add update page. /// </summary> /// <param name="objPage">Object of PageEntity class.</param> public int AddUpdatePages(PageEntity objPage) { int pageID = 0; try { PageDataProvider objProvider = new PageDataProvider(); pageID = objProvider.AddUpdatePages(objPage); //For SEO Meta Data if (objPage.PageID == 0 && objPage.IsAdmin == false) { List <SEOMetaValues> metaValues = new List <SEOMetaValues>(); SEOMetaValues title = new SEOMetaValues(); title.SEOMetaTagTypeID = 1; title.MetaTagContent = objPage.PageName; metaValues.Add(title); SEOMetaValues desc = new SEOMetaValues(); desc.SEOMetaTagTypeID = 2; desc.MetaTagContent = objPage.Description; metaValues.Add(desc); SEOMetaValues image = new SEOMetaValues(); image.SEOMetaTagTypeID = 4; image.MetaTagContent = string.Empty; metaValues.Add(image); SEOMetaValues type = new SEOMetaValues(); type.SEOMetaTagTypeID = 5; type.MetaTagContent = string.Empty; metaValues.Add(type); SEOController seoContrl = new SEOController(); seoContrl.SaveSEOMetaTag(pageID, metaValues, objPage.PortalID, objPage.AddedBy); } } catch (Exception e) { throw e; } return(pageID); }
public void AddUpdatePages(PageEntity objPage) { SQLHandler sqlH = new SQLHandler(); SqlTransaction tran = (SqlTransaction)sqlH.GetTransaction(); try { List <KeyValuePair <string, object> > ParaMeterCollection = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>( "@PageID", objPage.PageID), new KeyValuePair <string, object>( "@PageOrder", objPage.PageOrder), new KeyValuePair <string, object>( "@PageName", objPage.PageName.ToString()), new KeyValuePair <string, object>( "@IsVisible", objPage.IsVisible), new KeyValuePair <string, object>( "@ParentID", objPage.ParentID), new KeyValuePair <string, object>( "@IconFile", objPage.IconFile.ToString()), new KeyValuePair <string, object>( "@DisableLink", objPage.DisableLink), new KeyValuePair <string, object>( "@Title", objPage.Title.ToString()), new KeyValuePair <string, object>( "@Description", objPage.Description.ToString()), new KeyValuePair <string, object>( "@KeyWords", objPage.KeyWords.ToString()), new KeyValuePair <string, object>( "@Url", objPage.Url.ToString()), new KeyValuePair <string, object>( "@StartDate", objPage.StartDate.ToString()), new KeyValuePair <string, object>( "@EndDate", objPage.EndDate.ToString()), new KeyValuePair <string, object>( "@RefreshInterval", objPage.RefreshInterval), new KeyValuePair <string, object>( "@PageHeadText", objPage.PageHeadText.ToString()), new KeyValuePair <string, object>( "@IsSecure", objPage.IsSecure), new KeyValuePair <string, object>( "@IsActive", objPage.IsActive), new KeyValuePair <string, object>( "@IsShowInFooter", objPage.IsShowInFooter), new KeyValuePair <string, object>( "@IsRequiredPage", objPage.IsRequiredPage), new KeyValuePair <string, object>( "@BeforeID", objPage.BeforeID), new KeyValuePair <string, object>( "@AfterID", objPage.AfterID), new KeyValuePair <string, object>( "@PortalID", objPage.PortalID), new KeyValuePair <string, object>( "@AddedBy", objPage.AddedBy.ToString()), new KeyValuePair <string, object>( "@IsAdmin", objPage.IsAdmin), }; int pageID = 0; pageID = sqlH.ExecuteNonQuery(tran, CommandType.StoredProcedure, "sp_AddUpdatePage", ParaMeterCollection, "@InsertedPageID"); if (pageID > 0) { // objPage.PortalID = objPage.PortalID == -1 ? 1 : objPage.PortalID; AddUpdatePagePermission(objPage.LstPagePermission, tran, pageID, objPage.PortalID, objPage.AddedBy, objPage.IsAdmin); if (!objPage.IsAdmin) { if (objPage.Mode == "A") { MenuPageUpdate(objPage.MenuList, tran, pageID); } } if (objPage.MenuList != "0") { AddUpdateSelectedMenu(objPage.MenuList, tran, pageID, objPage.ParentID, objPage.Mode, objPage.Caption, objPage.PortalID, objPage.UpdateLabel); } } tran.Commit(); } catch (SqlException sqlEx) { tran.Rollback(); throw sqlEx; } catch (Exception ex) { throw ex; } }