public void loadData()
 {
     try
     {
         List <DonVi> list    = DonVi.getQuery().OrderBy(c => c.parent_id).ThenBy(c => c.ten).ToList();
         DonVi        objNULL = new DonVi();
         objNULL.id     = Guid.Empty;
         objNULL.ten    = "[Không có đơn vị]";
         objNULL.parent = null;
         list.Insert(0, objNULL);
         ucComboBoxDonVi1.DataSource = list;
         ucComboBoxViTri1.init(false, true);
         List <ViTriHienThi> listPhong    = ViTriHienThi.getAllHavePhong();
         ViTriHienThi        objPhongNULL = new ViTriHienThi();
         objPhongNULL.id        = Guid.Empty;
         objPhongNULL.ten       = "[Không có phòng]";
         objPhongNULL.loai      = typeof(Phong).Name;
         objPhongNULL.parent_id = Guid.Empty;
         listPhong.Insert(0, objPhongNULL);
         ucComboBoxViTri1.DataSource = listPhong;
         List <ViTriHienThi> listViTri    = ViTriHienThi.getAll();
         ViTriHienThi        objViTriNULL = new ViTriHienThi();
         objViTriNULL.id        = Guid.Empty;
         objViTriNULL.ten       = "[Không có vị trí]";
         objViTriNULL.loai      = typeof(CoSo).Name;
         objViTriNULL.parent_id = Guid.Empty;
         listViTri.Insert(0, objViTriNULL);
         ucComboBoxViTri2.DataSource = listViTri;
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->loadData:" + ex.Message);
     }
 }
 // Load dữ liệu
 public void loadData(Phong obj = null)
 {
     try
     {
         layout.load(gridViewCTThietBi);
         working = false;
         enableEdit(false);
         List<LoaiThietBi> listLoai = LoaiThietBi.getAll();
         _ucTreeLoaiTB.loadData(listLoai);
         List<ViTriHienThi> listVitris = ViTriHienThi.getAllHavePhong();
         _ucTreeViTri.loadData(listVitris);
         if (obj != null)
         {
             objPhong = obj;
             _ucTreeViTri.setPhong(objPhong);
         }
         else
         {
             objPhong = _ucTreeViTri.getPhong();
         }
         gridControlCTThietBi.DataSource = null;
         listCTThietBis = ChiTietTBHienThi.getAllByPhongId(objPhong.id);
         gridControlCTThietBi.DataSource = listCTThietBis;
         editGUI();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->loadData:" + ex.Message);
     }
 }
示例#3
0
        public void loadData()
        {
            List <ViTriHienThi> listViTriHienThi = ViTriHienThi.getAllHavePhong();

            _ucComboBoxViTri.DataSource = listViTriHienThi;
            List <TinhTrang> listTinhTrang = TinhTrang.getAllForTHIETBI();

            lookUpTinhTrang.Properties.DataSource = listTinhTrang;
        }
示例#4
0
        public void loadData()
        {
            try
            {
                //DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitFormLoad), true, true, false);
                //DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Đang tải dữ liệu...");
                //gridControlTaiSan.DataSource = TaiSanHienThi.getAllNoDonVi();
                //DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(false);
                ucComboBoxLoaiTS1.DataSource = LoaiTSHienThi.Convert(LoaiTaiSan.getQuery().OrderBy(c => c.parent_id).ThenBy(c => c.ten));
                List <DonVi> list    = DonVi.getQuery().OrderBy(c => c.parent_id).ThenBy(c => c.ten).ToList();
                DonVi        objNULL = new DonVi();
                objNULL.id     = Guid.Empty;
                objNULL.ten    = "[Không có đơn vị]";
                objNULL.parent = null;
                list.Insert(0, objNULL);
                ucComboBoxDonVi1.DataSource = list;
                ucComboBoxDonVi1.DonVi      = objNULL;

                List <ViTriHienThi> listViTri = ViTriHienThi.getAllHavePhong();
                ViTriHienThi        objNULL2  = new ViTriHienThi();
                objNULL2.id        = Guid.Empty;
                objNULL2.ten       = "[Không có vị trí]";
                objNULL2.parent_id = Guid.Empty;
                objNULL2.loai      = typeof(Phong).Name;
                listViTri.Insert(0, objNULL2);
                ucComboBoxViTri1.DataSource = listViTri;

                checkedCbxTinhTrang.Properties.DataSource = TinhTrang.getQuery().OrderBy(c => c.order).ToList();

                //ucComboBoxDonVi2.DonVi = objNULL;
                ucGridControlTaiSan1.DataSource = null;
                barBtnSuaTaiSan.Enabled         = false;
                barBtnXoaTaiSan.Enabled         = false;
                btnSua_r.Enabled = false;
                btnXoa_r.Enabled = false;

                btnClear.PerformClick();
                loadSearchXml(this.Name);
                Search();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(this.Name + "->loadData:" + ex.Message);
            }
        }
