示例#1
0
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public shaoqi.Model.Message DataRowToModel(DataRow row)
		{
            DAL.User userDal = new User();
			shaoqi.Model.Message model=new shaoqi.Model.Message();
			if (row != null)
			{
				if(row["Id"]!=null && row["Id"].ToString()!="")
				{
					model.Id=int.Parse(row["Id"].ToString());
				}
				if(row["MgeContent"]!=null)
				{
					model.MgeContent=row["MgeContent"].ToString();
				}
				if(row["UserId"]!=null && row["UserId"].ToString()!="")
				{
                    model.UserId = userDal.GetModel(int.Parse(row["UserId"].ToString()));
                        
				}
				if(row["AddTime"]!=null && row["AddTime"].ToString()!="")
				{
					model.AddTime=DateTime.Parse(row["AddTime"].ToString());
				}
			}
			return model;
		}
示例#2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public shaoqi.Model.Comment DataRowToModel(DataRow row)
 {
     DAL.User userDal = new User();
     DAL.CatroonInfo catrDal = new CatroonInfo();
     shaoqi.Model.Comment model = new shaoqi.Model.Comment();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["CartoonId"] != null && row["CartoonId"].ToString() != "")
         {
             model.CartoonId = catrDal.GetModel(int.Parse(row["CartoonId"].ToString()));
         }
         if (row["ComContent"] != null)
         {
             model.ComContent = row["ComContent"].ToString();
         }
         if (row["UserId"] != null && row["UserId"].ToString() != "")
         {
             model.UserId = userDal.GetModel(int.Parse(row["UserId"].ToString()));
         }
         if (row["AddTime"] != null && row["AddTime"].ToString() != "")
         {
             model.AddTime = DateTime.Parse(row["AddTime"].ToString());
         }
     }
     return model;
 }