public void LoadData()
        {
            _ucCollectionPager_DanhSachPhong.CollectionPager_Object.QueryStringKey = "PageRoom";
            listNhanVienPT = NhanVienPT.getQuery().OrderBy(c => c.hoten).ToList();
            if (listNhanVienPT.Count > 0)
            {
                SearchFunction();
                if (Request.QueryString["id"] != null)
                {
                    Guid id = Guid.Empty;
                    try
                    {
                        id = GUID.From(Request.QueryString["id"]);
                    }
                    catch
                    {
                        Response.Redirect(Request.Url.AbsolutePath);
                    }

                    objNhanVienPT = NhanVienPT.getById(id);
                    if (objNhanVienPT != null)
                    {
                        PanelThongTinNhanVienPhuTrach.Visible = true;
                        Label_MaNhanVien.Text = objNhanVienPT.subId;
                        _ucNhanVien_BreadCrumb.Label_TenNhanVien.Text = Label_HoTen.Text = objNhanVienPT.hoten;
                        Label_SoDienThoai.Text = objNhanVienPT.sodienthoai;
                        Libraries.ImageHelper.LoadImageWeb(objNhanVienPT.hinhanhs.ToList(), _ucASPxImageSlider_Mobile.ASPxImageSlider_Object);

                        List <PTB.Entities.Phong> ListPhong = objNhanVienPT.phongs.ToList();

                        var list = ListPhong.Select(a => new
                        {
                            id  = a.id,
                            ten = string.Format("{0}{1}", a.ten, !Object.Equals(getVitri(a), "") ? " " + getVitri(a) : ""),
                            url = string.Format("http://{0}/Phong.aspx?Search={1}", HttpContext.Current.Request.Url.Authority, a.id.ToString())
                        }).ToList();

                        _ucCollectionPager_DanhSachPhong.CollectionPager_Object.DataSource    = list;
                        _ucCollectionPager_DanhSachPhong.CollectionPager_Object.BindToControl = RepeaterDanhSachPhong;
                        RepeaterDanhSachPhong.DataSource = _ucCollectionPager_DanhSachPhong.CollectionPager_Object.DataSourcePaged;
                        RepeaterDanhSachPhong.DataBind();
                    }
                    else
                    {
                        Response.Redirect(Request.Url.AbsolutePath);
                    }
                }
                else
                {
                    PanelDanhSachNhanVienPhuTrach.Visible = true;
                    BindData();
                }
            }
            else
            {
                ucThongBaoLoi.Panel_ThongBaoLoi.Visible = true;
                ucThongBaoLoi.Label_ThongBaoLoi.Text    = "Chưa có nhân viên";
            }
        }
예제 #2
0
 private void searchLookUpEditNhanVienPT_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (searchLookUpEditNhanVienPT.EditValue != null && !searchLookUpEditNhanVienPT.EditValue.Equals(-1))
         {
             Guid id = GUID.From(searchLookUpEditNhanVienPT.EditValue);
             if (id != Guid.Empty)
             {
                 objNhanVienPT = NhanVienPT.getById(id);
             }
             else
             {
                 objNhanVienPT = null;
             }
             if (objNhanVienPT != null)
             {
                 txtMaNhanVien.Text  = objNhanVienPT.subId;
                 txtTenNhanVien.Text = objNhanVienPT.hoten;
                 txtSoDienThoai.Text = objNhanVienPT.sodienthoai;
                 listHinhAnhNhanVien = objNhanVienPT.hinhanhs.ToList();
                 reloadImageNhanVienPT();
             }
             else
             {
                 imgNhanVien.Images.Clear();
                 txtMaNhanVien.Text  = "";
                 txtTenNhanVien.Text = "";
                 txtSoDienThoai.Text = "";
             }
         }
     }
     catch (Exception ex)
     {
         System.Console.WriteLine(this.Name + ": " + ex.Message);
     }
 }