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); } DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.GetAllNodes().Where(item => Object.Equals(item.GetValue("id").ToString(), SearchID.ToString())).FirstOrDefault(); if (node != null) { Response.Redirect(string.Format("{0}?key={1}", Request.Url.AbsolutePath, node.Key.ToString())); } else { Response.Redirect(Request.Url.AbsolutePath); } } else { return; } }
void SelectParentNode(DevExpress.Web.ASPxTreeList.TreeListNode Node) { if (Node.ParentNode != null && Node.ParentNode != PermissionsTree.RootNode) { Node.ParentNode.Selected = true; SelectParentNode(Node.ParentNode); } }
public void FocusAndExpandToNode(DevExpress.Web.ASPxTreeList.TreeListNode node) { node.Focus(); node.Expanded = true; while (node.ParentNode != null) { node = node.ParentNode; node.Expanded = true; } }
private Boolean FindNodeTreeList(string key) { DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { node.Focus(); return(true); } return(false); }
void UnselectChildren(DevExpress.Web.ASPxTreeList.TreeListNode Node) { foreach (DevExpress.Web.ASPxTreeList.TreeListNode Child in Node.ChildNodes) { Child.Selected = false; if (Child.ChildNodes.Count > 0) { UnselectChildren(Child); } } }
private void ASPxTreeList_ViTri_CustomDataCallback(object sender, TreeListCustomDataCallbackEventArgs e) { string key = e.Argument.ToString(); DevExpress.Web.ASPxTreeList.TreeListNode node = ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { e.Result = Request.Url.AbsolutePath + "?key=" + key; } else { e.Result = Request.Url.AbsolutePath; } }
public void LoadData() { listViTriHienThi = ViTriHienThi.getAll(); if (listViTriHienThi.Count > 0) { infotr.Visible = true; ucTreeViTri.CreateTreeList(); ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi; ucTreeViTri.ASPxTreeList_ViTri.DataBind(); SearchFunction(); ClearData(); if (Request.QueryString["key"] != null) { infotd.Visible = true; string key = ""; try { key = Request.QueryString["key"].ToString(); } catch { Response.Redirect(Request.Url.AbsolutePath); } DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { ucTreeViTri.FocusAndExpandToNode(node); LoadFocusedNodeData(); } else { Response.Redirect(Request.Url.AbsolutePath); } } else { ChuaChonViTri.Visible = true; DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(""); node.Focus(); ucWarning_ChuaChonViTri.LabelInfo.Text = "Chưa chọn vị trí"; } } else { KhongCoDuLieu.Visible = true; ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có vị trí"; } }
public void LoadData() { listViTriHienThi = ViTriHienThi.getAll(); if (listViTriHienThi.Count > 0) { _ucTreeViTri.CreateTreeList(); _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi; _ucTreeViTri.ASPxTreeList_ViTri.DataBind(); SearchFunction(); Panel_Chinh.Visible = true; ClearData(); if (Request.QueryString["key"] != null) { string key = ""; try { key = Request.QueryString["key"].ToString(); } catch { Response.Redirect(Request.Url.AbsolutePath); } DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { _ucTreeViTri.FocusAndExpandToNode(node); LoadFocusedNodeData(); Panel_ThongTinViTri.Visible = true; } else { Response.Redirect(Request.Url.AbsolutePath); } } else { DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(""); node.Focus(); Label_ChuaChon.Visible = true; Label_ChuaChon.Text = "Chưa chọn vị trí"; } } else { ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true; ucThongBaoLoi.Label_ThongBaoLoi.Text = "Chưa có vị trí"; } }
void tree_HtmlRowPrepared(object sender, TreeListHtmlRowEventArgs e) { if (e.RowKind == TreeListRowKind.Data) { DevExpress.Web.ASPxTreeList.TreeListNode node = tree.FindNodeByKeyValue(e.NodeKey); if (!node.HasChildren) { e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='lightgray';this.style.cursor='pointer'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';"); } else { e.Row.BackColor = System.Drawing.Color.Gray; e.Row.Font.Bold = true; } } }
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; } }
protected override void PrepareControlHierarchy() { base.PrepareControlHierarchy(); if (!Page.IsCallback) { tree.DataBind(); DevExpress.Web.ASPxTreeList.TreeListNode node = null; if (SelectedValueID > 0) { node = tree.FindNodeByKeyValue(SelectedValueID.ToString()); } if (node != null) { hddData.Set(HKEY_ID, SelectedValueID); bteTextInput.Text = string.Empty;// node.DataItem } else { hddData.Set(HKEY_ID, 0); bteTextInput.Text = string.Empty; } } }
public void LoadData() { if (Convert.ToString(Session["Username"]).Equals(String.Empty)) { DangNhap.Visible = true; } else { DangNhap.Visible = false; listDonVi = Permission.getAll <TSCD.Entities.DonVi>(Permission._VIEW).OrderBy(c => c.ten).ToList(); if (listDonVi.Count > 0) { infotr.Visible = true; _ucTreeViTri.CreateTreeList(); if (!IsPostBack) { TreeListTextColumn _TreeListTextColumn = new TreeListTextColumn(); _ucTreeViTri.Label_TenViTri.Text = "Danh sách đơn vị"; TreeListDataColumn colDonvi = new TreeListDataColumn("ten", "Đơn vị"); _ucTreeViTri.ASPxTreeList_ViTri.Columns.Add(colDonvi); } _ucTreeViTri.ASPxTreeList_ViTri.SettingsBehavior.ColumnResizeMode = ColumnResizeMode.Control; _ucTreeViTri.ASPxTreeList_ViTri.Width = Unit.Percentage(100); //_ucTreeViTri.ASPxTreeList_ViTri.Settings.ShowColumnHeaders = true; //_ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.Mode = TreeListPagerMode.ShowPager; //_ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.PageSize = 10; //_ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.NextPageButton.Visible = false; //_ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.LastPageButton.Visible = false; //_ucTreeViTri.ASPxTreeList_ViTri.Settings.ShowColumnHeaders = true; _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listDonVi; _ucTreeViTri.ASPxTreeList_ViTri.DataBind(); if (Request.QueryString["key"] != null) { if (Session["DangMo"] != null) { LinkButton_ThuLai.Visible = true; LinkButton_MoRa.Visible = false; tdvitri.Visible = true; } else { LinkButton_ThuLai.Visible = false; LinkButton_MoRa.Visible = true; tdvitri.Visible = false; } infotd.Visible = true; string key = ""; try { key = Request.QueryString["key"].ToString(); } catch { Response.Redirect(Request.Url.AbsolutePath); } DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { _ucTreeViTri.FocusAndExpandToNode(node); LoadFocusedNodeData(); } else { Response.Redirect(Request.Url.AbsolutePath); } } else { DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(""); node.Focus(); ChuaChonViTri.Visible = true; ucWarning_ChuaChon.LabelInfo.Text = "Chưa chọn đơn vị"; ClearData(); } } else { KhongCoDuLieu.Visible = true; ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có đơn vị"; } } }
public void LoadData() { listLoaiTaiSan = TSCD.Entities.LoaiTaiSan.getAll(); if (listLoaiTaiSan.Count > 0) { infotr.Visible = true; ucTreeViTri.CreateTreeList(); //if (!IsPostBack) //{ // //TreeListDataColumn coldonvitinh = new TreeListDataColumn("donvitinh.ten", "Đơn vị tính"); // //ucTreeViTri.ASPxTreeList_ViTri.Columns.Add(coldonvitinh); // //TreeListCheckColumn colloaitaisanhuuhinh = new TreeListCheckColumn(); // //colloaitaisanhuuhinh.FieldName = "huuhinh"; // //colloaitaisanhuuhinh.Caption = "Loại tài sản hữu hình"; // //ucTreeViTri.ASPxTreeList_ViTri.Columns.Add(colloaitaisanhuuhinh); //} //ucTreeViTri.ASPxTreeList_ViTri.Settings.ShowColumnHeaders = true; //ucTreeViTri.ASPxTreeList_ViTri.SettingsBehavior.ColumnResizeMode = ColumnResizeMode.Control; //ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.Mode = TreeListPagerMode.ShowPager; //ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.PageSize = 10; //ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.NextPageButton.Visible = false; //ucTreeViTri.ASPxTreeList_ViTri.SettingsPager.LastPageButton.Visible = false; ucTreeViTri.ASPxTreeList_ViTri.DataSource = listLoaiTaiSan; ucTreeViTri.ASPxTreeList_ViTri.DataBind(); SearchFunction(); ClearData(); if (Request.QueryString["key"] != null) { infotd.Visible = true; string key = ""; try { key = Request.QueryString["key"].ToString(); } catch { Response.Redirect(Request.Url.AbsolutePath); } DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { ucTreeViTri.FocusAndExpandToNode(node); LoadFocusedNodeData(); } else { Response.Redirect(Request.Url.AbsolutePath); } } else { ChuaChon.Visible = true; DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(""); node.Focus(); ucWarning_ChuaChon.LabelInfo.Text = "Chưa chọn loại tài sản"; } } else { KhongCoDuLieu.Visible = true; ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có loại tài sản"; } }
public void LoadData() { listThietBi = PTB.Entities.ThietBi.getAll(); if (listThietBi.Count > 0) { CreateNode(); SearchFunction(); if (Convert.ToString(Page.Session["ShowInfo"]) == "1") { PanelChangePage.Visible = false; Session["ShowInfo"] = null; } Panel_Chinh.Visible = true; if (Request.QueryString["key"] != null) { try { key = Request.QueryString["key"].ToString(); } catch { Response.Redirect(Request.Url.AbsolutePath); } DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { _ucTreeViTri.FocusAndExpandToNode(node); LoadFocusedNodeData(); } else { Response.Redirect(Request.Url.AbsolutePath); } if (Request.QueryString["id"] != null) { idThietBi = Guid.Empty; try { idThietBi = GUID.From(Request.QueryString["id"]); } catch { Response.Redirect(Request.Url.AbsolutePath); } objThietBi = PTB.Entities.ThietBi.getById(idThietBi); if (objThietBi != null) { Panel_ThietBi.Visible = true; Label_ThietBi.Visible = false; Label_ThietBi.Text = ""; Label_ThongTinThietBi.Text = "Thông tin " + objThietBi.ten; Libraries.ImageHelper.LoadImageWeb(objThietBi.hinhanhs.ToList(), _ucASPxImageSlider_Web.ASPxImageSlider_Object); _ucASPxImageSlider_Web.urlHinhAnh = string.Format("http://{0}/HinhAnh.aspx?id={1}&type=THIETBI", HttpContext.Current.Request.Url.Authority, objThietBi.id); Label_MaThietBi.Text = objThietBi.subId; Session["TenThietBi"] = Label_TenThietBi.Text = objThietBi.ten; Label_LoaiThietBi.Text = objThietBi.loaithietbi != null ? objThietBi.loaithietbi.ten : ""; Label_NgayMua.Text = objThietBi.ngaymua != null?objThietBi.ngaymua.ToString() : ""; Label_MoTa.Text = Libraries.StringHelper.ConvertRNToBR(objThietBi.mota); } else { Response.Redirect(Request.Url.AbsolutePath); } } else { Label_ThietBi.Visible = true; Label_ThietBi.Text = "Chưa chọn thiết bị"; } } else { DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(""); node.Focus(); Label_TextDanhSachThietBi.Text = "Chưa chọn loại thiết bị"; Label_ThietBi.Visible = true; Label_ThietBi.Text = "Chưa chọn thiết bị"; } } else { ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true; ucThongBaoLoi.Label_ThongBaoLoi.Text = "Chưa có thiết bị"; } }
public void LoadData() { if (Convert.ToString(Session["Username"]).Equals(String.Empty)) { DangNhap.Visible = true; } else { DangNhap.Visible = false; listDonVi = Permission.getAll <TSCD.Entities.DonVi>(Permission._VIEW).OrderBy(c => c.ten).ToList(); if (listDonVi.Count > 0) { TreeViTri.Visible = true; if (listDonVi.Count > 0) { ucTreeViTri.CreateTreeList(); ucTreeViTri.ASPxTreeList_ViTri.DataSource = listDonVi; ucTreeViTri.ASPxTreeList_ViTri.DataBind(); SearchFunction(); if (Request.QueryString["key"] != null) { DanhSach.Visible = true; TreeViTri.Visible = false; key = ""; try { key = Request.QueryString["key"].ToString(); } catch { Response.Redirect(Request.Url.AbsolutePath); } DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { Guid idDonVi; ucDonViTaiSan_BreadCrumb.Label_Ten.Text = node.GetValue("ten").ToString(); if (Request.QueryString["id"] != null) { ThongTin.Visible = true; idTaiSan = Guid.Empty; try { idTaiSan = GUID.From(Request.QueryString["id"]); } catch { Response.Redirect(Request.Url.AbsolutePath); } TaiSanHienThi obj = TaiSanHienThi.Convert(TSCD.Entities.CTTaiSan.getQuery().Where(c => c.id == idTaiSan)).FirstOrDefault(); if (obj != null) { ucDonViTaiSan_BreadCrumb.Label_Ten.Text = obj.ten; Label_NgaySuDung.Text = ((DateTime)obj.ngay).ToString("d/M/yyyy"); Label_SoHieu.Text = obj.sohieu_ct; Label_NgayThang.Text = ((DateTime)obj.ngay_ct).ToString("d/M/yyyy"); Label_TenTaiSan.Text = obj.ten; Label_DonViTinh.Text = obj.donvitinh; Label_SoLuong.Text = obj.soluong.ToString(); Label_DonGia.Text = obj.dongia.ToString("#,# VNĐ"); Label_ThanhTien.Text = obj.thanhtien.ToString("#,# VNĐ"); Label_NuocSanXuat.Text = obj.nuocsx; Label_NguonGoc.Text = obj.nguongoc; Label_TinhTrang.Text = obj.tinhtrang; Label_Phong.Text = obj.phong; Label_ViTri.Text = obj.vitri; Label_DonViQuanLy.Text = obj.dvquanly; Label_DonViSuDung.Text = obj.dvsudung; Label_GhiChu.Text = StringHelper.ConvertRNToBR(obj.ghichu); } else { Response.Redirect(Request.Url.AbsolutePath); } } Guid _iddonvi = GUID.From(node.GetValue("id")); TSCD.Entities.DonVi objDonVi = TSCD.Entities.DonVi.getById(_iddonvi); ucDonViTaiSan_BreadCrumb.Label_Ten.Text = objDonVi.ten; List <TaiSanHienThi> listCTTaiSan = TaiSanHienThi.Convert(objDonVi.getAllCTTaiSanRecursive()); LoadDanhSachTaiSan(listCTTaiSan); } else { Response.Redirect(Request.Url.AbsolutePath); } } else { DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(""); node.Focus(); } } else { KhongCoDuLieu.Visible = true; ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có tài sản"; } } else { KhongCoDuLieu.Visible = true; ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có tài sản"; } } }
public void LoadData() { listThietBi = PTB.Entities.ThietBi.getAll(); if (listThietBi.Count > 0) { CreateNode(); SearchFunction(); if (Request.QueryString["key"] != null) { try { key = Request.QueryString["key"].ToString(); DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key); if (node != null) { node.Focus(); LoadFocusedNodeData(); } else { Response.Redirect(Request.Url.AbsolutePath); } } catch { Response.Redirect(Request.Url.AbsolutePath); } } else { DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(""); node.Focus(); Label_TextDanhSachThietBi.Text = "Chưa chọn loại thiết bị"; } if (Request.QueryString["id"] != null) { idThietBi = Guid.Empty; try { idThietBi = GUID.From(Request.QueryString["id"]); } catch { Response.Redirect(Request.Url.AbsolutePath); return; } objThietBi = PTB.Entities.ThietBi.getById(idThietBi); if (objThietBi != null) { Panel_ThongTinObj.Visible = true; Panel_TreeList.Visible = false; Label_ThongTinThietBi.Text = "Thông tin " + objThietBi.ten; Libraries.ImageHelper.LoadImageWeb(objThietBi.hinhanhs.ToList(), _ucASPxImageSlider_Mobile.ASPxImageSlider_Object); Label_MaThietBi.Text = objThietBi.subId; Session["TenThietBi"] = Label_TenThietBi.Text = objThietBi.ten; Label_LoaiThietBi.Text = objThietBi.loaithietbi != null ? objThietBi.loaithietbi.ten : ""; Label_NgayMua.Text = objThietBi.ngaymua != null?objThietBi.ngaymua.ToString() : ""; Label_MoTa.Text = Libraries.StringHelper.ConvertRNToBR(objThietBi.mota); } else { Response.Redirect(Request.Url.AbsolutePath); } } else { Panel_TreeList.Visible = true; } } else { ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true; ucThongBaoLoi.Label_ThongBaoLoi.Text = "Chưa có thiết bị"; } }