public void LoadLandlordData(User user_)
        {
            UserDAO userDAO = new UserDAO();

            if (user_.HouseId != null)
            {
                DataSet LandlordData = userDAO.SelectLandlordByHouseId(user.HouseId.Value);

                if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0)
                {
                    string FirstName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim();
                    string MiddleName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim();
                    string LastName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim();

                    Name.Text = FirstName + " " + MiddleName + " " + LastName;

                    Email.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim();
                    Mobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim();

                }

            }
            else if (user_.BaseHouseRoomId != null)
            {
                DataSet LandlordData = userDAO.SelectLandlordByBaseHouseRoomId(user.BaseHouseRoomId.Value);

                if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0)
                {
                    string FirstName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim();
                    string MiddleName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim();
                    string LastName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim();

                    Name.Text = FirstName + " " + MiddleName + " " + LastName;
                    Email.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim();
                    Mobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim();

                }
            }
        }
        public void LoadUserData()
        {
            // user data

            UserDAO userDAO = new UserDAO();

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

            if (user.HouseId != null)
            {

                Labelmessage.Text = "";//Current landload Details";
                DataSet LandlordData = userDAO.SelectLandlordByHouseId(user.HouseId.Value);

                if(LandlordData != null && LandlordData.Tables[0].Rows.Count > 0)
                {
                    PassID(Guid.Parse(LandlordData.Tables[0].Rows[0]["UserId"].ToString().Trim()));

                    ButtonVerify.Visible = false;
                    Email.Enabled = false;
                    FirstName.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim();
                    MiddleName.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim();
                    LastName.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim();
                    Email.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim();
                   // Mobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim();

                    MobileArea.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Substring(0, 3);
                    Mobile1.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Substring(3, 3);
                    Mobile2.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Substring(6, 4);

                }

            }
        }
        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);

            }
        }
        public void LoadUserData()
        {
            UserDAO userDAO = new UserDAO();
            if (Membership.GetUser() == null)
            {
                return;
            }
            user = RHP.UserManagement.User.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));

            if (user.HouseId != null || user.BaseHouseRoomId != null)
            {
                LoadLandlordData(user);
                LoadHouseData(user);
                LoadStudentData(user);
            }
            else
            {
                if (!IsFromWizard)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNoRecords + "'); window.location = '/Student/Student_Profile_Current_House.aspx';}", true);
                }
            }
        }
        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 LoadUserData()
        {
            UserDAO userDAO = new UserDAO();

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

            if (user.HouseId != null)
            {

               // LoadHouseData(user);
                loadHouseDatadata(user);
                hdHouseId.Value = user.HouseId.Value.ToString();
                hdUserID.Value = user.UserId.Value.ToString();
            }
            else
            {

                Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNoRecords + "'); window.location = '/Student/Student_Profile_Current_House.aspx';}", true);

            }
        }
        public void LoadUserData()
        {
            UserDAO userDAO = new UserDAO();

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

            if (user.HouseId != null)
            {

                    LoadLandlordData(user);

                    //if ((user.UserId.HasValue && user.IsPartialUser == true) && (user.AspnetUserId.HasValue == null || user.AspnetUserId == Guid.Empty))
                    //{
                    //}
                    //else
                    //{
                    //    Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNotPartialUser + "'); window.location = '/Student/Student_Profile_Update_Current_House.aspx';}", true);

                    //}
            }
            else
            {

                Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNoRecords + "'); window.location = '/Student/Student_Profile_Current_House.aspx';}", true);

            }
        }
        public void LoadLandlordData(User user_)
        {
            UserDAO userDAO = new UserDAO();

            if (user_.HouseId != null)
            {
                DataSet LandlordData = userDAO.SelectLandlordByHouseId(user_.HouseId.Value);

                if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0)
                {

                    string IspartialUser = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["IsPartialUser"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["IsPartialUser"].ToString().Trim();
                    string AspnetUserId = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["AspnetUserId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["AspnetUserId"].ToString().Trim();

                    if (IspartialUser.ToLower() == "true" && (AspnetUserId == "" || AspnetUserId == string.Empty))
                    {
                        hdLandloadId.Value = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim();
                        string FirstName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim();
                        string MiddleName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim();
                        string LastName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim();

                        lbName.Text = FirstName + " " + MiddleName + " " + LastName;

                        lbEmail.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim();
                        lbMobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim();

                        LandloadEmail.Text = lbEmail.Text;
                        LandloadFirstName.Text = FirstName;
                        LandloadMiddleName.Text = MiddleName;
                        LandloadLastName.Text = LastName;

                        LandloadMobileArea.Text = string.IsNullOrEmpty(lbMobile.Text) ? string.Empty : lbMobile.Text.Substring(0, 3);
                        LandloadMobile1.Text = string.IsNullOrEmpty(lbMobile.Text) ? string.Empty : lbMobile.Text.Substring(3, 3);
                        LandloadMobile2.Text = string.IsNullOrEmpty(lbMobile.Text) ? string.Empty : lbMobile.Text.Substring(6, 4);

                        LandloadEdit.Visible = true;
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNotPartialUser + "'); window.location = '/Student/Student_Profile_Update_Current_House.aspx';}", true);

                    }
                }
            }
        }
        // Landload info
        public void LoadLandlordData(User user_)
        {
            UserDAO userDAO = new UserDAO();

            if (user_.HouseId != null || user_.BaseHouseRoomId != null)
            {
                DataSet LandlordData;

                if (user_.HouseId != null)
                {
                    LandlordData = userDAO.SelectLandlordByHouseId(user.HouseId.Value);
                }
                else
                {
                    LandlordData = userDAO.SelectLandlordByBaseHouseRoomId(user.BaseHouseRoomId.Value);
                }

                if (LandlordData != null && LandlordData.Tables[0].Rows.Count > 0)
                {
                    string IspartialUser = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["IsPartialUser"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["IsPartialUser"].ToString().Trim();
                    string AspnetUserId = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["AspnetUserId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["AspnetUserId"].ToString().Trim();

                    if (IspartialUser.ToLower() == "true" && (AspnetUserId == "" || AspnetUserId == string.Empty))
                    {
                        EditLandloadInfoLink.Visible = true;
                    }
                    else
                    {
                        EditLandloadInfoLink.Visible = true;
                    }

                    hdLandloadId.Value = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LandlordId"].ToString().Trim();
                    string FirstName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["FirstName"].ToString().Trim();
                    string MiddleName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["MiddleName"].ToString().Trim();
                    string LastName = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["LastName"].ToString().Trim();

                    lbName.Text = FirstName + " " + MiddleName + " " + LastName;

                    lbEmail.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["PersonalEmail"].ToString().Trim();
                    lbMobile.Text = string.IsNullOrEmpty(LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim()) ? string.Empty : LandlordData.Tables[0].Rows[0]["BestContactNumber"].ToString().Trim();

                }

            }
        }
Beispiel #10
0
        public bool UpdateHouse()
        {
            bool result = false;

            Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING);
            DbConnection connection = db.CreateConnection();
            connection.Open();
            DbTransaction transaction = connection.BeginTransaction();

            try
            {
                UserDAO userDao = new UserDAO();
                if (userDao.IsUserExist(this))
                {
                    result = (new UserDAO()).UpdateHouse(this, db, transaction);
                }
                else
                {
                    result = false;
                }

                transaction.Commit();
            }
            catch (System.Exception ex)
            {
                transaction.Rollback();
                result = false;
                throw ex;
            }
            finally
            {
                connection.Close();
            }
            return result;
        }
        public void LoadUserData()
        {
            UserDAO userDAO = new UserDAO();

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

            if (user.HouseId != null)
            {
                ButtonLeaveHouseID.Visible = true;

                LoadStudentByHouseId(user.HouseId.Value);
                LoadLeaveCurrentHouseRequest(user.HouseId.Value);
            }
            else if (user.BaseHouseRoomId != null)
            {
                ButtonLeaveHouseID.Visible = true;

                LoadStudentByBaseHouseRoomId(user.BaseHouseRoomId.Value);
                LoadLeaveCurrentRoomRequest(user.BaseHouseRoomId.Value);
            }
            else
            {

                Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.CurrentHouseNoRecords + "'); window.location = '/Student/Student_Profile_Current_House.aspx';}", true);

            }
        }