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);
 }
        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í";
     }
 }
Example #5
0
        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";
            }
        }
Example #7
0
        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ị";
            }
        }
Example #8
0
 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ị";
            }
        }