public void GetRandomMember() { int rnd = UnityEngine.Random.Range(0, this.memberList.Count); m.Member member = this.memberList[rnd]; if (member.photo != null) { string memberInfo = member.name + ", " + member.city; string memberBio = member.bio; this.memberInfo.text = memberInfo; this.memberBio.text = memberBio; string photoUrl = member.photo.highres_link != null ? member.photo.highres_link : member.photo.photo_link; IEnumerator coroutine = LoadImage(photoUrl); StartCoroutine(coroutine); } else { this.GetRandomMember(); } }
/// <summary> /// Deprecated Method for adding a new object to the Member EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToMember(Member member) { base.AddObject("Member", member); }
/// <summary> /// Create a new Member object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="gender">Initial value of the Gender property.</param> /// <param name="contractNo">Initial value of the ContractNo property.</param> /// <param name="registDate">Initial value of the RegistDate property.</param> /// <param name="expireDate">Initial value of the ExpireDate property.</param> /// <param name="cardType">Initial value of the CardType property.</param> /// <param name="cardStartMoney">Initial value of the CardStartMoney property.</param> /// <param name="cardRestMoney">Initial value of the CardRestMoney property.</param> /// <param name="score">Initial value of the Score property.</param> /// <param name="isTemp">Initial value of the IsTemp property.</param> /// <param name="tempTimes">Initial value of the TempTimes property.</param> /// <param name="joneCount">Initial value of the JoneCount property.</param> public static Member CreateMember(global::System.Int32 id, global::System.String name, global::System.String gender, global::System.String contractNo, global::System.DateTime registDate, global::System.DateTime expireDate, global::System.String cardType, global::System.Double cardStartMoney, global::System.Double cardRestMoney, global::System.Int32 score, global::System.Boolean isTemp, global::System.Int32 tempTimes, global::System.Int32 joneCount) { Member member = new Member(); member.Id = id; member.Name = name; member.Gender = gender; member.ContractNo = contractNo; member.RegistDate = registDate; member.ExpireDate = expireDate; member.CardType = cardType; member.CardStartMoney = cardStartMoney; member.CardRestMoney = cardRestMoney; member.Score = score; member.IsTemp = isTemp; member.TempTimes = tempTimes; member.JoneCount = joneCount; return member; }
/// <summary> /// 往实体集合中添加记录 /// </summary> /// <param name="list">实体列表</param> /// <param name="dt">表</param> private void LoadListData(ref IList<Model.Member > list, DataTable dt) { if (dt.Rows.Count > 0) { Model.Member model; foreach (DataRow dr in dt.Rows) { model = new Model.Member (); LoadEntityData(ref model, dr); list.Add(model); } } }
/// <summary> /// 获得单个实体对象 /// </summary> /// <param name="whereStr">关键字</param> /// <returns>实体对象</returns> public Model.Member SelectModel(string whereStr) { StringBuilder strSql = new StringBuilder(); strSql.Append(@"select [Id],[JK_Name],[JK_Password],[JK_Leve],[JK_City],[JK_Sex],[JK_Phone],[JK_Datetime],[JK_Id],[JK_Jurisdiction],[JK_Activate],[JK_Number_Card_Id] from [Member] "); if (whereStr.Trim() != "") { strSql.Append(@" where " + whereStr); } Model.Member model = new Model.Member(); DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString()); if (dt.Rows.Count > 0) { LoadEntityData(ref model, dt.Rows[0]); return model; } else { return null; } }
/// <summary> /// 获得单个实体对象 /// </summary> /// <param name="id">关键字</param> /// <returns>实体对象</returns> public Model.Member SelectModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append(@"select [Id],[JK_Name],[JK_Password],[JK_Leve],[JK_City],[JK_Sex],[JK_Phone],[JK_Datetime],[JK_Id],[JK_Jurisdiction],[JK_Activate],[JK_Number_Card_Id] from [Member] "); strSql.Append(@" where [Id]=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4)}; parameters[0].Value = id; Model.Member model = new Model.Member(); DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString(), parameters); if (dt.Rows.Count > 0) { LoadEntityData(ref model, dt.Rows[0]); return model; } else { return null; } }
/// <summary> /// 根据条件查询实体记录 /// </summary> /// <param name="whereStr">查询条件</param> /// <returns>实体记录</returns> public IList<Model.Member> SelectList(int top,string whereStr) { StringBuilder strSql = new StringBuilder(); strSql.Append(@"select "); if(top>0) { strSql.Append(" top "+top); } strSql.Append(" [Id],[JK_Name],[JK_Password],[JK_Leve],[JK_City],[JK_Sex],[JK_Phone],[JK_Datetime],[JK_Id],[JK_Jurisdiction],[JK_Activate],[JK_Number_Card_Id] from [Member] "); if (whereStr.Trim() != "") { strSql.Append(@" where " + whereStr); } DataTable dt = DAL.SqlDataHelper.GetDataTable(strSql.ToString()); List<Model.Member > list = null; if (dt.Rows.Count > 0) { list = new List<Model.Member >(); Model.Member model = null; foreach (DataRow dr in dt.Rows) { model = new Model.Member (); LoadEntityData(ref model, dr); list.Add(model); } } return list; }