public Dictionary <bool,PlayerCardEquipData> UpdateCard(UInt32 UID,UInt32 CID,UInt32 CHARTYPEID,UInt32 CARDTYPEID,byte SLOT,byte FLAG,byte TIME)
        {
            PlayerCardEquipData UP;

            UP = null;
            foreach (PlayerCardEquipData P in this)
            {
                switch (FLAG)
                {
                case 0:
                    if ((P.CID == CID) && (P.CHAR_TYPEID == CHARTYPEID) && (P.SLOT == SLOT) && (P.FLAG == 0) && (P.VALID == 1))
                    {
                        UP = P;
                        break;
                    }
                    break;

                case 1:
                    if ((P.CID == CID) && (P.CARD_TYPEID == CARDTYPEID) && (P.SLOT == SLOT) && (P.FLAG == 1) && (P.ENDDATE > DateTime.Now) && (P.VALID == 1))
                    {
                        UP = P;
                        break;
                    }
                    break;
                }
            }
            if (UP == null)
            {
                try
                {
                    var _db  = new PangyaEntities();
                    var card = _db.USP_ADD_CARD_EQUIP((int)UID,(int)CID,(int)CHARTYPEID,(int)CARDTYPEID,SLOT,FLAG,TIME).FirstOrDefault();
                    if (!(card.CODE == 0))
                    {
                        return(new Dictionary <bool,PlayerCardEquipData>()
                        {
                            { false,null }
                        });
                    }

                    this.Clear();
                    Build((int)UID);
                    return(new Dictionary <bool,PlayerCardEquipData>()
                    {
                        { true,new PlayerCardEquipData()
                          {
                              ID = (uint)card.OUT_INDEX,
                              CID = (uint)card.CID,
                              CHAR_TYPEID = (uint)card.CHARTYPEID,
                              CARD_TYPEID = (uint)card.CARDTYPEID,
                              SLOT = (byte)card.SLOT,
                              REGDATE = card.REGDATE,
                              ENDDATE = (DateTime)card.ENDDATE,
                              FLAG = (byte)card.FLAG,
                              VALID = 1,
                              NEEDUPDATE = false
                          } }
                    });
                }
                finally
                {
                }
            }
            else
            {
                UP.CARD_TYPEID = CARDTYPEID;
                UP.NEEDUPDATE  = true;
                if (FLAG == 1)
                {
                    UP.ENDDATE = DateTime.Now.AddMinutes(TIME);
                }
            }
            return(new Dictionary <bool,PlayerCardEquipData>()
            {
                { true,UP }
            });
        }