public bool SetItemInformations(WarehouseData Info)
 {
     ItemIndex                  = Info.ItemIndex;
     ItemTypeID                 = Info.ItemTypeID;
     ItemHourLeft               = Info.ItemHourLeft;
     ItemC0                     = Info.ItemC0;
     ItemC1                     = Info.ItemC1;
     ItemC2                     = Info.ItemC2;
     ItemC3                     = Info.ItemC3;
     ItemC4                     = Info.ItemC4;
     ItemUCCUnique              = Info.ItemUCCUnique;
     ItemUCCStatus              = Info.ItemUCCStatus;
     ItemUCCDrawer              = Info.ItemUCCDrawer;
     ItemUCCDrawerUID           = Info.ItemUCCDrawerUID;
     ItemUCCName                = Info.ItemUCCName;
     ItemUCCCopyCount           = Info.ItemUCCCopyCount;
     ItemClubPoint              = Info.ItemClubPoint;
     ItemClubWorkCount          = Info.ItemClubWorkCount;
     ItemClubPointLog           = Info.ItemClubPointLog;
     ItemClubPangLog            = Info.ItemClubPangLog;
     ItemC0Slot                 = Info.ItemC0Slot;
     ItemC1Slot                 = Info.ItemC1Slot;
     ItemC2Slot                 = Info.ItemC2Slot;
     ItemC3Slot                 = Info.ItemC3Slot;
     ItemC4Slot                 = Info.ItemC4Slot;
     ItemClubSlotCancelledCount = Info.ItemClubSlotCancelledCount;
     ItemGroup                  = (byte)IFFTools.GetItemGroup(Info.ItemTypeID);
     ItemRegDate                = Info.ItemRegDate;
     ItemEndDate                = Info.ItemEndDate;
     ItemIsValid                = Info.ItemIsValid;
     ItemNeedUpdate             = false;
     return(true);
 }
 public void CreateNewItem()
 {
     this.ItemC1                     = 0;
     this.ItemC2                     = 0;
     this.ItemC3                     = 0;
     this.ItemC4                     = 0;
     this.ItemUCCName                = string.Empty;
     this.ItemUCCStatus              = 0;
     this.ItemUCCDrawer              = string.Empty;
     this.ItemUCCDrawerUID           = 0;
     this.ItemClubPoint              = 0;
     this.ItemClubWorkCount          = 0;
     this.ItemClubPointLog           = 0;
     this.ItemClubPangLog            = 0;
     this.ItemC0Slot                 = 0;
     this.ItemC1Slot                 = 0;
     this.ItemC2Slot                 = 0;
     this.ItemC3Slot                 = 0;
     this.ItemC4Slot                 = 0;
     this.ItemClubSlotCancelledCount = 0;
     this.ItemNeedUpdate             = false;
     this.ItemIsValid                = 1;
     this.ItemNeedUpdate             = false;
     this.ItemFlag                   = 0;
     this.ItemEndDate                = DateTime.Now;
     switch (IFFTools.GetItemGroup(this.ItemTypeID))
     {
     case IffGroupFlag.ITEM_TYPE_CLUB:
     case IffGroupFlag.ITEM_TYPE_PART:
     {
         this.ItemC0 = 0;
     }
     break;
     }
 }
        internal bool RemoveItem(uint TypeId, uint Count)
        {
            switch ((byte)IFFTools.GetItemGroup(TypeId))
            {
            case 5:
            case 6:
            {
                foreach (var Items in this)
                {
                    if (Items.ItemTypeID == TypeId && Items.ItemC0 >= Count && Items.ItemIsValid == 1)
                    {
                        Items.ItemC0 -= (ushort)Count;

                        if (Items.ItemC0 == 0)
                        {
                            Items.ItemIsValid = 0;
                        }
                    }
                    return(true);
                }
            }
            break;
            }
            return(false);
        }
        public bool IsClubExist(uint typeID)
        {
            var Items = this.FirstOrDefault(c => c.ItemTypeID == typeID && c.ItemIsValid == 1);

            if (Items != null && (byte)IFFTools.GetItemGroup(Items.ItemTypeID) == 4)
            {
                return(true);
            }
            return(false);
        }
        public bool RemoveClubSlot(byte RemoveType, byte Count = 1)
        {
            if (!(IFFTools.GetItemGroup(ItemTypeID) == IffGroupFlag.ITEM_TYPE_CLUB))
            {
                return(false);
            }

            ItemClubWorkCount--;

            if (ItemClubSlotCancelledCount >= 5)
            {
                return(false);
            }
            ItemClubSlotCancelledCount++;

            switch (RemoveType)
            {
            case 0:
            {
                ItemC0Slot -= Count;
            }
            break;

            case 1:
            {
                ItemC1Slot -= Count;
            }
            break;

            case 2:
            {
                ItemC2Slot -= Count;
            }
            break;

            case 3:
            {
                ItemC3Slot -= Count;
            }
            break;

            case 4:
            {
                ItemC0Slot -= Count;
            }
            break;
            }
            Update();
            return(true);
        }
        public bool ClubAddSlot(byte AddType, byte Count = 1)
        {
            if (!(IFFTools.GetItemGroup(ItemTypeID) == IffGroupFlag.ITEM_TYPE_CLUB))
            {
                return(false);
            }

            ItemClubWorkCount += 1;
            switch (AddType)
            {
            case 0:
            {
                ItemC0Slot++;
                Count++;
            }
            break;

            case 1:
            {
                ItemC1Slot++;
                Count++;
            }
            break;

            case 2:
            {
                ItemC2Slot++;
                Count++;
            }
            break;

            case 3:
            {
                ItemC3Slot++;
                Count++;
            }
            break;

            case 4:
            {
                ItemC0Slot++;
                Count++;
            }
            break;
            }
            Update();
            return(true);
        }
        public string GetSqlUpdateString()
        {
            StringBuilder SQLString;

            SQLString = new StringBuilder();

            try
            {
                SQLString.Append('^');
                SQLString.Append(ItemIndex);
                SQLString.Append('^');
                SQLString.Append(ItemC0);
                SQLString.Append('^');
                SQLString.Append(ItemC1);
                SQLString.Append('^');
                SQLString.Append(ItemC2);
                SQLString.Append('^');
                SQLString.Append(ItemC3);
                SQLString.Append('^');
                SQLString.Append(ItemC4);
                SQLString.Append('^');
                SQLString.Append(ItemIsValid);
                SQLString.Append('^');
                SQLString.Append(Compare.IfCompare <byte>(IFFEntry.GetIff.IsSelfDesign(ItemTypeID), 1, 0));
                SQLString.Append('^');
                SQLString.Append(ItemUCCStatus ?? 0);
                SQLString.Append('^');
                SQLString.Append(ItemUCCUnique ?? "0");
                SQLString.Append('^');
                SQLString.Append(ItemEndDate.GetSQLTime());
                SQLString.Append('^');
                SQLString.Append(ItemFlag ?? 0);
                SQLString.Append('^');
                // { CLUB SET DATA }
                SQLString.Append(ItemClubPoint);
                SQLString.Append('^');
                SQLString.Append(ItemClubWorkCount);
                SQLString.Append('^');
                SQLString.Append(ItemClubPointLog);
                SQLString.Append('^');
                SQLString.Append(ItemClubPangLog);
                SQLString.Append('^');
                SQLString.Append(ItemC0Slot);
                SQLString.Append('^');
                SQLString.Append(ItemC1Slot);
                SQLString.Append('^');
                SQLString.Append(ItemC2Slot);
                SQLString.Append('^');
                SQLString.Append(ItemC3Slot);
                SQLString.Append('^');
                SQLString.Append(ItemC4Slot);
                SQLString.Append('^');
                SQLString.Append(ItemClubSlotCancelledCount);
                SQLString.Append('^');
                SQLString.Append(Compare.IfCompare <byte>(IFFTools.GetItemGroup(ItemTypeID) == IffGroupFlag.ITEM_TYPE_CLUB, 1, 0));
                SQLString.Append(',');
                // close for next player
                var data = SQLString.ToString();
                return(data);
            }
            finally
            {
                SQLString.Clear();
            }
        }