public string RefreshXML() { //初始化pie List<Piecearea> pieList = new List<Piecearea>(); pieList.Add(new Piecearea { code = 1, name = "浦城" }); pieList.Add(new Piecearea { code = 1, name = "浦城" }); pieList.Add(new Piecearea { code = 1, name = "浦城" }); pieList.Add(new Piecearea { code = 1, name = "浦城" }); pieList.Add(new Piecearea { code = 1, name = "浦城" }); pieList.Add(new Piecearea { code = 1, name = "浦城" }); //初始化city List<City> cityList = new List<City>(); cityList.Add(new City { code = 1, name = "南平", pieList = pieList }); cityList.Add(new City { code = 1, name = "南平", pieList = pieList }); cityList.Add(new City { code = 1, name = "南平", pieList = pieList }); cityList.Add(new City { code = 1, name = "南平", pieList = pieList }); cityList.Add(new City { code = 1, name = "南平", pieList = pieList }); //初始化省份 List<province> proList = new List<province>(); proList.Add(new province { ID = 1, code = 1, name = "北京", cityList = cityList }); proList.Add(new province { ID = 1, code = 1, name = "北京", cityList = cityList }); proList.Add(new province { ID = 1, code = 1, name = "北京", cityList = cityList }); proList.Add(new province { }); string path = System.AppDomain.CurrentDomain.BaseDirectory.ToString(); Country model = new Country { code = 123, name = "test", proList = proList }; path = path + "test.xml"; XmlHelper.XmlSerializeToFile(model, path, Encoding.UTF8); return ""; }
public void test() { var list = entity.hp_address.Where(o => o.pid == 0).ToList(); //包装省份 List<province> proList = new List<province>(); for (int i = 0; i < list.Count(); i++) { int proid = list[i].id; string proname = list[i].name.Trim(); proList.Add(new province { ID = i, code = proid, name = proname }); int procode = proList[i].code; var city_model_list = entity.hp_address.Where(o => o.pid == procode).ToList(); proList[i].cityList = new List<City>(); //proList[i].cityList = initCityList(city_model_list); for (int j = 0; j < city_model_list.Count(); j++) { //proList[i].cityList.Add---每一个都add一个县list int id2 = city_model_list[j].id; var piecearea_model_list = entity.hp_address.Where(o => o.pid == id2).ToList(); List<Piecearea> piecearer_list=new List<Piecearea> (); for(int k=0;k<piecearea_model_list.Count();k++) { Piecearea p_model=initPiecearea(piecearea_model_list[k]); piecearer_list.Add(p_model); } City c_model = initCityList(piecearer_list, city_model_list[j]); proList[i].cityList.Add(c_model); } } string path = System.AppDomain.CurrentDomain.BaseDirectory.ToString(); path = path + "/Resource/area.xml"; Country model = new Country { code = 086, name = "中国", proList = proList }; XmlHelper.XmlSerializeToFile(model, path, Encoding.UTF8); //用proList的每一项的code当做pid条件去找,来包装citylist //用citylist的每一项的code当做pid条件去找,来包装piearealist }
private void LoadDDls() { Religion religion = new Religion(); religion.LoadAll(); uiDropDownListReligion.DataSource = religion.DefaultView; uiDropDownListReligion.DataTextField = "Name"; uiDropDownListReligion.DataValueField = "ReligionID"; uiDropDownListReligion.DataBind(); Country country = new Country(); country.LoadAll(); uiDropDownListCountry.DataSource = country.DefaultView; uiDropDownListCountry.DataTextField = "Name"; uiDropDownListCountry.DataValueField = "CountryID"; uiDropDownListCountry.DataBind(); uiDropDownListCountry.Items.Insert(0, new ListItem("إختر البلد", "0")); }
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"); } }