Exemplo n.º 1
0
        private void LoadInitialData()
        {
            //DRPYear
            DRPYear.Items.Clear();
            DRPYear.Items.Add(new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));
            for (int i = Constants.LANDLORD_PROFILE_HOUSEBUILD_STARTING_YEAR; i <= Constants.LANDLORD_PROFILE_HOUSEBUILD_NUMBER_OF_YEARS + Constants.LANDLORD_PROFILE_HOUSEBUILD_STARTING_YEAR; i++)
            {
                DRPYear.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }

            //Drpstate
            Drpstate.DataSource     = RHP.Utility.Generic.GetAll <State>();
            Drpstate.DataTextField  = "StateName";
            Drpstate.DataValueField = "StateId";
            Drpstate.DataBind();
            Drpstate.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));

            //DrpBathRooms
            DrpBathRooms.Items.Clear();
            for (int i = Constants.LANDLORD_PROFILE_HOUSEBUILD_BATHROOMS_MIN; i <= Constants.LANDLORD_PROFILE_HOUSEBUILD_BATHROOMS_MIN + Constants.LANDLORD_PROFILE_HOUSEBUILD_BATHROOMS; i++)
            {
                DrpBathRooms.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            DrpBathRooms.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));

            //DrpBedRooms
            DrpBedRooms.Items.Clear();
            for (int i = Constants.LANDLORD_PROFILE_HOUSEBUILD_BEDROOMS_MIN; i <= Constants.LANDLORD_PROFILE_HOUSEBUILD_BEDROOMS_MIN + Constants.LANDLORD_PROFILE_HOUSEBUILD_BEDROOMS; i++)
            {
                DrpBedRooms.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }
            DrpBedRooms.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));
        }
Exemplo n.º 2
0
        public void LoadUserData()
        {
            // user data
            user = User.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));

            // user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
            // user.AspnetUserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
            FirstName.Text  = string.IsNullOrEmpty(user.FirstName) ? string.Empty : user.FirstName;
            MiddleName.Text = string.IsNullOrEmpty(user.MiddleName) ? string.Empty : user.MiddleName;
            LastName.Text   = string.IsNullOrEmpty(user.LastName) ? string.Empty : user.LastName;
            Email.Text      = string.IsNullOrEmpty(Membership.GetUser().Email.ToString()) ? string.Empty : Membership.GetUser().Email.ToString();
            Address.Text    = string.IsNullOrEmpty(user.StreetAddress) ? string.Empty : user.StreetAddress;
            City.Text       = string.IsNullOrEmpty(user.City) ? string.Empty : user.City;
            Zip.Text        = string.IsNullOrEmpty(user.Zip) ? string.Empty : user.Zip;

            //if (user.DateOfBirth.HasValue)
            //{
            //    DateTime DOB_ = user.DateOfBirth.Value;

            //}
            DOB.Text = string.IsNullOrEmpty(user.DateOfBirth.ToString()) ? string.Empty : user.DateOfBirth.Value.ToShortDateString();

            MobileArea.Text = string.IsNullOrEmpty(user.BestContactNumber) ? string.Empty : user.BestContactNumber.Substring(0, 3);
            Mobile1.Text    = string.IsNullOrEmpty(user.BestContactNumber) ? string.Empty : user.BestContactNumber.Substring(3, 3);
            Mobile2.Text    = string.IsNullOrEmpty(user.BestContactNumber) ? string.Empty : user.BestContactNumber.Substring(6, 4);


            // Mobile.Text = string.IsNullOrEmpty(user.BestContactNumber) ? string.Empty : user.BestContactNumber;

            // DriversLicense.Text = string.IsNullOrEmpty(user.DriversLicenseNumber) ? string.Empty : user.DriversLicenseNumber;


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

            if (!string.IsNullOrEmpty(user.Gender))
            {
                for (int i = 0; i < DrpGender.Items.Count; i++)
                {
                    if (DrpGender.Items[i].Value.ToString().ToLower() == user.Gender.ToLower())
                    {
                        DrpGender.ClearSelection();
                        DrpGender.Items[i].Selected = true;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void LoadInitialData()
        {
            //Set Gender
            DrpGender.Items.AddRange(Constants.STUDENT_SEX_LIST);

            //Drpstate
            Drpstate.DataSource     = RHP.Utility.Generic.GetAll <State>();
            Drpstate.DataTextField  = "StateName";
            Drpstate.DataValueField = "StateId";
            Drpstate.DataBind();
            Drpstate.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));
        }
        private void LoadInitialData()
        {
            //Drpstate

            if (Drpstate.Items.Count < 1)
            {
                Drpstate.DataSource     = RHP.Utility.Generic.GetAll <State>();
                Drpstate.DataTextField  = "StateName";
                Drpstate.DataValueField = "StateId";
                Drpstate.DataBind();
                Drpstate.Items.Insert(0, new ListItem(Constants.DROPDOWN_EMPTY_ITEM_TEXT, Constants.DROPDOWN_EMPTY_ITEM_VALUE));
            }
        }
        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);
            }
        }