Beispiel #1
0
 private static SqlParameter[] CreateSqlParameter(ItemAttribute model)
 {
     return(new SqlParameter[]
     {
         new SqlParameter("@MapCode", model.MapCode),
         new SqlParameter("@ItemCode", model.ItemCode),
         new SqlParameter("@AttributeCode", model.AttributeCode),
         new SqlParameter("@ItemValue", model.ItemValue),
         new SqlParameter("@CreatedUser", model.CreatedUser),
         new SqlParameter("@CreatedDate", model.CreatedDate),
     });
 }
Beispiel #2
0
        public static ItemAttribute UpdateItem(ItemAttribute model)
        {
            String result = String.Empty;

            using (var reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "tblItemAttribute_Update", CreateSqlParameter(model)))
            {
                while (reader.Read())
                {
                    result = (String)reader[0];
                }
            }
            return(GetItemByID(result));
        }
Beispiel #3
0
        public static ItemAttribute GetItemByID(String mapCode)
        {
            ItemAttribute item      = new ItemAttribute();
            var           sqlParams = new SqlParameter[1];

            sqlParams[0] = new SqlParameter("@MapCode", mapCode);
            using (var reader = SqlHelper.ExecuteReader("tblItemAttribute_GetByID", sqlParams))
            {
                while (reader.Read())
                {
                    item = GetItemFromReader(reader);
                }
            }
            return(item);
        }
Beispiel #4
0
        public static ItemAttributeCollection GetAllItem()
        {
            ItemAttributeCollection collection = new ItemAttributeCollection();

            using (var reader = SqlHelper.ExecuteReader("tblItemAttribute_GetAll", null))
            {
                while (reader.Read())
                {
                    ItemAttribute obj = new ItemAttribute();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Beispiel #5
0
        private static ItemAttribute GetItemFromReader(IDataReader dataReader)
        {
            ItemAttribute objItem = new ItemAttribute();

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

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

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

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

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

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