Esempio n. 1
0
 private static SqlParameter[] CreateSqlParameter(ItemImage model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@ImageCode", model.ImageCode),
         new SqlParameter("@ItemCode", model.ItemCode),
         new SqlParameter("@ImgUrl", model.ImgUrl),
         new SqlParameter("@ImgDesc", model.ImgDesc),
         new SqlParameter("@CreatedDate", model.CreatedDate),
         new SqlParameter("@CreatedUser", model.CreatedUser),
     });
 }
Esempio n. 2
0
        public static ItemImage UpdateItem(ItemImage model)
        {
            String result = String.Empty;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "tblItemImage_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (String)reader[0];
                }
            }
            return(GetItemByID(result));
        }
Esempio n. 3
0
        public static ItemImage GetItemByID(String imageCode)
        {
            ItemImage item      = new ItemImage();
            var       sqlParams = new SqlParameter[1];

            sqlParams[0] = new SqlParameter("@ImageCode", imageCode);
            using (var reader = SqlHelper.ExecuteReader("tblItemImage_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
Esempio n. 4
0
        public static ItemImageCollection GetAllItem()
        {
            ItemImageCollection collection = new ItemImageCollection();

            using (var reader = SqlHelper.ExecuteReader("tblItemImage_GetAll", null))
            {
                while (reader.Read())
                {
                    ItemImage obj = new ItemImage();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Esempio n. 5
0
        private static ItemImage GetItemFromReader(IDataReader dataReader)
        {
            ItemImage objItem = new ItemImage();

            objItem.ImageCode = SqlHelper.GetString(dataReader, "ImageCode");

            objItem.ItemCode = SqlHelper.GetString(dataReader, "ItemCode");

            objItem.ImgUrl = SqlHelper.GetString(dataReader, "ImgUrl");

            objItem.ImgDesc = SqlHelper.GetString(dataReader, "ImgDesc");

            objItem.CreatedDate = SqlHelper.GetDateTime(dataReader, "CreatedDate");

            objItem.CreatedUser = SqlHelper.GetString(dataReader, "CreatedUser");
            return(objItem);
        }