private void detach_ItemHistories(ItemHistory entity)
		{
			this.SendPropertyChanging();
			entity.Item = null;
		}
		private void attach_ItemHistories(ItemHistory entity)
		{
			this.SendPropertyChanging();
			entity.Item = this;
		}
 partial void DeleteItemHistory(ItemHistory instance);
 partial void UpdateItemHistory(ItemHistory instance);
 partial void InsertItemHistory(ItemHistory instance);
예제 #6
0
        private void ExecuteTask(Data.User user, Item item, int quantity)
        {
            int qtyToGive = GetActualQuantity(user, item, quantity);

            if (qtyToGive == 0)
            {
                return;
            }

            Manager.Server.Whisper(user, string.Format("Giving you {0} {1}",  qtyToGive, item.Name));

            int remainingQuantity = qtyToGive;
            while (remainingQuantity > 0)
            {
                int give = Math.Min(qtyToGive, MAX_GIVE_STEP);
                Manager.Server.Execute(string.Format("give {0} {1} {2}", user.Username, item.Block_Decimal_ID, give));
                remainingQuantity = remainingQuantity - give;
            }

            ItemHistory history = new ItemHistory();
            history.Item = item;
            history.User = user;
            history.Quantity = qtyToGive;
            history.CreateDate = DateTime.Now;
            using (EMMDataContext db = Manager.GetContext)
            {
                db.ItemHistories.InsertOnSubmit(history);
                db.SubmitChanges();
            }
        }