Example #1
0
    protected void Grid_HostList_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem DataItem = e.Item as GridDataItem;
            int          hostid   = Convert.ToInt32(DataItem["DormitoryHostId"].Text.ToString());
            int          status   = Convert.ToInt32(DataItem["HostStatus"].Text.ToString().Trim());
            DataItem["HostStatus"].Text = DormitoryHostStatus(status);
            //School and Campus
            var cHostSchool = new CDormitoryHostPreferredSchool();
            DormitoryHostPrefferedSchool hostTopSchool = cHostSchool.GetHostTopSchool(hostid);

            SiteLocation HostSchoolLocation = cHostSchool.GetHostTopShoolNameLocation(Convert.ToInt32(hostTopSchool.SiteLocationId));
            var          cSite       = new CSite();
            Site         SchoolName  = cSite.Get(Convert.ToInt32(HostSchoolLocation.SiteId));
            RadLabel     lblTopShool = (RadLabel)DataItem.FindControl("lbl_HostTopSchool");
            lblTopShool.Text = SchoolName.Abbreviation.ToString();
            RadLabel lblTopCampus = (RadLabel)DataItem.FindControl("lbl_HostTopCampus");
            lblTopCampus.Text = HostSchoolLocation.City.ToString();


            //Room Number
            RadLabel lblRoomNumber = (RadLabel)DataItem.FindControl("lbl_RoomNumber");
            var      cHostRoom     = new CDormitoryHostRoom();
            int      RoomNumber    = 0;
            RoomNumber         = cHostRoom.GetDormitoryHostRoomNumber(hostid);
            lblRoomNumber.Text = RoomNumber.ToString();
            //Bed Number
            RadLabel lblBedNumber = (RadLabel)DataItem.FindControl("lbl_BedNumber");
            var      cHostBed     = new CDormitoryHostBed();
            int      BedNumber    = 0;
            BedNumber         = cHostBed.GetDormitoryHostBedNumber(hostid);
            lblBedNumber.Text = BedNumber.ToString();
        }
    }
Example #2
0
    protected void Grid_HostList_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem DataItem = e.Item as GridDataItem;
            int          hostid   = Convert.ToInt32(DataItem["HostId"].Text.ToString());
            int          status   = Convert.ToInt32(DataItem["HouseActiveStutas"].Text.ToString().Trim());
            DataItem["HouseActiveStutas"].Text = "Active";
            //School and Campus
            var cHostSchool = new CHomestayHostPreferredSchool();
            HomestayHostPrefferedSchool hostTopSchool = cHostSchool.GetHostTopSchool(hostid);

            SiteLocation HostSchoolLocation = cHostSchool.GetHostTopShoolNameLocation(Convert.ToInt32(hostTopSchool.SiteLocationId));
            var          cSite       = new CSite();
            Site         SchoolName  = cSite.Get(Convert.ToInt32(HostSchoolLocation.SiteId));
            RadLabel     lblTopShool = (RadLabel)DataItem.FindControl("lbl_HostTopSchool");
            lblTopShool.Text = SchoolName.Abbreviation.ToString();
            RadLabel lblTopCampus = (RadLabel)DataItem.FindControl("lbl_HostTopCampus");
            lblTopCampus.Text = HostSchoolLocation.City.ToString();

            //Family Member
            RadLabel lblFamilyMember = (RadLabel)DataItem.FindControl("lbl_FamilyMember");
            var      cHostFamily     = new CHomestayHostFamilyMember();
            int      MemberNumber    = 0;
            MemberNumber         = cHostFamily.GetFamilyMemberNumber(hostid);
            lblFamilyMember.Text = MemberNumber.ToString();
            //Room Number
            RadLabel lblRoomNumber = (RadLabel)DataItem.FindControl("lbl_RoomNumber");
            var      cHostRoom     = new CHomestayHostRoom();
            int      RoomNumber    = 0;
            RoomNumber         = cHostRoom.GetHomestayHostRoomNumber(hostid);
            lblRoomNumber.Text = RoomNumber.ToString();
            //Bed Number
            RadLabel lblBedNumber = (RadLabel)DataItem.FindControl("lbl_BedNumber");
            var      cHostBed     = new CHomestayHostBed();
            int      BedNumber    = 0;
            BedNumber         = cHostBed.GetHomestayHostBedNumber(hostid);
            lblBedNumber.Text = BedNumber.ToString();


            //
            if (hostid == 1) //AvalibleHost(int HostId)
            {
                DataItem.Display = false;
            }
        }
    }