public void MoveUp() { //if there are pages with the same parentID and a lower sort than me //subtract 3 from my sort and save it, then reset sort order on //all children of my parent by 2 starting from 1 //no need to look up whther pages above me, assume yes if my sort is > 1 if (this.PageOrder > 1) { //pages exist above me so update my page order this.PageOrder -= 3; PageSettings.UpdatePageOrder(this.PageId, this.PageOrder); //now get all children of my parent id and reset sort using current order ResortPages(); } else { if (this.PageOrder < 1) { this.PageOrder = 1; PageSettings.UpdatePageOrder(this.PageId, this.PageOrder); ResortPages(); } //else must be equal to 1 no need to do anything } }
public void MoveDown() { this.PageOrder += 3; PageSettings.UpdatePageOrder(this.PageId, this.PageOrder); //now get all children of my parent id and reset sort using current order ResortPages(); }
public void MoveToBottom() { this.pageOrder = 999999; PageSettings.UpdatePageOrder(this.pageID, this.pageOrder); //now get all children of my parent id and reset sort using current order ResortPages(); }
public void ResortPages() { int i = 1; DataTable table = GetChildPageIds(); foreach (DataRow row in table.Rows) { int pageID = Convert.ToInt32(row["PageID"]); PageSettings.UpdatePageOrder(pageID, i); i += 2; } }
public void ResortPagesAlphabetically() { int i = 1; DataTable dataTable = new DataTable(); using (IDataReader reader = PageSettings.GetChildPagesSortedAlphabetic(SiteId, PageId)) { dataTable.Load(reader); } foreach (DataRow row in dataTable.Rows) { int pageID = Convert.ToInt32(row["PageID"]); PageSettings.UpdatePageOrder(pageID, i); i += 2; } }