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(); } }
protected void FillFormBySelectedHostid(int hostid) { if (Session["DormitoryHostid"] != null) { var Dormitory = (new CDormitoryHost()).Get(hostid); //DormitoryHost Dormitory = new DormitoryHost(); //Dormitory Information txtDormitoryName.Text = Dormitory.DormitoryHostName; txtHomeAddress.Text = Dormitory.Address; txtCity.Text = Dormitory.City; txtPostalCode.Text = Dormitory.PostalCode; txtPhone.Text = Dormitory.PhoneNumber; txtAdditionalPhone.Text = Dormitory.AdditionalPhone; txtCoordianatorName.Text = Dormitory.CoordinatorName; txtCoordianatorPhone.Text = Dormitory.CoordinatorPhone; ddlSchoolName.SelectedValue = Dormitory.SchoolName; DatePickerLeaseStartDate.SelectedDate = Dormitory.LeaseStartDate; DatePickerLeaseEndDate.SelectedDate = Dormitory.LeaseEndDate; ddlHomeType.SelectedIndex = Convert.ToInt32(Dormitory.HomeType); ddlProvice.SelectedValue = Dormitory.Province; //School var cHostSchool = new CDormitoryHostPreferredSchool(); DormitoryHostPrefferedSchool HostSchool = cHostSchool.GetHostTopSchool(hostid); ddlSchoolName.SelectedValue = HostSchool.SiteLocationId.ToString(); // Host status LoadDropListHostStatus(); ddlHostStatus.SelectedValue = Convert.ToInt32(Dormitory.HostStatus).ToString();// HomestayHostStatus(Convert.ToInt32(Dormitory.HostStatus.ToString())); if (Dormitory.HostStatus == 1 || Dormitory.HostStatus == 0) { DatePickStatusDate.SelectedDate = Dormitory.ActiveDate; } else { DatePickStatusDate.SelectedDate = Dormitory.InactiveDate; } if (Dormitory.HostStatus == 1) { DatePickActiveDate.SelectedDate = Dormitory.ActiveDate; } else if (Dormitory.HostStatus == 2) { DatePickInactiveDate.SelectedDate = Dormitory.InactiveDate; } else if (Dormitory.HostStatus == 0) { DatePickActiveDate.SelectedDate = null; DatePickInactiveDate.SelectedDate = null; } Grid_HostRoom.Rebind(); Grid_HostBed.Rebind(); Grid_DormitoryPlacement.Rebind(); } else { ShowMessage("Session time out."); } }