private void SearchFunction() { if (Request.QueryString["Search"] != null) { Guid SearchID = Guid.Empty; try { SearchID = GUID.From(Request.QueryString["Search"]); } catch { Response.Redirect(Request.Url.AbsolutePath); } TSCD.Entities.CTTaiSan CTTaiSanSearch = TSCD.Entities.CTTaiSan.getById(SearchID); if (CTTaiSanSearch != null) { Guid nodeGuid = GUID.From(CTTaiSanSearch.donviquanly_id); DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.GetAllNodes().Where(item => Object.Equals(item.GetValue("id").ToString(), nodeGuid.ToString())).FirstOrDefault(); if (node != null) { int Page = SearchPage(nodeGuid, SearchID); if (Page != -1) { Response.Redirect(string.Format("{0}?key={1}&id={2}&Page={3}", Request.Url.AbsolutePath, node.Key.ToString(), SearchID.ToString(), Page.ToString())); } else { Response.Redirect(Request.Url.AbsolutePath); } } else { Response.Redirect(Request.Url.AbsolutePath); } } else { Response.Redirect(Request.Url.AbsolutePath); } } else { return; } }
public IQueryable <CTTaiSan> getAllCTTaiSanRecursive_All(Boolean included_root_in_result = true) { List <Guid> tmp = this.getAllChildsRecursive(true).Select(c => c.id).ToList(); return(CTTaiSan.getQuery().Where(c => ((c.donviquanly != null && tmp.Contains(c.donviquanly.id)) || (c.donvisudung != null && tmp.Contains(c.donvisudung.id))))); }
/// <summary> /// Lấy tất cả đám con cháu CTTaiSan thuộc về Đơn vị này /// </summary> /// <returns></returns> public IQueryable <CTTaiSan> getAllCTTaiSanRecursive() { List <Guid> tmp = this.getAllChildsRecursive(true).Select(c => c.id).ToList(); return(CTTaiSan.getQuery().Where(c => c.soluong > 0 && ((c.donviquanly != null && tmp.Contains(c.donviquanly.id)) || (c.donvisudung != null && tmp.Contains(c.donvisudung.id))))); }