Пример #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public zlzw.Model.GeneralImageModel DataRowToModel(DataRow row)
 {
     zlzw.Model.GeneralImageModel model = new zlzw.Model.GeneralImageModel();
     if (row != null)
     {
         if (row["ImageID"] != null && row["ImageID"].ToString() != "")
         {
             model.ImageID = int.Parse(row["ImageID"].ToString());
         }
         if (row["ImageGuid"] != null && row["ImageGuid"].ToString() != "")
         {
             model.ImageGuid = new Guid(row["ImageGuid"].ToString());
         }
         if (row["ImageName"] != null)
         {
             model.ImageName = row["ImageName"].ToString();
         }
         if (row["RelativeGuid"] != null && row["RelativeGuid"].ToString() != "")
         {
             model.RelativeGuid = new Guid(row["RelativeGuid"].ToString());
         }
         if (row["ImageCategoryCode"] != null)
         {
             model.ImageCategoryCode = row["ImageCategoryCode"].ToString();
         }
         if (row["ImageKind"] != null)
         {
             model.ImageKind = row["ImageKind"].ToString();
         }
         if (row["OwnerGuid"] != null && row["OwnerGuid"].ToString() != "")
         {
             model.OwnerGuid = new Guid(row["OwnerGuid"].ToString());
         }
         if (row["ImageRelativePath"] != null)
         {
             model.ImageRelativePath = row["ImageRelativePath"].ToString();
         }
         if (row["ImageSize"] != null && row["ImageSize"].ToString() != "")
         {
             model.ImageSize = int.Parse(row["ImageSize"].ToString());
         }
         if (row["ImageWidth"] != null && row["ImageWidth"].ToString() != "")
         {
             model.ImageWidth = int.Parse(row["ImageWidth"].ToString());
         }
         if (row["ImageHeight"] != null && row["ImageHeight"].ToString() != "")
         {
             model.ImageHeight = int.Parse(row["ImageHeight"].ToString());
         }
         if (row["ImageStatus"] != null && row["ImageStatus"].ToString() != "")
         {
             model.ImageStatus = int.Parse(row["ImageStatus"].ToString());
         }
         if (row["ImageOrder"] != null && row["ImageOrder"].ToString() != "")
         {
             model.ImageOrder = int.Parse(row["ImageOrder"].ToString());
         }
         if (row["ImageIsMain"] != null && row["ImageIsMain"].ToString() != "")
         {
             model.ImageIsMain = int.Parse(row["ImageIsMain"].ToString());
         }
         if (row["CanUsable"] != null && row["CanUsable"].ToString() != "")
         {
             model.CanUsable = int.Parse(row["CanUsable"].ToString());
         }
         if (row["ImageType"] != null)
         {
             model.ImageType = row["ImageType"].ToString();
         }
         if (row["CreateTime"] != null && row["CreateTime"].ToString() != "")
         {
             model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
         }
         if (row["ImageDescription"] != null)
         {
             model.ImageDescription = row["ImageDescription"].ToString();
         }
         if (row["ImageDownCount"] != null && row["ImageDownCount"].ToString() != "")
         {
             model.ImageDownCount = int.Parse(row["ImageDownCount"].ToString());
         }
         if (row["ImageDisplayCount"] != null && row["ImageDisplayCount"].ToString() != "")
         {
             model.ImageDisplayCount = int.Parse(row["ImageDisplayCount"].ToString());
         }
         if (row["PropertyNames"] != null)
         {
             model.PropertyNames = row["PropertyNames"].ToString();
         }
         if (row["PropertyValues"] != null)
         {
             model.PropertyValues = row["PropertyValues"].ToString();
         }
     }
     return model;
 }
Пример #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public zlzw.Model.GeneralImageModel GetModel(int ImageID)
        {
            SqlParameter[] parameters = {
					new SqlParameter("@ImageID", SqlDbType.Int,4)
			};
            parameters[0].Value = ImageID;

            zlzw.Model.GeneralImageModel model = new zlzw.Model.GeneralImageModel();
            DataSet ds = DbHelperSQL.RunProcedure("GeneralImage_GetModel", parameters, "ds");
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }