protected void OnConfirmRequest(object sender, EventArgs e)
        {
            string confirmValue = Request.Form["confirm_value"];
            if (confirmValue == "Yes")
            {
                user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());

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

                Guid HouseId = Guid.Empty;
                Guid RoomId = Guid.Empty;
                if (user.HouseId.HasValue)
                {
                    HouseId = user.HouseId.Value;
                    user.HouseId = null;
                }
                else if (user.BaseHouseRoomId.HasValue)
                {
                    RoomId = user.BaseHouseRoomId.Value;
                    user.BaseHouseRoomId = null;
                }

                if (user.UpdateHouse())
                {
                    StudentHouseLeave studentHouseLeave = new StudentHouseLeave();
                    if (user.HouseId.HasValue)
                    {
                        studentHouseLeave = StudentHouseLeave.SelectByHouseId(HouseId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));
                    }
                    else if (user.BaseHouseRoomId.HasValue)
                    {
                        studentHouseLeave = StudentHouseLeave.SelectByRoomId(RoomId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));
                    }

                    studentHouseLeave.status = 1;

                    if (studentHouseLeave.Save())
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.LeaveCurrentHouseResponseSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true);
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.LeaveCurrentHouseResponseUnSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true);
                    }
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.LeaveCurrentHouseResponseUnSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true);
                }

            }
            else
            {
                user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());

                StudentHouseLeave studentHouseLeave = new StudentHouseLeave();
                if (user.HouseId.HasValue)
                {
                    studentHouseLeave = StudentHouseLeave.SelectByHouseId(user.HouseId.Value, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));
                }
                else if (user.BaseHouseRoomId.HasValue)
                {
                    studentHouseLeave = StudentHouseLeave.SelectByRoomId(user.BaseHouseRoomId.Value, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));
                }

                studentHouseLeave.status = 2;

                if (studentHouseLeave.Save())
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.RejectLeaveCurrentHouseResponseSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true);
                }
            }
        }
        protected void RequestLeaveCurrentHouse_Command(object sender, CommandEventArgs args)
        {
            string userid = (string)args.CommandArgument;

            RHP.UserManagement.User _user = new RHP.UserManagement.User();

            _user = RHP.UserManagement.User.Select(Guid.Parse(userid));

            StudentHouseLeave studentHouseLeave = new StudentHouseLeave();
            studentHouseLeave.RequestBy = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
            studentHouseLeave.RequestTo = Guid.Parse(userid);
            studentHouseLeave.HouseId = _user.HouseId.Value;
            studentHouseLeave.status = 0;

            studentHouseLeave.Save();

            string strMsgContent = message(_user);

            string strMsgTitle = "www.ratemystudenthome.com is Requesting you to Leave Current Residence.";

            int rtn = SendEmail(_user.PersonalEmail, strMsgTitle, strMsgContent);

            Page.ClientScript.RegisterStartupScript(this.GetType(), "Redirect", "window.onload = function(){ alert('" + Messages.LeaveCurrentHouseRequestSuccess + "'); window.location = '/Student/Student_Profile_Leave_Current_House.aspx';}", true);
        }
        public void OnConfirm(object sender, EventArgs e)
        {
            string confirmValue = Request.Form["confirm_value"];
            if (confirmValue == "Yes")
            {
                user.UserId = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
                Guid HouseId = Guid.Empty;
                Guid RoomId = Guid.Empty;
                if (user.HouseId.HasValue)
                {
                    HouseId = user.HouseId.Value;
                    user.HouseId = null;
                }
                else if (user.BaseHouseRoomId.HasValue)
                {
                    RoomId = user.BaseHouseRoomId.Value;
                    user.BaseHouseRoomId = null;
                }

                if (user.UpdateHouse())
                {
                    StudentHouseLeave studentHouseLeave = new StudentHouseLeave();
                    if (HouseId !=Guid.Empty )
                    {
                        studentHouseLeave = StudentHouseLeave.SelectByHouseId(HouseId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));
                    }
                    else if (RoomId != Guid.Empty)
                    {
                        studentHouseLeave = StudentHouseLeave.SelectByRoomId(RoomId, Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));
                    }

                    studentHouseLeave.status = 1;

                    if (studentHouseLeave.Save())
                    {

                    }

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

            }
            else
            {
                // this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true);
            }
        }