//==================================================================================
// ´´ÖÇÖÇÄÜ³¿¼ìÍøÂç¹ÜÀíÏµÍ³4.0
//==================================================================================
// Copyright @2005 Shanghai Chuangzhi Toy&Technology Corporation All rights reserved.
//±¾¼ÆËã»ú³ÌÐòÊÜ°æÈ¨·¨ºÍ¹ú¼ÊÌõÔ¼±£»¤.
// ÈçÎ´¾­ÊÚÈ¨¶øÉÃ×Ô¸´ÖÆ»ò´«²¥±¾³ÌÐò(»òÆäÖÐÈÎºÎ²¿·Ö),½«ÊÜµ½ÑÏÀ÷µÄÃñÊÂ¼°ÐÌÊÂÖÆ²Ã,
//²¢½«ÔÚ·¨ÂÉÐí¿ÉµÄ·¶Î§ÄÚÊÜµ½×î´ó³Ì¶ÈµÄÆðËß!
//==================================================================================

using System;

using CPTT.BusinessRule;
using CPTT.DataAccess;
using CPTT.SystemFramework;

namespace CPTT.BusinessFacade
{
	/// <summary>
	/// UserSystem µÄÕªÒªËµÃ÷¡£
	/// </summary>
	public class UserSystem
	{
		public UserSystem()
		{
			//
			// TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ôìº¯ÊýÂß¼­
			//
		}

		public int userLogin(User user)
		{
			return new UserRule().userLogin(user);
		}

		public void CreateUserAccount(string userAccount,string userPwd)
		{
			new UsersDataAccess().CreateUserAccount(userAccount,userPwd);
		}

		public void DeleteUserAccount(string userAccount)
		{
			new UsersDataAccess().DeleteUserAccount(userAccount);
		}

		public int ChangePwd(string oldPwd,string newPwd)
		{
			return new UsersDataAccess().ChangePwd(oldPwd,newPwd);
		}

		public void AddUserRole(string userAccount,string userRole)
		{
			new UsersDataAccess().AddUserRole(userAccount,userRole);
		}

		public int UpdateUserRole(string userAccount,string newUserRole)
		{
			return new UsersDataAccess().UpdateUserRole(userAccount,newUserRole);
		}

		public string GetUserRole(string userAccount)
		{
			return new UsersDataAccess().GetUserRole(userAccount);
		}

		public void DeleteUserRole(string userAccount,string userRole)
		{
			new UsersDataAccess().DeleteUserRole(userAccount,userRole);
		}

		public void DeleteSpecialRole()
		{
			using(UsersDataAccess usersDataAccess = new UsersDataAccess())
			{
				usersDataAccess.DeleteSpecialRole();
			}
		}
	}
}
