public void loadHouseDatadata()
        {
            House_Search.Visible = false;
            DrpHouse.Visible     = false;
            DrpHouse.Items.Clear();

            DataSet ds = new DataSet();

            ds = new HouseDAO().SelectAllDataset(Guid.Parse(hdLandloadId.Value));
            ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns["HouseId"] };

            if (ds.Tables[0].Rows.Count > 0)
            {
                LabelRentalAddressMessage.Text = "";
                House_Search.Visible           = true;
                DrpHouse.Visible = true;
                showHouseDetails();
                if (DrpHouse.Items.Count < 1)
                {
                    DrpHouse.DataSource     = ds;
                    DrpHouse.DataTextField  = "StreetAddress";
                    DrpHouse.DataValueField = "HouseId";
                    DrpHouse.DataBind();
                    DrpHouse.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));
                }
                else
                {
                }
            }
            else
            {
                LabelRentalAddressMessage.Text    = "No House Registerd for Landlord, Please Contact Landlord to Add a New House.";
                LabelRentalAddressMessage.Visible = true;
                ButtonLandload.Visible            = false;
                ClearHouse();
            }
        }
        public void loaddata()
        {
            if (LandlordId != null)
            {
                house.LandlordId = LandlordId.Value;

                if (DrpHouse.Items.Count < 1)
                {
                    DrpHouse.DataSource     = dsHouseList;
                    DrpHouse.DataTextField  = "StreetAddress";
                    DrpHouse.DataValueField = "HouseId";
                    DrpHouse.DataBind();
                    DrpHouse.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));
                }
            }

            UserDAO userDAO = new UserDAO();

            user = User.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));

            if (user.HouseId != null)
            {
                // set selected house
                if (user.HouseId.HasValue)
                {
                    for (int i = 0; i < DrpHouse.Items.Count; i++)
                    {
                        if (DrpHouse.Items[i].Value.ToString().ToLower() == user.HouseId.ToString().ToLower())
                        {
                            DrpHouse.ClearSelection();
                            DrpHouse.Items[i].Selected = true;
                        }
                    }
                }

                House house = House.Select(user.HouseId.Value);

                if (house != null)
                {
                    HouseSearch.Visible     = false;
                    chknotavailable.Visible = false;
                    DrpHouse.Enabled        = false;
                    Drpstate.Enabled        = false;
                    PassHouseID(house.HouseId.Value);
                    // set selected house details
                    if (house.StateId.HasValue)
                    {
                        for (int i = 0; i < Drpstate.Items.Count; i++)
                        {
                            if (Drpstate.Items[i].Value.ToString().ToLower() == house.StateId.ToString().ToLower())
                            {
                                Drpstate.ClearSelection();
                                Drpstate.Items[i].Selected = true;
                            }
                        }
                    }

                    Address.Text = house.StreetAddress;
                    City.Text    = house.City;
                    Zip.Text     = house.Zip;
                }
            }
        }
        public void loadHouseDatadata(User user_)
        {
            if (user_.HouseId != null && user_.HouseId != Guid.Empty)
            {
                UserDAO userDAO      = new UserDAO();
                DataSet LandlordData = userDAO.SelectLandlordByHouseId(user_.HouseId.Value);

                if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0)
                {
                    hdLandloadId.Value = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim();
                }

                DataSet ds = new DataSet();
                ds = new HouseDAO().SelectAllDataset(Guid.Parse(hdLandloadId.Value));
                ds.Tables[0].PrimaryKey = new DataColumn[] { ds.Tables[0].Columns["HouseId"] };

                if (DrpHouse.Items.Count < 1)
                {
                    DrpHouse.DataSource     = ds;
                    DrpHouse.DataTextField  = "StreetAddress";
                    DrpHouse.DataValueField = "HouseId";
                    DrpHouse.DataBind();
                    DrpHouse.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));
                }


                HouseEdit.Visible = true;
                // set selected house
                if (user_.HouseId.HasValue)
                {
                    for (int i = 0; i < DrpHouse.Items.Count; i++)
                    {
                        if (DrpHouse.Items[i].Value.ToString().ToLower() == user_.HouseId.ToString().ToLower())
                        {
                            DrpHouse.ClearSelection();
                            DrpHouse.Items[i].Selected = true;
                        }
                    }
                }

                House houseData = House.Select(user_.HouseId.Value);

                if (houseData != null)
                {
                    if (houseData.IsPartialHouse == true)
                    {
                        // HouseSearch.Visible = true;
                        chknotavailable.Visible = true;
                        DrpHouse.Enabled        = true;

                        EnableEdit();

                        if (houseData.StateId.HasValue)
                        {
                            for (int i = 0; i < Drpstate.Items.Count; i++)
                            {
                                if (Drpstate.Items[i].Value.ToString().ToLower() == houseData.StateId.ToString().ToLower())
                                {
                                    Drpstate.ClearSelection();
                                    Drpstate.Items[i].Selected = true;
                                }
                            }

                            State state;
                            state = Generic.Get <State>(houseData.StateId.Value);
                            if (state != null)
                            {
                                State.Text = state.StateName;
                            }
                        }

                        Address.Text = houseData.StreetAddress;
                        City.Text    = houseData.City;
                        Zip.Text     = houseData.Zip;

                        RentalAddress.Text = houseData.StreetAddress;
                        RentalCity.Text    = houseData.City;
                        RentalZip.Text     = houseData.Zip;
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNotPartialHouse + "'); window.location = '/Student/Student_Profile_Current_House_Details.aspx';}", true);
                    }
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNoRecords + "'); window.location = '/Student/Student_Profile_Current_House.aspx';}", true);
            }
        }