protected void uiLinkButtonSaveMemberSettings_Click(object sender, EventArgs e)
        {
            Member member = new Member();
            member.GetMemberByUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()));

            MemberSetting setting = new MemberSetting();
            setting.GetMemberSettingsByMemberID(member.MemberID);
            if (!(setting.RowCount > 0))
            {
                setting.AddNew();
                setting.MemberID = member.MemberID;
            }
            setting.HidePics = uiCheckBoxHidePics.Checked;
            setting.HideRoomPics = uiCheckBoxHideRoomPics.Checked;
            setting.HideProfile = uiCheckBoxHideProfile.Checked;
            setting.NotifyOnPrivateChat = uiCheckBoxNotifyOnPrivateChat.Checked;
            setting.NotifyOnFriendsOnOff = uiCheckBoxNotifyOnFriendsOnOff.Checked;
            setting.NotifyOnFriendChangeStatus = uiCheckBoxNotifyOnFriendChangeStatus.Checked;
            setting.NotifyOnGetMsg = uiCheckBoxNotifyOnGetMsg.Checked;
            setting.NotifyOnVoiceMail = uiCheckBoxNotifyOnVoiceMail.Checked;
            setting.SearchMeByMail = uiCheckBoxSearchMeByMail.Checked;
            setting.VoiceNotfication = uiCheckBoxVoiceNotfication.Checked;
            setting.ChangeMyStatus = uiCheckBoxChangeMyStatus.Checked;
            if (!string.IsNullOrEmpty(uiTextBoxChangeMyStatusMin.Text))
                setting.ChangeMyStatusMin = Convert.ToInt32(uiTextBoxChangeMyStatusMin.Text);
            if (uiRadioButtonListAcceptPM.SelectedIndex != -1)
                setting.AcceptPM = uiRadioButtonListAcceptPM.SelectedValue == "0" ? false : true;
            else
                setting.AcceptPM = false;

            if (uiRadioButtonListAcceptSMS.SelectedIndex != -1)
                setting.AcceptSMS = uiRadioButtonListAcceptSMS.SelectedValue == "0" ? false : true;
            else
                setting.AcceptSMS = false;

            if (uiRadioButtonListAcceptMsg.SelectedIndex != -1)
                setting.AcceptMSG = uiRadioButtonListAcceptMsg.SelectedValue == "0" ? false : true;
            else
                setting.AcceptMSG = false;
            if (uiRadioButtonListAcceptVoiceMail.SelectedIndex != -1)
                setting.AcceptVoiceMail = uiRadioButtonListAcceptVoiceMail.SelectedValue == "0" ? false : true;
            else
                setting.AcceptVoiceMail = false;
            if (uiRadioButtonListAcceptFiles.SelectedIndex != -1)
                setting.AcceptFiles = uiRadioButtonListAcceptFiles.SelectedValue == "0" ? false : true;
            else
                setting.AcceptFiles = false;
            if (uiRadioButtonListAcceptInvitations.SelectedIndex != -1)
                setting.AcceptInvitations = uiRadioButtonListAcceptInvitations.SelectedValue == "0" ? false : true;
            else
                setting.AcceptInvitations = false;

            setting.Save();
            LoadProfile();
            ClientScript.RegisterStartupScript(this.GetType(), "doneSavesett", "$(document).ready(function (){ notify('success','تم حقظ الإعدادات بنجاح.');}); ", true);
        }
        private void LoadProfile()
        {
            if (Request.IsAuthenticated)
            {
                Member member = new Member();
                member.GetMemberByUserId(new Guid(Membership.GetUser().ProviderUserKey.ToString()));
                uiLabelName.Text = uiTextBoxName.Text = member.Name;
                uiHiddenFieldCID_profile.Value = member.MemberID.ToString();
                if (!member.IsColumnNull("ReligionID"))
                {
                    Religion religion = new Religion();
                    uiDropDownListReligion.SelectedValue = member.ReligionID.ToString();
                    religion.LoadByPrimaryKey(member.ReligionID);
                    uiLabelReligion.Text = religion.Name;
                }
                uiLabelJob.Text = uiTextBoxJob.Text = member.JobTitle;
                if (!member.IsColumnNull("BirthDate"))
                {
                    uiLabelDOP.Text = uiTextBoxDOP.Text = member.BirthDate.ToString("yyyy/MM/dd");
                }
                if (!member.IsColumnNull("CountryID"))
                {
                    Country country = new Country();
                    if (member.CountryID != 0)
                        uiDropDownListCountry.SelectedValue = member.CountryID.ToString();
                    country.LoadByPrimaryKey(member.CountryID);
                    uiLabelCountry.Text = country.Name;
                }
                uiLabelBestFood.Text = uiTextBoxBestFood.Text = member.BestFood;
                uiLabelBestCar.Text = uiTextBoxBestCar.Text = member.BestCar;
                uiLabelBestTeam.Text = uiTextBoxBestTeam.Text = member.BestTeam;
                uiLabelBestCountry.Text = uiTextBoxBestCountry.Text = member.BestCounrty;
                uiLabelMail.Text = Membership.GetUser().Email;
                uiHyperLinkFb.NavigateUrl = uiTextBoxfb.Text = member.FbURL;
                uiHyperLinktwitter.NavigateUrl = uiTextBoxTwitter.Text = member.TURL;
                uiHyperLinkyt.NavigateUrl = uiTextBoxyt.Text = member.YtURL;

                uiLabelCreatedDate.Text = Membership.GetUser().CreationDate.ToString("yyyy/MM/dd");
                if (member.MemberType.MemberTypeSpecDurationID != Helper.Defaults.MemberTypeSpecDurationID)
                {
                    uiLabelAccountType.Text = member.MemberType.MemberTypeSpecDuration.MemberTypeSpec.Name;
                    if (!member.MemberType.IsColumnNull("EndDate"))
                        uiLabelTypeExpiry.Text = member.MemberType.EndDate.ToString("yyyy/MM/dd");
                }
                if (!member.IsColumnNull("ProfilePic"))
                {
                    uiImageMain.ImageUrl = "Thumb.aspx?w=100&h=100&Image=" + member.ProfilePic;
                }
                ///////////////////////////////
                uiLabelInterests.Text = uiTextBoxInterests.Text = member.Interests;

                ProfileLike likes = new ProfileLike();
                likes.GetLikeCount(member.MemberID);
                uiLabelLikeCount.Text = likes.RowCount.ToString();

                // load settings
                MemberSetting setting = new MemberSetting();
                setting.GetMemberSettingsByMemberID(member.MemberID);
                if (!(setting.RowCount > 0))
                {
                    return;
                }
                uiCheckBoxHidePics.Checked = setting.HidePics;
                uiCheckBoxHideRoomPics.Checked = setting.HideRoomPics;
                uiCheckBoxHideProfile.Checked = setting.HideProfile;
                uiCheckBoxNotifyOnPrivateChat.Checked = setting.NotifyOnPrivateChat;
                uiCheckBoxNotifyOnFriendsOnOff.Checked = setting.NotifyOnFriendsOnOff;
                uiCheckBoxNotifyOnFriendChangeStatus.Checked = setting.NotifyOnFriendChangeStatus;
                uiCheckBoxNotifyOnGetMsg.Checked = setting.NotifyOnGetMsg;
                uiCheckBoxNotifyOnVoiceMail.Checked = setting.NotifyOnVoiceMail;
                uiCheckBoxSearchMeByMail.Checked = setting.SearchMeByMail;
                uiCheckBoxVoiceNotfication.Checked = setting.VoiceNotfication;
                uiCheckBoxChangeMyStatus.Checked = setting.ChangeMyStatus;

                if (!setting.IsColumnNull("ChangeMyStatusMin"))
                    uiTextBoxChangeMyStatusMin.Text = setting.ChangeMyStatusMin.ToString();

                if (!setting.IsColumnNull("AcceptPM"))
                    uiRadioButtonListAcceptPM.SelectedValue = setting.AcceptPM ? "0" : "1";
                if (!setting.IsColumnNull("AcceptSMS"))
                    uiRadioButtonListAcceptSMS.SelectedValue = setting.AcceptSMS ? "0" : "1";
                if (!setting.IsColumnNull("AcceptMSG"))
                    uiRadioButtonListAcceptMsg.SelectedValue = setting.AcceptMSG ? "0" : "1";
                if (!setting.IsColumnNull("AcceptVoiceMail"))
                    uiRadioButtonListAcceptVoiceMail.SelectedValue = setting.AcceptVoiceMail ? "0" : "1";
                if (!setting.IsColumnNull("AcceptFiles"))
                    uiRadioButtonListAcceptFiles.SelectedValue = setting.AcceptFiles ? "0" : "1";
                if (!setting.IsColumnNull("AcceptInvitations"))
                    uiRadioButtonListAcceptInvitations.SelectedValue = setting.AcceptInvitations ? "0" : "1";

            }
            else
            {
                Response.Redirect("default.aspx");
            }
        }
        private void LoadProfile()
        {
            uiPanelHideProfile.Visible = false;
            uipanelProfile.Visible = true;
            if (userId != 0)
            {
                Member member = new Member();
                member.LoadByPrimaryKey(userId);

                // load settings
                MemberSetting setting = new MemberSetting();
                setting.GetMemberSettingsByMemberID(member.MemberID);
                if ((setting.RowCount > 0))
                {
                    if (!setting.IsColumnNull("HideProfile"))
                    {
                        if (setting.HideProfile)
                        {
                            uiPanelHideProfile.Visible = true;
                            uipanelProfile.Visible = false;
                        }
                    }
                    if (!setting.IsColumnNull("HidePics"))
                        uiPanelPics.Visible = !setting.HidePics;
                }

                uiLabelName.Text = member.Name;

                if (!member.IsColumnNull("ReligionID"))
                {
                    Religion religion = new Religion();
                    religion.LoadByPrimaryKey(member.ReligionID);
                    uiLabelReligion.Text = religion.Name;
                }
                uiLabelJob.Text = member.JobTitle;
                if (!member.IsColumnNull("BirthDate"))
                {
                    uiLabelDOP.Text = member.BirthDate.ToString("yyyy/MM/dd");
                }
                if (!member.IsColumnNull("CountryID"))
                {
                    Country country = new Country();
                    if (member.CountryID != 0)
                    {
                        country.LoadByPrimaryKey(member.CountryID);
                        uiLabelCountry.Text = country.Name;
                    }
                }
                uiLabelBestFood.Text = member.BestFood;
                uiLabelBestCar.Text = member.BestCar;
                uiLabelBestTeam.Text = member.BestTeam;
                uiLabelBestCountry.Text = member.BestCounrty;
                uiHyperLinkFb.NavigateUrl = member.FbURL;
                uiHyperLinktwitter.NavigateUrl = member.TURL;
                uiHyperLinkyt.NavigateUrl = member.YtURL;

                uiLabelCreatedDate.Text = Membership.GetUser().CreationDate.ToString("yyyy/MM/dd");
                if (member.MemberType.MemberTypeSpecDurationID != Helper.Defaults.MemberTypeSpecDurationID)
                {
                    uiLabelAccountType.Text = member.MemberType.MemberTypeSpecDuration.MemberTypeSpec.Name;
                    uiLabelAccountType.Attributes.Add("style", "background-color:" + member.MemberType.MemberTypeSpecDuration.MemberTypeSpec.Color + ";color:#fff;");

                    if (!member.MemberType.IsColumnNull("EndDate"))
                        uiLabelTypeExpiry.Text = member.MemberType.EndDate.ToString("yyyy/MM/dd");
                }
                if (!member.IsColumnNull("ProfilePic"))
                {
                    uiImageMain.ImageUrl = "images.aspx?Image=" + member.ProfilePic;
                }
                ///////////////////////////////
                uiLabelInterests.Text = member.Interests;

                ProfileLike likes = new ProfileLike();
                likes.GetLikeCount(member.MemberID);
                uiLabelLikeCount.Text = likes.RowCount.ToString();

                likes.LoadByPrimaryKey(Member.CurrentMemberID, member.MemberID);
                uiLinkButtonLike.OnClientClick = "return ToggleProfileLike(" + Member.CurrentMemberID.ToString() + ", " + member.MemberID + ")";
                uiLinkButtonUnLike.OnClientClick = "return ToggleProfileLike(" + Member.CurrentMemberID.ToString() + ", " + member.MemberID + ")";
                if (likes.RowCount > 0)
                {
                    uiLinkButtonUnLike.Attributes.Add("style","display:inline;padding:0px;");
                    uiLinkButtonLike.Attributes.Add("style", "display:none;padding:0px;");

                }
                else
                {
                    uiLinkButtonUnLike.Attributes.Add("style", "display:none;padding:0px;");
                    uiLinkButtonLike.Attributes.Add("style", "display:inline;padding:0px;");
                }

                MemberPic pics = new MemberPic();
                pics.GetMemberPicsByMemberID(member.MemberID);
                uiRepeaterPhotos.DataSource = pics.DefaultView;
                uiRepeaterPhotos.DataBind();
            }
            else
            {
                Response.Redirect("home.aspx");
            }
        }