Esempio n. 1
0
 public void LoadData()
 {
     listDonVi = TSCD.Entities.DonVi.getAll();
     if (listDonVi.Count > 0)
     {
         ucTreeViTri.CreateTreeList();
         ucTreeViTri.ASPxTreeList_ViTri.DataSource = listDonVi;
         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"));
                 objDonVi = TSCD.Entities.DonVi.getById(id);
                 if (objDonVi != null)
                 {
                     info.Visible        = true;
                     Label_ThongTin.Text = string.Format("Thông tin {0}", objDonVi.ten);
                     Label_Ma.Text       = objDonVi.subId;
                     ucDonVi_BreadCrumb.Label_TenDonVi.Text = Label_Ten.Text = objDonVi.ten;
                     Label_Loai.Text  = objDonVi.loaidonvi.ten;
                     Label_Thuoc.Text = objDonVi.parent == null ? "[Đại học Sài Gòn]" : objDonVi.parent.ten;
                     Label_MoTa.Text  = StringHelper.ConvertRNToBR(objDonVi.mota);
                 }
                 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ó đơn vị";
     }
 }
Esempio n. 2
0
        private void ASPxTreeList_ViTri_CustomDataCallback(object sender, DevExpress.Web.ASPxTreeList.TreeListCustomDataCallbackEventArgs e)
        {
            string key = e.Argument.ToString();

            DevExpress.Web.ASPxTreeList.TreeListNode node = _ucTreeViTri.ASPxTreeList_ViTri.FindNodeByKeyValue(key);
            if (node != null)
            {
                if (Object.Equals(node.GetValue("loai"), typeof(PTB.Entities.Phong).Name))
                {
                    e.Result = Request.Url.AbsolutePath + "?key=" + key;
                }
                else
                {
                    e.Result = "";
                }
            }
            else
            {
                e.Result = Request.Url.AbsolutePath;
            }
        }
Esempio n. 3
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";
            }
        }
Esempio n. 4
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í";
            }
        }
Esempio n. 6
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";
     }
 }
Esempio n. 8
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í";
     }
 }
Esempio n. 9
0
 public void LoadData()
 {
     listPhong = TSCD.Entities.Phong.getAll();
     if (listPhong.Count > 0)
     {
         TreeViTri.Visible = true;
         listLoaiPhong     = TSCD.Entities.LoaiPhong.getAll();
         if (listLoaiPhong.Count > 0)
         {
             ucTreeViTri.CreateTreeList();
             ucTreeViTri.ASPxTreeList_ViTri.DataSource = listLoaiPhong;
             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)
                 {
                     ucLoaiPhong_BreadCrumb.Label_TenLoaiPhong.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)
                         {
                             ucLoaiPhong_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);
                         }
                     }
                     Guid _id = GUID.From(node.GetValue("id"));
                     LoadDanhSachPhong(listPhong.Where(phong => phong.loaiphong.id != null).ToList().Where(phong => phong.loaiphong.id == _id).ToList());
                 }
                 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";
     }
 }
 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í";
     }
 }