Example #1
0
        public static String StringViTriPhong(TSCD.Entities.Phong objPhong)
        {
            String strViTri = "";

            if (objPhong.vitri != null)
            {
                if (objPhong.vitri.coso != null)
                {
                    strViTri = string.Format("({0}", objPhong.vitri.coso.ten);
                    if (objPhong.vitri.day != null)
                    {
                        strViTri += string.Format(" - {0}", objPhong.vitri.day.ten);
                        if (objPhong.vitri.tang != null)
                        {
                            strViTri += string.Format(" - {0})", objPhong.vitri.tang.ten);
                        }
                        else
                        {
                            strViTri += ")";
                        }
                    }
                    else
                    {
                        strViTri += ")";
                    }
                }
            }
            return(strViTri);
        }
Example #2
0
        protected string ViTriCuaPhong(TSCD.Entities.Phong objPhong)
        {
            string _strtemp = "", _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(""))
            {
                _strtemp += _strCoSo;
                if (!_strDay.Equals(""))
                {
                    _strtemp += " - " + _strDay;
                    if (!_strTang.Equals(""))
                    {
                        _strtemp += " - " + _strTang;
                    }
                }
            }
            return(_strtemp == "" ? "[Không rõ]" : _strtemp);
        }
 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()
        {
            listPhong = TSCD.Entities.Phong.getAll();
            if (listPhong.Count > 0)
            {
                infotr.Visible = true;
                listLoaiPhong = TSCD.Entities.LoaiPhong.getAll();
                if (listLoaiPhong.Count > 0)
                {
                    _ucTreeViTri.CreateTreeList();
                    _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listLoaiPhong;
                    _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;
                                ucLoaiPhong_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";
            }
        }
Example #5
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";
     }
 }
Example #6
0
 private void SearchFunction()
 {
     if (Request.QueryString["Search"] != null)
     {
         Guid SearchID = Guid.Empty;
         try
         {
             SearchID = GUID.From(Request.QueryString["Search"]);
         }
         catch
         {
             Response.Redirect(Request.Url.AbsolutePath);
         }
         TSCD.Entities.Phong PhongSearch = listPhong.Where(item => Object.Equals(item.id, SearchID)).FirstOrDefault();
         if (PhongSearch != null)
         {
             Guid nodeGuid = Guid.Empty;
             int  type     = 0;
             if (PhongSearch.vitri != null)
             {
                 if (PhongSearch.vitri.tang != null)
                 {
                     nodeGuid = PhongSearch.vitri.tang.id;
                     type     = 3;
                 }
                 else if (PhongSearch.vitri.day != null)
                 {
                     nodeGuid = PhongSearch.vitri.day.id;
                     type     = 2;
                 }
                 else if (PhongSearch.vitri.coso != null)
                 {
                     nodeGuid = PhongSearch.vitri.coso.id;
                     type     = 1;
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 Response.Redirect(Request.Url.AbsolutePath);
             }
             DevExpress.Web.ASPxTreeList.TreeListNode node = ucTreeViTri.ASPxTreeList_ViTri.GetAllNodes().Where(item => Object.Equals(item.GetValue("id").ToString(), nodeGuid.ToString())).FirstOrDefault();
             if (node != null)
             {
                 int Page = SearchPage(nodeGuid, PhongSearch.id, type);
                 if (Page != -1)
                 {
                     Response.Redirect(string.Format("{0}?key={1}&id={2}&Page={3}", Request.Url.AbsolutePath, node.Key.ToString(), PhongSearch.id.ToString(), Page.ToString()));
                 }
                 else
                 {
                     Response.Redirect(Request.Url.AbsolutePath);
                 }
             }
             else
             {
                 Response.Redirect(Request.Url.AbsolutePath);
             }
         }
         else
         {
             Response.Redirect(Request.Url.AbsolutePath);
         }
     }
     else
     {
         return;
     }
 }
        public void LoadData()
        {
            listPhong = TSCD.Entities.Phong.getAll();
            if (listPhong.Count > 0)
            {
                infotr.Visible = true;
                listLoaiPhong  = TSCD.Entities.LoaiPhong.getAll();
                if (listLoaiPhong.Count > 0)
                {
                    _ucTreeViTri.CreateTreeList();
                    _ucTreeViTri.ASPxTreeList_ViTri.DataSource = listLoaiPhong;
                    _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;
                                ucLoaiPhong_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";
            }
        }