#if !defined(AFX_DATAPROCESS_H__08D2010B_29D7_4069_930A_034727195917__INCLUDED_)
#define AFX_DATAPROCESS_H__08D2010B_29D7_4069_930A_034727195917__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif

class CChatSet;

class CPerson
{
public:
	CPerson(){}
	~CPerson(){}
	CString idname;
	CString nickname;
	CString addr;
	CString user_color;
	CString ipadd;
	CString tel;
	CString sex;
	CString email;
	CString state;
	
};

class ChatRoom
{
public:
	ChatRoom(CString room_name,CString owner)
	{
		_name=room_name;
		_roomowner=owner;
	}

	ChatRoom() {}

	~ChatRoom()
	{
	}
	
	ChatRoom(const ChatRoom &rhs)
	{		
		_name=rhs._name;
		_roomowner=rhs._roomowner;

	}


	
	BOOL operator<(const ChatRoom &ch2)
	{
		if(this->GetName()<ch2.GetName())
			return true;
		else return false;
	}

	CString GetName() const { return _name; }
	CString GetOwner() const { return _roomowner; }

private:

	CString _name;
	CString _roomowner;

};



class Ro_Me
{
public:
	Ro_Me(CString room_name,CString parti_name)
	{
		_room_name=room_name;
		_parti_name=parti_name;
	}
	Ro_Me(){}
	~Ro_Me(){}

	CString _room_name;
	CString _parti_name;
};



class ChatRoom_DB
{
public:
	ChatRoom_DB(){}
	~ChatRoom_DB(){}
	bool Open_New(CString,CString);
	bool Close_Chat(CString,CString);
	bool JOIN_Chat(CString,CString);
	int Left_Chat(CString,CString);
	bool Get_Chat_List(CString,CStringList &vec);
	void Owner_Get_List(CString,CStringList &vec);
	CStringList vec1,vec2,vec3;
	int Get_Room_Num(){return Chatroomvec.GetCount();}
	CPerson SearchName(CString name);
	int Login(CString name,CString PWD);
	bool Logout(CString name);
	bool EditData_PWD(CString ,CString );
	bool EditData_Email(CString ,CString );
	bool EditData_Nick(CString ,CString );
	bool EditData_TEL(CString ,CString );
	bool EditData_Addr(CString ,CString );
	bool EditData_Color(CString ,CString );
	int SavetoDB(CString name,CString ipaddr,CString psd,
				CString nickname,CString sex,CString addr,CString email,
				CString tel,CString color );
	void Del(CString name);
	void GetAllChatroom(CStringList &vec);
	void OnInitial();
	POSITION WhereIs(CString name);
	
	CList<ChatRoom,ChatRoom&>  Chatroomvec;
	CList<Ro_Me,Ro_Me&> Room_Memberset;
	CDatabase dd;
	CChatSet* m_pset;
private:
	bool OnNamequery(CString name);
	void PersonOut(CString);

};
#endif