예제 #1
0
 public ADeeWu.HuoBi3J.Model.IM_Friends GetEntity(string where)
 {
     DataTable dt = this.Select(where,"");
     if(dt.Rows.Count==0) return null;
     DataRow dr = dt.Rows[0];
     ADeeWu.HuoBi3J.Model.IM_Friends Entity = new ADeeWu.HuoBi3J.Model.IM_Friends();
     Entity.ID = long.Parse(dr["ID"].ToString());
     Entity.UserID = long.Parse(dr["UserID"].ToString());
     Entity.UserUIN = (string)(dr["UserUIN"]);
     Entity.FriendUserID = long.Parse(dr["FriendUserID"].ToString());
     Entity.FriendUIN = (string)(dr["FriendUIN"]);
     Entity.Alias = (string)(dr["Alias"]);
     Entity.CheckState = int.Parse(dr["CheckState"].ToString());
     Entity.CreateTime = DateTime.Parse(dr["CreateTime"].ToString());
     return Entity;
 }
예제 #2
0
        public ADeeWu.HuoBi3J.Model.IM_Friends[] GetEntityList(string orderBy,string[] columns,params object[] values)
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("select * from [IM_Friends] where 1=1");
            db.Parameters.Clear();
            for(int i=0;i<columns.Length;i++)
            {
                builder.AppendFormat(" and [{0}]=@{0}", columns[i]);
                db.Parameters.Append("@"+columns[i],values[i]);
            }

            if (!string.IsNullOrEmpty(orderBy))
            {
                builder.AppendFormat(" order by {0}", orderBy);
            }

            DataTable dt = db.Select(builder.ToString());

            ADeeWu.HuoBi3J.Model.IM_Friends[] EntityList = new ADeeWu.HuoBi3J.Model.IM_Friends[dt.Rows.Count];
             if (dt.Rows.Count == 0) return EntityList;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow dr = dt.Rows[i];
                ADeeWu.HuoBi3J.Model.IM_Friends Entity = new ADeeWu.HuoBi3J.Model.IM_Friends();
                Entity.ID = long.Parse(dr["ID"].ToString());
                Entity.UserID = long.Parse(dr["UserID"].ToString());
                Entity.UserUIN = (string)(dr["UserUIN"]);
                Entity.FriendUserID = long.Parse(dr["FriendUserID"].ToString());
                Entity.FriendUIN = (string)(dr["FriendUIN"]);
                Entity.Alias = (string)(dr["Alias"]);
                Entity.CheckState = int.Parse(dr["CheckState"].ToString());
                Entity.CreateTime = DateTime.Parse(dr["CreateTime"].ToString());
                EntityList[i] = Entity;
            }
             return EntityList;
        }
예제 #3
0
 public ADeeWu.HuoBi3J.Model.IM_Friends GetEntity(long  ID)
 {
     db.Parameters.Clear();
     db.Parameters.Append("@ID",ID);
     DataTable dt = db.Select("select * from [IM_Friends] where 1=1  and [ID]=@ID");
     if(dt.Rows.Count==0) return null;
     DataRow dr = dt.Rows[0];
     ADeeWu.HuoBi3J.Model.IM_Friends Entity = new ADeeWu.HuoBi3J.Model.IM_Friends();
     Entity.ID = long.Parse(dr["ID"].ToString());
     Entity.UserID = long.Parse(dr["UserID"].ToString());
     Entity.UserUIN = (string)(dr["UserUIN"]);
     Entity.FriendUserID = long.Parse(dr["FriendUserID"].ToString());
     Entity.FriendUIN = (string)(dr["FriendUIN"]);
     Entity.Alias = (string)(dr["Alias"]);
     Entity.CheckState = int.Parse(dr["CheckState"].ToString());
     Entity.CreateTime = DateTime.Parse(dr["CreateTime"].ToString());
     return Entity;
 }