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);
     }
 }
Exemple #2
0
 public void loadData()
 {
     DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this.ParentForm, typeof(WaitFormLoad), true, true, false);
     DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Đang tải dữ liệu...");
     try
     {
         editGUI("view");
         List <ViTriHienThi> listVitri  = ViTriHienThi.getAll();
         List <ViTriHienThi> listVitri2 = new List <ViTriHienThi>(listVitri);
         _ucTreeViTri.DataSource     = listVitri;
         _ucComboBoxViTri.DataSource = listVitri2;
         loadLoaiPhong();
         _ViTriHienTai = _ucTreeViTri.Vitri;
         if (_ViTriHienTai != null)
         {
             listPhong = PhongHienThi.getPhongByViTri(_ViTriHienTai.coso != null ? _ViTriHienTai.coso.id : Guid.Empty, _ViTriHienTai.day != null ? _ViTriHienTai.day.id : Guid.Empty, _ViTriHienTai.tang != null ? _ViTriHienTai.tang.id : Guid.Empty);
         }
         else
         {
             listPhong = null;
         }
         gridControlPhong.DataSource = listPhong;
         if (listPhong == null || listPhong.Count() == 0)
         {
             enableButton(false);
             gridLookUpLoai.EditValue = null;
         }
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->loadData: " + ex.Message);
     }
     DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(false);
 }
 //Khi thêm mới cơ sở -> phòng thì load treelist bên trái + reload dữ liệu ucQuanLyPhong
 public void reLoadAll()
 {
     try
     {
         listVitris = ViTriHienThi.getAll().ToList();
         _ucTreeViTri.loadData(listVitris);
         reLoad();
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->reLoadAll: " + ex.Message);
     }
 }
        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í";
     }
 }
 public void loadData()
 {
     try
     {
         _ucComboBoxCoSo.DataSource = ViTriHienThi.getAllCoSo();
         _ucComboBoxDay.DataSource  = ViTriHienThi.getAllHaveDay();
         listViTriHienThi           = ViTriHienThi.getAll();
         if (listViTriHienThi.Count == 0)
         {
             editGUI("nothing", "");
         }
         treeListViTri.DataSource = listViTriHienThi;
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->loadData:" + ex.Message);
     }
 }
        public void loadData()
        {
            try
            {
                loadLayout();
                //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);
                checkedCbxLoaiPhong.Properties.DataSource = LoaiPhong.getQuery().OrderBy(c => c.order).ToList();

                //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.getAll();
                //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;

                gridControlPhong.DataSource = null;
                //loadSearchXml(this.Name);
                //Search();

                btnClear.PerformClick();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(this.Name + "->loadData:" + ex.Message);
            }
        }
 public void loadData()
 {
     try
     {
         canAddCoSo = Permission.canAdd <CoSo>();
         canAddDay  = Permission.canAdd <Dayy>();
         canAddTang = Permission.canAdd <Tang>();
         _ucComboBoxViTri.DataSource        = ViTriHienThi.getAllCoSo();
         _ucComboBoxViTriChonDay.DataSource = ViTriHienThi.getAllHaveDay();
         listViTriHienThi = ViTriHienThi.getAll();
         if (listViTriHienThi.Count == 0)
         {
             editGUI("nothing", "");
             editGUI2("nothing", "");
         }
         treeListViTri.DataSource = listViTriHienThi;
     }
     catch (Exception ex)
     {
         Debug.WriteLine(this.Name + "->loadData:" + ex.Message);
     }
 }
        // Load dữ liệu
        public void loadData()
        {
            try
            {
                //load layout
                layout.load(gridViewPhong);
                canAdd     = Permission.canAdd <Phong>();
                listVitris = ViTriHienThi.getAll().ToList();
                _ucTreeViTri.loadData(listVitris);
                _ucComboBoxViTri.DataSource = listVitris;
                _ViTriHienTai = _ucTreeViTri.getVitri();
                listPhong     = PhongHienThi.getPhongByViTri(_ViTriHienTai.coso != null ? _ViTriHienTai.coso.id : Guid.Empty, _ViTriHienTai.day != null ? _ViTriHienTai.day.id : Guid.Empty, _ViTriHienTai.tang != null ? _ViTriHienTai.tang.id : Guid.Empty);
                gridControlPhong.DataSource = listPhong;
                if (listPhong.Count() == 0)
                {
                    deleteData();
                    enableEdit(false);
                    enableBar(false);
                }
                else
                {
                    getThongTinPhong(true);
                    enableEdit(false);
                    enableBar(true);
                }

                listNhanVienPT = NhanVienPT.getAll();
                NhanVienPT NhanVienPTNULL = new NhanVienPT();
                NhanVienPTNULL.hoten = "[Không có]";
                NhanVienPTNULL.id    = Guid.Empty;
                listNhanVienPT.Insert(0, NhanVienPTNULL);
                searchLookUpEditNhanVienPT.Properties.DataSource = listNhanVienPT;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(this.Name + "->loadData: " + ex.Message);
            }
        }