示例#5
0
 public void LoadData()
 {
     listViTriHienThi = ViTriHienThi.getAllHavePhong();
     if (listViTriHienThi.Count > 0)
     {
         if (listViTriHienThi.Where(item => Object.Equals(item.loai, typeof(PTB.Entities.Phong).Name)).FirstOrDefault() != null)
         {
             Panel_Chinh.Visible = true;
             _ucTreeViTri.CreateTreeList();
             _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
             _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
             SearchFunction();
             if (Convert.ToString(Page.Session["ShowInfo"]) == "1")
             {
                 PanelChangePage.Visible = false;
                 Session["ShowInfo"]     = null;
             }
             else
             {
                 _ucCollectionPager_DanhSachSuCo.ShowPanelPage(PanelChangePage);
             }
             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);
                     objPhong = PTB.Entities.Phong.getById(GUID.From(node.GetValue("id")));
                     if (objPhong != null)
                     {
                         LoadDataObjPhong();
                         if (Request.QueryString["id"] != null)
                         {
                             idSuCo = Guid.Empty;
                             try
                             {
                                 idSuCo = GUID.From(Request.QueryString["id"]);
                             }
                             catch
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                             objSuCoPhong = PTB.Entities.SuCoPhong.getById(idSuCo);
                             if (objSuCoPhong != null)
                             {
                                 Panel_SuCo.Visible      = true;
                                 Label_SuCo.Visible      = false;
                                 Label_SuCo.Text         = "";
                                 Label_ThongTinSuCo.Text = "Thông tin " + objSuCoPhong.ten;
                                 Libraries.ImageHelper.LoadImageWeb(objSuCoPhong.hinhanhs.ToList(), _ucASPxImageSlider_Web.ASPxImageSlider_Object);
                                 _ucASPxImageSlider_Web.urlHinhAnh = string.Format("http://{0}/HinhAnh.aspx?id={1}&type=SUCOPHONG", HttpContext.Current.Request.Url.Authority, objSuCoPhong.id);
                                 Session["TenSuCo"]          = Label_TenSuCo.Text = objSuCoPhong.ten;
                                 Label_TinhTrang.Text        = objSuCoPhong.tinhtrang != null ? objSuCoPhong.tinhtrang.value : "[Tình trạng]";
                                 Label_NgayTao.Text          = ((DateTime)objSuCoPhong.date_create).ToString();
                                 Label_MoTa.Text             = Libraries.StringHelper.ConvertRNToBR(objSuCoPhong.mota);
                                 Button_XemLog.OnClientClick = string.Format("OnMoreInfoClick('{0}'); return false;", Libraries.StringHelper.AddParameter(new Uri("http://" + Request.Url.Authority + "/" + ResolveClientUrl("~/LogSuCo.aspx")), "id", idSuCo.ToString()));
                             }
                             else
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                         }
                         else
                         {
                             Panel_SuCo.Visible = false;
                             Label_SuCo.Visible = true;
                             Label_SuCo.Text    = "Chưa chọn sự cố";
                         }
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue("");
                 node.Focus();
                 Label_DanhSachSuCo.Text = "Chưa chọn phòng";
                 ClearData();
             }
         }
         else
         {
             ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
             ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có phòng";
         }
     }
     else
     {
         ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
         ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có sự cố";
     }
 }
        public void LoadData()
        {
            listViTriHienThi = ViTriHienThi.getAllHavePhong();
            if (listViTriHienThi.Count > 0)
            {
                if (listViTriHienThi.Where(item => Object.Equals(item.loai, typeof(PTB.Entities.Phong).Name)).FirstOrDefault() != null)
                {
                    Panel_Chinh.Visible = true;
                    _ucTreeViTri.CreateTreeList();
                    _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
                    _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
                    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);
                            objPhong = PTB.Entities.Phong.getById(GUID.From(node.GetValue("id")));
                            if (objPhong != null)
                            {
                                string strViTri = "";
                                DevExpress.Web.ASPxTreeList.TreeListNode Pnode = node.ParentNode;
                                while (!Object.Equals(Pnode.Key, ""))
                                {
                                    strViTri = " - " + Pnode.GetValue("ten").ToString() + strViTri;
                                    Pnode    = Pnode.ParentNode;
                                }
                                strViTri = string.Format("({0})", strViTri.Substring(3));
                                ucPhongThietBi_BreadCrumb.Label_TenPhong.Text = objPhong.ten + " " + strViTri;
                                LoadDataObjPhong();
                                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)
                                    {
                                        Label_ThongTinThietBi.Text = string.Format("Thông tin {0}", objThietBi.ten);
                                        Panel_ThietBi.Visible      = true;
                                        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;
                                        ucPhongThietBi_BreadCrumb.Label_TenThietBi.Text = Label_TenThietBi.Text = objThietBi.ten;
                                        if (objThietBi.loaithietbi != null)
                                        {
                                            Label_LoaiThietBi.Text = objThietBi.loaithietbi.ten;
                                            if (objThietBi.loaithietbi.loaichung)
                                            {
                                                Panel_NgayMua.Visible = false;
                                                Label_NgayMua.Text    = "";
                                                Label_KieuQuanLy.Text = "Theo số lượng";
                                            }
                                            else
                                            {
                                                Panel_NgayMua.Visible = true;
                                                Label_NgayMua.Text    = objThietBi.ngaymua.ToString();
                                                Label_KieuQuanLy.Text = "Theo cá thể";
                                            }
                                        }
                                        else
                                        {
                                            Label_LoaiThietBi.Text = "[Loại thiết bị]";
                                            Panel_NgayMua.Visible  = false;
                                            Label_NgayMua.Text     = "";
                                            Label_KieuQuanLy.Text  = "Chưa rõ";
                                        }
                                        Label_Phong.Text   = objPhong.ten;
                                        Label_NgayLap.Text = objThietBi.ctthietbis != null?objThietBi.ctthietbis.Where(item => item.phong_id == objPhong.id).FirstOrDefault().ngay.ToString() : "";

                                        Label_MoTa.Text             = Libraries.StringHelper.ConvertRNToBR(objThietBi.mota);
                                        Button_XemLog.OnClientClick = string.Format("OnMoreInfoClick('{0}'); return false;", Libraries.StringHelper.AddParameter(new Uri("http://" + Request.Url.Authority + "/" + ResolveClientUrl("~/LogThietBi.aspx")), new List <string>(new string[] { "id", "idp" }), new List <string>(new string[] { idThietBi.ToString(), objPhong.id.ToString() })));
                                        Label_ThietBi.Visible       = false;
                                        Label_ThietBi.Text          = "";
                                    }
                                    else
                                    {
                                        Response.Redirect(Request.Url.AbsolutePath);
                                    }
                                }
                                else
                                {
                                    ClearData();
                                }
                            }
                            else
                            {
                                Response.Redirect(Request.Url.AbsolutePath);
                            }
                        }
                        else
                        {
                            Response.Redirect(Request.Url.AbsolutePath);
                        }
                    }
                    else
                    {
                        DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue("");
                        node.Focus();
                        Label_DanhSachThietBi.Text = "Chưa chọn phòng";
                        ClearData();
                    }
                }
                else
                {
                    ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
                    ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có phòng";
                }
            }
            else
            {
                ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
                ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có vị trí";
            }
        }
 public void LoadData()
 {
     listViTriHienThi = ViTriHienThi.getAllHavePhong();
     if (listViTriHienThi.Count > 0)
     {
         if (listViTriHienThi.Where(item => Object.Equals(item.loai, typeof(PTB.Entities.Phong).Name)).FirstOrDefault() != null)
         {
             _ucTreeViTri.CreateTreeList();
             _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
             _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
             if (Request.QueryString["key"] != null)
             {
                 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)
                 {
                     node.Focus();
                     objPhong = PTB.Entities.Phong.getById(GUID.From(node.GetValue("id")));
                     if (objPhong != null)
                     {
                         if (Request.QueryString["id"] != null)
                         {
                             idSuCo = Guid.Empty;
                             try
                             {
                                 idSuCo = GUID.From(Request.QueryString["id"]);
                             }
                             catch
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                             objSuCoPhong = PTB.Entities.SuCoPhong.getById(idSuCo);
                             if (objSuCoPhong != null)
                             {
                                 Panel_SuCo.Visible      = true;
                                 Label_ThongTinSuCo.Text = "Thông tin " + objSuCoPhong.ten;
                                 Libraries.ImageHelper.LoadImageWeb(objSuCoPhong.hinhanhs.ToList(), _ucASPxImageSlider_Mobile.ASPxImageSlider_Object);
                                 Session["TenSuCo"]          = Label_TenSuCo.Text = objSuCoPhong.ten;
                                 Label_TinhTrang.Text        = objSuCoPhong.tinhtrang != null ? objSuCoPhong.tinhtrang.value : "[Tình trạng]";
                                 Label_NgayTao.Text          = ((DateTime)objSuCoPhong.date_create).ToString();
                                 Label_MoTa.Text             = Libraries.StringHelper.ConvertRNToBR(objSuCoPhong.mota);
                                 Button_XemLog.OnClientClick = string.Format("location.href='{0}'; return false;", Libraries.StringHelper.AddParameter(new Uri("http://" + Request.Url.Authority + "/" + ResolveClientUrl("~/LogSuCo.aspx")), "id", idSuCo.ToString()));
                             }
                             else
                             {
                                 Response.Redirect(Request.Url.AbsolutePath);
                             }
                         }
                         else
                         {
                             LoadDataObjPhong();
                             Panel_DanhSachSuCo.Visible = true;
                         }
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 Panel_TreeViTri.Visible = true;
             }
         }
         else
         {
             ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
             ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có phòng";
         }
     }
     else
     {
         ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
         ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có vị trí";
     }
 }