private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // #endregion Fields #region Methods /// <summary> /// 绑定 /// </summary> /// <param name="CurrentPage"></param> /// <param name="PageSize"></param> public void bind(AccountSearchJson json, string IsShow, string Sort, bool isTrue) { PagingInfo pagingInfo = new PagingInfo(); pagingInfo.CurrentPage = AspNetPager1.CurrentPageIndex; pagingInfo.PageSize = AspNetPager1.PageSize = SetCurrentPageSize.CurrentPageSize; List<CY.UME.Core.Business.Account> accountList = CY.UME.Core.Business.Account.GetIsShowAccounts(json, CY.Utility.Common.ConvertUtility.ConvertToInt(IsShow, -1), Sort, pagingInfo); List<Accountplus> accountplus = new List<Accountplus>(); for (int i = 0; i < accountList.Count; i++) { Accountplus tempaccountplus = new Accountplus(); tempaccountplus.Id = accountList[i].Id; tempaccountplus.Code = accountList[i].Code; tempaccountplus.Name = accountList[i].Name; tempaccountplus.NickName = accountList[i].NickName; tempaccountplus.DateCreated = accountList[i].DateCreated; tempaccountplus.IsProtected = accountList[i].IsProtected; tempaccountplus.HasAvatar = accountList[i].HasAvatar; tempaccountplus.ViewNumber = accountList[i].ViewNumber; tempaccountplus.IsTeacher = accountList[i].IsTeacher; tempaccountplus.IsPublic = accountList[i].IsPublic; tempaccountplus.Credit = accountList[i].Credit; tempaccountplus.Remark = accountList[i].Remark; tempaccountplus.FriendCount = accountList[i].FriendCount; if (CY.UME.Core.Business.Recommend.IsRecommend(accountList[i].Id.ToString(), "user")) { tempaccountplus.Oper = "decommend"; } else { tempaccountplus.Oper = "recommend"; } accountplus.Add(tempaccountplus); } if (accountplus.Count >= 1) { if (isTrue) { AspNetPager1.RecordCount = CY.UME.Core.Business.Account.GetIsShowAccountCount(json, CY.Utility.Common.ConvertUtility.ConvertToInt(IsShow, -1));//绑定总条数 GetAccountsCount } //绑定用户 AspNetPager1.Visible = true; Repeater2.Visible = false; Repeater1.Visible = true; Repeater1.DataSourceID = ""; Repeater1.DataSource = accountplus; Repeater1.DataBind(); } else { Repeater1.Visible = false; Repeater2.Visible = true; Repeater2.DataSourceID = ""; Repeater2.DataSource = BindNoData("暂无数据"); Repeater2.DataBind(); AspNetPager1.Visible = false; } }
/// <summary> /// 高级查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSearch_Click(object sender, EventArgs e) { AspNetPager1.CurrentPageIndex = 1; int universityId = CY.Utility.Common.ConvertUtility.ConvertToInt(HFUniversity.Value, 0); int collegeId = CY.Utility.Common.ConvertUtility.ConvertToInt(HFCollegeId.Value, 0); int majorId = CY.Utility.Common.ConvertUtility.ConvertToInt(ddlMajor.SelectedValue, 0); AccountSearchJson json = new AccountSearchJson(); json.Name = txtName.Text.ToString().Trim();//姓名 json.Gender = Convert.ToInt32(rbGender.SelectedValue);//性别 json.UniversityID = universityId;//学校 json.CollegeId = collegeId;//学院 json.ResideProvinceId = ProvinceCityReside.ProvinceId; //居住地省份 json.ResideCityId = ProvinceCityReside.CityId; //居住地城市 json.HometownProvinceId = HomeProvinceCity.ProvinceId; json.HometownCityId = HomeProvinceCity.CityId; json.ClassInfoId = CY.Utility.Common.ConvertUtility.ConvertToInt(ddlClassInfo.SelectedValue, -1);//班级 json.MajorId = majorId;//专业 Session["json"] = json; HFIsShow.Value = DDLIsShow.SelectedValue; HFSort.Value = DDLSort.SelectedValue; bind(json, HFIsShow.Value, DDLSort.SelectedValue, true); HFUniversityName.Value = CY.UME.Core.Business.University.GetUniversityNameById(universityId.ToString()); //学院 IList<College> ColegeList = College.GetCollegeByUniIdAndName(CY.Utility.Common.ConvertUtility.ConvertToInt(universityId, -1), "");//accountExtend.UniversityId ddlCollege.DataSourceID = ""; ddlCollege.DataSource = ColegeList; ddlCollege.DataBind(); ddlCollege.Items.Insert(0, new ListItem("-暂无-", "-1")); IList<Major> MajorList = Major.GetMojorByCollegeIdAndName(collegeId, ""); ddlMajor.DataSourceID = ""; ddlMajor.DataSource = MajorList; ddlMajor.DataBind(); ddlMajor.Items.Insert(0, new ListItem("-暂无-", "-1")); try { ddlCollege.SelectedValue = collegeId.ToString(); ddlMajor.SelectedValue = majorId.ToString(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["json"] = new AccountSearchJson();//在没有搜索的情况下使用。 if (Request.QueryString["action"] != null) { int action = Convert.ToInt32(Request.QueryString["action"].ToString()); bind(new AccountSearchJson(), "1", "", true); } bind(new AccountSearchJson(), "1", "", true); //bindCollege(ddlUniversity.SelectedValue);//学院 //bindMajor(ddlCollege.SelectedValue);//专业 bindClassInfo();//班级 } IList<CY.UME.Core.Business.Account> AccountList = CY.UME.Core.Business.Account.GetAllAccountAndNotIsShow(); TextBox1.Text = AccountList.Count.ToString(); System.Text.StringBuilder sbAccount = new System.Text.StringBuilder(); System.Text.StringBuilder sbAccountExtend = new System.Text.StringBuilder(); for (int i = 0; i < 100; i++) { sbAccount.Append("INSERT INTO Ask_members(Id,username,password) values(" + AccountList[i].Id + ",'" + AccountList[i].ExtendInfo.Email + "','" + AccountList[i].ExtendInfo.Password + "'); \r\n"); sbAccountExtend.Append("INSERT INTO Ask_memberfields(Id,Score,Username,Email,Realname) values(" + AccountList[i].Id + ",100,'" + AccountList[i].ExtendInfo.Email + "','" + AccountList[i].ExtendInfo.Email + "','" + AccountList[i].Name + "'); \r\n"); } TextBox1.Text = sbAccount.ToString(); TextBox2.Text = sbAccountExtend.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["json"] = new AccountSearchJson();//在没有搜索的情况下使用。 if (Request.QueryString["action"] != null) { int action = Convert.ToInt32(Request.QueryString["action"].ToString()); bind(new AccountSearchJson(), "", true); } bind(new AccountSearchJson(), "", true); //bindCollege(HFUniversity.Value);//学院 //bindMajor(ddlCollege.SelectedValue);//专业 bindClassInfo();//班级 } }