Exemple #10
0
        public void LoadData()
        {
            listPhong = PTB.Entities.Phong.getAll();
            if (listPhong.Count > 0)
            {
                listViTriHienThi = ViTriHienThi.getAll();
                if (listViTriHienThi.Count > 0)
                {
                    _ucTreeViTri.CreateTreeList();
                    _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
                    _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
                    SearchFunction();
                    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)
                        {
                            string strViTri = "";
                            DevExpress.Web.ASPxTreeList.TreeListNode Pnode = node.ParentNode;
                            while (!Object.Equals(Pnode.Key, ""))
                            {
                                strViTri = " - " + Pnode.GetValue("ten").ToString() + strViTri;
                                Pnode    = Pnode.ParentNode;
                            }
                            if (!Object.Equals(strViTri, ""))
                            {
                                strViTri = string.Format("({0})", strViTri.Substring(3));
                                ucPhong_BreadCrumb.Label_TenViTri.Text = node.GetValue("ten").ToString() + " " + strViTri;
                            }
                            else
                            {
                                ucPhong_BreadCrumb.Label_TenViTri.Text = node.GetValue("ten").ToString();
                            }
                            if (Request.QueryString["id"] != null)
                            {
                                Guid idPhong = Guid.Empty;
                                try
                                {
                                    idPhong = GUID.From(Request.QueryString["id"]);
                                }
                                catch
                                {
                                    Response.Redirect(Request.Url.AbsolutePath);
                                }
                                objPhong = PTB.Entities.Phong.getById(idPhong);
                                if (objPhong != null)
                                {
                                    ucPhong_BreadCrumb.Label_TenPhong.Text = objPhong.ten;
                                    Panel_ThongTinPhong.Visible            = true;
                                    Libraries.ImageHelper.LoadImageWeb(objPhong.hinhanhs.ToList(), _ucASPxImageSlider_Mobile_Phong.ASPxImageSlider_Object);
                                    Label_MaPhong.Text  = objPhong.subId;
                                    Label_TenPhong.Text = objPhong.ten;
                                    string strCoSo, strDay, strTang;
                                    strCoSo = objPhong.vitri.coso != null ? objPhong.vitri.coso.ten : "";
                                    strDay  = objPhong.vitri.day != null ? objPhong.vitri.day.ten : "";
                                    strTang = objPhong.vitri.tang != null ? objPhong.vitri.tang.ten : "";
                                    if (!strCoSo.Equals(""))
                                    {
                                        Label_ViTriPhong.Text += strCoSo;
                                        if (!strDay.Equals(""))
                                        {
                                            Label_ViTriPhong.Text += " - " + strDay;
                                            if (!strTang.Equals(""))
                                            {
                                                Label_ViTriPhong.Text += " - " + strTang;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        Label_ViTriPhong.Text = "[Không rõ]";
                                    }
                                    Label_MoTaPhong.Text        = Libraries.StringHelper.ConvertRNToBR(objPhong.mota);
                                    Label_NhanVienPhuTrach.Text = objPhong.nhanvienpt != null ? objPhong.nhanvienpt.hoten : "";

                                    if (objPhong.nhanvienpt != null)
                                    {
                                        Panel_NhanVienPT.Visible = true;
                                        Label_NhanVienPT.Visible = false;
                                        Label_NhanVienPT.Text    = "";
                                        Libraries.ImageHelper.LoadImageWeb(objPhong.nhanvienpt.hinhanhs.ToList(), _ucASPxImageSlider_Mobile_NhanVienPT.ASPxImageSlider_Object);
                                        Label_MaNhanVien.Text  = objPhong.nhanvienpt.subId;
                                        Label_HoTen.Text       = objPhong.nhanvienpt.hoten;
                                        Label_SoDienThoai.Text = objPhong.nhanvienpt.sodienthoai;
                                    }
                                    else
                                    {
                                        Panel_NhanVienPT.Visible = false;
                                        Label_NhanVienPT.Visible = true;
                                        Label_NhanVienPT.Text    = "Phòng này chưa có nhân viên phụ trách";
                                        Libraries.ImageHelper.LoadImageWeb(null, _ucASPxImageSlider_Mobile_NhanVienPT.ASPxImageSlider_Object);
                                        Label_MaNhanVien.Text  = "";
                                        Label_HoTen.Text       = "";
                                        Label_SoDienThoai.Text = "";
                                    }
                                }
                                else
                                {
                                    Response.Redirect(Request.Url.AbsolutePath);
                                }
                            }
                            else
                            {
                                LoadDanhSachPhong(GUID.From(node.GetValue("id")), node.GetValue("loai").ToString());
                                Panel_DanhSachPhong.Visible = true;
                            }
                        }
                        else
                        {
                            Response.Redirect(Request.Url.AbsolutePath);
                        }
                    }
                    else
                    {
                        Panel_TreeListViTri.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ó phòng";
            }
        }
Exemple #11
0
 public void LoadData()
 {
     listViTriHienThi = ViTriHienThi.getAll();
     if (listViTriHienThi.Count > 0)
     {
         ucTreeViTri.CreateTreeList();
         ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
         ucTreeViTri.ASPxTreeList_ViTri.DataBind();
         SearchFunction();
         treevitri.Visible = true;
         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)
             {
                 node.Focus();
                 ucTreeViTri.FocusAndExpandToNode(node);
                 Guid   id   = GUID.From(node.GetValue("id"));
                 string type = node.GetValue("loai").ToString();
                 if (type.Equals(typeof(CoSo).Name))
                 {
                     objCoSo = CoSo.getById(id);
                     if (objCoSo != null)
                     {
                         info.Visible        = true;
                         Label_ThongTin.Text = "Thông tin " + objCoSo.ten;
                         Label_Ten.Text      = objCoSo.ten;
                         ucViTri_BreadCrumb.Label_TenViTri.Text = Label_Ten.Text = objCoSo.ten;
                         Label_Thuoc.Text = "[Đại học Sài Gòn]";
                         Label_MoTa.Text  = StringHelper.ConvertRNToBR(objCoSo.mota);
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else if (type.Equals(typeof(Dayy).Name))
                 {
                     objDay = Dayy.getById(id);
                     if (objDay != null)
                     {
                         info.Visible        = true;
                         Label_ThongTin.Text = "Thông tin " + objDay.ten;
                         Label_Ten.Text      = objDay.ten;
                         Label_Thuoc.Text    = objDay.coso != null ? objDay.coso.ten : "[Cơ sở]";
                         ucViTri_BreadCrumb.Label_TenViTri.Text = string.Format("{0} ({1})", Label_Ten.Text, Label_Thuoc.Text);
                         Label_MoTa.Text = StringHelper.ConvertRNToBR(objDay.mota);
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else if (type.Equals(typeof(Tang).Name))
                 {
                     objTang = Tang.getById(id);
                     if (objTang != null)
                     {
                         info.Visible        = true;
                         Label_ThongTin.Text = "Thông tin " + objTang.ten;
                         Label_Ten.Text      = objTang.ten;
                         if (objTang.day != null)
                         {
                             if (objTang.day.coso != null)
                             {
                                 Label_Thuoc.Text = objTang.day.coso.ten + " - " + objTang.day.ten;
                             }
                             else
                             {
                                 Label_Thuoc.Text = "[Cơ sở] - " + objTang.day.ten;
                             }
                         }
                         else
                         {
                             Label_Thuoc.Text = "[Cơ sở] - [Dãy]";
                         }
                         ucViTri_BreadCrumb.Label_TenViTri.Text = string.Format("{0} ({1})", Label_Ten.Text, Label_Thuoc.Text);
                         Label_MoTa.Text = StringHelper.ConvertRNToBR(objTang.mota);
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 Response.Redirect(Request.Url.AbsolutePath);
             }
         }
         else
         {
             DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue("");
             node.Focus();
         }
     }
     else
     {
         thongbaoloi.Visible     = true;
         ucDanger.LabelInfo.Text = "Chưa có vị trí";
     }
 }
 public void LoadData()
 {
     listPhong = TSCD.Entities.Phong.getAll();
     if (listPhong.Count > 0)
     {
         TreeViTri.Visible = true;
         listViTriHienThi  = ViTriHienThi.getAll();
         if (listViTriHienThi.Count > 0)
         {
             ucTreeViTri.CreateTreeList();
             ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
             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)
                 {
                     string strViTri = "";
                     DevExpress.Web.ASPxTreeList.TreeListNode Pnode = node.ParentNode;
                     while (!Object.Equals(Pnode.Key, ""))
                     {
                         strViTri = " - " + Pnode.GetValue("ten").ToString() + strViTri;
                         Pnode    = Pnode.ParentNode;
                     }
                     if (!Object.Equals(strViTri, ""))
                     {
                         strViTri = string.Format("({0})", strViTri.Substring(3));
                         ucPhong_BreadCrumb.Label_TenViTri.Text = node.GetValue("ten").ToString() + " " + strViTri;
                     }
                     else
                     {
                         ucPhong_BreadCrumb.Label_TenViTri.Text = node.GetValue("ten").ToString();
                     }
                     if (Request.QueryString["id"] != null)
                     {
                         ThongTin.Visible = true;
                         idPhong          = Guid.Empty;
                         try
                         {
                             idPhong = GUID.From(Request.QueryString["id"]);
                         }
                         catch
                         {
                             Response.Redirect(Request.Url.AbsolutePath);
                         }
                         objPhong = TSCD.Entities.Phong.getById(idPhong);
                         if (objPhong != null)
                         {
                             ucPhong_BreadCrumb.Label_TenPhong.Text = objPhong.ten;
                             Label_MaPhong.Text    = objPhong.subId;
                             Label_TenPhong.Text   = objPhong.ten;
                             Label_LoaiPhong.Text  = objPhong.loaiphong.ten;
                             Label_ViTriPhong.Text = ViTriCuaPhong(objPhong);
                             Label_MoTaPhong.Text  = StringHelper.ConvertRNToBR(objPhong.mota);
                         }
                         else
                         {
                             Response.Redirect(Request.Url.AbsolutePath);
                         }
                     }
                     LoadDanhSachPhong(GUID.From(node.GetValue("id")), node.GetValue("loai").ToString());
                 }
                 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ó phòng";
         }
     }
     else
     {
         KhongCoDuLieu.Visible = true;
         ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có phòng";
     }
 }
Exemple #13
0
 public void LoadData()
 {
     listViTriHienThi = ViTriHienThi.getAll();
     if (listViTriHienThi.Count > 0)
     {
         _ucTreeViTri.CreateTreeList();
         _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listViTriHienThi;
         _ucTreeViTri.ASPxTreeList_ViTri.DataBind();
         SearchFunction();
         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)
             {
                 Guid   id   = GUID.From(node.GetValue("id"));
                 string type = node.GetValue("loai").ToString();
                 if (type.Equals(typeof(CoSo).Name))
                 {
                     objCoSo = CoSo.getById(id);
                     if (objCoSo != null)
                     {
                         Panel_ThongTinObj.Visible = true;
                         Label_ThongTin.Text       = "Thông tin " + objCoSo.ten;
                         Libraries.ImageHelper.LoadImageWeb(objCoSo.hinhanhs.ToList(), _ucASPxImageSlider_Mobile.ASPxImageSlider_Object);
                         Label_Ten.Text = objCoSo.ten;
                         ucViTri_BreadCrumb.Label_TenViTri.Text = Label_Ten.Text = objCoSo.ten;
                         Label_Thuoc.Text     = "[Đại học Sài Gòn]";
                         Panel_DiaChi.Visible = true;
                         Label_DiaChi.Text    = objCoSo.diachi;
                         Label_MoTa.Text      = Libraries.StringHelper.ConvertRNToBR(objCoSo.mota);
                         if (objCoSo.diachi != null)
                         {
                             if (objCoSo.diachi.Length > 0)
                             {
                                 Button_Map.Visible = true;
                             }
                             else
                             {
                                 Button_Map.Visible = false;
                             }
                         }
                         else
                         {
                             Button_Map.Visible = false;
                         }
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else if (type.Equals(typeof(Dayy).Name))
                 {
                     objDay = Dayy.getById(id);
                     if (objDay != null)
                     {
                         Panel_ThongTinObj.Visible = true;
                         Label_ThongTin.Text       = "Thông tin " + objDay.ten;
                         Libraries.ImageHelper.LoadImageWeb(objDay.hinhanhs.ToList(), _ucASPxImageSlider_Mobile.ASPxImageSlider_Object);
                         Label_Ten.Text   = objDay.ten;
                         Label_Thuoc.Text = objDay.coso != null ? objDay.coso.ten : "[Cơ sở]";
                         ucViTri_BreadCrumb.Label_TenViTri.Text = string.Format("{0} ({1})", Label_Ten.Text, Label_Thuoc.Text);
                         Panel_DiaChi.Visible = false;
                         Label_DiaChi.Text    = "";
                         Label_MoTa.Text      = Libraries.StringHelper.ConvertRNToBR(objDay.mota);
                         Button_Map.Visible   = false;
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 else if (type.Equals(typeof(Tang).Name))
                 {
                     objTang = Tang.getById(id);
                     if (objTang != null)
                     {
                         Panel_ThongTinObj.Visible = true;
                         Label_ThongTin.Text       = "Thông tin " + objTang.ten;
                         Libraries.ImageHelper.LoadImageWeb(objTang.hinhanhs.ToList(), _ucASPxImageSlider_Mobile.ASPxImageSlider_Object);
                         Label_Ten.Text = objTang.ten;
                         if (objTang.day != null)
                         {
                             if (objTang.day.coso != null)
                             {
                                 Label_Thuoc.Text = objTang.day.coso.ten + " - " + objTang.day.ten;
                             }
                             else
                             {
                                 Label_Thuoc.Text = "[Cơ sở] - " + objTang.day.ten;
                             }
                         }
                         else
                         {
                             Label_Thuoc.Text = "[Cơ sở] - [Dãy]";
                         }
                         ucViTri_BreadCrumb.Label_TenViTri.Text = string.Format("{0} ({1})", Label_Ten.Text, Label_Thuoc.Text);
                         Panel_DiaChi.Visible = false;
                         Label_DiaChi.Text    = "";
                         Label_MoTa.Text      = Libraries.StringHelper.ConvertRNToBR(objTang.mota);
                         Button_Map.Visible   = false;
                     }
                     else
                     {
                         Response.Redirect(Request.Url.AbsolutePath);
                     }
                 }
                 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ó vị trí";
     }
 }
        public void LoadData()
        {
            listPhong = TSCD.Entities.Phong.getAll();
            if (listPhong.Count > 0)
            {
                infotr.Visible   = true;
                listViTriHienThi = ViTriHienThi.getAll();
                if (listViTriHienThi.Count > 0)
                {
                    _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_DanhSachPhong.ShowPanelPage(PanelChangePage);
                    }
                    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);
                        }
                        if (Request.QueryString["id"] != null)
                        {
                            ThongTinPhong.Visible = true;
                            thongtin.Visible      = true;
                            idPhong = Guid.Empty;
                            try
                            {
                                idPhong = GUID.From(Request.QueryString["id"]);
                            }
                            catch
                            {
                                Response.Redirect(Request.Url.AbsolutePath);
                            }

                            objPhong = TSCD.Entities.Phong.getById(idPhong);
                            if (objPhong != null)
                            {
                                Label_ThongTinPhong.Text = "Thông tin phòng " + objPhong.ten;
                                Label_MaPhong.Text       = objPhong.subId;
                                ucPhong_BreadCrumb.Label_TenPhong.Text = Label_TenPhong.Text = objPhong.ten;
                                Label_LoaiPhong.Text  = objPhong.loaiphong.ten;
                                Label_ViTriPhong.Text = ViTriCuaPhong(objPhong);
                                Label_MoTaPhong.Text  = StringHelper.ConvertRNToBR(objPhong.mota);
                            }
                            else
                            {
                                Response.Redirect(Request.Url.AbsolutePath);
                            }
                        }
                        else
                        {
                            ClearData();
                        }
                    }
                    else
                    {
                        DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue("");
                        node.Focus();
                        ChuaChonViTri.Visible = true;
                        ucWarning_ChuaChonViTri.LabelInfo.Text = "Chưa chọn vị trí";
                        ClearData();
                    }
                }
                else
                {
                    KhongCoDuLieu.Visible = true;
                    ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có phòng";
                }
            }
            else
            {
                KhongCoDuLieu.Visible = true;
                ucDanger_KhongCoDuLieu.LabelInfo.Text = "Chưa có phòng";
            }
        }
        public void LoadData()
        {
            listPhong = PTB.Entities.Phong.getAll();
            if (listPhong.Count > 0)
            {
                listViTriHienThi = ViTriHienThi.getAll();
                if (listViTriHienThi.Count > 0)
                {
                    _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_DanhSachPhong.ShowPanelPage(PanelChangePage);
                    }
                    Panel_Chinh.Visible = true;
                    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();
                        }
                        else
                        {
                            Response.Redirect(Request.Url.AbsolutePath);
                        }
                        if (Request.QueryString["id"] != null)
                        {
                            idPhong = Guid.Empty;
                            try
                            {
                                idPhong = GUID.From(Request.QueryString["id"]);
                            }
                            catch
                            {
                                Response.Redirect(Request.Url.AbsolutePath);
                            }

                            objPhong = PTB.Entities.Phong.getById(idPhong);
                            if (objPhong != null)
                            {
                                Panel_Phong.Visible      = true;
                                Label_Phong.Visible      = false;
                                Label_ThongTinPhong.Text = "Thông tin " + objPhong.ten;
                                Libraries.ImageHelper.LoadImageWeb(objPhong.hinhanhs.ToList(), _ucASPxImageSlider_Web_Phong.ASPxImageSlider_Object);
                                _ucASPxImageSlider_Web_Phong.urlHinhAnh = string.Format("http://{0}/HinhAnh.aspx?id={1}&type=PHONG", HttpContext.Current.Request.Url.Authority, objPhong.id);
                                Label_MaPhong.Text = objPhong.subId;
                                ucPhong_BreadCrumb.Label_TenPhong.Text = Label_TenPhong.Text = objPhong.ten;
                                string strCoSo, strDay, strTang;
                                strCoSo = objPhong.vitri.coso != null ? objPhong.vitri.coso.ten : "";
                                strDay  = objPhong.vitri.day != null ? objPhong.vitri.day.ten : "";
                                strTang = objPhong.vitri.tang != null ? objPhong.vitri.tang.ten : "";
                                if (!strCoSo.Equals(""))
                                {
                                    Label_ViTriPhong.Text += strCoSo;
                                    if (!strDay.Equals(""))
                                    {
                                        Label_ViTriPhong.Text += " - " + strDay;
                                        if (!strTang.Equals(""))
                                        {
                                            Label_ViTriPhong.Text += " - " + strTang;
                                        }
                                    }
                                }
                                else
                                {
                                    Label_ViTriPhong.Text = "[Không rõ]";
                                }
                                Label_MoTaPhong.Text        = Libraries.StringHelper.ConvertRNToBR(objPhong.mota);
                                Label_NhanVienPhuTrach.Text = objPhong.nhanvienpt != null ? objPhong.nhanvienpt.hoten : "";

                                if (objPhong.nhanvienpt != null)
                                {
                                    Panel_NhanVienPT.Visible = true;
                                    Label_NhanVienPT.Visible = false;
                                    Label_NhanVienPT.Text    = "";
                                    Libraries.ImageHelper.LoadImageWeb(objPhong.nhanvienpt.hinhanhs.ToList(), _ucASPxImageSlider_Web_NhanVienPT.ASPxImageSlider_Object);
                                    _ucASPxImageSlider_Web_NhanVienPT.urlHinhAnh = string.Format("http://{0}/HinhAnh.aspx?id={1}&type=NHANVIEN", HttpContext.Current.Request.Url.Authority, objPhong.nhanvienpt_id);
                                    Label_MaNhanVien.Text  = objPhong.nhanvienpt.subId;
                                    Label_HoTen.Text       = objPhong.nhanvienpt.hoten;
                                    Label_SoDienThoai.Text = objPhong.nhanvienpt.sodienthoai;
                                }
                                else
                                {
                                    Panel_NhanVienPT.Visible = false;
                                    Label_NhanVienPT.Visible = true;
                                    Label_NhanVienPT.Text    = "Phòng này chưa có nhân viên phụ trách";
                                    Libraries.ImageHelper.LoadImageWeb(null, _ucASPxImageSlider_Web_NhanVienPT.ASPxImageSlider_Object);
                                    Label_MaNhanVien.Text  = "";
                                    Label_HoTen.Text       = "";
                                    Label_SoDienThoai.Text = "";
                                }
                            }
                            else
                            {
                                Response.Redirect(Request.Url.AbsolutePath);
                            }
                        }
                        else
                        {
                            ClearData();
                            Label_Phong.Visible = true;
                            Label_Phong.Text    = "Chưa chọn phòng";
                        }
                    }
                    else
                    {
                        DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue("");
                        node.Focus();
                        Label_TextDanhSachPhong.Text = "Chưa chọn vị trí";
                        ClearData();
                        Label_Phong.Visible = true;
                        Label_Phong.Text    = "Chưa chọn phòng";
                    }
                }
                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ó phòng";
            }
        }