public UserInterface(Session session)
     : this()
 {
     this.session = session;
     if (!IsAuthorize(this.session))
     {
         throw new Exception("请登陆!");
     }
 }
 public void StopSession(Session session)
 {
     if (session == null)
     {
         throw new ArgumentNullException("Session can not be null!");
     }
     else
     {
         AccountServiceCore.Logout(session.Id.ToString());
     }
 }
        public static Session NewSession(Account anAccount)
        {
            if (SystemAccountDao.IsExist(anAccount.Name))
            {
                SystemAccount sysAccount = SystemAccountDao.Login(anAccount);
                Session session = new Session(sysAccount);

                sessionList.Add(session, DateTime.Now);
                return session;
            }
            else
            {
                return null;
            }
        }
 private TableUI(Session session)
     : base(session)
 {
     Table = new Table();
 }
 public TableUI(Table aTable, Session session)
     : this(session)
 {
     this.Table = aTable;
 }
 public TableUI(string tableNumber, Session session)
     : this(session)
 {
     this.Table.Number = tableNumber;
 }
 public ChangeItemForm(Session session)
 {
     InitializeComponent();
     ui = new TableUI("001",session);
 }
        //check for user authentication
        private bool IsAuthorize(Session session)
        {
            using (AccountService.AccountServiceClient proxy = new AccountService.AccountServiceClient())
            {
                try
                {

                    return proxy.IsLogin(session);

                }
                catch (FaultException<HCSMSException> ex)
                {
                    raiseError(ex);
                    return false;
                }
                catch (Exception ex)
                {
                    raiseError(ex);
                    return false;
                }

            }
        }
 public MemberUI(Session session)
     : base(session)
 {
 }
 public bool IsLogin(Session session)
 {
     return AccountServiceCore.IsLogin(session.Id.ToString());
 }
 public StockUI(Session session)
     : base(session)
 {
 }
 public ReservationUI(Session session)
     : base(session)
 {
 }
 public BillingUI(Session session)
     : base(session)
 {
 }