Example #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <CSLG.CTalk.Model.friendInfo> DataTableToList(DataTable dt)
        {
            List <CSLG.CTalk.Model.friendInfo> modelList = new List <CSLG.CTalk.Model.friendInfo>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                CSLG.CTalk.Model.friendInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CSLG.CTalk.Model.friendInfo();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["userID"] != null && dt.Rows[n]["userID"].ToString() != "")
                    {
                        model.userID = int.Parse(dt.Rows[n]["userID"].ToString());
                    }
                    if (dt.Rows[n]["friendID"] != null && dt.Rows[n]["friendID"].ToString() != "")
                    {
                        model.friendID = int.Parse(dt.Rows[n]["friendID"].ToString());
                    }
                    if (dt.Rows[n]["friendName"] != null && dt.Rows[n]["friendName"].ToString() != "")
                    {
                        model.friendName = dt.Rows[n]["friendName"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CSLG.CTalk.Model.friendInfo model)
 {
     return(dal.Update(model));
 }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(CSLG.CTalk.Model.friendInfo model)
 {
     return(dal.Add(model));
 }