public bool AddAASInfo(AASInfo info)
        {
            bool result = false;

            try
            {
                SqlParameter[] para = new SqlParameter[5];

                para[0] = new SqlParameter("@UserID", info.UserID);
                para[1] = new SqlParameter("@Name", info.Name);
                para[2] = new SqlParameter("@IDNumber", info.IDNumber);
                para[3] = new SqlParameter("@State", info.State);
                para[4] = new SqlParameter("@Result", System.Data.SqlDbType.Int);
                para[4].Direction = ParameterDirection.ReturnValue;

                db.RunProcedure("SP_ASSInfo_Add", para);
                result = (int)para[4].Value == 0;

            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("UpdateAASInfo", e);
                }
            }

            return result;
        }
        public AASInfo[] GetAllAASInfo()
        {
            List<AASInfo> infos = new List<AASInfo>();
            SqlDataReader reader = null;
            try
            {
                db.GetReader(ref reader, "SP_AASInfo_All");

                while (reader.Read())
                {
                    AASInfo info = new AASInfo();
                    info.UserID = (int)reader["ID"];
                    info.Name = reader["Name"].ToString();
                    info.IDNumber = reader["IDNumber"].ToString();
                    info.State = (int)reader["State"];

                    infos.Add(info);
                }

            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("GetAllAASInfo", e);
                }
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }

            return infos.ToArray();
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            AASInfo info = new AASInfo();
            info.UserID = client.Player.PlayerCharacter.ID;
            bool result = false;
            bool rlt = false;

            bool isclosed = packet.ReadBoolean();
            if (isclosed)
            {
                info.Name = "";
                info.IDNumber = "";
                info.State = 0;
                result = true;
            }
            else 
            {
                info.Name = packet.ReadString();
                info.IDNumber = packet.ReadString();
                result = CheckIDNumber(info.IDNumber);
                if (info.IDNumber != "")
                {
                    client.Player.IsAASInfo = true;
                    //result = false;
                    int Age = Convert.ToInt32(info.IDNumber.Substring(6, 4));
                    int month = Convert.ToInt32(info.IDNumber.Substring(10, 2));
                    if (DateTime.Now.Year.CompareTo(Age + 18) > 0 || (DateTime.Now.Year.CompareTo(Age + 18) == 0 && DateTime.Now.Month.CompareTo(month) >= 0))
                        client.Player.IsMinor = false;

                }
                if (info.Name != "" && result)
                {
                    info.State = 1;
                }
                else
                {
                    info.State = 0;
                }

            }

            if (result)
            {
                client.Out.SendAASState(false);
                client.Out.SendAASControl(false, client.Player.IsAASInfo, client.Player.IsMinor);
                using (ProduceBussiness db = new ProduceBussiness())
                {
                    rlt = db.AddAASInfo(info);
                    client.Out.SendAASInfoSet(rlt);
                }
            }

            if (rlt && (info.State == 1) )
            {
                ItemTemplateInfo rewardItem = Bussiness.Managers.ItemMgr.FindItemTemplate(11019);
                if (rewardItem != null)
                {
                    ItemInfo item = ItemInfo.CreateFromTemplate(rewardItem, 1, (int)ItemAddType.Other);
                    if (item != null)
                    {
                        item.IsBinds = true;
                        AbstractInventory bg = client.Player.GetItemInventory(item.Template);
                        if (bg.AddItem(item, bg.BeginSlot))
                        {
                            client.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("ASSInfoSetHandle.Success", item.Template.Name));
                            
                        }
                        else
                        {
                            client.Out.SendMessage(eMessageType.ChatNormal, LanguageMgr.GetTranslation("ASSInfoSetHandle.NoPlace"));
                        }
                    }
                }

            }
            return 0;
        }